本文整理汇总了C++中BookmarksItem::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ BookmarksItem::remove方法的具体用法?C++ BookmarksItem::remove怎么用?C++ BookmarksItem::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BookmarksItem
的用法示例。
在下文中一共展示了BookmarksItem::remove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addBookmark
void BookmarksContentsWidget::addBookmark()
{
BookmarksItem *bookmark = BookmarksManager::addBookmark(BookmarksModel::UrlBookmark, QUrl(), QString(), findFolder(m_ui->bookmarksViewWidget->currentIndex()));
BookmarkPropertiesDialog dialog(bookmark, BookmarkPropertiesDialog::AddBookmarkMode, this);
if (dialog.exec() == QDialog::Rejected)
{
bookmark->remove();
}
}
示例2: addBookmark
void MainWindow::addBookmark(const QUrl &url, const QString &title, const QString &description, bool warn)
{
const QUrl bookmarkUrl = (url.isValid() ? url.adjusted(QUrl::RemovePassword) : m_windowsManager->getUrl().adjusted(QUrl::RemovePassword));
if (bookmarkUrl.isEmpty() || (warn && BookmarksManager::hasBookmark(bookmarkUrl) && QMessageBox::warning(this, tr("Warning"), tr("You already have this address in your bookmarks.\nDo you want to continue?"), (QMessageBox::Yes | QMessageBox::Cancel)) == QMessageBox::Cancel))
{
return;
}
BookmarksItem *bookmark = BookmarksManager::addBookmark(BookmarksModel::UrlBookmark, bookmarkUrl, (url.isValid() ? title : m_windowsManager->getTitle()));
bookmark->setData(description, BookmarksModel::DescriptionRole);
BookmarkPropertiesDialog dialog(bookmark, BookmarkPropertiesDialog::AddBookmarkMode, this);
if (dialog.exec() == QDialog::Rejected)
{
bookmark->remove();
}
}
示例3: import
bool OperaBookmarksImporter::import()
{
QTextStream stream(m_file);
stream.setCodec("UTF-8");
QString line = stream.readLine();
if (line != QLatin1String("Opera Hotlist version 2.0"))
{
return false;
}
BookmarksItem *bookmark = NULL;
OperaBookmarkEntry type = NoEntry;
bool isHeader = true;
handleOptions();
while (!stream.atEnd())
{
line = stream.readLine();
if (isHeader && (line.isEmpty() || line.at(0) != QLatin1Char('#')))
{
continue;
}
isHeader = false;
if (line.startsWith(QLatin1String("#URL")))
{
bookmark = BookmarksManager::addBookmark(BookmarksModel::UrlBookmark, QUrl(), QString(), getCurrentFolder());
type = UrlEntry;
}
else if (line.startsWith(QLatin1String("#FOLDER")))
{
bookmark = BookmarksManager::addBookmark(BookmarksModel::FolderBookmark, QUrl(), QString(), getCurrentFolder());
type = FolderStartEntry;
}
else if (line.startsWith(QLatin1String("#SEPERATOR")))
{
bookmark = BookmarksManager::addBookmark(BookmarksModel::SeparatorBookmark, QUrl(), QString(), getCurrentFolder());
type = SeparatorEntry;
}
else if (line == QLatin1String("-"))
{
type = FolderEndEntry;
}
else if (line.startsWith(QLatin1String("\tURL=")) && bookmark)
{
const QUrl url(line.section(QLatin1Char('='), 1, -1));
if (!allowDuplicates() && BookmarksManager::hasBookmark(url))
{
bookmark->remove();
bookmark = NULL;
}
else
{
bookmark->setData(url, BookmarksModel::UrlRole);
}
}
else if (line.startsWith(QLatin1String("\tNAME=")) && bookmark)
{
bookmark->setData(line.section(QLatin1Char('='), 1, -1), BookmarksModel::TitleRole);
}
else if (line.startsWith(QLatin1String("\tDESCRIPTION=")) && bookmark)
{
bookmark->setData(line.section(QLatin1Char('='), 1, -1).replace(QLatin1String("\x02\x02"), QLatin1String("\n")), BookmarksModel::DescriptionRole);
}
else if (line.startsWith(QLatin1String("\tSHORT NAME=")) && bookmark)
{
const QString keyword = line.section(QLatin1Char('='), 1, -1);
if (!BookmarksManager::hasKeyword(keyword))
{
bookmark->setData(keyword, BookmarksModel::KeywordRole);
}
}
else if (line.startsWith(QLatin1String("\tCREATED=")) && bookmark)
{
bookmark->setData(QDateTime::fromTime_t(line.section(QLatin1Char('='), 1, -1).toUInt()), BookmarksModel::TimeAddedRole);
}
else if (line.startsWith(QLatin1String("\tVISITED=")) && bookmark)
{
bookmark->setData(QDateTime::fromTime_t(line.section(QLatin1Char('='), 1, -1).toUInt()), BookmarksModel::TimeVisitedRole);
}
else if (line.isEmpty())
{
if (bookmark)
{
if (type == FolderStartEntry)
{
setCurrentFolder(bookmark);
}
bookmark = NULL;
}
else if (type == FolderEndEntry)
{
//.........这里部分代码省略.........