mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
SearchEngine: Prepare for POST method support
This commit is contained in:
parent
f465157897
commit
8a5a4017d6
|
@ -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'");
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ private:
|
|||
void update118();
|
||||
void update120();
|
||||
void update130();
|
||||
void update140();
|
||||
|
||||
QString m_profilePath;
|
||||
};
|
||||
|
|
Binary file not shown.
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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 &&
|
||||
|
|
Loading…
Reference in New Issue
Block a user