[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
This commit is contained in:
Elvis Angelaccio 2018-11-11 17:35:13 +01:00
parent e3eba9ea66
commit 140ccf1df8
2 changed files with 10 additions and 10 deletions

View 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

View 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;