From 9f5fdbf83ebcfbf4efa0f2dd0cf0bdbe1922445e Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 20 Nov 2011 12:15:15 +0100 Subject: here we are, rekonq ftp remote sync done! With this commit, I think we reached the "sync" status with remote ftp sites. This means we basically have a first sync feature and we can heavily test it to eventually add more options in the future (webdav? ownCloud? firefox Sync? etc...) --- src/sync/settings_sync.ui | 33 +++++++++++++++++++++++++++++---- src/sync/syncmanager.cpp | 21 +++++++++++++++------ src/sync/syncwidget.cpp | 13 ++++++++++--- 3 files changed, 54 insertions(+), 13 deletions(-) (limited to 'src/sync') diff --git a/src/sync/settings_sync.ui b/src/sync/settings_sync.ui index ec8f0ddb..8f6e4387 100644 --- a/src/sync/settings_sync.ui +++ b/src/sync/settings_sync.ui @@ -63,17 +63,17 @@ - URL: + Server: - + - username: + Username: @@ -83,13 +83,33 @@ - password: + Password: + + + + + + + Path: + + + + + + + + + + Port: + + + @@ -132,6 +152,11 @@ QLineEdit
klineedit.h
+ + KIntNumInput + QWidget +
knuminput.h
+
diff --git a/src/sync/syncmanager.cpp b/src/sync/syncmanager.cpp index b6206e3a..b1da8c00 100644 --- a/src/sync/syncmanager.cpp +++ b/src/sync/syncmanager.cpp @@ -103,10 +103,13 @@ void SyncManager::firstTimeSync() // Bookmarks if (ReKonfig::syncBookmarks()) { - _remoteBookmarksUrl = QUrl::fromUserInput(ReKonfig::syncUrl()); + _remoteBookmarksUrl = QUrl(); + _remoteBookmarksUrl.setHost(ReKonfig::syncHost()); + _remoteBookmarksUrl.setScheme("ftp"); _remoteBookmarksUrl.setUserName(ReKonfig::syncUser()); _remoteBookmarksUrl.setPassword(ReKonfig::syncPass()); - _remoteBookmarksUrl.setPath(QL1S("/home/") + ReKonfig::syncUser() + QL1S("/bookmarks.xml")); + _remoteBookmarksUrl.setPort(ReKonfig::syncPort()); + _remoteBookmarksUrl.setPath(ReKonfig::syncPath() + QL1S("/bookmarks.xml")); kDebug() << "REMOTE BK URL: " << _remoteBookmarksUrl; const QString bookmarksFilePath = KStandardDirs::locateLocal("data", QL1S("konqueror/bookmarks.xml")); @@ -122,10 +125,13 @@ void SyncManager::firstTimeSync() // History if (ReKonfig::syncHistory()) { - _remoteHistoryUrl = QUrl::fromUserInput(ReKonfig::syncUrl()); + _remoteHistoryUrl = QUrl(); + _remoteHistoryUrl.setHost(ReKonfig::syncHost()); + _remoteHistoryUrl.setScheme("ftp"); _remoteHistoryUrl.setUserName(ReKonfig::syncUser()); _remoteHistoryUrl.setPassword(ReKonfig::syncPass()); - _remoteHistoryUrl.setPath(QL1S("/home/") + ReKonfig::syncUser() + QL1S("/history")); + _remoteHistoryUrl.setPort(ReKonfig::syncPort()); + _remoteHistoryUrl.setPath(ReKonfig::syncPath() + QL1S("/history")); kDebug() << "REMOTE HISTORY URL: " << _remoteHistoryUrl; const QString historyFilePath = KStandardDirs::locateLocal("appdata", "history"); @@ -141,10 +147,13 @@ void SyncManager::firstTimeSync() // Passwords if (ReKonfig::syncPasswords()) { - _remotePasswordsUrl = QUrl::fromUserInput(ReKonfig::syncUrl()); + _remotePasswordsUrl = QUrl(); + _remotePasswordsUrl.setHost(ReKonfig::syncHost()); + _remotePasswordsUrl.setScheme("ftp"); _remotePasswordsUrl.setUserName(ReKonfig::syncUser()); _remotePasswordsUrl.setPassword(ReKonfig::syncPass()); - _remotePasswordsUrl.setPath(QL1S("/home/") + ReKonfig::syncUser() + QL1S("/kdewallet.kwl")); + _remotePasswordsUrl.setPort(ReKonfig::syncPort()); + _remotePasswordsUrl.setPath(ReKonfig::syncPath() + QL1S("/kdewallet.kwl")); kDebug() << "REMOTE PSWD URL: " << _remotePasswordsUrl; const QString passwordsFilePath = KStandardDirs::locateLocal("data", QL1S("kwallet/kdewallet.kwl")); diff --git a/src/sync/syncwidget.cpp b/src/sync/syncwidget.cpp index c8fc1368..a7adfd3d 100644 --- a/src/sync/syncwidget.cpp +++ b/src/sync/syncwidget.cpp @@ -43,12 +43,16 @@ SyncWidget::SyncWidget(QWidget *parent) setupUi(this); kcfg_syncEnabled->setChecked(ReKonfig::syncEnabled()); + kcfg_syncBookmarks->setChecked(ReKonfig::syncBookmarks()); kcfg_syncHistory->setChecked(ReKonfig::syncHistory()); kcfg_syncPasswords->setChecked(ReKonfig::syncPasswords()); - kcfg_syncUrl->setText(ReKonfig::syncUrl()); + + kcfg_syncHost->setText(ReKonfig::syncHost()); kcfg_syncUser->setText(ReKonfig::syncUser()); kcfg_syncPass->setText(ReKonfig::syncPass()); + kcfg_syncPath->setText(ReKonfig::syncPath()); + kcfg_syncPort->setValue(ReKonfig::syncPort()); bool isSyncEnabled = ReKonfig::syncEnabled(); enablewidgets(isSyncEnabled); @@ -65,12 +69,16 @@ SyncWidget::SyncWidget(QWidget *parent) void SyncWidget::save() { ReKonfig::setSyncEnabled(kcfg_syncEnabled->isChecked()); + ReKonfig::setSyncBookmarks(kcfg_syncBookmarks->isChecked()); ReKonfig::setSyncHistory(kcfg_syncHistory->isChecked()); ReKonfig::setSyncPasswords(kcfg_syncPasswords->isChecked()); - ReKonfig::setSyncUrl(kcfg_syncUrl->text()); + + ReKonfig::setSyncHost(kcfg_syncHost->text()); ReKonfig::setSyncUser(kcfg_syncUser->text()); ReKonfig::setSyncPass(kcfg_syncPass->text()); + ReKonfig::setSyncPath(kcfg_syncPath->text()); + ReKonfig::setSyncPort(kcfg_syncPort->value()); rApp->syncManager()->firstTimeSync(); } @@ -114,4 +122,3 @@ void SyncWidget::syncNow() // TODO do something in the sync UI... } - -- cgit v1.2.1