diff --git a/src/lib/autofill/autofill.cpp b/src/lib/autofill/autofill.cpp index 222cfa7ce..51d3276d1 100644 --- a/src/lib/autofill/autofill.cpp +++ b/src/lib/autofill/autofill.cpp @@ -18,12 +18,12 @@ #include "autofill.h" #include "browserwindow.h" #include "webpage.h" +#include "sqldatabase.h" #include "tabbedwebview.h" #include "popupwebview.h" #include "mainapplication.h" #include "autofillnotification.h" #include "pageformcompleter.h" -#include "databasewriter.h" #include "settings.h" #include "passwordmanager.h" @@ -100,7 +100,7 @@ void AutoFill::blockStoringforUrl(const QUrl &url) query.prepare("INSERT INTO autofill_exceptions (server) VALUES (?)"); query.addBindValue(server); - DatabaseWriter::instance()->executeQuery(query); + SqlDatabase::instance()->execAsync(query); } QVector AutoFill::getFormData(const QUrl &url) diff --git a/src/lib/autofill/passwordbackends/databasepasswordbackend.cpp b/src/lib/autofill/passwordbackends/databasepasswordbackend.cpp index 981c3fdae..2914fe571 100644 --- a/src/lib/autofill/passwordbackends/databasepasswordbackend.cpp +++ b/src/lib/autofill/passwordbackends/databasepasswordbackend.cpp @@ -17,7 +17,6 @@ * ============================================================ */ #include "databasepasswordbackend.h" #include "mainapplication.h" -#include "databasewriter.h" #include "autofill.h" #include diff --git a/src/lib/lib.pro b/src/lib/lib.pro index 9fcb89952..8051ac626 100644 --- a/src/lib/lib.pro +++ b/src/lib/lib.pro @@ -172,7 +172,6 @@ SOURCES += \ webview/webhistorywrapper.cpp \ tools/pagethumbnailer.cpp \ plugins/speeddial.cpp \ - other/databasewriter.cpp \ tools/enhancedmenu.cpp \ navigation/siteicon.cpp \ navigation/goicon.cpp \ @@ -370,7 +369,6 @@ HEADERS += \ webview/webhistorywrapper.h \ tools/pagethumbnailer.h \ plugins/speeddial.h \ - other/databasewriter.h \ tools/enhancedmenu.h \ navigation/siteicon.h \ navigation/goicon.h \ diff --git a/src/lib/opensearch/searchenginesmanager.cpp b/src/lib/opensearch/searchenginesmanager.cpp index 7f9360216..7ce167263 100644 --- a/src/lib/opensearch/searchenginesmanager.cpp +++ b/src/lib/opensearch/searchenginesmanager.cpp @@ -23,7 +23,6 @@ #include "networkmanager.h" #include "opensearchreader.h" #include "opensearchengine.h" -#include "databasewriter.h" #include "settings.h" #include "qzsettings.h" #include "webview.h" @@ -31,6 +30,7 @@ #include #include #include +#include #include #if QT_VERSION >= 0x050000 @@ -87,6 +87,7 @@ void SearchEnginesManager::loadSettings() QSqlQuery query; query.exec("SELECT name, icon, url, shortcut, suggestionsUrl, suggestionsParameters, postData FROM search_engines"); + while (query.next()) { Engine en; en.name = query.value(0).toString(); diff --git a/src/lib/other/databasewriter.cpp b/src/lib/other/databasewriter.cpp deleted file mode 100644 index 438962fc4..000000000 --- a/src/lib/other/databasewriter.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* ============================================================ -* QupZilla - WebKit based browser -* Copyright (C) 2010-2014 David Rosca -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* ============================================================ */ -#include "databasewriter.h" - -#include - -Q_GLOBAL_STATIC(DatabaseWriter, qz_database_writer) - -DatabaseWriter::DatabaseWriter() - : QObject() -{ -} - -void DatabaseWriter::executeQuery(const QSqlQuery &query) -{ - m_queries.append(query); - QTimer::singleShot(0, this, SLOT(execute())); -} - -DatabaseWriter* DatabaseWriter::instance() -{ - return qz_database_writer(); -} - -void DatabaseWriter::execute() -{ - if (m_queries.isEmpty()) { - return; - } - - m_queries.first().exec(); - m_queries.remove(0); -} diff --git a/src/lib/other/databasewriter.h b/src/lib/other/databasewriter.h deleted file mode 100644 index c7a062534..000000000 --- a/src/lib/other/databasewriter.h +++ /dev/null @@ -1,45 +0,0 @@ -/* ============================================================ -* QupZilla - WebKit based browser -* Copyright (C) 2010-2014 David Rosca -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* ============================================================ */ -#ifndef DATABASEWRITER_H -#define DATABASEWRITER_H - -#include -#include -#include - -#include "qzcommon.h" - -class QUPZILLA_EXPORT DatabaseWriter : public QObject -{ - Q_OBJECT -public: - explicit DatabaseWriter(); - - // Delayed execution of query - void executeQuery(const QSqlQuery &query); - - static DatabaseWriter* instance(); - -private slots: - void execute(); - -private: - QVector m_queries; -}; - -#endif // DATABASEWRITER_H diff --git a/src/lib/tools/iconprovider.cpp b/src/lib/tools/iconprovider.cpp index d585bb2f2..935f872b7 100644 --- a/src/lib/tools/iconprovider.cpp +++ b/src/lib/tools/iconprovider.cpp @@ -17,7 +17,7 @@ * ============================================================ */ #include "iconprovider.h" #include "mainapplication.h" -#include "databasewriter.h" +#include "sqldatabase.h" #include "autosaver.h" #include "webview.h" @@ -235,7 +235,7 @@ void IconProvider::saveIconsToDatabase() query.bindValue(0, buffer.data()); query.bindValue(1, ic.first.toEncoded(QUrl::RemoveFragment)); - DatabaseWriter::instance()->executeQuery(query); + SqlDatabase::instance()->execAsync(query); } m_iconBuffer.clear();