From: Elvis Angelaccio Date: Sun, 11 Nov 2018 16:35:13 +0000 (+0100) Subject: [PlacesItemModel] Match KFilePlacesModel addPlaces() API X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/140ccf1df8ae3b9958120881b4c34c0f230d5d54 [PlacesItemModel] Match KFilePlacesModel addPlaces() API This will allow to create a place visible only from Dolphin, by passing an `appName` to the KFilePlacesModel. CCBUG: 376619 --- diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index f7fe5587c..86fbf886d 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -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 diff --git a/src/panels/places/placesitemmodel.h b/src/panels/places/placesitemmodel.h index 58d0d55b2..dde3f3d7b 100644 --- a/src/panels/places/placesitemmodel.h +++ b/src/panels/places/placesitemmodel.h @@ -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;