diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2011-11-14 17:41:28 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2011-12-12 16:40:28 +0100 |
commit | e35004358ab0b290a5fefd893c7c9aab9cce6440 (patch) | |
tree | 9b84f4e54b2cd04642ecc7e8bb5a8d56003bd370 /src/sync | |
parent | Let the "big sync" work (the one done every minute...) (diff) | |
download | rekonq-e35004358ab0b290a5fefd893c7c9aab9cce6440.tar.xz |
let history, bookmarks and passwords sync on change (first bits)
Diffstat (limited to 'src/sync')
-rw-r--r-- | src/sync/syncmanager.cpp | 31 | ||||
-rw-r--r-- | src/sync/syncmanager.h | 3 |
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 |