Changeset View
Changeset View
Standalone View
Standalone View
src/filewidgets/kfileplacesmodel.cpp
Show First 20 Lines • Show All 1037 Lines • ▼ Show 20 Line(s) | 1032 | { | |||
---|---|---|---|---|---|
1038 | } | 1038 | } | ||
1039 | 1039 | | |||
1040 | return newUrl; | 1040 | return newUrl; | ||
1041 | } | 1041 | } | ||
1042 | 1042 | | |||
1043 | void KFilePlacesModel::addPlace(const QString &text, const QUrl &url, | 1043 | void KFilePlacesModel::addPlace(const QString &text, const QUrl &url, | ||
1044 | const QString &iconName, const QString &appName) | 1044 | const QString &iconName, const QString &appName) | ||
1045 | { | 1045 | { | ||
1046 | addPlace(text, url, iconName, appName, QModelIndex()); | 1046 | addPlace(text, url, iconName, appName, index(rowCount() -1, 0)); | ||
meven: It seems to me you don't need to edit this function. | |||||
As it is, with a null QModelIndex, the function below will move the new item to the top. gvgeo: As it is, with a `null QModelIndex`, the function below will move the new item to the top. | |||||
I missed this, you could pass the current modelIndex or the first to save some code here, but that's just some nitpicking. meven: I missed this, you could pass the current modelIndex or the first to save some code here, but… | |||||
1047 | } | 1047 | } | ||
1048 | 1048 | | |||
1049 | void KFilePlacesModel::addPlace(const QString &text, const QUrl &url, | 1049 | void KFilePlacesModel::addPlace(const QString &text, const QUrl &url, | ||
1050 | const QString &iconName, const QString &appName, | 1050 | const QString &iconName, const QString &appName, | ||
1051 | const QModelIndex &after) | 1051 | const QModelIndex &after) | ||
1052 | { | 1052 | { | ||
1053 | KBookmark bookmark = KFilePlacesItem::createBookmark(d->bookmarkManager, | 1053 | KBookmark bookmark = KFilePlacesItem::createBookmark(d->bookmarkManager, | ||
1054 | text, url, iconName); | 1054 | text, url, iconName); | ||
ngraham: unrelated change | |||||
It is a style change, but it is hardly unrelated, I copy this line above. I need to mirror the style for ease of reading. And, I'm not going to copy a "bad"(in lack of a better word) style. gvgeo: It is a style change, but it is hardly unrelated, I copy this line above. I need to mirror the… | |||||
1055 | 1055 | | |||
1056 | if (!appName.isEmpty()) { | 1056 | if (!appName.isEmpty()) { | ||
1057 | bookmark.setMetaDataItem(QStringLiteral("OnlyInApp"), appName); | 1057 | bookmark.setMetaDataItem(QStringLiteral("OnlyInApp"), appName); | ||
1058 | } | 1058 | } | ||
1059 | 1059 | | |||
1060 | if (after.isValid()) { | 1060 | if (after.isValid()) { | ||
1061 | KFilePlacesItem *item = static_cast<KFilePlacesItem *>(after.internalPointer()); | 1061 | KFilePlacesItem *item = static_cast<KFilePlacesItem *>(after.internalPointer()); | ||
1062 | d->bookmarkManager->root().moveBookmark(bookmark, item->bookmark()); | 1062 | d->bookmarkManager->root().moveBookmark(bookmark, item->bookmark()); | ||
1063 | } else { | ||||
1064 | d->bookmarkManager->root().moveBookmark(bookmark, KBookmark()); | ||||
1063 | } | 1065 | } | ||
1064 | 1066 | | |||
1065 | refresh(); | 1067 | refresh(); | ||
1066 | } | 1068 | } | ||
1067 | 1069 | | |||
1068 | void KFilePlacesModel::editPlace(const QModelIndex &index, const QString &text, const QUrl &url, | 1070 | void KFilePlacesModel::editPlace(const QModelIndex &index, const QString &text, const QUrl &url, | ||
1069 | const QString &iconName, const QString &appName) | 1071 | const QString &iconName, const QString &appName) | ||
1070 | { | 1072 | { | ||
▲ Show 20 Lines • Show All 321 Lines • Show Last 20 Lines |
It seems to me you don't need to edit this function.