]> cloud.milkyroute.net Git - dolphin.git/commitdiff
[PlacesItemModel] Match KFilePlacesModel addPlaces() API
authorElvis Angelaccio <elvis.angelaccio@kde.org>
Sun, 11 Nov 2018 16:35:13 +0000 (17:35 +0100)
committerElvis Angelaccio <elvis.angelaccio@kde.org>
Sun, 11 Nov 2018 18:02:54 +0000 (19:02 +0100)
This will allow to create a place visible only from Dolphin, by passing
an `appName` to the KFilePlacesModel.

CCBUG: 376619

src/panels/places/placesitemmodel.cpp
src/panels/places/placesitemmodel.h

index f7fe5587c7fa3cd2c5ce855982aad8e93fe83925..86fbf886da4f30f5333bc58930d78d1ce9236ca3 100644 (file)
@@ -78,12 +78,14 @@ PlacesItemModel::~PlacesItemModel()
 {
 }
 
-void PlacesItemModel::createPlacesItem(const QString& text,
-                                       const QUrl& url,
-                                       const QString& iconName,
-                                       int after)
+void PlacesItemModel::createPlacesItem(const QString &text, const QUrl &url, const QString &iconName, const QString &appName)
 {
-    m_sourceModel->addPlace(text, url, iconName, {}, mapToSource(after));
+    createPlacesItem(text, url, iconName, appName, -1);
+}
+
+void PlacesItemModel::createPlacesItem(const QString &text, const QUrl &url, const QString &iconName, const QString &appName, int after)
+{
+    m_sourceModel->addPlace(text, url, iconName, appName, mapToSource(after));
 }
 
 PlacesItem* PlacesItemModel::placesItem(int index) const
@@ -369,7 +371,7 @@ void PlacesItemModel::dropMimeDataBefore(int index, const QMimeData* mimeData)
                 continue;
             }
 
-            createPlacesItem(text, url, KIO::iconNameForUrl(url), qMax(0, index - 1));
+            createPlacesItem(text, url, KIO::iconNameForUrl(url), {}, qMax(0, index - 1));
         }
     }
     // will save bookmark alteration and fix sort if that is broken by the drag/drop operation
index 58d0d55b2b6dab9ab47b3798e233fc75d43a5292..dde3f3d7b5239154a67aa2bcc3a1291824449f06 100644 (file)
@@ -52,10 +52,8 @@ public:
      * @brief Create a new place entry in the bookmark file
      * and add it to the model
      */
-    void createPlacesItem(const QString& text,
-                          const QUrl& url,
-                          const QString& iconName = QString(),
-                          int after = -1);
+    void createPlacesItem(const QString& text, const QUrl& url, const QString& iconName = {}, const QString& appName = {});
+    void createPlacesItem(const QString& text, const QUrl& url, const QString& iconName, const QString& appName, int after);
 
     PlacesItem* placesItem(int index) const;