diff options
-rw-r--r-- | src/bookmarks/bookmarkprovider.cpp | 9 | ||||
-rw-r--r-- | src/bookmarks/bookmarkprovider.h | 1 | ||||
-rw-r--r-- | src/history/historymanager.cpp | 2 | ||||
-rw-r--r-- | src/history/historymanager.h | 2 | ||||
-rw-r--r-- | src/sync/syncmanager.cpp | 31 | ||||
-rw-r--r-- | src/sync/syncmanager.h | 3 | ||||
-rw-r--r-- | src/webtab.cpp | 5 |
7 files changed, 36 insertions, 17 deletions
diff --git a/src/bookmarks/bookmarkprovider.cpp b/src/bookmarks/bookmarkprovider.cpp index ca705715..262941d8 100644 --- a/src/bookmarks/bookmarkprovider.cpp +++ b/src/bookmarks/bookmarkprovider.cpp @@ -69,8 +69,8 @@ BookmarkProvider::BookmarkProvider(QObject *parent) delete tempManager; } - connect(m_manager, SIGNAL(changed(const QString &, const QString &)), - this, SLOT(slotBookmarksChanged())); + connect(m_manager, SIGNAL(changed(const QString &, const QString &)), this, SLOT(slotBookmarksChanged())); + connect(m_manager, SIGNAL(changed(const QString &, const QString &)), this, SIGNAL(changed())); // setup menu m_owner = new BookmarkOwner(m_manager, this); @@ -187,7 +187,10 @@ void BookmarkProvider::slotBookmarksChanged() fillBookmarkBar(bookmarkToolBar); } } - if (rApp->mainWindow() && rApp->mainWindow()->currentTab() && rApp->mainWindow()->currentTab()->url().toMimeDataString().contains("about:bookmarks")) + if (rApp->mainWindow() + && rApp->mainWindow()->currentTab() + && rApp->mainWindow()->currentTab()->url().toMimeDataString().contains("about:bookmarks") + ) rApp->loadUrl(KUrl("about:bookmarks"), Rekonq::CurrentTab); } diff --git a/src/bookmarks/bookmarkprovider.h b/src/bookmarks/bookmarkprovider.h index fe49eaee..db7efe45 100644 --- a/src/bookmarks/bookmarkprovider.h +++ b/src/bookmarks/bookmarkprovider.h @@ -140,6 +140,7 @@ Q_SIGNALS: * @short This signal is emitted when an url has to be loaded */ void openUrl(const KUrl &, const Rekonq::OpenType &); + void emitChanged(); private: void find(QList<KBookmark> *list, const KBookmark &bookmark, const QString &text); diff --git a/src/history/historymanager.cpp b/src/history/historymanager.cpp index d9d6a93b..d4cb0f24 100644 --- a/src/history/historymanager.cpp +++ b/src/history/historymanager.cpp @@ -471,4 +471,6 @@ void HistoryManager::save() } } m_lastSavedUrl = m_history.value(0).url; + + emit historySaved(); } diff --git a/src/history/historymanager.h b/src/history/historymanager.h index bdce16d7..cfc875af 100644 --- a/src/history/historymanager.h +++ b/src/history/historymanager.h @@ -183,6 +183,8 @@ Q_SIGNALS: void entryRemoved(const HistoryItem &item); void entryUpdated(int offset); + void historySaved(); + public Q_SLOTS: void clear(); void loadSettings(); 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 diff --git a/src/webtab.cpp b/src/webtab.cpp index b4694064..bded411c 100644 --- a/src/webtab.cpp +++ b/src/webtab.cpp @@ -41,6 +41,7 @@ #include "webshortcutwidget.h" #include "application.h" #include "sessionmanager.h" +#include "syncmanager.h" #include "opensearchmanager.h" #include "messagebar.h" @@ -152,6 +153,10 @@ void WebTab::createWalletBar(const QString &key, const QUrl &url) wallet, SLOT(acceptSaveFormDataRequest(const QString &)), Qt::UniqueConnection); connect(m_walletBar.data(), SIGNAL(saveFormDataRejected(const QString &)), wallet, SLOT(rejectSaveFormDataRequest(const QString &)), Qt::UniqueConnection); + + // sync passwords + connect(m_walletBar.data(), SIGNAL(saveFormDataAccepted(const QString &)), + rApp->syncManager(), SLOT(syncPasswords()), Qt::UniqueConnection); } |