Changeset View
Changeset View
Standalone View
Standalone View
src/knotifyconfig.cpp
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 34 | { | |||
---|---|---|---|---|---|
45 | cache.insert(filename, new KSharedConfig::Ptr(m)); | 45 | cache.insert(filename, new KSharedConfig::Ptr(m)); | ||
46 | 46 | | |||
47 | return m; | 47 | return m; | ||
48 | } | 48 | } | ||
49 | 49 | | |||
50 | void KNotifyConfig::reparseConfiguration() | 50 | void KNotifyConfig::reparseConfiguration() | ||
51 | { | 51 | { | ||
52 | QCache<QString, KSharedConfig::Ptr> &cache = *static_cache; | 52 | QCache<QString, KSharedConfig::Ptr> &cache = *static_cache; | ||
53 | Q_FOREACH (const QString &filename, cache.keys()) { | 53 | const auto listFiles = cache.keys(); | ||
54 | for (const QString &filename : listFiles) { | ||||
dfaure: horribly slow, should use STL iterators | |||||
mlaurent: How we can use iterator here ?
I didn't find a method for it. | |||||
dfaure: Urgh, indeed. What kind of container is that....
Never mind then.... | |||||
54 | (*cache[filename])->reparseConfiguration(); | 55 | (*cache[filename])->reparseConfiguration(); | ||
55 | } | 56 | } | ||
56 | } | 57 | } | ||
57 | 58 | | |||
58 | void KNotifyConfig::reparseSingleConfiguration(const QString &app) | 59 | void KNotifyConfig::reparseSingleConfiguration(const QString &app) | ||
59 | { | 60 | { | ||
60 | QCache<QString, KSharedConfig::Ptr> &cache = *static_cache; | 61 | QCache<QString, KSharedConfig::Ptr> &cache = *static_cache; | ||
61 | const QString appCacheKey = app + QStringLiteral(".notifyrc"); | 62 | const QString appCacheKey = app + QStringLiteral(".notifyrc"); | ||
Show All 28 Lines | 89 | // config->actions = actions; | |||
90 | config->configfile = configfile; | 91 | config->configfile = configfile; | ||
91 | // appname, contexts, eventid already done in constructor | 92 | // appname, contexts, eventid already done in constructor | ||
92 | 93 | | |||
93 | return config; | 94 | return config; | ||
94 | } | 95 | } | ||
95 | 96 | | |||
96 | QString KNotifyConfig::readEntry(const QString &entry, bool path) | 97 | QString KNotifyConfig::readEntry(const QString &entry, bool path) | ||
97 | { | 98 | { | ||
98 | QPair<QString, QString> context; | 99 | for (const QPair<QString, QString> &context : qAsConst(contexts)) { | ||
99 | | ||||
100 | Q_FOREACH (context, contexts) { | | |||
101 | const QString group = QStringLiteral("Event/") + eventid + QLatin1Char('/') + context.first + QLatin1Char('/') + context.second; | 100 | const QString group = QStringLiteral("Event/") + eventid + QLatin1Char('/') + context.first + QLatin1Char('/') + context.second; | ||
102 | 101 | | |||
103 | if (configfile->hasGroup(group)) { | 102 | if (configfile->hasGroup(group)) { | ||
104 | KConfigGroup cg(configfile, group); | 103 | KConfigGroup cg(configfile, group); | ||
105 | QString p = path ? cg.readPathEntry(entry, QString()) : cg.readEntry(entry, QString()); | 104 | QString p = path ? cg.readPathEntry(entry, QString()) : cg.readEntry(entry, QString()); | ||
106 | 105 | | |||
107 | if (!p.isNull()) { | 106 | if (!p.isNull()) { | ||
108 | return p; | 107 | return p; | ||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |
horribly slow, should use STL iterators