summaryrefslogtreecommitdiff
path: root/src/sync
diff options
context:
space:
mode:
Diffstat (limited to 'src/sync')
-rw-r--r--src/sync/syncmanager.cpp31
-rw-r--r--src/sync/syncmanager.h3
2 files changed, 20 insertions, 14 deletions
diff --git a/src/sync/syncmanager.cpp b/src/sync/syncmanager.cpp
index 53149ee1..f4a2fdf4 100644
--- a/src/sync/syncmanager.cpp
+++ b/src/sync/syncmanager.cpp
@@ -32,6 +32,9 @@
#include "rekonq.h"
// Local Includes
+#include "application.h"
+#include "bookmarkprovider.h"
+#include "historymanager.h"
#include "syncwidget.h"
// KDE Includes
@@ -46,7 +49,6 @@
SyncManager::SyncManager(QObject *parent)
: QObject(parent)
, _firstTimeSynced(false)
- , _syncTimer(0)
{
loadSettings();
}
@@ -62,20 +64,27 @@ void SyncManager::loadSettings()
{
if (ReKonfig::syncEnabled())
{
- if (_syncTimer)
- return;
+ firstTimeSync();
- _syncTimer = new QTimer(this);
- connect(_syncTimer, SIGNAL(timeout()), this, SLOT(sync()));
- _syncTimer->start(60 * 1000); // sync every minute
+ // bookmarks
+ ReKonfig::syncBookmarks()
+ ? connect(rApp->bookmarkProvider(), SIGNAL(changed()), this, SLOT(syncBookmarks()))
+ : disconnect(rApp->bookmarkProvider(), SIGNAL(changed()), this, SLOT(syncBookmarks()))
+ ;
+
+ // history
+ ReKonfig::syncHistory()
+ ? connect(rApp->historyManager(), SIGNAL(historySaved()), this, SLOT(syncHistory()))
+ : disconnect(rApp->historyManager(), SIGNAL(historySaved()), this, SLOT(syncHistory()))
+ ;
}
else
{
- if (_syncTimer)
- {
- _syncTimer->stop();
- delete _syncTimer;
- }
+ // bookmarks
+ disconnect(rApp->bookmarkProvider(), SIGNAL(changed()), this, SLOT(syncBookmarks()));
+
+ // history
+ disconnect(rApp->historyManager(), SIGNAL(historySaved()), this, SLOT(syncHistory()));
}
}
diff --git a/src/sync/syncmanager.h b/src/sync/syncmanager.h
index c6f8a76a..b87045a1 100644
--- a/src/sync/syncmanager.h
+++ b/src/sync/syncmanager.h
@@ -39,7 +39,6 @@
// Forward Declarations
class KJob;
-class QTimer;
class REKONQ_TESTS_EXPORT SyncManager : public QObject
@@ -84,8 +83,6 @@ private:
QUrl _remotePasswordsUrl;
KUrl _localPasswordsUrl;
-
- QTimer *_syncTimer;
};
#endif // SYNC_MANAGER_H