1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

[DatabaseWriter] Replace with new SqlDatabase class

This commit is contained in:
nowrep 2014-03-15 01:14:06 +01:00
parent 167ae2af50
commit 688e021fff
7 changed files with 6 additions and 101 deletions

View File

@ -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<PasswordEntry> AutoFill::getFormData(const QUrl &url)

View File

@ -17,7 +17,6 @@
* ============================================================ */
#include "databasepasswordbackend.h"
#include "mainapplication.h"
#include "databasewriter.h"
#include "autofill.h"
#include <QVector>

View File

@ -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 \

View File

@ -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 <QNetworkReply>
#include <QMessageBox>
#include <QWebElement>
#include <QSqlQuery>
#include <QBuffer>
#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();

View File

@ -1,48 +0,0 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
* ============================================================ */
#include "databasewriter.h"
#include <QTimer>
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);
}

View File

@ -1,45 +0,0 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
* ============================================================ */
#ifndef DATABASEWRITER_H
#define DATABASEWRITER_H
#include <QObject>
#include <QSqlQuery>
#include <QVector>
#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<QSqlQuery> m_queries;
};
#endif // DATABASEWRITER_H

View File

@ -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();