summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-11-20 12:15:15 +0100
committerAndrea Diamantini <adjam7@gmail.com>2011-12-12 16:40:29 +0100
commit9f5fdbf83ebcfbf4efa0f2dd0cf0bdbe1922445e (patch)
tree7d9dbaf5cb433e370308ff759287aa271f7d1a28 /src
parentLet sync work with ftp sites :D (diff)
downloadrekonq-9f5fdbf83ebcfbf4efa0f2dd0cf0bdbe1922445e.tar.xz
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...)
Diffstat (limited to 'src')
-rw-r--r--src/rekonq.kcfg8
-rw-r--r--src/sync/settings_sync.ui33
-rw-r--r--src/sync/syncmanager.cpp21
-rw-r--r--src/sync/syncwidget.cpp13
4 files changed, 61 insertions, 14 deletions
diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg
index 8b9299b5..df838505 100644
--- a/src/rekonq.kcfg
+++ b/src/rekonq.kcfg
@@ -270,7 +270,7 @@
<entry name="syncPasswords" type="Bool">
<default>false</default>
</entry>
- <entry name="syncUrl" type="String">
+ <entry name="syncHost" type="String">
<default></default>
</entry>
<entry name="syncUser" type="String">
@@ -279,6 +279,12 @@
<entry name="syncPass" type="String">
<default></default>
</entry>
+ <entry name="syncPath" type="String">
+ <default></default>
+ </entry>
+ <entry name="syncPort" type="Int">
+ <default>21</default>
+ </entry>
<entry name="lastSyncDateTime" type="DateTime">
<default></default>
</entry>
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 @@
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
- <string>URL:</string>
+ <string>Server:</string>
</property>
</widget>
</item>
<item row="0" column="1">
- <widget class="KLineEdit" name="kcfg_syncUrl"/>
+ <widget class="KLineEdit" name="kcfg_syncHost"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
- <string>username:</string>
+ <string>Username:</string>
</property>
</widget>
</item>
@@ -83,13 +83,33 @@
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
- <string>password:</string>
+ <string>Password:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="KLineEdit" name="kcfg_syncPass"/>
</item>
+ <item row="3" column="1">
+ <widget class="KLineEdit" name="kcfg_syncPath"/>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Path:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="KIntNumInput" name="kcfg_syncPort"/>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Port:</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
@@ -132,6 +152,11 @@
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
+ <customwidget>
+ <class>KIntNumInput</class>
+ <extends>QWidget</extends>
+ <header>knuminput.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
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...
}
-