summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sync/operasynchandler.cpp11
-rw-r--r--src/sync/sync_data.ui16
-rw-r--r--src/sync/sync_host_type.ui22
-rw-r--r--src/sync/syncassistant.cpp2
-rw-r--r--src/sync/syncassistant.h2
-rw-r--r--src/sync/syncdatawidget.cpp58
-rw-r--r--src/sync/syncdatawidget.h12
-rw-r--r--src/sync/syncftpsettingswidget.cpp2
-rw-r--r--src/sync/syncgooglesettingswidget.cpp2
-rw-r--r--src/sync/synchosttypewidget.cpp29
-rw-r--r--src/sync/synchosttypewidget.h12
-rw-r--r--src/sync/syncmanager.cpp2
-rw-r--r--src/sync/syncoperasettingswidget.cpp2
13 files changed, 101 insertions, 71 deletions
diff --git a/src/sync/operasynchandler.cpp b/src/sync/operasynchandler.cpp
index 2e67ab34..9a1241ca 100644
--- a/src/sync/operasynchandler.cpp
+++ b/src/sync/operasynchandler.cpp
@@ -169,6 +169,7 @@ void OperaSyncHandler::startLogin()
if (_qoauth.error() != QOAuth::NoError)
{
kDebug() << "Error occured while fetching request tokens. Error code is : " << _qoauth.error();
+ emit syncStatus(Rekonq::Bookmarks, false, i18n("OAuth : Error fetching request token."));
_isSyncing = false;
return;
}
@@ -228,8 +229,8 @@ void OperaSyncHandler::loadFinished(bool ok)
password.setAttribute("value", ReKonfig::syncPass());
button.evaluateJavaScript("this.click();");
-
emit syncStatus(Rekonq::Bookmarks, true, i18n("Signing in..."));
+
_doLogin = false;
}
else if (html.contains("verifier"))
@@ -240,11 +241,14 @@ void OperaSyncHandler::loadFinished(bool ok)
kDebug() << "OAuth verifier code is : " << verifier;
authParams.insert("oauth_verifier", verifier);
+
+ emit syncStatus(Rekonq::Bookmarks, true, i18n("OAuth : Sending verification code."));
QOAuth::ParamMap resultParam = _qoauth.accessToken("https://auth.opera.com/service/oauth/access_token", QOAuth::POST, _requestToken, _requestTokenSecret, QOAuth::HMAC_SHA1, authParams);
if (_qoauth.error() != QOAuth::NoError)
{
kDebug() << "Error occured while fetching access tokens. Error code is : " << _qoauth.error();
+ emit syncStatus(Rekonq::Bookmarks, false, i18n("OAuth : Error fetching access token."));
_isSyncing = false;
return;
}
@@ -267,6 +271,11 @@ void OperaSyncHandler::loadFinished(bool ok)
kDebug() << "Login failed!";
_isSyncing = false;
}
+ else
+ {
+ kDebug() << "Unknown page : " << _webPage.mainFrame()->url();
+ _isSyncing = false;
+ }
}
}
diff --git a/src/sync/sync_data.ui b/src/sync/sync_data.ui
index 53b98057..73058357 100644
--- a/src/sync/sync_data.ui
+++ b/src/sync/sync_data.ui
@@ -18,13 +18,6 @@
</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>
@@ -32,6 +25,9 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="kcfg_syncBookmarks">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
<property name="text">
<string>bookmarks</string>
</property>
@@ -39,6 +35,9 @@
</item>
<item>
<widget class="QCheckBox" name="kcfg_syncHistory">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
<property name="text">
<string>history</string>
</property>
@@ -46,6 +45,9 @@
</item>
<item>
<widget class="QCheckBox" name="kcfg_syncPasswords">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
<property name="text">
<string>passwords</string>
</property>
diff --git a/src/sync/sync_host_type.ui b/src/sync/sync_host_type.ui
index ed7e1cd9..6bdef5fa 100644
--- a/src/sync/sync_host_type.ui
+++ b/src/sync/sync_host_type.ui
@@ -12,7 +12,14 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
- <widget class="QGroupBox" name="groupBox">
+ <widget class="QCheckBox" name="kcfg_syncEnabled">
+ <property name="text">
+ <string>Activate sync</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="hostGroupBox">
<property name="title">
<string>sync host type</string>
</property>
@@ -48,19 +55,6 @@
</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/>
diff --git a/src/sync/syncassistant.cpp b/src/sync/syncassistant.cpp
index 078ff375..7edc1f67 100644
--- a/src/sync/syncassistant.cpp
+++ b/src/sync/syncassistant.cpp
@@ -43,10 +43,10 @@ SyncAssistant::SyncAssistant(QWidget *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_Google_Settings, new SyncGoogleSettingsWidget(this));
setPage(Page_Opera_Settings, new SyncOperaSettingsWidget(this));
+ setPage(Page_Data, new SyncDataWidget(this));
setPage(Page_Check, new SyncCheckWidget(this));
}
diff --git a/src/sync/syncassistant.h b/src/sync/syncassistant.h
index 263c918a..f373a5f8 100644
--- a/src/sync/syncassistant.h
+++ b/src/sync/syncassistant.h
@@ -39,11 +39,11 @@ class SyncAssistant : public QWizard
public:
enum
{
- Page_Data,
Page_Type,
Page_FTP_Settings,
Page_Google_Settings,
Page_Opera_Settings,
+ Page_Data,
Page_Check
};
diff --git a/src/sync/syncdatawidget.cpp b/src/sync/syncdatawidget.cpp
index fe3637b1..9b415ad2 100644
--- a/src/sync/syncdatawidget.cpp
+++ b/src/sync/syncdatawidget.cpp
@@ -38,55 +38,49 @@
SyncDataWidget::SyncDataWidget(QWidget *parent)
: QWizardPage(parent)
- , _changed(false)
{
setupUi(this);
-
- kcfg_syncEnabled->setChecked(ReKonfig::syncEnabled());
-
- kcfg_syncBookmarks->setChecked(ReKonfig::syncBookmarks());
- kcfg_syncHistory->setChecked(ReKonfig::syncHistory());
- kcfg_syncPasswords->setChecked(ReKonfig::syncPasswords());
-
- bool isSyncEnabled = ReKonfig::syncEnabled();
- enablewidgets(isSyncEnabled);
-
- connect(kcfg_syncEnabled, SIGNAL(clicked()), this, SLOT(hasChanged()));
}
-
-bool SyncDataWidget::changed()
+void SyncDataWidget::initializePage()
{
- return _changed;
-}
+ kcfg_syncBookmarks->setDisabled(true);
+ kcfg_syncHistory->setDisabled(true);
+ kcfg_syncPasswords->setDisabled(true);
+
+ switch(ReKonfig::syncType())
+ {
+ //Ftp Sync Handler
+ case 0:
+ kcfg_syncBookmarks->setEnabled(true);
+ kcfg_syncHistory->setEnabled(true);
+ kcfg_syncPasswords->setEnabled(true);
+ break;
+ //Google Sync Handler
+ case 1:
+ //Opera Sync Handler
+ case 2:
+ kcfg_syncBookmarks->setEnabled(true);
+ break;
+ default:
+ kDebug() << "Unknown sync type!";
+ }
-void SyncDataWidget::hasChanged()
-{
- enablewidgets(kcfg_syncEnabled->isChecked());
-
- _changed = true;
- emit changed(true);
-}
-
+ kcfg_syncBookmarks->setChecked(ReKonfig::syncBookmarks());
+ kcfg_syncHistory->setChecked(ReKonfig::syncHistory());
+ kcfg_syncPasswords->setChecked(ReKonfig::syncPasswords());
-void SyncDataWidget::enablewidgets(bool b)
-{
- syncGroupBox->setEnabled(b);
}
int SyncDataWidget::nextId() const
{
// save
- ReKonfig::setSyncEnabled(kcfg_syncEnabled->isChecked());
ReKonfig::setSyncBookmarks(kcfg_syncBookmarks->isChecked());
ReKonfig::setSyncHistory(kcfg_syncHistory->isChecked());
ReKonfig::setSyncPasswords(kcfg_syncPasswords->isChecked());
- if (ReKonfig::syncEnabled())
- return SyncAssistant::Page_Type;
- else
- return SyncAssistant::Page_Check;
+ return SyncAssistant::Page_Check;
}
diff --git a/src/sync/syncdatawidget.h b/src/sync/syncdatawidget.h
index b1676384..cfec1d49 100644
--- a/src/sync/syncdatawidget.h
+++ b/src/sync/syncdatawidget.h
@@ -47,18 +47,8 @@ public:
int nextId() const;
- bool changed();
+ void initializePage();
-Q_SIGNALS:
- void changed(bool);
-
-private Q_SLOTS:
- void hasChanged();
-
-private:
- void enablewidgets(bool);
-
- bool _changed;
};
#endif // SYNC_WIDGET_H
diff --git a/src/sync/syncftpsettingswidget.cpp b/src/sync/syncftpsettingswidget.cpp
index 31660843..5eb6bfdc 100644
--- a/src/sync/syncftpsettingswidget.cpp
+++ b/src/sync/syncftpsettingswidget.cpp
@@ -59,5 +59,5 @@ int SyncFTPSettingsWidget::nextId() const
ReKonfig::setSyncPath(kcfg_syncPath->text());
ReKonfig::setSyncPort(kcfg_syncPort->value());
- return SyncAssistant::Page_Check;
+ return SyncAssistant::Page_Data;
}
diff --git a/src/sync/syncgooglesettingswidget.cpp b/src/sync/syncgooglesettingswidget.cpp
index 0a357d4f..6c364b38 100644
--- a/src/sync/syncgooglesettingswidget.cpp
+++ b/src/sync/syncgooglesettingswidget.cpp
@@ -57,5 +57,5 @@ int SyncGoogleSettingsWidget::nextId() const
ReKonfig::setSyncHistory(false);
ReKonfig::setSyncPasswords(false);
- return SyncAssistant::Page_Check;
+ return SyncAssistant::Page_Data;
}
diff --git a/src/sync/synchosttypewidget.cpp b/src/sync/synchosttypewidget.cpp
index 73f9a7cb..cece6e2c 100644
--- a/src/sync/synchosttypewidget.cpp
+++ b/src/sync/synchosttypewidget.cpp
@@ -37,9 +37,12 @@
SyncHostTypeWidget::SyncHostTypeWidget(QWidget *parent)
: QWizardPage(parent)
+ , _changed(false)
{
setupUi(this);
+ connect(kcfg_syncEnabled, SIGNAL(clicked()), this, SLOT(hasChanged()));
+ kcfg_syncEnabled->setChecked(ReKonfig::syncEnabled());
if (ReKonfig::syncType() == 0)
ftpRadioButton->setChecked(true);
else if(ReKonfig::syncType() == 1)
@@ -48,11 +51,32 @@ SyncHostTypeWidget::SyncHostTypeWidget(QWidget *parent)
operaRadioButton->setChecked(true);
else
nullRadioButton->setChecked(true);
+
+ enablewidgets(ReKonfig::syncEnabled());
+}
+
+
+bool SyncHostTypeWidget::changed()
+{
+ return _changed;
}
+void SyncHostTypeWidget::hasChanged()
+{
+ enablewidgets(kcfg_syncEnabled->isChecked());
+
+ _changed = true;
+ emit changed(true);
+}
+
int SyncHostTypeWidget::nextId() const
{
+ ReKonfig::setSyncEnabled(kcfg_syncEnabled->isChecked());
+
+ if (!ReKonfig::syncEnabled())
+ return SyncAssistant::Page_Check;
+
// save
if (ftpRadioButton->isChecked())
{
@@ -76,3 +100,8 @@ int SyncHostTypeWidget::nextId() const
}
}
+
+void SyncHostTypeWidget::enablewidgets(bool b)
+{
+ hostGroupBox->setEnabled(b);
+}
diff --git a/src/sync/synchosttypewidget.h b/src/sync/synchosttypewidget.h
index bc16f00b..4f577958 100644
--- a/src/sync/synchosttypewidget.h
+++ b/src/sync/synchosttypewidget.h
@@ -46,6 +46,18 @@ public:
SyncHostTypeWidget(QWidget *parent = 0);
int nextId() const;
+ bool changed();
+
+Q_SIGNALS:
+ void changed(bool);
+
+private Q_SLOTS:
+ void hasChanged();
+
+private:
+ void enablewidgets(bool b);
+ bool _changed;
+
};
#endif // SYNC_HOST_TYPE_WIDGET_H
diff --git a/src/sync/syncmanager.cpp b/src/sync/syncmanager.cpp
index a4acb80b..67b23054 100644
--- a/src/sync/syncmanager.cpp
+++ b/src/sync/syncmanager.cpp
@@ -92,7 +92,6 @@ void SyncManager::loadSettings()
return;
}
- _syncImplementation.data()->initialLoadAndCheck();
// --- Connect syncmanager to bookmarks & history manager
@@ -108,6 +107,7 @@ void SyncManager::loadSettings()
: disconnect(rApp->historyManager(), SIGNAL(historySaved()), this, SLOT(syncHistory()))
;
+ _syncImplementation.data()->initialLoadAndCheck();
// NOTE: password sync will be called just on save
}
else
diff --git a/src/sync/syncoperasettingswidget.cpp b/src/sync/syncoperasettingswidget.cpp
index 0b5e3386..7cef9e24 100644
--- a/src/sync/syncoperasettingswidget.cpp
+++ b/src/sync/syncoperasettingswidget.cpp
@@ -56,5 +56,5 @@ int SyncOperaSettingsWidget::nextId() const
ReKonfig::setSyncHistory(false);
ReKonfig::setSyncPasswords(false);
- return SyncAssistant::Page_Check;
+ return SyncAssistant::Page_Data;
}