1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

SpeedDial: Save using AutoSaver

Prevents losing dials in case of crash.
This commit is contained in:
David Rosca 2014-09-29 18:23:42 +02:00
parent dc29f6bde5
commit 52f3811916
5 changed files with 17 additions and 3 deletions

View File

@ -1,6 +1,7 @@
Version 1.8.1 Version 1.8.1
* not yet released * not yet released
* fixed: autofill not working for some frames * fixed: autofill not working for some frames
* fixed: saving speed dial in case of crash
* fixed: building on Mac * fixed: building on Mac
Version 1.8.0 Version 1.8.0

View File

@ -294,6 +294,9 @@ MainApplication::~MainApplication()
// Delete all classes that are saving data in destructor // Delete all classes that are saving data in destructor
delete m_bookmarks; delete m_bookmarks;
delete m_cookieJar; delete m_cookieJar;
delete m_plugins;
Settings::syncSettings();
} }
bool MainApplication::isClosing() const bool MainApplication::isClosing() const
@ -761,7 +764,6 @@ void MainApplication::saveSettings()
qzSettings->saveSettings(); qzSettings->saveSettings();
AdBlockManager::instance()->save(); AdBlockManager::instance()->save();
QFile::remove(DataPaths::currentProfilePath() + QLatin1String("/WebpageIcons.db")); QFile::remove(DataPaths::currentProfilePath() + QLatin1String("/WebpageIcons.db"));
Settings::syncSettings();
} }
void MainApplication::messageReceived(const QString &message) void MainApplication::messageReceived(const QString &message)

View File

@ -93,7 +93,6 @@ void Plugins::loadSettings()
void Plugins::shutdown() void Plugins::shutdown()
{ {
c2f_saveSettings(); c2f_saveSettings();
m_speedDial->saveSettings();
foreach (PluginInterface* iPlugin, m_loadedPlugins) { foreach (PluginInterface* iPlugin, m_loadedPlugins) {
iPlugin->unload(); iPlugin->unload();

View File

@ -20,6 +20,7 @@
#include "settings.h" #include "settings.h"
#include "datapaths.h" #include "datapaths.h"
#include "qztools.h" #include "qztools.h"
#include "autosaver.h"
#include <QDir> #include <QDir>
#include <QCryptographicHash> #include <QCryptographicHash>
@ -38,6 +39,14 @@ SpeedDial::SpeedDial(QObject* parent)
, m_loaded(false) , m_loaded(false)
, m_regenerateScript(true) , m_regenerateScript(true)
{ {
m_autoSaver = new AutoSaver(this);
connect(m_autoSaver, SIGNAL(save()), this, SLOT(saveSettings()));
connect(this, SIGNAL(pagesChanged()), m_autoSaver, SLOT(changeOcurred()));
}
SpeedDial::~SpeedDial()
{
m_autoSaver->saveIfNecessary();
} }
void SpeedDial::loadSettings() void SpeedDial::loadSettings()

View File

@ -27,6 +27,7 @@ class QUrl;
class QWebFrame; class QWebFrame;
class QPixmap; class QPixmap;
class AutoSaver;
class PageThumbnailer; class PageThumbnailer;
class QUPZILLA_EXPORT SpeedDial : public QObject class QUPZILLA_EXPORT SpeedDial : public QObject
@ -44,9 +45,9 @@ public:
}; };
explicit SpeedDial(QObject* parent = 0); explicit SpeedDial(QObject* parent = 0);
~SpeedDial();
void loadSettings(); void loadSettings();
void saveSettings();
Page pageForUrl(const QUrl &url); Page pageForUrl(const QUrl &url);
QUrl urlForShortcut(int key); QUrl urlForShortcut(int key);
@ -81,6 +82,7 @@ public slots:
private slots: private slots:
void thumbnailCreated(const QPixmap &pixmap); void thumbnailCreated(const QPixmap &pixmap);
void saveSettings();
private: private:
QString escapeTitle(QString string) const; QString escapeTitle(QString string) const;
@ -99,6 +101,7 @@ private:
QList<QPointer<QWebFrame> > m_webFrames; QList<QPointer<QWebFrame> > m_webFrames;
QList<Page> m_webPages; QList<Page> m_webPages;
AutoSaver* m_autoSaver;
bool m_loaded; bool m_loaded;
bool m_regenerateScript; bool m_regenerateScript;