summaryrefslogtreecommitdiff
path: root/src/sync/syncmanager.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-11-14 17:16:08 +0100
committerAndrea Diamantini <adjam7@gmail.com>2011-12-12 16:40:28 +0100
commit7932ee0fd2e683af8cc1207986504747ccfbc68e (patch)
treec66446b807778be74401bfb649a1b3784379bcf5 /src/sync/syncmanager.cpp
parentSync feature, first bits (diff)
downloadrekonq-7932ee0fd2e683af8cc1207986504747ccfbc68e.tar.xz
Let the "big sync" work (the one done every minute...)
Diffstat (limited to 'src/sync/syncmanager.cpp')
-rw-r--r--src/sync/syncmanager.cpp48
1 files changed, 42 insertions, 6 deletions
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 <KStandardDirs>
#include <KMessageBox>
@@ -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<KDialog> 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();
}