Changeset View
Changeset View
Standalone View
Standalone View
runners/bookmarks/browsers/firefox.cpp
Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Line(s) | 80 | { | |||
---|---|---|---|---|---|
93 | } else { | 93 | } else { | ||
94 | const QString escapedTerm = tmpTerm.replace('\'', QLatin1String("\\'")); | 94 | const QString escapedTerm = tmpTerm.replace('\'', QLatin1String("\\'")); | ||
95 | query = QString("SELECT moz_bookmarks.fk, moz_bookmarks.title, moz_places.url " \ | 95 | query = QString("SELECT moz_bookmarks.fk, moz_bookmarks.title, moz_places.url " \ | ||
96 | "FROM moz_bookmarks, moz_places WHERE " \ | 96 | "FROM moz_bookmarks, moz_places WHERE " \ | ||
97 | "moz_bookmarks.type = 1 AND moz_bookmarks.fk = moz_places.id AND " \ | 97 | "moz_bookmarks.type = 1 AND moz_bookmarks.fk = moz_places.id AND " \ | ||
98 | "(moz_bookmarks.title LIKE '%" + escapedTerm + "%' or moz_places.url LIKE '%" | 98 | "(moz_bookmarks.title LIKE '%" + escapedTerm + "%' or moz_places.url LIKE '%" | ||
99 | + escapedTerm + "%')"); | 99 | + escapedTerm + "%')"); | ||
100 | } | 100 | } | ||
101 | QList<QVariantMap> results = m_fetchsqlite->query(query, QMap<QString, QVariant>()); | 101 | const QList<QVariantMap> results = m_fetchsqlite->query(query, QMap<QString, QVariant>()); | ||
102 | QMultiMap<QString, QString> uniqueResults; | 102 | QMultiMap<QString, QString> uniqueResults; | ||
apol: const &
| |||||
103 | foreach(QVariantMap result, results) { | 103 | for (QVariantMap result : results) { | ||
104 | const QString title = result.value(QStringLiteral("title")).toString(); | 104 | const QString title = result.value(QStringLiteral("title")).toString(); | ||
105 | const QUrl url = result.value(QStringLiteral("url")).toUrl(); | 105 | const QUrl url = result.value(QStringLiteral("url")).toUrl(); | ||
106 | if (url.isEmpty() || url.scheme() == QLatin1String("place")) { | 106 | if (url.isEmpty() || url.scheme() == QLatin1String("place")) { | ||
107 | // Don't use bookmarks with empty url or Firefox's "place:" scheme, | 107 | // Don't use bookmarks with empty url or Firefox's "place:" scheme, | ||
108 | // e.g. used for "Most Visited" or "Recent Tags" | 108 | // e.g. used for "Most Visited" or "Recent Tags" | ||
109 | //qDebug() << "element " << url << " was not added"; | 109 | //qDebug() << "element " << url << " was not added"; | ||
110 | continue; | 110 | continue; | ||
111 | } | 111 | } | ||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Line(s) | 173 | if (m_dbFile.isEmpty() || !QFile::exists(m_dbFile)) { | |||
180 | 180 | | |||
181 | QString profilePath; | 181 | QString profilePath; | ||
182 | if (size == 1) { | 182 | if (size == 1) { | ||
183 | // There is only 1 profile so we select it | 183 | // There is only 1 profile so we select it | ||
184 | KConfigGroup fGrp = firefoxProfile.group(profilesList.first()); | 184 | KConfigGroup fGrp = firefoxProfile.group(profilesList.first()); | ||
185 | profilePath = fGrp.readEntry("Path", ""); | 185 | profilePath = fGrp.readEntry("Path", ""); | ||
186 | } else { | 186 | } else { | ||
187 | // There are multiple profiles, find the default one | 187 | // There are multiple profiles, find the default one | ||
188 | foreach(const QString & profileName, profilesList) { | 188 | for (const QString & profileName : qAsConst(profilesList)) { | ||
189 | KConfigGroup fGrp = firefoxProfile.group(profileName); | 189 | KConfigGroup fGrp = firefoxProfile.group(profileName); | ||
190 | if (fGrp.readEntry<int>("Default", 0)) { | 190 | if (fGrp.readEntry<int>("Default", 0)) { | ||
191 | profilePath = fGrp.readEntry("Path", ""); | 191 | profilePath = fGrp.readEntry("Path", ""); | ||
192 | break; | 192 | break; | ||
193 | } | 193 | } | ||
194 | } | 194 | } | ||
195 | } | 195 | } | ||
196 | 196 | | |||
Show All 20 Lines |
const &