From 9d3a019445d7a7fdf3177bca9eeef4c44599e706 Mon Sep 17 00:00:00 2001 From: Renato Araujo Oliveira Filho Date: Fri, 15 Dec 2017 09:10:47 -0300 Subject: [PATCH] Ignore baloo urls created from new KIO model Summary: For now ignore baloo urls that was created by new KIO::KFilePlacesModel, until we make use of new KIO API. BUG: 387888 Test Plan: Open any KIO file dialog using the new API. Runs dolphin v17.12.0 Make sure that baloo urls does not appear duplicated Reviewers: ngraham, elvisangelaccio Reviewed By: ngraham, elvisangelaccio Subscribers: cfeck, elvisangelaccio, ervin, mlaurent, #dolphin Differential Revision: https://phabricator.kde.org/D9347 --- src/panels/places/placesitemmodel.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index 680d513b5c..abdd4c20b6 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -65,6 +65,17 @@ namespace { // Hence a prefix to the application-name of the stored bookmarks is // added, which is only read by PlacesItemModel. const char AppNamePrefix[] = "-places-panel"; + + static QList balooURLs = { + QUrl(QStringLiteral("timeline:/today")), + QUrl(QStringLiteral("timeline:/yesterday")), + QUrl(QStringLiteral("timeline:/thismonth")), + QUrl(QStringLiteral("timeline:/lastmonth")), + QUrl(QStringLiteral("search:/documents")), + QUrl(QStringLiteral("search:/images")), + QUrl(QStringLiteral("search:/audio")), + QUrl(QStringLiteral("search:/videos")) + }; } PlacesItemModel::PlacesItemModel(QObject* parent) : @@ -832,6 +843,12 @@ bool PlacesItemModel::acceptBookmark(const KBookmark& bookmark, const QString appName = bookmark.metaDataItem(QStringLiteral("OnlyInApp")); const bool deviceAvailable = availableDevices.contains(udi); + if (balooURLs.contains(url) && appName.isEmpty()) { + // Does not accept baloo URLS with empty appName, this came from new KIO model and will cause duplications + qCWarning(DolphinDebug) << "Ignore KIO url:" << url; + return false; + } + const bool allowedHere = (appName.isEmpty() || appName == KAboutData::applicationData().componentName() || appName == KAboutData::applicationData().componentName() + AppNamePrefix)