mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-28 03:21:56 +00:00
[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:
parent
e3eba9ea66
commit
140ccf1df8
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue