From 8a5a4017d67871efef5ec9cef63ba88fbeb55f47 Mon Sep 17 00:00:00 2001 From: nowrep Date: Fri, 8 Nov 2013 22:17:27 +0100 Subject: [PATCH] SearchEngine: Prepare for POST method support --- src/lib/app/profileupdater.cpp | 16 ++++++++++++++-- src/lib/app/profileupdater.h | 1 + src/lib/data/data/browsedata.db | Bin 20480 -> 20480 bytes src/lib/opensearch/searchenginesmanager.cpp | 20 +++++++++++--------- src/lib/opensearch/searchenginesmanager.h | 3 +-- 5 files changed, 27 insertions(+), 13 deletions(-) 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 4776a1c3eee9ffc48701d675e771023cd3265048..e382cbb444d2645327ec01a7b03da6059adbfb41 100644 GIT binary patch delta 264 zcmZozz}T>Wae}m<1_J|w2oOU7(}amS#;h6)y3ZIlrp#hyJ_r!sG6I5Dwt1Cu}hWae}m<8Uq7^5D-HFQ}09_V^&oL-AAe$Q)V$Ua&G?5%qX#mgM~$iouQZk zh~6=_GTviyWIE5>H?c8x^F);xCay*sHg<7MO~xkU$;z6Fa_r7Qu8twD3L%b8KCTMI zsfk6&8S$xk>6v+{#R?jeH>yiaZr2o@JXh0`sepa*do?LWj>%l=p**ZWM=&z~202A& zV?iJD#0e=G`ILqXqrl|n8b%iG zJZ$2!;*6P@c`2zCnaTNi#i2zxV45H5pin>0z))8OPd^ve2nDE$0RGA8+6s&!lRLEa zl^W$Z*u~}L8JoCE5|eULlk)Ska}$fQi{T8e$&Kpuo1bZ_GfLyJZt^8iconFromBase64(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 &&