summaryrefslogtreecommitdiff
path: root/src/sync
diff options
context:
space:
mode:
Diffstat (limited to 'src/sync')
-rw-r--r--src/sync/ftpsynchandler.cpp83
-rw-r--r--src/sync/ftpsynchandler.h8
-rw-r--r--src/sync/sync_check.ui152
-rw-r--r--src/sync/sync_data.ui74
-rw-r--r--src/sync/sync_ftp_settings.ui (renamed from src/sync/settings_sync.ui)78
-rw-r--r--src/sync/sync_host_type.ui57
-rw-r--r--src/sync/syncassistant.cpp48
-rw-r--r--src/sync/syncassistant.h51
-rw-r--r--src/sync/synccheckwidget.cpp179
-rw-r--r--src/sync/synccheckwidget.h53
-rw-r--r--src/sync/syncdatawidget.cpp (renamed from src/sync/syncwidget.cpp)68
-rw-r--r--src/sync/syncdatawidget.h (renamed from src/sync/syncwidget.h)17
-rw-r--r--src/sync/syncftpsettingswidget.cpp63
-rw-r--r--src/sync/syncftpsettingswidget.h51
-rw-r--r--src/sync/synchandler.cpp41
-rw-r--r--src/sync/synchandler.h19
-rw-r--r--src/sync/synchosttypewidget.cpp64
-rw-r--r--src/sync/synchosttypewidget.h51
-rw-r--r--src/sync/syncmanager.cpp35
-rw-r--r--src/sync/syncmanager.h8
20 files changed, 1010 insertions, 190 deletions
diff --git a/src/sync/ftpsynchandler.cpp b/src/sync/ftpsynchandler.cpp
index e5170964..cfa0c4b5 100644
--- a/src/sync/ftpsynchandler.cpp
+++ b/src/sync/ftpsynchandler.cpp
@@ -36,18 +36,22 @@
#include <klocalizedstring.h>
#include <KIO/Job>
-#include <KIO/JobUiDelegate>
FTPSyncHandler::FTPSyncHandler(QObject *parent)
: SyncHandler(parent)
- , _firstTimeSynced(false)
{
}
-void FTPSyncHandler::firstTimeSync()
+void FTPSyncHandler::initialLoadAndCheck()
{
+ if (!ReKonfig::syncEnabled())
+ {
+ _firstTimeSynced = false;
+ return;
+ }
+
// Bookmarks
if (ReKonfig::syncBookmarks())
{
@@ -66,8 +70,6 @@ void FTPSyncHandler::firstTimeSync()
KIO::StatJob *job = KIO::stat(_remoteBookmarksUrl, KIO::StatJob::DestinationSide, 0, KIO::HideProgressInfo);
connect(job, SIGNAL(finished(KJob *)), this, SLOT(onBookmarksStatFinished(KJob *)));
-
- _firstTimeSynced = true;
}
// History
@@ -88,8 +90,6 @@ void FTPSyncHandler::firstTimeSync()
KIO::StatJob *job = KIO::stat(_remoteHistoryUrl, KIO::StatJob::DestinationSide, 0, KIO::HideProgressInfo);
connect(job, SIGNAL(finished(KJob *)), this, SLOT(onHistoryStatFinished(KJob *)));
-
- _firstTimeSynced = true;
}
// Passwords
@@ -110,8 +110,6 @@ void FTPSyncHandler::firstTimeSync()
KIO::StatJob *job = KIO::stat(_remotePasswordsUrl, KIO::StatJob::DestinationSide, 0, KIO::HideProgressInfo);
connect(job, SIGNAL(finished(KJob *)), this, SLOT(onPasswordsStatFinished(KJob *)));
-
- _firstTimeSynced = true;
}
}
@@ -122,11 +120,7 @@ bool FTPSyncHandler::syncRelativeEnabled(bool check)
return false;
if (!_firstTimeSynced)
- {
- kDebug() << "need to sync for the first time...";
- firstTimeSync();
return false;
- }
return check;
}
@@ -151,13 +145,26 @@ void FTPSyncHandler::onBookmarksStatFinished(KJob *job)
{
if (job->error())
{
- KIO::Job *job = KIO::file_copy(_localBookmarksUrl, _remoteBookmarksUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
- connect(job, SIGNAL(finished(KJob *)), this, SLOT(onBookmarksSyncFinished(KJob *)));
+ if (job->error() == KIO::ERR_DOES_NOT_EXIST)
+ {
+ KIO::Job *job = KIO::file_copy(_localBookmarksUrl, _remoteBookmarksUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
+ connect(job, SIGNAL(finished(KJob *)), this, SLOT(onBookmarksSyncFinished(KJob *)));
+
+ emit syncStatus(Rekonq::Bookmarks, true, i18n("Remote bookmarks file does NOT exists. Exporting local copy..."));
+ _firstTimeSynced = true;
+ }
+ else
+ {
+ emit syncStatus(Rekonq::Bookmarks, false, job->errorString());
+ }
}
else
{
KIO::Job *job = KIO::file_copy(_remoteBookmarksUrl, _localBookmarksUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
connect(job, SIGNAL(finished(KJob *)), this, SLOT(onBookmarksSyncFinished(KJob *)));
+
+ emit syncStatus(Rekonq::Bookmarks, true, i18n("Remote bookmarks file exists! Syncing local copy..."));
+ _firstTimeSynced = true;
}
}
@@ -166,13 +173,11 @@ void FTPSyncHandler::onBookmarksSyncFinished(KJob *job)
{
if (job->error())
{
- job->uiDelegate()->showErrorMessage();
+ emit syncStatus(Rekonq::Bookmarks, false, job->errorString());
emit syncBookmarksFinished(false);
return;
}
- QDateTime now = QDateTime::currentDateTime();
- ReKonfig::setLastSyncDateTime(now);
emit syncBookmarksFinished(true);
}
@@ -196,13 +201,26 @@ void FTPSyncHandler::onHistoryStatFinished(KJob *job)
{
if (job->error())
{
- KIO::Job *job = KIO::file_copy(_localHistoryUrl, _remoteHistoryUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
- connect(job, SIGNAL(finished(KJob *)), this, SLOT(onHistorySyncFinished(KJob *)));
+ if (job->error() == KIO::ERR_DOES_NOT_EXIST)
+ {
+ KIO::Job *job = KIO::file_copy(_localHistoryUrl, _remoteHistoryUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
+ connect(job, SIGNAL(finished(KJob *)), this, SLOT(onHistorySyncFinished(KJob *)));
+
+ emit syncStatus(Rekonq::History, true, i18n("Remote history file does NOT exists. Exporting local copy..."));
+ _firstTimeSynced = true;
+ }
+ else
+ {
+ emit syncStatus(Rekonq::History, false, job->errorString());
+ }
}
else
{
KIO::Job *job = KIO::file_copy(_remoteHistoryUrl, _localHistoryUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
connect(job, SIGNAL(finished(KJob *)), this, SLOT(onHistorySyncFinished(KJob *)));
+
+ emit syncStatus(Rekonq::History, true, i18n("Remote history file exists! Syncing local copy..."));
+ _firstTimeSynced = true;
}
}
@@ -211,13 +229,11 @@ void FTPSyncHandler::onHistorySyncFinished(KJob *job)
{
if (job->error())
{
- job->uiDelegate()->showErrorMessage();
+ emit syncStatus(Rekonq::History, false, job->errorString());
emit syncHistoryFinished(false);
return;
}
- QDateTime now = QDateTime::currentDateTime();
- ReKonfig::setLastSyncDateTime(now);
emit syncHistoryFinished(true);
}
@@ -241,13 +257,26 @@ void FTPSyncHandler::onPasswordsStatFinished(KJob *job)
{
if (job->error())
{
- KIO::Job *job = KIO::file_copy(_localPasswordsUrl, _remotePasswordsUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
- connect(job, SIGNAL(finished(KJob *)), this, SLOT(onPasswordsSyncFinished(KJob *)));
+ if (job->error() == KIO::ERR_DOES_NOT_EXIST)
+ {
+ KIO::Job *job = KIO::file_copy(_localPasswordsUrl, _remotePasswordsUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
+ connect(job, SIGNAL(finished(KJob *)), this, SLOT(onPasswordsSyncFinished(KJob *)));
+
+ emit syncStatus(Rekonq::Passwords, true, i18n("Remote passwords file does NOT exists. Exporting local copy..."));
+ _firstTimeSynced = true;
+ }
+ else
+ {
+ emit syncStatus(Rekonq::Passwords, false, job->errorString());
+ }
}
else
{
KIO::Job *job = KIO::file_copy(_remotePasswordsUrl, _localPasswordsUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
connect(job, SIGNAL(finished(KJob *)), this, SLOT(onPasswordsSyncFinished(KJob *)));
+
+ emit syncStatus(Rekonq::Passwords, true, i18n("Remote passwords file exists! Syncing local copy..."));
+ _firstTimeSynced = true;
}
}
@@ -256,12 +285,10 @@ void FTPSyncHandler::onPasswordsSyncFinished(KJob *job)
{
if (job->error())
{
- job->uiDelegate()->showErrorMessage();
+ emit syncStatus(Rekonq::Passwords, false, job->errorString());
emit syncPasswordsFinished(false);
return;
}
- QDateTime now = QDateTime::currentDateTime();
- ReKonfig::setLastSyncDateTime(now);
emit syncPasswordsFinished(true);
}
diff --git a/src/sync/ftpsynchandler.h b/src/sync/ftpsynchandler.h
index 2620e89d..2cb1227a 100644
--- a/src/sync/ftpsynchandler.h
+++ b/src/sync/ftpsynchandler.h
@@ -41,7 +41,7 @@ class KJob;
class FTPSyncHandler : public SyncHandler
{
Q_OBJECT
-
+
public:
FTPSyncHandler(QObject *parent = 0);
@@ -49,8 +49,8 @@ public:
void syncBookmarks();
void syncPasswords();
- void firstTimeSync();
-
+ void initialLoadAndCheck();
+
private Q_SLOTS:
void onBookmarksSyncFinished(KJob *);
void onBookmarksStatFinished(KJob *);
@@ -77,8 +77,6 @@ private:
QUrl _remotePasswordsUrl;
KUrl _localPasswordsUrl;
-
- bool _firstTimeSynced;
};
#endif // FTP_SYNC_HANDLER_H
diff --git a/src/sync/sync_check.ui b/src/sync/sync_check.ui
new file mode 100644
index 00000000..dcd7aee7
--- /dev/null
+++ b/src/sync/sync_check.ui
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SyncCheck</class>
+ <widget class="QWidget" name="SyncCheck">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>645</width>
+ <height>464</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>data</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>sync handler</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="syncLabel">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Host</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="hostLabel">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>check</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Bookmarks</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QLabel" name="bkMsgLabel">
+ <property name="acceptDrops">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>History</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLabel" name="hsLabel">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QLabel" name="hsMsgLabel">
+ <property name="acceptDrops">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Passwords</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLabel" name="psLabel">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QLabel" name="psMsgLabel">
+ <property name="acceptDrops">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="bkLabel">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>154</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/sync/sync_data.ui b/src/sync/sync_data.ui
new file mode 100644
index 00000000..53b98057
--- /dev/null
+++ b/src/sync/sync_data.ui
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SyncData</class>
+ <widget class="QWidget" name="SyncData">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>378</width>
+ <height>369</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>300</width>
+ <height>0</height>
+ </size>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QCheckBox" name="kcfg_syncEnabled">
+ <property name="text">
+ <string>Activate sync</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="syncGroupBox">
+ <property name="title">
+ <string>sync</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QCheckBox" name="kcfg_syncBookmarks">
+ <property name="text">
+ <string>bookmarks</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="kcfg_syncHistory">
+ <property name="text">
+ <string>history</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="kcfg_syncPasswords">
+ <property name="text">
+ <string>passwords</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>50</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/sync/settings_sync.ui b/src/sync/sync_ftp_settings.ui
index 8f6e4387..a6a7e3af 100644
--- a/src/sync/settings_sync.ui
+++ b/src/sync/sync_ftp_settings.ui
@@ -1,63 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
- <class>Sync</class>
- <widget class="QWidget" name="Sync">
+ <class>SyncFTPSettings</class>
+ <widget class="QWidget" name="SyncFTPSettings">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>378</width>
- <height>369</height>
+ <width>400</width>
+ <height>300</height>
</rect>
</property>
- <property name="minimumSize">
- <size>
- <width>300</width>
- <height>0</height>
- </size>
+ <property name="windowTitle">
+ <string>Form</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
+ <layout class="QVBoxLayout" name="verticalLayout">
<item>
- <widget class="QCheckBox" name="kcfg_syncEnabled">
- <property name="text">
- <string>Activate sync</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="syncGroupBox">
- <property name="title">
- <string>sync</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QCheckBox" name="kcfg_syncBookmarks">
- <property name="text">
- <string>bookmarks</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_syncHistory">
- <property name="text">
- <string>history</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_syncPasswords">
- <property name="text">
- <string>passwords</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="ownCloudGroupBox">
+ <widget class="QGroupBox" name="ftpGroupBox">
<property name="title">
- <string>remote host settings</string>
+ <string>remote FTP host settings</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
@@ -114,24 +74,6 @@
</widget>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="lastSyncTimeLabel">
- <property name="text">
- <string>Last sync: NEVER</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="syncNowButton">
- <property name="text">
- <string>Sync now!</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -139,7 +81,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
- <height>50</height>
+ <height>124</height>
</size>
</property>
</spacer>
diff --git a/src/sync/sync_host_type.ui b/src/sync/sync_host_type.ui
new file mode 100644
index 00000000..76815cb7
--- /dev/null
+++ b/src/sync/sync_host_type.ui
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SyncHostType</class>
+ <widget class="QWidget" name="SyncHostType">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>sync host type</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QRadioButton" name="ftpRadioButton">
+ <property name="text">
+ <string>FTP</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="nullRadioButton">
+ <property name="text">
+ <string>/dev/null</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>204</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/sync/syncassistant.cpp b/src/sync/syncassistant.cpp
new file mode 100644
index 00000000..8688d7bc
--- /dev/null
+++ b/src/sync/syncassistant.cpp
@@ -0,0 +1,48 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
+*
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation; either version 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+* ============================================================ */
+
+
+// Self Includes
+#include "syncassistant.h"
+#include "syncassistant.moc"
+
+// Local Includes
+#include "synccheckwidget.h"
+#include "syncdatawidget.h"
+#include "synchosttypewidget.h"
+
+#include "syncftpsettingswidget.h"
+
+
+SyncAssistant::SyncAssistant(QWidget *parent)
+ : QWizard(parent)
+{
+ setWindowTitle(i18n("sync assistant"));
+
+ setPage(Page_Data, new SyncDataWidget(this));
+ setPage(Page_Type, new SyncHostTypeWidget(this));
+ setPage(Page_FTP_Settings, new SyncFTPSettingsWidget(this));
+ setPage(Page_Check, new SyncCheckWidget(this));
+}
diff --git a/src/sync/syncassistant.h b/src/sync/syncassistant.h
new file mode 100644
index 00000000..01b9647f
--- /dev/null
+++ b/src/sync/syncassistant.h
@@ -0,0 +1,51 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
+*
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation; either version 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+* ============================================================ */
+
+
+#ifndef SYNC_ASSISTANT_H
+#define SYNC_ASSISTANT_H
+
+
+// KDE Includes
+#include <QWizard>
+
+
+class SyncAssistant : public QWizard
+{
+ Q_OBJECT
+
+public:
+ enum
+ {
+ Page_Data,
+ Page_Type,
+ Page_FTP_Settings,
+ Page_Check
+ };
+
+ SyncAssistant(QWidget *parent = 0);
+};
+
+#endif
diff --git a/src/sync/synccheckwidget.cpp b/src/sync/synccheckwidget.cpp
new file mode 100644
index 00000000..92cce8a8
--- /dev/null
+++ b/src/sync/synccheckwidget.cpp
@@ -0,0 +1,179 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
+*
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation; either version 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+* ============================================================ */
+
+
+// Self Includes
+#include "synccheckwidget.h"
+#include "synccheckwidget.moc"
+
+// Auto Includes
+#include "rekonq.h"
+
+// Local Includes
+#include "syncassistant.h"
+#include "syncmanager.h"
+
+#include "application.h"
+
+// KDE Includes
+#include <KStandardDirs>
+#include <KIcon>
+
+// Qt Includes
+#include <QMovie>
+
+
+SyncCheckWidget::SyncCheckWidget(QWidget *parent)
+ : QWizardPage(parent)
+{
+ setupUi(this);
+}
+
+
+void SyncCheckWidget::initializePage()
+{
+ // set initial values
+ if (ReKonfig::syncType() == 0)
+ {
+ syncLabel->setText(i18n("FTP"));
+ hostLabel->setText(ReKonfig::syncHost());
+ }
+ else
+ {
+ syncLabel->setText(i18n("No sync"));
+ hostLabel->setText(i18n("none"));
+ }
+
+ bkMsgLabel->setText(QString());
+ hsMsgLabel->setText(QString());
+ psMsgLabel->setText(QString());
+
+ KIcon notSyncedIcon(QL1S("dialog-cancel"));
+
+ if (!ReKonfig::syncEnabled())
+ {
+ bkLabel->setPixmap(notSyncedIcon.pixmap(16));
+ hsLabel->setPixmap(notSyncedIcon.pixmap(16));
+ psLabel->setPixmap(notSyncedIcon.pixmap(16));
+ return;
+ }
+
+ QString loadingGitPath = KStandardDirs::locate("appdata" , "pics/loading.mng");
+
+ // bookmarks
+ if (ReKonfig::syncBookmarks())
+ {
+ QMovie *movie = new QMovie(loadingGitPath, QByteArray(), bkLabel);
+ movie->setSpeed(50);
+ bkLabel->setMovie(movie);
+ movie->start();
+ }
+ else
+ {
+ bkLabel->setPixmap(notSyncedIcon.pixmap(16));
+ }
+
+ // history
+ if (ReKonfig::syncHistory())
+ {
+ QMovie *movie = new QMovie(loadingGitPath, QByteArray(), hsLabel);
+ movie->setSpeed(50);
+ hsLabel->setMovie(movie);
+ movie->start();
+ }
+ else
+ {
+ hsLabel->setPixmap(notSyncedIcon.pixmap(16));
+ }
+
+ // passwords
+ if (ReKonfig::syncPasswords())
+ {
+ QMovie *movie = new QMovie(loadingGitPath, QByteArray(), psLabel);
+ movie->setSpeed(50);
+ psLabel->setMovie(movie);
+ movie->start();
+ }
+ else
+ {
+ psLabel->setPixmap(notSyncedIcon.pixmap(16));
+ }
+
+ // Now, load syncManager settings...
+ rApp->syncManager()->loadSettings();
+
+ SyncHandler *h = rApp->syncManager()->handler();
+ connect(h, SIGNAL(syncStatus(Rekonq::SyncData, bool, QString)), this, SLOT(updateWidget(Rekonq::SyncData, bool, QString)));
+}
+
+
+void SyncCheckWidget::updateWidget(Rekonq::SyncData type, bool done, QString msg)
+{
+ KIcon doneIcon(QL1S("dialog-ok-apply"));
+ KIcon failIcon(QL1S("edit-delete"));
+
+ switch (type)
+ {
+ case Rekonq::Bookmarks:
+ if (done)
+ {
+ bkLabel->setPixmap(doneIcon.pixmap(16));
+ }
+ else
+ {
+ bkLabel->setPixmap(failIcon.pixmap(16));
+ }
+ bkMsgLabel->setText(msg);
+ break;
+
+ case Rekonq::History:
+ if (done)
+ {
+ hsLabel->setPixmap(doneIcon.pixmap(16));
+ }
+ else
+ {
+ hsLabel->setPixmap(failIcon.pixmap(16));
+ }
+ hsMsgLabel->setText(msg);
+ break;
+
+ case Rekonq::Passwords:
+ if (done)
+ {
+ psLabel->setPixmap(doneIcon.pixmap(16));
+ }
+ else
+ {
+ psLabel->setPixmap(failIcon.pixmap(16));
+ }
+ psMsgLabel->setText(msg);
+ break;
+
+ default:
+ // nothing to do here...
+ break;
+ };
+}
diff --git a/src/sync/synccheckwidget.h b/src/sync/synccheckwidget.h
new file mode 100644
index 00000000..5cec1591
--- /dev/null
+++ b/src/sync/synccheckwidget.h
@@ -0,0 +1,53 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
+*
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation; either version 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+* ============================================================ */
+
+
+#ifndef SYNC_CHECK_WIDGET_H
+#define SYNC_CHECK_WIDGET_H
+
+
+// Rekonq Includes
+#include "rekonq_defines.h"
+
+// Ui Includes
+#include "ui_sync_check.h"
+
+// Qt Includes
+#include <QWizardPage>
+
+
+class SyncCheckWidget : public QWizardPage, private Ui::SyncCheck
+{
+ Q_OBJECT
+
+public:
+ SyncCheckWidget(QWidget *parent = 0);
+ void initializePage();
+
+private Q_SLOTS:
+ void updateWidget(Rekonq::SyncData, bool, QString);
+};
+
+#endif // SYNC_CHECK_WIDGET_H
diff --git a/src/sync/syncwidget.cpp b/src/sync/syncdatawidget.cpp
index f1e79da6..8b6ca8e3 100644
--- a/src/sync/syncwidget.cpp
+++ b/src/sync/syncdatawidget.cpp
@@ -25,19 +25,19 @@
// Self Includes
-#include "syncwidget.h"
-#include "syncwidget.moc"
+#include "syncdatawidget.h"
+#include "syncdatawidget.moc"
// Auto Includes
#include "rekonq.h"
// Local Includes
#include "syncmanager.h"
-#include "application.h"
+#include "syncassistant.h"
-SyncWidget::SyncWidget(QWidget *parent)
- : QWidget(parent)
+SyncDataWidget::SyncDataWidget(QWidget *parent)
+ : QWizardPage(parent)
, _changed(false)
{
setupUi(this);
@@ -48,49 +48,20 @@ SyncWidget::SyncWidget(QWidget *parent)
kcfg_syncHistory->setChecked(ReKonfig::syncHistory());
kcfg_syncPasswords->setChecked(ReKonfig::syncPasswords());
- 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);
- kcfg_syncPass->setPasswordMode(true);
-
connect(kcfg_syncEnabled, SIGNAL(clicked()), this, SLOT(hasChanged()));
- connect(syncNowButton, SIGNAL(clicked()), this, SLOT(syncNow()));
-
- setSyncLabel(ReKonfig::lastSyncDateTime());
}
-void SyncWidget::save()
-{
- ReKonfig::setSyncEnabled(kcfg_syncEnabled->isChecked());
-
- ReKonfig::setSyncBookmarks(kcfg_syncBookmarks->isChecked());
- ReKonfig::setSyncHistory(kcfg_syncHistory->isChecked());
- ReKonfig::setSyncPasswords(kcfg_syncPasswords->isChecked());
-
- 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()->resetSyncer();
-}
-
-
-bool SyncWidget::changed()
+bool SyncDataWidget::changed()
{
return _changed;
}
-void SyncWidget::hasChanged()
+void SyncDataWidget::hasChanged()
{
enablewidgets(kcfg_syncEnabled->isChecked());
@@ -99,26 +70,23 @@ void SyncWidget::hasChanged()
}
-void SyncWidget::enablewidgets(bool b)
+void SyncDataWidget::enablewidgets(bool b)
{
syncGroupBox->setEnabled(b);
- ownCloudGroupBox->setEnabled(b);
- syncNowButton->setEnabled(b);
}
-void SyncWidget::setSyncLabel(const QDateTime &dt)
+int SyncDataWidget::nextId() const
{
- if (dt.isNull())
- lastSyncTimeLabel->setText(i18n("Last Sync: NEVER!"));
- else
- lastSyncTimeLabel->setText(i18n("Last Sync: %1", dt.toString(Qt::DefaultLocaleShortDate)));
-}
-
+ // save
+ ReKonfig::setSyncEnabled(kcfg_syncEnabled->isChecked());
-void SyncWidget::syncNow()
-{
- rApp->syncManager()->resetSyncer();
+ ReKonfig::setSyncBookmarks(kcfg_syncBookmarks->isChecked());
+ ReKonfig::setSyncHistory(kcfg_syncHistory->isChecked());
+ ReKonfig::setSyncPasswords(kcfg_syncPasswords->isChecked());
- // TODO do something in the sync UI...
+ if (ReKonfig::syncEnabled())
+ return SyncAssistant::Page_Type;
+ else
+ return SyncAssistant::Page_Check;
}
diff --git a/src/sync/syncwidget.h b/src/sync/syncdatawidget.h
index 8621eae1..30d1ae34 100644
--- a/src/sync/syncwidget.h
+++ b/src/sync/syncdatawidget.h
@@ -24,26 +24,28 @@
* ============================================================ */
-#ifndef SYNC_WIDGET_H
-#define SYNC_WIDGET_H
+#ifndef SYNC_DATA_WIDGET_H
+#define SYNC_DATA_WIDGET_H
// Rekonq Includes
#include "rekonq_defines.h"
// Ui Includes
-#include "ui_settings_sync.h"
+#include "ui_sync_data.h"
// Qt Includes
-#include <QtGui/QWidget>
+#include <QWizardPage>
-class SyncWidget : public QWidget, private Ui::Sync
+class SyncDataWidget : public QWizardPage, private Ui::SyncData
{
Q_OBJECT
public:
- SyncWidget(QWidget *parent = 0);
+ SyncDataWidget(QWidget *parent = 0);
+
+ int nextId() const;
bool changed();
@@ -51,13 +53,10 @@ Q_SIGNALS:
void changed(bool);
private Q_SLOTS:
- void save();
void hasChanged();
- void syncNow();
private:
void enablewidgets(bool);
- void setSyncLabel(const QDateTime &);
bool _changed;
};
diff --git a/src/sync/syncftpsettingswidget.cpp b/src/sync/syncftpsettingswidget.cpp
new file mode 100644
index 00000000..31660843
--- /dev/null
+++ b/src/sync/syncftpsettingswidget.cpp
@@ -0,0 +1,63 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
+*
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation; either version 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+* ============================================================ */
+
+
+// Self Includes
+#include "syncftpsettingswidget.h"
+#include "syncftpsettingswidget.moc"
+
+// Auto Includes
+#include "rekonq.h"
+
+// Local Includes
+#include "syncassistant.h"
+
+
+SyncFTPSettingsWidget::SyncFTPSettingsWidget(QWidget *parent)
+ : QWizardPage(parent)
+{
+ setupUi(this);
+
+ 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());
+
+ kcfg_syncPass->setPasswordMode(true);
+}
+
+
+int SyncFTPSettingsWidget::nextId() const
+{
+ // save
+ 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());
+
+ return SyncAssistant::Page_Check;
+}
diff --git a/src/sync/syncftpsettingswidget.h b/src/sync/syncftpsettingswidget.h
new file mode 100644
index 00000000..d067eef4
--- /dev/null
+++ b/src/sync/syncftpsettingswidget.h
@@ -0,0 +1,51 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
+*
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation; either version 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+* ============================================================ */
+
+
+#ifndef SYNC_FTP_SETTINGS_WIDGET_H
+#define SYNC_FTP_SETTINGS_WIDGET_H
+
+
+// Rekonq Includes
+#include "rekonq_defines.h"
+
+// Ui Includes
+#include "ui_sync_ftp_settings.h"
+
+// Qt Includes
+#include <QWizardPage>
+
+
+class SyncFTPSettingsWidget : public QWizardPage, private Ui::SyncFTPSettings
+{
+ Q_OBJECT
+
+public:
+ SyncFTPSettingsWidget(QWidget *parent = 0);
+
+ int nextId() const;
+};
+
+#endif // SYNC_FTP_SETTINGS_WIDGET_H
diff --git a/src/sync/synchandler.cpp b/src/sync/synchandler.cpp
new file mode 100644
index 00000000..759af064
--- /dev/null
+++ b/src/sync/synchandler.cpp
@@ -0,0 +1,41 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
+*
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation; either version 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+* ============================================================ */
+
+
+// Self Includes
+#include "synchandler.h"
+#include "synchandler.moc"
+
+
+SyncHandler::SyncHandler(QObject *parent)
+ : QObject(parent)
+ , _firstTimeSynced(false)
+{
+}
+
+
+SyncHandler::~SyncHandler()
+{
+}
diff --git a/src/sync/synchandler.h b/src/sync/synchandler.h
index 30873fa5..32266d7c 100644
--- a/src/sync/synchandler.h
+++ b/src/sync/synchandler.h
@@ -37,16 +37,25 @@
class SyncHandler : public QObject
{
-
+ Q_OBJECT
+
public:
- SyncHandler(QObject *parent = 0) : QObject(parent) {}
- virtual ~SyncHandler() {}
-
+ SyncHandler(QObject *parent = 0);
+ virtual ~SyncHandler();
+
virtual void syncHistory() = 0;
virtual void syncBookmarks() = 0;
virtual void syncPasswords() = 0;
- virtual void firstTimeSync() = 0;
+ virtual void initialLoadAndCheck() = 0;
+
+Q_SIGNALS:
+ void syncStatus(Rekonq::SyncData type, bool syncDone, QString message);
+
+protected:
+ bool _firstTimeSynced;
+
+
};
#endif // SYNC_HANDLER_H
diff --git a/src/sync/synchosttypewidget.cpp b/src/sync/synchosttypewidget.cpp
new file mode 100644
index 00000000..0810182e
--- /dev/null
+++ b/src/sync/synchosttypewidget.cpp
@@ -0,0 +1,64 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
+*
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation; either version 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+* ============================================================ */
+
+
+// Self Includes
+#include "synchosttypewidget.h"
+#include "synchosttypewidget.moc"
+
+// Auto Includes
+#include "rekonq.h"
+
+// Local Includes
+#include "syncassistant.h"
+
+
+SyncHostTypeWidget::SyncHostTypeWidget(QWidget *parent)
+ : QWizardPage(parent)
+{
+ setupUi(this);
+
+ if (ReKonfig::syncType() == 0)
+ ftpRadioButton->setChecked(true);
+ else
+ nullRadioButton->setChecked(true);
+}
+
+
+int SyncHostTypeWidget::nextId() const
+{
+ // save
+ if (ftpRadioButton->isChecked())
+ {
+ ReKonfig::setSyncType(0);
+ return SyncAssistant::Page_FTP_Settings;
+ }
+ else
+ {
+ ReKonfig::setSyncType(1);
+ return SyncAssistant::Page_Check;
+ }
+
+}
diff --git a/src/sync/synchosttypewidget.h b/src/sync/synchosttypewidget.h
new file mode 100644
index 00000000..66408825
--- /dev/null
+++ b/src/sync/synchosttypewidget.h
@@ -0,0 +1,51 @@
+/* ============================================================
+*
+* This file is a part of the rekonq project
+*
+* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
+*
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License as
+* published by the Free Software Foundation; either version 2 of
+* the License or (at your option) version 3 or any later version
+* accepted by the membership of KDE e.V. (or its successor approved
+* by the membership of KDE e.V.), which shall act as a proxy
+* defined in Section 14 of version 3 of the license.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+* ============================================================ */
+
+
+#ifndef SYNC_HOST_TYPE_WIDGET_H
+#define SYNC_HOST_TYPE_WIDGET_H
+
+
+// Rekonq Includes
+#include "rekonq_defines.h"
+
+// Ui Includes
+#include "ui_sync_host_type.h"
+
+// Qt Includes
+#include <QWizardPage>
+
+
+class SyncHostTypeWidget : public QWizardPage, private Ui::SyncHostType
+{
+ Q_OBJECT
+
+public:
+ SyncHostTypeWidget(QWidget *parent = 0);
+
+ int nextId() const;
+};
+
+#endif // SYNC_HOST_TYPE_WIDGET_H
diff --git a/src/sync/syncmanager.cpp b/src/sync/syncmanager.cpp
index 41a60179..efd0ffd3 100644
--- a/src/sync/syncmanager.cpp
+++ b/src/sync/syncmanager.cpp
@@ -35,7 +35,8 @@
#include "application.h"
#include "bookmarkmanager.h"
#include "historymanager.h"
-#include "syncwidget.h"
+
+#include "syncassistant.h"
#include "ftpsynchandler.h"
// KDE Includes
@@ -63,7 +64,16 @@ void SyncManager::loadSettings()
{
if (ReKonfig::syncEnabled())
{
- resetSyncer();
+ // reset syncer
+ if (_syncImplementation.isNull())
+ {
+ // actually we have just FTP handler...
+ _syncImplementation = new FTPSyncHandler(this);
+ }
+
+ _syncImplementation.data()->initialLoadAndCheck();
+
+ // --- Connect syncmanager to bookmarks & history manager
// bookmarks
ReKonfig::syncBookmarks()
@@ -92,32 +102,13 @@ void SyncManager::loadSettings()
void SyncManager::showSettings()
{
- QPointer<KDialog> dialog = new KDialog();
- dialog->setCaption(i18nc("@title:window", "Sync Settings"));
- dialog->setButtons(KDialog::Ok | KDialog::Cancel);
-
- SyncWidget widget;
- dialog->setMainWidget(&widget);
- connect(dialog, SIGNAL(okClicked()), &widget, SLOT(save()));
- connect(dialog, SIGNAL(okClicked()), this, SLOT(loadSettings()));
+ QPointer<SyncAssistant> dialog = new SyncAssistant();
dialog->exec();
dialog->deleteLater();
}
-void SyncManager::resetSyncer()
-{
- if (_syncImplementation.isNull())
- {
- // actually we have just FTP handler...
- _syncImplementation = new FTPSyncHandler(this);
- }
-
- _syncImplementation.data()->firstTimeSync();
-}
-
-
// ---------------------------------------------------------------------------------------
diff --git a/src/sync/syncmanager.h b/src/sync/syncmanager.h
index 98536603..cd7dbefa 100644
--- a/src/sync/syncmanager.h
+++ b/src/sync/syncmanager.h
@@ -46,15 +46,17 @@ class REKONQ_TESTS_EXPORT SyncManager : public QObject
public:
SyncManager(QObject *parent = 0);
~SyncManager();
-
- void resetSyncer();
+
+ SyncHandler *handler() const
+ {
+ return _syncImplementation.data();
+ };
public Q_SLOTS:
void syncBookmarks();
void syncHistory();
void syncPasswords();
-private Q_SLOTS:
void loadSettings();
void showSettings();