From 7932ee0fd2e683af8cc1207986504747ccfbc68e Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 14 Nov 2011 17:16:08 +0100 Subject: Let the "big sync" work (the one done every minute...) --- src/sync/syncmanager.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-) (limited to 'src/sync/syncmanager.cpp') diff --git a/src/sync/syncmanager.cpp b/src/sync/syncmanager.cpp index cf3f2df7..53149ee1 100644 --- a/src/sync/syncmanager.cpp +++ b/src/sync/syncmanager.cpp @@ -31,6 +31,9 @@ // Auto Includes #include "rekonq.h" +// Local Includes +#include "syncwidget.h" + // KDE Includes #include #include @@ -43,20 +46,53 @@ SyncManager::SyncManager(QObject *parent) : QObject(parent) , _firstTimeSynced(false) + , _syncTimer(0) +{ + loadSettings(); +} + + +SyncManager::~SyncManager() +{ + sync(); +} + + +void SyncManager::loadSettings() { if (ReKonfig::syncEnabled()) { - // sync every minute - QTimer *timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), this, SLOT(sync())); - timer->start(60 * 1000); + if (_syncTimer) + return; + + _syncTimer = new QTimer(this); + connect(_syncTimer, SIGNAL(timeout()), this, SLOT(sync())); + _syncTimer->start(60 * 1000); // sync every minute + } + else + { + if (_syncTimer) + { + _syncTimer->stop(); + delete _syncTimer; + } } } -SyncManager::~SyncManager() +void SyncManager::showSettings() { - sync(); + QPointer dialog = new KDialog(); + dialog->setCaption(i18nc("@title:window", "Sync Settings")); + dialog->setButtons(KDialog::Ok | KDialog::Cancel); + + SyncWidget widget; + dialog->setMainWidget(&widget); + connect(dialog, SIGNAL(okClicked()), &widget, SLOT(save())); + connect(dialog, SIGNAL(okClicked()), this, SLOT(loadSettings())); + dialog->exec(); + + dialog->deleteLater(); } -- cgit v1.2.1