Changeset View
Changeset View
Standalone View
Standalone View
runners/bookmarks/browsers/chrome.cpp
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | |||||
47 | 47 | | |||
48 | Chrome::Chrome( FindProfile* findProfile, QObject* parent ) | 48 | Chrome::Chrome( FindProfile* findProfile, QObject* parent ) | ||
49 | : QObject(parent), | 49 | : QObject(parent), | ||
50 | m_watcher(new KDirWatch(this)), | 50 | m_watcher(new KDirWatch(this)), | ||
51 | m_dirty(false) | 51 | m_dirty(false) | ||
52 | { | 52 | { | ||
53 | const auto profiles = findProfile->find(); | 53 | const auto profiles = findProfile->find(); | ||
54 | for(const Profile &profile : profiles) { | 54 | for(const Profile &profile : profiles) { | ||
55 | updateCacheFile(profile.faviconSource(), profile.faviconCache()); | ||||
meven: Might as well check the returned value for error | |||||
If this fails only the icons are affected and the default icon will be displayed, this case will be handled in the FetchSqlite class alex: If this fails only the icons are affected and the default icon will be displayed, this case… | |||||
55 | m_profileBookmarks << new ProfileBookmarks(profile); | 56 | m_profileBookmarks << new ProfileBookmarks(profile); | ||
56 | m_watcher->addFile(profile.path()); | 57 | m_watcher->addFile(profile.path()); | ||
57 | } | 58 | } | ||
58 | connect(m_watcher, &KDirWatch::created, [=] { m_dirty = true; }); | 59 | connect(m_watcher, &KDirWatch::created, [=] { m_dirty = true; }); | ||
59 | } | 60 | } | ||
60 | 61 | | |||
61 | Chrome::~Chrome() | 62 | Chrome::~Chrome() | ||
62 | { | 63 | { | ||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | 99 | for(ProfileBookmarks *profileBookmarks : qAsConst(m_profileBookmarks)) { | |||
109 | const QJsonObject resultMap = jdoc.object(); | 110 | const QJsonObject resultMap = jdoc.object(); | ||
110 | if (!resultMap.contains(QLatin1String("roots"))) { | 111 | if (!resultMap.contains(QLatin1String("roots"))) { | ||
111 | return; | 112 | return; | ||
112 | } | 113 | } | ||
113 | const QJsonObject entries = resultMap.value(QStringLiteral("roots")).toObject(); | 114 | const QJsonObject entries = resultMap.value(QStringLiteral("roots")).toObject(); | ||
114 | for (const QJsonValue &folder : entries) { | 115 | for (const QJsonValue &folder : entries) { | ||
115 | parseFolder(folder.toObject(), profileBookmarks); | 116 | parseFolder(folder.toObject(), profileBookmarks); | ||
116 | } | 117 | } | ||
118 | updateCacheFile(profile.faviconSource(), profile.faviconCache()); | ||||
117 | profile.favicon()->prepare(); | 119 | profile.favicon()->prepare(); | ||
118 | } | 120 | } | ||
119 | } | 121 | } | ||
120 | 122 | | |||
121 | void Chrome::teardown() | 123 | void Chrome::teardown() | ||
122 | { | 124 | { | ||
123 | for(ProfileBookmarks *profileBookmarks : qAsConst(m_profileBookmarks)) { | 125 | for(ProfileBookmarks *profileBookmarks : qAsConst(m_profileBookmarks)) { | ||
124 | profileBookmarks->tearDown(); | 126 | profileBookmarks->tearDown(); | ||
Show All 15 Lines |
Might as well check the returned value for error