Changeset View
Changeset View
Standalone View
Standalone View
src/core/krecentdocument.cpp
Show First 20 Lines • Show All 80 Lines • ▼ Show 20 Line(s) | 66 | for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) { | |||
---|---|---|---|---|---|
81 | } | 81 | } | ||
82 | } | 82 | } | ||
83 | 83 | | |||
84 | return fullList; | 84 | return fullList; | ||
85 | } | 85 | } | ||
86 | 86 | | |||
87 | void KRecentDocument::add(const QUrl &url) | 87 | void KRecentDocument::add(const QUrl &url) | ||
88 | { | 88 | { | ||
89 | KRecentDocument::add(url, QCoreApplication::applicationName()); | 89 | // desktopFileName is in QGuiApplication but we're in KIO Core here | ||
90 | QString desktopEntryName = QCoreApplication::instance()->property("desktopFileName").toString(); | ||||
91 | if (desktopEntryName.isEmpty()) { | ||||
92 | desktopEntryName = QCoreApplication::applicationName(); | ||||
93 | } | ||||
94 | KRecentDocument::add(url, desktopEntryName); | ||||
90 | // ### componentName might not match the service filename... | 95 | // ### componentName might not match the service filename... | ||
91 | } | 96 | } | ||
92 | 97 | | |||
93 | void KRecentDocument::add(const QUrl &url, const QString &desktopEntryName) | 98 | void KRecentDocument::add(const QUrl &url, const QString &desktopEntryName) | ||
94 | { | 99 | { | ||
95 | if (url.isLocalFile() && url.toLocalFile().startsWith(QDir::tempPath())) { | 100 | if (url.isLocalFile() && url.toLocalFile().startsWith(QDir::tempPath())) { | ||
96 | return; // inside tmp resource, do not save | 101 | return; // inside tmp resource, do not save | ||
97 | } | 102 | } | ||
Show All 40 Lines | |||||
138 | // check for max entries, delete oldest files if exceeded | 143 | // check for max entries, delete oldest files if exceeded | ||
139 | const QStringList list = dir.entryList(QDir::Files | QDir::Hidden, QFlags<QDir::SortFlag>(QDir::Time | QDir::Reversed)); | 144 | const QStringList list = dir.entryList(QDir::Files | QDir::Hidden, QFlags<QDir::SortFlag>(QDir::Time | QDir::Reversed)); | ||
140 | i = list.count(); | 145 | i = list.count(); | ||
141 | if (i > maxEntries - 1) { | 146 | if (i > maxEntries - 1) { | ||
142 | QStringList::ConstIterator it; | 147 | QStringList::ConstIterator it; | ||
143 | it = list.begin(); | 148 | it = list.begin(); | ||
144 | while (i > maxEntries - 1) { | 149 | while (i > maxEntries - 1) { | ||
145 | QFile::remove(dir.absolutePath() + QLatin1String("/") + (*it)); | 150 | QFile::remove(dir.absolutePath() + QLatin1String("/") + (*it)); | ||
146 | --i, ++it; | 151 | --i; | ||
152 | ++it; | ||||
147 | } | 153 | } | ||
148 | } | 154 | } | ||
149 | 155 | | |||
150 | // create the applnk | 156 | // create the applnk | ||
151 | KDesktopFile configFile(ddesktop); | 157 | KDesktopFile configFile(ddesktop); | ||
152 | KConfigGroup conf = configFile.desktopGroup(); | 158 | KConfigGroup conf = configFile.desktopGroup(); | ||
153 | conf.writeEntry("Type", QStringLiteral("Link")); | 159 | conf.writeEntry("Type", QStringLiteral("Link")); | ||
154 | conf.writePathEntry("URL", openStr); | 160 | conf.writePathEntry("URL", openStr); | ||
Show All 21 Lines |