bool BookmarksManager::hasBookmark(const QString &url) { if (url.isEmpty()) { return false; } return hasBookmark(QUrl(url)); }
void BookmarksManager::removeBookmark(const QUrl &url) { ensureInitialized(); const QUrl normalizedUrl(Utils::normalizeUrl(url)); if (!hasBookmark(normalizedUrl)) { return; } const QVector<BookmarksModel::Bookmark*> bookmarks(m_model->findUrls(normalizedUrl)); for (int i = 0; i < bookmarks.count(); ++i) { bookmarks.at(i)->remove(); } }
bool BookmarksManager::deleteBookmark(const QUrl &url) { if (!hasBookmark(url)) { return false; } const QString bookmarkUrl = url.toString(QUrl::RemovePassword); for (int i = 0; i < m_allBookmarks.count(); ++i) { if (m_allBookmarks.at(i) && m_allBookmarks.at(i)->type == UrlBookmark && m_allBookmarks.at(i)->url == bookmarkUrl) { deleteBookmark(m_allBookmarks.at(i)); } } return true; }
void BookmarksManager::removeBookmark(const QUrl &url) { if (!m_model) { getModel(); } const QUrl adjustedUrl = BookmarksModel::adjustUrl(url); if (!hasBookmark(adjustedUrl)) { return; } const QList<BookmarksItem*> items = m_model->findUrls(adjustedUrl); for (int i = 0; i < items.count(); ++i) { items.at(i)->remove(); } }