summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bookmarks/bookmarkmanager.cpp4
-rw-r--r--src/bookmarks/bookmarkmanager.h2
-rw-r--r--src/rekonq.kcfg2
-rw-r--r--src/sync/settings_sync.ui6
-rw-r--r--src/sync/syncmanager.cpp83
-rw-r--r--src/sync/syncmanager.h7
-rw-r--r--src/sync/syncwidget.cpp4
7 files changed, 63 insertions, 45 deletions
diff --git a/src/bookmarks/bookmarkmanager.cpp b/src/bookmarks/bookmarkmanager.cpp
index 49c697a5..066e0681 100644
--- a/src/bookmarks/bookmarkmanager.cpp
+++ b/src/bookmarks/bookmarkmanager.cpp
@@ -186,11 +186,15 @@ void BookmarkManager::slotBookmarksChanged()
fillBookmarkBar(bookmarkToolBar);
}
}
+
+ // this update about:bookmarks page...
if (rApp->mainWindow()
&& rApp->mainWindow()->currentTab()
&& rApp->mainWindow()->currentTab()->url().toMimeDataString().contains("about:bookmarks")
)
rApp->loadUrl(KUrl("about:bookmarks"), Rekonq::CurrentTab);
+
+ emit bookmarksUpdated();
}
diff --git a/src/bookmarks/bookmarkmanager.h b/src/bookmarks/bookmarkmanager.h
index b00a4b0e..0254b19f 100644
--- a/src/bookmarks/bookmarkmanager.h
+++ b/src/bookmarks/bookmarkmanager.h
@@ -149,6 +149,8 @@ Q_SIGNALS:
*/
void openUrl(const KUrl &, const Rekonq::OpenType &);
+ void bookmarksUpdated();
+
private:
void find(QList<KBookmark> *list, const KBookmark &bookmark, const QString &text);
KBookmark bookmarkForUrl(const KBookmark &bookmark, const KUrl &url);
diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg
index c84265e0..8b9299b5 100644
--- a/src/rekonq.kcfg
+++ b/src/rekonq.kcfg
@@ -270,7 +270,7 @@
<entry name="syncPasswords" type="Bool">
<default>false</default>
</entry>
- <entry name="syncHost" type="String">
+ <entry name="syncUrl" type="String">
<default></default>
</entry>
<entry name="syncUser" type="String">
diff --git a/src/sync/settings_sync.ui b/src/sync/settings_sync.ui
index f45c8b6c..ec8f0ddb 100644
--- a/src/sync/settings_sync.ui
+++ b/src/sync/settings_sync.ui
@@ -57,18 +57,18 @@
<item>
<widget class="QGroupBox" name="ownCloudGroupBox">
<property name="title">
- <string>ownCloud settings</string>
+ <string>remote host settings</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
- <string>host:</string>
+ <string>URL:</string>
</property>
</widget>
</item>
<item row="0" column="1">
- <widget class="KLineEdit" name="kcfg_syncHost"/>
+ <widget class="KLineEdit" name="kcfg_syncUrl"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
diff --git a/src/sync/syncmanager.cpp b/src/sync/syncmanager.cpp
index fe4ffc43..e926e181 100644
--- a/src/sync/syncmanager.cpp
+++ b/src/sync/syncmanager.cpp
@@ -54,12 +54,6 @@ SyncManager::SyncManager(QObject *parent)
}
-SyncManager::~SyncManager()
-{
- sync();
-}
-
-
void SyncManager::loadSettings()
{
if (ReKonfig::syncEnabled())
@@ -68,8 +62,8 @@ void SyncManager::loadSettings()
// bookmarks
ReKonfig::syncBookmarks()
- ? connect(rApp->bookmarkManager(), SIGNAL(changed()), this, SLOT(syncBookmarks()))
- : disconnect(rApp->bookmarkManager(), SIGNAL(changed()), this, SLOT(syncBookmarks()))
+ ? connect(rApp->bookmarkManager(), SIGNAL(bookmarksUpdated()), this, SLOT(syncBookmarks()))
+ : disconnect(rApp->bookmarkManager(), SIGNAL(bookmarksUpdated()), this, SLOT(syncBookmarks()))
;
// history
@@ -81,7 +75,7 @@ void SyncManager::loadSettings()
else
{
// bookmarks
- disconnect(rApp->bookmarkManager(), SIGNAL(changed()), this, SLOT(syncBookmarks()));
+ disconnect(rApp->bookmarkManager(), SIGNAL(bookmarksUpdated()), this, SLOT(syncBookmarks()));
// history
disconnect(rApp->historyManager(), SIGNAL(historySaved()), this, SLOT(syncHistory()));
@@ -110,7 +104,7 @@ void SyncManager::firstTimeSync()
// Bookmarks
if (ReKonfig::syncBookmarks())
{
- _remoteBookmarksUrl = QUrl(ReKonfig::syncHost());
+ _remoteBookmarksUrl = QUrl::fromUserInput(ReKonfig::syncUrl());
_remoteBookmarksUrl.setUserName(ReKonfig::syncUser());
_remoteBookmarksUrl.setPassword(ReKonfig::syncPass());
_remoteBookmarksUrl.setPath(QL1S("/data/") + ReKonfig::syncUser() + QL1S("/files/bookmarks.xml"));
@@ -129,7 +123,7 @@ void SyncManager::firstTimeSync()
// History
if (ReKonfig::syncHistory())
{
- _remoteHistoryUrl = QUrl(ReKonfig::syncHost());
+ _remoteHistoryUrl = QUrl::fromUserInput(ReKonfig::syncUrl());
_remoteHistoryUrl.setUserName(ReKonfig::syncUser());
_remoteHistoryUrl.setPassword(ReKonfig::syncPass());
_remoteHistoryUrl.setPath(QL1S("/data/") + ReKonfig::syncUser() + QL1S("/files/history"));
@@ -148,7 +142,7 @@ void SyncManager::firstTimeSync()
// Passwords
if (ReKonfig::syncPasswords())
{
- _remotePasswordsUrl = QUrl(ReKonfig::syncHost());
+ _remotePasswordsUrl = QUrl::fromUserInput(ReKonfig::syncUrl());
_remotePasswordsUrl.setUserName(ReKonfig::syncUser());
_remotePasswordsUrl.setPassword(ReKonfig::syncPass());
_remotePasswordsUrl.setPath(QL1S("/data/") + ReKonfig::syncUser() + QL1S("/files/kdewallet.kwl"));
@@ -166,46 +160,37 @@ void SyncManager::firstTimeSync()
}
-void SyncManager::sync()
+bool SyncManager::syncRelativeEnabled(bool check)
{
- kDebug() << "syncing now...";
-
if (!ReKonfig::syncEnabled())
- return;
+ return false;
if (!_firstTimeSynced)
{
kDebug() << "need to sync for the first time...";
firstTimeSync();
- return;
- }
-
- // Bookmarks
- if (ReKonfig::syncBookmarks())
- {
- KIO::Job *job = KIO::file_copy(_localBookmarksUrl, _remoteBookmarksUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
- connect(job, SIGNAL(finished(KJob *)), this, SLOT(onBookmarksSyncFinished(KJob *)));
+ return false;
}
- // History
- if (ReKonfig::syncHistory())
- {
- KIO::Job *job = KIO::file_copy(_localHistoryUrl, _remoteHistoryUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
- connect(job, SIGNAL(finished(KJob *)), this, SLOT(onHistorySyncFinished(KJob *)));
- }
-
- // Passwords
- if (ReKonfig::syncPasswords())
- {
- KIO::Job *job = KIO::file_copy(_localPasswordsUrl, _remotePasswordsUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
- connect(job, SIGNAL(finished(KJob *)), this, SLOT(onPasswordsSyncFinished(KJob *)));
- }
+ return check;
}
// ---------------------------------------------------------------------------------------
+void SyncManager::syncBookmarks()
+{
+ kDebug() << "syncing now...";
+
+ if (!syncRelativeEnabled(ReKonfig::syncBookmarks()))
+ return;
+
+ KIO::Job *job = KIO::file_copy(_localBookmarksUrl, _remoteBookmarksUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
+ connect(job, SIGNAL(finished(KJob *)), this, SLOT(onBookmarksSyncFinished(KJob *)));
+}
+
+
void SyncManager::onBookmarksStatFinished(KJob *job)
{
if (job->error() ||
@@ -246,6 +231,18 @@ void SyncManager::onBookmarksSyncFinished(KJob *job)
// ---------------------------------------------------------------------------------------
+void SyncManager::syncHistory()
+{
+ kDebug() << "syncing now...";
+
+ if (!syncRelativeEnabled(ReKonfig::syncHistory()))
+ return;
+
+ KIO::Job *job = KIO::file_copy(_localHistoryUrl, _remoteHistoryUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
+ connect(job, SIGNAL(finished(KJob *)), this, SLOT(onHistorySyncFinished(KJob *)));
+}
+
+
void SyncManager::onHistoryStatFinished(KJob *job)
{
if (job->error() ||
@@ -286,6 +283,18 @@ void SyncManager::onHistorySyncFinished(KJob *job)
// ---------------------------------------------------------------------------------------
+void SyncManager::syncPasswords()
+{
+ kDebug() << "syncing now...";
+
+ if (!syncRelativeEnabled(ReKonfig::syncPasswords()))
+ return;
+
+ KIO::Job *job = KIO::file_copy(_localPasswordsUrl, _remotePasswordsUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
+ connect(job, SIGNAL(finished(KJob *)), this, SLOT(onPasswordsSyncFinished(KJob *)));
+}
+
+
void SyncManager::onPasswordsStatFinished(KJob *job)
{
if (job->error() ||
diff --git a/src/sync/syncmanager.h b/src/sync/syncmanager.h
index b87045a1..82fd3551 100644
--- a/src/sync/syncmanager.h
+++ b/src/sync/syncmanager.h
@@ -47,12 +47,13 @@ class REKONQ_TESTS_EXPORT SyncManager : public QObject
public:
SyncManager(QObject *parent = 0);
- ~SyncManager();
void firstTimeSync();
public Q_SLOTS:
- void sync();
+ void syncBookmarks();
+ void syncHistory();
+ void syncPasswords();
private Q_SLOTS:
void loadSettings();
@@ -73,6 +74,8 @@ Q_SIGNALS:
void syncPasswordsFinished(bool);
private:
+ bool syncRelativeEnabled(bool);
+
bool _firstTimeSynced;
QUrl _remoteBookmarksUrl;
diff --git a/src/sync/syncwidget.cpp b/src/sync/syncwidget.cpp
index b8e95753..c8fc1368 100644
--- a/src/sync/syncwidget.cpp
+++ b/src/sync/syncwidget.cpp
@@ -46,7 +46,7 @@ SyncWidget::SyncWidget(QWidget *parent)
kcfg_syncBookmarks->setChecked(ReKonfig::syncBookmarks());
kcfg_syncHistory->setChecked(ReKonfig::syncHistory());
kcfg_syncPasswords->setChecked(ReKonfig::syncPasswords());
- kcfg_syncHost->setText(ReKonfig::syncHost());
+ kcfg_syncUrl->setText(ReKonfig::syncUrl());
kcfg_syncUser->setText(ReKonfig::syncUser());
kcfg_syncPass->setText(ReKonfig::syncPass());
@@ -68,7 +68,7 @@ void SyncWidget::save()
ReKonfig::setSyncBookmarks(kcfg_syncBookmarks->isChecked());
ReKonfig::setSyncHistory(kcfg_syncHistory->isChecked());
ReKonfig::setSyncPasswords(kcfg_syncPasswords->isChecked());
- ReKonfig::setSyncHost(kcfg_syncHost->text());
+ ReKonfig::setSyncUrl(kcfg_syncUrl->text());
ReKonfig::setSyncUser(kcfg_syncUser->text());
ReKonfig::setSyncPass(kcfg_syncPass->text());