Changeset View
Changeset View
Standalone View
Standalone View
src/filewidgets/kfileplacesmodel.cpp
Show First 20 Lines • Show All 181 Lines • ▼ Show 20 Line(s) | 181 | { | |||
---|---|---|---|---|---|
182 | qDeleteAll(items); | 182 | qDeleteAll(items); | ||
183 | } | 183 | } | ||
184 | 184 | | |||
185 | KFilePlacesModel *q; | 185 | KFilePlacesModel *q; | ||
186 | 186 | | |||
187 | QList<KFilePlacesItem *> items; | 187 | QList<KFilePlacesItem *> items; | ||
188 | QVector<QString> availableDevices; | 188 | QVector<QString> availableDevices; | ||
189 | QMap<QObject *, QPersistentModelIndex> setupInProgress; | 189 | QMap<QObject *, QPersistentModelIndex> setupInProgress; | ||
190 | QStringList supportedSchemes; | ||||
190 | 191 | | |||
191 | Solid::Predicate predicate; | 192 | Solid::Predicate predicate; | ||
192 | KBookmarkManager *bookmarkManager; | 193 | KBookmarkManager *bookmarkManager; | ||
193 | 194 | | |||
194 | const bool fileIndexingEnabled; | 195 | const bool fileIndexingEnabled; | ||
195 | 196 | | |||
196 | QString alternativeApplicationName; | 197 | QString alternativeApplicationName; | ||
197 | 198 | | |||
▲ Show 20 Lines • Show All 469 Lines • ▼ Show 20 Line(s) | 662 | while (!bookmark.isNull()) { | |||
667 | if (it != devices.end()) { | 668 | if (it != devices.end()) { | ||
668 | devices.erase(it); | 669 | devices.erase(it); | ||
669 | } | 670 | } | ||
670 | 671 | | |||
671 | bool allowedHere = appName.isEmpty() || | 672 | bool allowedHere = appName.isEmpty() || | ||
672 | ((appName == QCoreApplication::instance()->applicationName()) || | 673 | ((appName == QCoreApplication::instance()->applicationName()) || | ||
673 | (appName == alternativeApplicationName)); | 674 | (appName == alternativeApplicationName)); | ||
674 | bool isSupportedUrl = isBalooUrl(url) ? fileIndexingEnabled : true; | 675 | bool isSupportedUrl = isBalooUrl(url) ? fileIndexingEnabled : true; | ||
676 | bool isSupportedScheme = supportedSchemes.isEmpty() || supportedSchemes.contains(url.scheme()); | ||||
675 | 677 | | |||
676 | if ((isSupportedUrl && udi.isEmpty() && allowedHere) || deviceAvailable) { | 678 | if (isSupportedScheme && ((isSupportedUrl && udi.isEmpty() && allowedHere) || deviceAvailable)) { | ||
677 | 679 | | |||
678 | KFilePlacesItem *item; | 680 | KFilePlacesItem *item; | ||
679 | if (deviceAvailable) { | 681 | if (deviceAvailable) { | ||
680 | item = new KFilePlacesItem(bookmarkManager, bookmark.address(), udi); | 682 | item = new KFilePlacesItem(bookmarkManager, bookmark.address(), udi); | ||
681 | // TODO: Update bookmark internal element | 683 | // TODO: Update bookmark internal element | ||
682 | } else { | 684 | } else { | ||
683 | item = new KFilePlacesItem(bookmarkManager, bookmark.address()); | 685 | item = new KFilePlacesItem(bookmarkManager, bookmark.address()); | ||
684 | } | 686 | } | ||
▲ Show 20 Lines • Show All 574 Lines • ▼ Show 20 Line(s) | |||||
1259 | 1261 | | |||
1260 | void KFilePlacesModel::Private::_k_storageTeardownDone(Solid::ErrorType error, QVariant errorData) | 1262 | void KFilePlacesModel::Private::_k_storageTeardownDone(Solid::ErrorType error, QVariant errorData) | ||
1261 | { | 1263 | { | ||
1262 | if (error && errorData.isValid()) { | 1264 | if (error && errorData.isValid()) { | ||
1263 | emit q->errorMessage(errorData.toString()); | 1265 | emit q->errorMessage(errorData.toString()); | ||
1264 | } | 1266 | } | ||
1265 | } | 1267 | } | ||
1266 | 1268 | | |||
1269 | void KFilePlacesModel::setSupportedSchemes(const QStringList &schemes) | ||||
1270 | { | ||||
1271 | d->supportedSchemes = schemes; | ||||
1272 | d->_k_reloadBookmarks(); | ||||
1273 | } | ||||
1274 | | ||||
1275 | QStringList KFilePlacesModel::supportedSchemes() const | ||||
1276 | { | ||||
1277 | return d->supportedSchemes; | ||||
1278 | } | ||||
1279 | | ||||
1267 | #include "moc_kfileplacesmodel.cpp" | 1280 | #include "moc_kfileplacesmodel.cpp" |