Changeset View
Changeset View
Standalone View
Standalone View
src/core/krecentdocument.cpp
Show All 33 Lines | |||||
34 | #include <utime.h> | 34 | #include <utime.h> | ||
35 | #endif | 35 | #endif | ||
36 | 36 | | |||
37 | #include <QDebug> | 37 | #include <QDebug> | ||
38 | #include <kio/global.h> | 38 | #include <kio/global.h> | ||
39 | #include <kdesktopfile.h> | 39 | #include <kdesktopfile.h> | ||
40 | #include <QDir> | 40 | #include <QDir> | ||
41 | #include <QCoreApplication> | 41 | #include <QCoreApplication> | ||
42 | #include <QRegExp> | 42 | #include <QRegularExpression> | ||
43 | #include <qplatformdefs.h> | 43 | #include <qplatformdefs.h> | ||
44 | 44 | | |||
45 | #include <kconfiggroup.h> | 45 | #include <kconfiggroup.h> | ||
46 | #include <ksharedconfig.h> | 46 | #include <ksharedconfig.h> | ||
47 | 47 | | |||
48 | QString KRecentDocument::recentDocumentDirectory() | 48 | QString KRecentDocument::recentDocumentDirectory() | ||
49 | { | 49 | { | ||
50 | // need to change this path, not sure where | 50 | // need to change this path, not sure where | ||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | |||||
96 | 96 | | |||
97 | void KRecentDocument::add(const QUrl &url, const QString &desktopEntryName) | 97 | void KRecentDocument::add(const QUrl &url, const QString &desktopEntryName) | ||
98 | { | 98 | { | ||
99 | if (url.isLocalFile() && url.toLocalFile().startsWith(QDir::tempPath())) { | 99 | if (url.isLocalFile() && url.toLocalFile().startsWith(QDir::tempPath())) { | ||
100 | return; // inside tmp resource, do not save | 100 | return; // inside tmp resource, do not save | ||
101 | } | 101 | } | ||
102 | 102 | | |||
103 | QString openStr = url.toDisplayString(); | 103 | QString openStr = url.toDisplayString(); | ||
104 | openStr.replace(QRegExp(QStringLiteral("\\$")), QStringLiteral("$$")); // Desktop files with type "Link" are $-variable expanded | 104 | openStr.replace(QRegularExpression(QStringLiteral("\\$")), QStringLiteral("$$")); // Desktop files with type "Link" are $-variable expanded | ||
105 | 105 | | |||
106 | // qDebug() << "KRecentDocument::add for " << openStr; | 106 | // qDebug() << "KRecentDocument::add for " << openStr; | ||
107 | KConfigGroup config = KSharedConfig::openConfig()->group(QByteArray("RecentDocuments")); | 107 | KConfigGroup config = KSharedConfig::openConfig()->group(QByteArray("RecentDocuments")); | ||
108 | bool useRecent = config.readEntry(QStringLiteral("UseRecent"), true); | 108 | bool useRecent = config.readEntry(QStringLiteral("UseRecent"), true); | ||
109 | int maxEntries = config.readEntry(QStringLiteral("MaxEntries"), 10); | 109 | int maxEntries = config.readEntry(QStringLiteral("MaxEntries"), 10); | ||
110 | 110 | | |||
111 | if (!useRecent || maxEntries <= 0) { | 111 | if (!useRecent || maxEntries <= 0) { | ||
112 | return; | 112 | return; | ||
▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines |