Changeset View
Changeset View
Standalone View
Standalone View
runners/bookmarks/browsers/firefox.cpp
Show First 20 Lines • Show All 132 Lines • ▼ Show 20 Line(s) | |||||
133 | 133 | | |||
134 | void Firefox::reloadConfiguration() | 134 | void Firefox::reloadConfiguration() | ||
135 | { | 135 | { | ||
136 | KConfigGroup config(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), QStringLiteral("General") ); | 136 | KConfigGroup config(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), QStringLiteral("General") ); | ||
137 | if (QSqlDatabase::isDriverAvailable(QStringLiteral("QSQLITE"))) { | 137 | if (QSqlDatabase::isDriverAvailable(QStringLiteral("QSQLITE"))) { | ||
138 | KConfigGroup grp = config; | 138 | KConfigGroup grp = config; | ||
139 | /* This allows the user to specify a profile database */ | 139 | /* This allows the user to specify a profile database */ | ||
140 | m_dbFile = grp.readEntry<QString>("dbfile", QLatin1String("")); | 140 | m_dbFile = grp.readEntry<QString>("dbfile", QLatin1String("")); | ||
141 | if (m_dbFile.isEmpty() || QFile::exists(m_dbFile)) { | 141 | if (m_dbFile.isEmpty() || !QFile::exists(m_dbFile)) { | ||
142 | //Try to get the right database file, the default profile is used | 142 | //Try to get the right database file, the default profile is used | ||
143 | KConfig firefoxProfile(QDir::homePath() + "/.mozilla/firefox/profiles.ini", | 143 | KConfig firefoxProfile(QDir::homePath() + "/.mozilla/firefox/profiles.ini", | ||
144 | KConfig::SimpleConfig); | 144 | KConfig::SimpleConfig); | ||
145 | QStringList profilesList = firefoxProfile.groupList(); | 145 | QStringList profilesList = firefoxProfile.groupList(); | ||
146 | profilesList = profilesList.filter(QRegExp(QStringLiteral("^Profile\\d+$"))); | 146 | profilesList = profilesList.filter(QRegExp(QStringLiteral("^Profile\\d+$"))); | ||
147 | int size = profilesList.size(); | 147 | int size = profilesList.size(); | ||
148 | 148 | | |||
149 | QString profilePath; | 149 | QString profilePath; | ||
Show All 16 Lines | 165 | if (profilePath.isEmpty()) { | |||
166 | //qDebug() << "No default firefox profile found"; | 166 | //qDebug() << "No default firefox profile found"; | ||
167 | return; | 167 | return; | ||
168 | } | 168 | } | ||
169 | //qDebug() << "Profile " << profilePath << " found"; | 169 | //qDebug() << "Profile " << profilePath << " found"; | ||
170 | profilePath.prepend(QStringLiteral("%1/.mozilla/firefox/").arg(QDir::homePath())); | 170 | profilePath.prepend(QStringLiteral("%1/.mozilla/firefox/").arg(QDir::homePath())); | ||
171 | m_dbFile = profilePath + "/places.sqlite"; | 171 | m_dbFile = profilePath + "/places.sqlite"; | ||
172 | grp.writeEntry("dbfile", m_dbFile); | 172 | grp.writeEntry("dbfile", m_dbFile); | ||
173 | m_dbFile_fav = profilePath + "/favicons.sqlite"; | 173 | m_dbFile_fav = profilePath + "/favicons.sqlite"; | ||
174 | } else { | ||||
175 | auto dir = QDir(m_dbFile); | ||||
176 | if (dir.cdUp()) { | ||||
177 | QString profilePath = dir.absolutePath(); | ||||
178 | m_dbFile_fav = profilePath + "/favicons.sqlite"; | ||||
179 | } | ||||
174 | } | 180 | } | ||
175 | } else { | 181 | } else { | ||
176 | //qDebug() << "SQLITE driver isn't available"; | 182 | //qDebug() << "SQLITE driver isn't available"; | ||
177 | } | 183 | } | ||
178 | } | 184 | } |