Пример #1
0
bool BookmarksManager::hasBookmark(const QString &url)
{
	if (url.isEmpty())
	{
		return false;
	}

	return hasBookmark(QUrl(url));
}
Пример #2
0
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();
	}
}
Пример #3
0
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;
}
Пример #4
0
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();
	}
}