diff --git a/src/lib/app/profileupdater.cpp b/src/lib/app/profileupdater.cpp index 12889598d..75d877224 100644 --- a/src/lib/app/profileupdater.cpp +++ b/src/lib/app/profileupdater.cpp @@ -89,8 +89,8 @@ void ProfileUpdater::updateProfile(const QString ¤t, const QString &profil return; } - // 1.3.5, 1.4.x = no changes - if (prof >= Updater::Version("1.3.5") && prof < Updater::Version("1.5.0")) { + if (prof >= Updater::Version("1.4.0") && prof <= Updater::Version("1.5.0")) { + update140(); return; } @@ -173,4 +173,16 @@ void ProfileUpdater::update130() QSqlQuery query; query.exec("ALTER TABLE bookmarks ADD COLUMN keyword TEXT"); + + update140(); +} + +void ProfileUpdater::update140() +{ + std::cout << "QupZilla: Upgrading profile version from 1.4.0..." << std::endl; + mApp->connectDatabase(); + + QSqlQuery query; + query.exec("ALTER TABLE search_engines ADD COLUMN method TEXT"); + query.exec("UPDATE search_engines SET method='GET'"); } diff --git a/src/lib/app/profileupdater.h b/src/lib/app/profileupdater.h index 98e0eee05..7960405e2 100644 --- a/src/lib/app/profileupdater.h +++ b/src/lib/app/profileupdater.h @@ -36,6 +36,7 @@ private: void update118(); void update120(); void update130(); + void update140(); QString m_profilePath; }; diff --git a/src/lib/data/data/browsedata.db b/src/lib/data/data/browsedata.db index 4776a1c3e..e382cbb44 100644 Binary files a/src/lib/data/data/browsedata.db and b/src/lib/data/data/browsedata.db differ diff --git a/src/lib/opensearch/searchenginesmanager.cpp b/src/lib/opensearch/searchenginesmanager.cpp index 86819b168..3a58dc8b9 100644 --- a/src/lib/opensearch/searchenginesmanager.cpp +++ b/src/lib/opensearch/searchenginesmanager.cpp @@ -67,14 +67,15 @@ void SearchEnginesManager::loadSettings() m_settingsLoaded = true; QSqlQuery query; - query.exec("SELECT name, icon, url, shortcut, suggestionsUrl FROM search_engines"); + query.exec("SELECT name, icon, url, shortcut, method, suggestionsUrl FROM search_engines"); while (query.next()) { Engine en; en.name = query.value(0).toString(); en.icon = qIconProvider->iconFromBase64(query.value(1).toByteArray()); en.url = query.value(2).toString(); en.shortcut = query.value(3).toString(); - en.suggestionsUrl = query.value(4).toString(); + en.method = query.value(4).toString(); + en.suggestionsUrl = query.value(5).toString(); m_allEngines.append(en); @@ -446,13 +447,14 @@ void SearchEnginesManager::saveSettings() query.exec("DELETE FROM search_engines"); foreach (const Engine &en, m_allEngines) { - query.prepare("INSERT INTO search_engines (name, icon, url, shortcut, suggestionsUrl, suggestionsParameters) VALUES (?, ?, ?, ?, ?, ?)"); - query.bindValue(0, en.name); - query.bindValue(1, qIconProvider->iconToBase64(en.icon)); - query.bindValue(2, en.url); - query.bindValue(3, en.shortcut); - query.bindValue(4, en.suggestionsUrl); - query.bindValue(5, en.suggestionsParameters); + query.prepare("INSERT INTO search_engines (name, icon, url, shortcut, method, suggestionsUrl, suggestionsParameters) VALUES (?, ?, ?, ?, ?, ?)"); + query.addBindValue(en.name); + query.addBindValue(qIconProvider->iconToBase64(en.icon)); + query.addBindValue(en.url); + query.addBindValue(en.shortcut); + query.addBindValue(en.method); + query.addBindValue(en.suggestionsUrl); + query.addBindValue(en.suggestionsParameters); query.exec(); } diff --git a/src/lib/opensearch/searchenginesmanager.h b/src/lib/opensearch/searchenginesmanager.h index dbf8be5f3..59c81a707 100644 --- a/src/lib/opensearch/searchenginesmanager.h +++ b/src/lib/opensearch/searchenginesmanager.h @@ -34,7 +34,6 @@ class QT_QUPZILLA_EXPORT SearchEnginesManager : public QObject { Q_OBJECT public: - explicit SearchEnginesManager(); struct Engine { @@ -42,11 +41,11 @@ public: QIcon icon; QString url; QString shortcut; + QString method; QString suggestionsUrl; QByteArray suggestionsParameters; - bool operator==(const Engine &other) const { return (this->name == other.name && this->url == other.url &&