Changeset View
Changeset View
Standalone View
Standalone View
src/filewidgets/kfileplacesmodel.cpp
| Show First 20 Lines • Show All 233 Lines • ▼ Show 20 Line(s) | 229 | if (root.first().isNull() || !QFile::exists(file)) { | |||
|---|---|---|---|---|---|
| 234 | // createSystemBookmark actually does nothing with its third argument, | 234 | // createSystemBookmark actually does nothing with its third argument, | ||
| 235 | // but we have to give it something so the I18N_NOOP2 calls stay here for now. | 235 | // but we have to give it something so the I18N_NOOP2 calls stay here for now. | ||
| 236 | // | 236 | // | ||
| 237 | // (coles, 13th May 2009) | 237 | // (coles, 13th May 2009) | ||
| 238 | 238 | | |||
| 239 | KFilePlacesItem::createSystemBookmark(d->bookmarkManager, | 239 | KFilePlacesItem::createSystemBookmark(d->bookmarkManager, | ||
| 240 | QStringLiteral("Home"), I18N_NOOP2("KFile System Bookmarks", "Home"), | 240 | QStringLiteral("Home"), I18N_NOOP2("KFile System Bookmarks", "Home"), | ||
| 241 | QUrl::fromLocalFile(QDir::homePath()), QStringLiteral("user-home")); | 241 | QUrl::fromLocalFile(QDir::homePath()), QStringLiteral("user-home")); | ||
| 242 | | ||||
| 243 | // Some distros may not create various standard XDG folders by default | ||||
| 244 | // so check for their existance before adding bookmarks for them | ||||
| 245 | const QString desktopFolder = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); | ||||
broulik: Desktop KIO claims that this may return $HOME if the Desktop folder does not exist, can you… | |||||
If I delete ~/Desktop, trying to access it via the Places entry gives me a red KMessageWidget that says "The file or folder /home/test/Desktop does not exist." Still, that folder exists by default, and I think the kind of user who deletes their Desktop folder is the kind of user we're not targeting with this change. ngraham: If I delete ~/Desktop, trying to access it via the Places entry gives me a red KMessageWidget… | |||||
| 246 | if (QDir(desktopFolder).exists()) { | ||||
| 247 | KFilePlacesItem::createSystemBookmark(d->bookmarkManager, | ||||
| 248 | QStringLiteral("Desktop"), I18N_NOOP2("KFile System Bookmarks", "Desktop"), | ||||
| 249 | QUrl::fromLocalFile(desktopFolder), QStringLiteral("user-desktop")); | ||||
| 250 | } | ||||
| 251 | const QString downloadFolder = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation); | ||||
| 252 | if (QDir(downloadFolder).exists()) { | ||||
| 253 | KFilePlacesItem::createSystemBookmark(d->bookmarkManager, | ||||
| 254 | QStringLiteral("Downloads"), I18N_NOOP2("KFile System Bookmarks", "Downloads"), | ||||
| 255 | QUrl::fromLocalFile(downloadFolder), QStringLiteral("folder-downloads")); | ||||
| 256 | } | ||||
| 257 | | ||||
| 242 | KFilePlacesItem::createSystemBookmark(d->bookmarkManager, | 258 | KFilePlacesItem::createSystemBookmark(d->bookmarkManager, | ||
| 243 | QStringLiteral("Network"), I18N_NOOP2("KFile System Bookmarks", "Network"), | 259 | QStringLiteral("Network"), I18N_NOOP2("KFile System Bookmarks", "Network"), | ||
| 244 | QUrl(QStringLiteral("remote:/")), QStringLiteral("network-workgroup")); | 260 | QUrl(QStringLiteral("remote:/")), QStringLiteral("network-workgroup")); | ||
| 245 | #if defined(_WIN32_WCE) | 261 | #if defined(_WIN32_WCE) | ||
| 246 | // adding drives | 262 | // adding drives | ||
| 247 | foreach (const QFileInfo &info, QDir::drives()) { | 263 | foreach (const QFileInfo &info, QDir::drives()) { | ||
| 248 | QString driveIcon = "drive-harddisk"; | 264 | QString driveIcon = "drive-harddisk"; | ||
| 249 | KFilePlacesItem::createSystemBookmark(d->bookmarkManager, | 265 | KFilePlacesItem::createSystemBookmark(d->bookmarkManager, | ||
| ▲ Show 20 Lines • Show All 1025 Lines • Show Last 20 Lines | |||||
Desktop KIO claims that this may return $HOME if the Desktop folder does not exist, can you confirm/invalidate that?