diff --git a/src/lib/navigation/completer/locationcompleter.cpp b/src/lib/navigation/completer/locationcompleter.cpp index 34e4468e6..0f2e7a67a 100644 --- a/src/lib/navigation/completer/locationcompleter.cpp +++ b/src/lib/navigation/completer/locationcompleter.cpp @@ -284,10 +284,11 @@ void LocationCompleter::indexDeleteRequested(const QModelIndex &index) if (index.data(LocationCompleterModel::BookmarkRole).toBool()) { BookmarkItem* bookmark = static_cast(index.data(LocationCompleterModel::BookmarkItemRole).value()); mApp->bookmarks()->removeBookmark(bookmark); - } - else { + } else if (index.data(LocationCompleterModel::HistoryRole).toBool()) { int id = index.data(LocationCompleterModel::IdRole).toInt(); mApp->history()->deleteHistoryEntry(id); + } else { + return; } s_view->setUpdatesEnabled(false); diff --git a/src/lib/navigation/completer/locationcompletermodel.h b/src/lib/navigation/completer/locationcompletermodel.h index d2c7aa78b..e04622571 100644 --- a/src/lib/navigation/completer/locationcompletermodel.h +++ b/src/lib/navigation/completer/locationcompletermodel.h @@ -1,6 +1,6 @@ /* ============================================================ * Falkon - Qt web browser -* Copyright (C) 2010-2017 David Rosca +* Copyright (C) 2010-2018 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,6 +33,7 @@ public: TitleRole, UrlRole, CountRole, + HistoryRole, BookmarkRole, BookmarkItemRole, SearchStringRole, diff --git a/src/lib/navigation/completer/locationcompleterrefreshjob.cpp b/src/lib/navigation/completer/locationcompleterrefreshjob.cpp index 36ac2ea06..b7236d341 100644 --- a/src/lib/navigation/completer/locationcompleterrefreshjob.cpp +++ b/src/lib/navigation/completer/locationcompleterrefreshjob.cpp @@ -1,6 +1,6 @@ /* ============================================================ * Falkon - Qt web browser -* Copyright (C) 2014-2017 David Rosca +* Copyright (C) 2014-2018 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -134,7 +134,7 @@ void LocationCompleterRefreshJob::runJob() item->setText(m_searchString); item->setData(m_searchString, LocationCompleterModel::UrlRole); item->setData(m_searchString, LocationCompleterModel::SearchStringRole); - item->setData(QVariant(true), LocationCompleterModel::VisitSearchItemRole); + item->setData(true, LocationCompleterModel::VisitSearchItemRole); if (!m_domainCompletion.isEmpty()) { const QUrl url = QUrl(QSL("http://%1").arg(m_domainCompletion)); item->setData(IconProvider::imageForDomain(url), LocationCompleterModel::ImageRole); @@ -162,7 +162,7 @@ void LocationCompleterRefreshJob::completeFromHistory() item->setData(bookmark->title(), LocationCompleterModel::TitleRole); item->setData(bookmark->url(), LocationCompleterModel::UrlRole); item->setData(bookmark->visitCount(), LocationCompleterModel::CountRole); - item->setData(QVariant(true), LocationCompleterModel::BookmarkRole); + item->setData(true, LocationCompleterModel::BookmarkRole); item->setData(QVariant::fromValue(static_cast(bookmark)), LocationCompleterModel::BookmarkItemRole); item->setData(m_searchString, LocationCompleterModel::SearchStringRole); @@ -193,7 +193,7 @@ void LocationCompleterRefreshJob::completeFromHistory() item->setData(query.value(2), LocationCompleterModel::TitleRole); item->setData(url, LocationCompleterModel::UrlRole); item->setData(query.value(3), LocationCompleterModel::CountRole); - item->setData(QVariant(false), LocationCompleterModel::BookmarkRole); + item->setData(true, LocationCompleterModel::HistoryRole); item->setData(m_searchString, LocationCompleterModel::SearchStringRole); m_items.append(item); @@ -214,7 +214,6 @@ void LocationCompleterRefreshJob::completeMostVisited() item->setData(query.value(0), LocationCompleterModel::IdRole); item->setData(query.value(2), LocationCompleterModel::TitleRole); item->setData(url, LocationCompleterModel::UrlRole); - item->setData(QVariant(false), LocationCompleterModel::BookmarkRole); m_items.append(item); }