summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Klapetek <[email protected]>2015-10-15 17:43:29 -0400
committerMartin Klapetek <[email protected]>2015-10-15 17:43:29 -0400
commit6da76d279a24de891ab19b3aaf4c8ba0a37caad6 (patch)
tree31e3518696c8aa8a03647c7d37abb58e32b009be
parenta3180be07bca0b8fa2a371182706d8aafc54e1d6 (diff)
[owncloud] Remove the QWidgets wizard
The OwnCloud dialog is now QML only
-rw-r--r--plugins/owncloud-ui/CMakeLists.txt18
-rw-r--r--plugins/owncloud-ui/oaccountwidget.cpp146
-rw-r--r--plugins/owncloud-ui/oaccountwidget.h59
-rw-r--r--plugins/owncloud-ui/owncloud.cpp112
-rw-r--r--plugins/owncloud-ui/owncloud.h26
-rw-r--r--plugins/owncloud-ui/pages/basicinfo.cpp225
-rw-r--r--plugins/owncloud-ui/pages/basicinfo.h72
-rw-r--r--plugins/owncloud-ui/pages/basicinfo.ui129
-rw-r--r--plugins/owncloud-ui/pages/connecting.cpp87
-rw-r--r--plugins/owncloud-ui/pages/connecting.h48
-rw-r--r--plugins/owncloud-ui/pages/connecting.ui100
-rw-r--r--plugins/owncloud-ui/pages/oservices.cpp80
-rw-r--r--plugins/owncloud-ui/pages/oservices.h48
-rw-r--r--plugins/owncloud-ui/pages/oservices.ui83
-rw-r--r--plugins/owncloud-ui/qmlhelper.h3
15 files changed, 7 insertions, 1229 deletions
diff --git a/plugins/owncloud-ui/CMakeLists.txt b/plugins/owncloud-ui/CMakeLists.txt
index e69f6e1..97b018f 100644
--- a/plugins/owncloud-ui/CMakeLists.txt
+++ b/plugins/owncloud-ui/CMakeLists.txt
@@ -1,4 +1,4 @@
-project (owncloud-plugin-kaccounts)
+project (owncloud-ui-plugin)
include_directories (${CMAKE_CURRENT_BUILD_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
@@ -7,15 +7,6 @@ include_directories (${CMAKE_CURRENT_BUILD_DIR}
set (owncloud_plugin_kaccounts_SRCS
owncloud.cpp
qmlhelper.cpp
- pages/basicinfo.cpp
- pages/connecting.cpp
- pages/oservices.cpp
-)
-
-ki18n_wrap_ui(owncloud_plugin_kaccounts_SRCS
- pages/basicinfo.ui
- pages/connecting.ui
- pages/oservices.ui
)
add_library (owncloud_plugin_kaccounts MODULE
@@ -24,15 +15,10 @@ add_library (owncloud_plugin_kaccounts MODULE
target_link_libraries (owncloud_plugin_kaccounts
Qt5::Core
- Qt5::Widgets
KF5::KIOCore
- KF5::KIOWidgets
- KF5::CoreAddons
- KF5::WidgetsAddons
- KF5::IconThemes
KF5::I18n
KF5::Declarative
- kaccounts
+ KAccounts
${ACCOUNTSQT_LIBRARIES}
${SIGNONQT_LIBRARIES}
)
diff --git a/plugins/owncloud-ui/oaccountwidget.cpp b/plugins/owncloud-ui/oaccountwidget.cpp
deleted file mode 100644
index 51343ee..0000000
--- a/plugins/owncloud-ui/oaccountwidget.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/*************************************************************************************
- * Copyright (C) 2012 by Alejandro Fiestas Olivares <[email protected]> *
- * *
- * 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) any later version. *
- * *
- * 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, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
- *************************************************************************************/
-#include "oaccountwidget.h"
-
-#include "google/pages/serviceoption.h"
-#include "owncloud/jobs/ocreatecontact.h"
-#include "owncloud/jobs/ocreatecalendar.h"
-#include "owncloud/jobs/ocreatefile.h"
-#include "owncloud/jobs/oremovefile.h"
-#include "owncloud/jobs/oremovecalendar.h"
-#include "owncloud/jobs/oremovecontact.h"
-
-#include <QDebug>
-
-OAccountWidget::OAccountWidget(KConfigGroup group, QWidget *parent)
- : QWidget(parent)
- , m_config(group)
-{
- setupUi(this);
-
- int status = 0;
- KConfigGroup services = m_config.group("services");
- QStringList keys = services.keyList();
-
- Q_FOREACH(const QString &key, keys) {
- status = services.readEntry(key, 0);
- m_serviceWidgets[key] = new ServiceOption(key, key, this);
- m_serviceWidgets[key]->setStatus(status);
- connect(m_serviceWidgets[key], SIGNAL(toggled(QString,bool)),
- this, SLOT(serviceChanged(QString,bool)));
- d_layout->addWidget(m_serviceWidgets[key]);
- }
-}
-
-OAccountWidget::~OAccountWidget()
-{
-
-}
-
-void OAccountWidget::serviceChanged(const QString &service, bool enabled)
-{
- if (service == "Calendar") {
- modifyCalendar(enabled);
- return;
- }
-
- if (service == "Contact") {
- modifyContact(enabled);
- return;
- }
-
- if (service == "File") {
- modifyFile(enabled);
- return;
- }
-
- qWarning() << "Not implemented service: " << service;
-}
-
-void OAccountWidget::updateService(const QString &name)
-{
- int status = m_config.group("services").readEntry(name, -1);
- m_serviceWidgets[name]->setStatus(status);
-}
-
-void OAccountWidget::modifyCalendar(bool enabled)
-{
- if (!enabled) {
- ORemoveCalendar *removeCalendar = new ORemoveCalendar(m_config, this);
- connect(removeCalendar, SIGNAL(finished(KJob*)), this, SLOT(updateCalendar()));
- removeCalendar->start();
- return;
- }
-
- OCreateCalendar *createCalendar = new OCreateCalendar(m_config, this);
- connect(createCalendar, SIGNAL(finished(KJob*)), this, SLOT(updateCalendar()));
- createCalendar->start();
-}
-
-void OAccountWidget::modifyFile(bool enabled)
-{
- if (!enabled) {
- ORemoveFile *removeFile = new ORemoveFile(m_config, this);
- connect(removeFile, SIGNAL(finished(KJob*)), this, SLOT(updateFile()));
- removeFile->start();
- return;
- }
-
- OCreateFile *createFile = new OCreateFile(m_config, this);
- connect(createFile, SIGNAL(finished(KJob*)), this, SLOT(updateFile()));
- createFile->start();
-}
-
-void OAccountWidget::modifyContact(bool enabled)
-{
- if (!enabled) {
- ORemoveContact *removeContact = new ORemoveContact(m_config, this);
- connect(removeContact, SIGNAL(finished(KJob*)), this, SLOT(updateContact()));
- removeContact->start();
- return;
- }
-
- OCreateContact *createContact = new OCreateContact(m_config, this);
- connect(createContact, SIGNAL(finished(KJob*)), this, SLOT(updateContact()));
- createContact->start();
-}
-
-void OAccountWidget::updateCalendar()
-{
- updateService("Calendar");
-}
-
-void OAccountWidget::updateFile()
-{
- updateService("File");
-}
-
-void OAccountWidget::updateContact()
-{
- updateService("Contact");
-}
-
-void OAccountWidget::updateAll()
-{
- KConfigGroup services = m_config.group("services");
- QStringList keys = services.keyList();
-
- Q_FOREACH(const QString &key, keys) {
- updateService(key);
- }
-}
diff --git a/plugins/owncloud-ui/oaccountwidget.h b/plugins/owncloud-ui/oaccountwidget.h
deleted file mode 100644
index 0832c08..0000000
--- a/plugins/owncloud-ui/oaccountwidget.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*************************************************************************************
- * Copyright (C) 2012 by Alejandro Fiestas Olivares <[email protected]> *
- * *
- * 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) any later version. *
- * *
- * 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, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
- *************************************************************************************/
-
-#ifndef O_ACCOUNTWIDGET_H
-#define O_ACCOUNTWIDGET_H
-
-#include "ui_services.h"
-
-#include <QWidget>
-
-#include <KConfigGroup>
-
-class ServiceOption;
-
-class OAccountWidget : public QWidget, Ui::Services
-{
- Q_OBJECT
-
-public:
- explicit OAccountWidget(KConfigGroup group, QWidget *parent);
- virtual ~OAccountWidget();
-
-public Q_SLOTS:
- void serviceChanged(const QString &service, bool enabled);
-
-private Q_SLOTS:
- void updateCalendar();
- void updateContact();
- void updateFile();
-
- void updateAll();
-
-private:
- void modifyCalendar(bool enabled);
- void modifyContact(bool enabled);
- void modifyFile(bool enabled);
-
- void updateService(const QString &name);
-private:
- KConfigGroup m_config;
- QHash<QString, ServiceOption*> m_serviceWidgets;
-};
-
-#endif //O_ACCOUNTWIDGET_H
diff --git a/plugins/owncloud-ui/owncloud.cpp b/plugins/owncloud-ui/owncloud.cpp
index 877627c..4330871 100644
--- a/plugins/owncloud-ui/owncloud.cpp
+++ b/plugins/owncloud-ui/owncloud.cpp
@@ -18,34 +18,21 @@
*************************************************************************************/
#include "owncloud.h"
-#include "pages/basicinfo.h"
-#include "pages/connecting.h"
-#include "pages/oservices.h"
#include "qmlhelper.h"
-#include <klocalizedstring.h>
-#include <kstandardguiitem.h>
+#include <KLocalizedString>
#include <KDeclarative/QmlObject>
#include <QQmlEngine>
#include <QQmlContext>
-#include <QPushButton>
-#include <QWizard>
-
-// #include <KWallet/Wallet>
-
-// using namespace KWallet;
-
-OwnCloudWizard::OwnCloudWizard(QWidget *parent)
+OwnCloudWizard::OwnCloudWizard(QObject *parent)
: KAccountsUiPlugin(parent)
{
-
}
OwnCloudWizard::~OwnCloudWizard()
{
-
}
void OwnCloudWizard::init(KAccountsUiPlugin::UiType type)
@@ -75,41 +62,6 @@ void OwnCloudWizard::init(KAccountsUiPlugin::UiType type)
if (!m_object->package().metadata().isValid()) {
return;
}
- /*
- m_wizard = new QWizard();
- m_wizard->setWindowTitle(i18n("Add ownCloud Account"));
-
- BasicInfo *basicInfo = new BasicInfo(m_wizard);
- Connecting *connecting = new Connecting(m_wizard);
- OServices *services = new OServices(m_wizard);
-
- m_wizard->addPage(basicInfo);
- m_wizard->addPage(connecting);
- m_wizard->addPage(services);
-
- QPushButton *backButton = new QPushButton(m_wizard);
- QPushButton *forwardButton = new QPushButton(m_wizard);
- QPushButton *applyButton = new QPushButton(m_wizard);
- QPushButton *cancelButton = new QPushButton(m_wizard);
-
- KGuiItem::assign(backButton, KStandardGuiItem::back());
- KGuiItem::assign(forwardButton, KStandardGuiItem::forward());
- KGuiItem::assign(applyButton, KStandardGuiItem::apply());
- KGuiItem::assign(cancelButton, KStandardGuiItem::cancel());
-
- m_wizard->setButton(QWizard::BackButton, backButton);
- m_wizard->setButton(QWizard::NextButton, forwardButton);
- m_wizard->setButton(QWizard::FinishButton, applyButton);
- m_wizard->setButton(QWizard::CancelButton, cancelButton);
-
- // We do not want "Forward" as text
- m_wizard->setButtonText(QWizard::NextButton, i18nc("Action to go to the next page on the wizard", "Next"));
- m_wizard->setButtonText(QWizard::FinishButton, i18nc("Action to finish the wizard", "Finish"));
-
- m_wizard->setOption(QWizard::NoDefaultButton, false);
-
-
- connect(m_wizard, &QWizard::accepted, this, &OwnCloudWizard::done);*/
Q_EMIT uiReady();
}
@@ -124,9 +76,6 @@ void OwnCloudWizard::setProviderName(const QString &providerName)
void OwnCloudWizard::showNewAccountDialog()
{
-// if (m_wizard) {
-// m_wizard->exec();
-// }
QWindow *window = qobject_cast<QWindow *>(m_object->rootObject());
if (window) {
window->setTransientParent(transientParent());
@@ -146,60 +95,3 @@ QStringList OwnCloudWizard::supportedServicesForConfig() const
{
return QStringList();
}
-
-void OwnCloudWizard::done()
-{
- QVariantMap data;
- data.insert("server", m_wizard->property("server"));
-
- Q_FOREACH (const QString &disabledService, m_wizard->property("disabledServices").toStringList()) {
- data.insert("__service/" + disabledService, false);
- }
-
- const QString username = m_wizard->property("username").toString();
- QUrl carddavUrl = m_wizard->property("server").toUrl();
- carddavUrl.setPath(carddavUrl.path() + QString("/remote.php/carddav/addressbooks/%1").arg(username));
-
- data.insert("carddavUrl", carddavUrl);
- Q_EMIT success(username, m_wizard->property("password").toString(), data);
-}
-
-void OwnCloudWizard::setUsername(const QString &username)
-{
- m_username = username;
-}
-
-void OwnCloudWizard::setPassword(const QString &password)
-{
- m_password = password;
-}
-
-void OwnCloudWizard::setServer(const QUrl &server)
-{
- m_server = server;
-}
-
-const QString OwnCloudWizard::username() const
-{
- return m_username;
-}
-
-const QString OwnCloudWizard::password() const
-{
- return m_password;
-}
-
-const QUrl OwnCloudWizard::server() const
-{
- return m_server;
-}
-
-void OwnCloudWizard::activateOption(const QString &name, bool checked)
-{
- if (!checked) {
- m_services[name] = 0;
- return;
- }
-
- m_services[name] = 2;
-}
diff --git a/plugins/owncloud-ui/owncloud.h b/plugins/owncloud-ui/owncloud.h
index da92932..8c7c383 100644
--- a/plugins/owncloud-ui/owncloud.h
+++ b/plugins/owncloud-ui/owncloud.h
@@ -23,9 +23,7 @@
#include <QUrl>
#include <QHash>
-#include "../lib/kaccountsuiplugin.h"
-
-class QWizard;
+#include <kaccountsuiplugin.h>
namespace KDeclarative {
class QmlObject;
@@ -38,7 +36,7 @@ class OwnCloudWizard : public KAccountsUiPlugin
Q_INTERFACES(KAccountsUiPlugin)
public:
- explicit OwnCloudWizard(QWidget *parent = 0);
+ explicit OwnCloudWizard(QObject *parent = 0);
virtual ~OwnCloudWizard();
virtual void init(KAccountsUiPlugin::UiType type) Q_DECL_OVERRIDE;
@@ -47,28 +45,8 @@ public:
virtual void showConfigureAccountDialog(const quint32 accountId) Q_DECL_OVERRIDE;
virtual QStringList supportedServicesForConfig() const Q_DECL_OVERRIDE;
- void done();
-
- void setUsername(const QString &username);
- void setPassword(const QString &password);
- void setServer(const QUrl &server);
-
- const QString username() const;
- const QString password() const;
- const QUrl server() const;
-
- void activateOption(const QString &name, bool checked);
-
-Q_SIGNALS:
- void newAccount(const QString &type, const QString &name);
-
private:
- QWizard *m_wizard;
- QString m_username;
- QString m_password;
- QUrl m_server;
QString m_providerName;
-
QHash<QString, int> m_services;
KDeclarative::QmlObject *m_object;
};
diff --git a/plugins/owncloud-ui/pages/basicinfo.cpp b/plugins/owncloud-ui/pages/basicinfo.cpp
deleted file mode 100644
index 51e5e5b..0000000
--- a/plugins/owncloud-ui/pages/basicinfo.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-/*************************************************************************************
- * Copyright (C) 2012 by Alejandro Fiestas Olivares <[email protected]> *
- * Copyright (C) 2015 by Martin Klapetek <[email protected]> *
- * *
- * 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) any later version. *
- * *
- * 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, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
- *************************************************************************************/
-
-#include "basicinfo.h"
-#include "../owncloud.h"
-
-#include <QDebug>
-#include <QJsonDocument>
-#include <QJsonObject>
-#include <QTimer>
-
-#include <KPixmapSequenceOverlayPainter>
-#include <KPixmapSequence>
-#include <KIO/Job>
-#include <kio/global.h>
-#include <KIconLoader>
-
-
-BasicInfo::BasicInfo(QWizard *parent)
- : QWizardPage(parent)
- , m_validServer(false)
- , m_painter(new KPixmapSequenceOverlayPainter(this))
- , m_wizard(parent)
- , m_timer(new QTimer(this))
-{
- setupUi(this);
- icon->setPixmap(QIcon::fromTheme("owncloud").pixmap(32, 32));
-
- int lineEditHeight = server->sizeHint().height();
- QSize workingSize(lineEditHeight, lineEditHeight);
- working->setMinimumSize(workingSize);
-
- m_painter->setWidget(working);
- m_painter->setSequence(KIconLoader::global()->loadPixmapSequence(QStringLiteral("process-working"), 22));
- m_timer->setInterval(2000);
- m_timer->setSingleShot(true);
-
- username->setFocus();
- connect(server, &QLineEdit::textChanged, [=]{setWorking(true);});
- connect(server, SIGNAL(textChanged(QString)), m_timer, SLOT(start()));
- connect(m_timer, SIGNAL(timeout()), this, SLOT(checkServer()));
- connect(username, SIGNAL(textChanged(QString)), this, SIGNAL(completeChanged()));
- connect(password, SIGNAL(textChanged(QString)), this, SIGNAL(completeChanged()));
-}
-
-BasicInfo::~BasicInfo()
-{
-
-}
-
-void BasicInfo::initializePage()
-{
- QList <QWizard::WizardButton> list;
- list << QWizard::Stretch;
- list << QWizard::NextButton;
- list << QWizard::CancelButton;
- m_wizard->setButtonLayout(list);
-}
-
-bool BasicInfo::validatePage()
-{
- if (!validData()) {
- return false;
- }
-
- m_wizard->setProperty("username", username->text());
- m_wizard->setProperty("password", password->text());
- m_wizard->setProperty("server", m_server);
-
- return true;
-}
-
-bool BasicInfo::isComplete() const
-{
- return validData();
-}
-
-void BasicInfo::checkServer()
-{
- if (!server->text().isEmpty()) {
- checkServer(server->text());
- }
-}
-
-bool BasicInfo::validData() const
-{
- if (username->text().isEmpty() || password->text().isEmpty()) {
- return false;
- }
-
- if (!m_validServer) {
- return false;
- }
-
- return true;
-}
-
-void BasicInfo::checkServer(const QString &path)
-{
- QString fixedUrl;
- if (!path.startsWith("http://") && !path.startsWith("https://")) {
- fixedUrl.append("https://");
- fixedUrl.append(path);
- } else {
- fixedUrl = path;
- }
-
- m_json.clear();
-
- QUrl url(fixedUrl);
- url = url.adjusted(QUrl::StripTrailingSlash);
- url.setPath(url.path() + '/' + "status.php");
-
- if (url.host().isEmpty()) {
- return;
- }
-
- checkServer(url);
-}
-
-void BasicInfo::checkServer(const QUrl &url)
-{
- qDebug() << url;
- setResult(false);
- setWorking(true);
- KIO::TransferJob *job = KIO::get(url, KIO::NoReload, KIO::HideProgressInfo);
- job->setUiDelegate(0);
- connect(job, SIGNAL(data(KIO::Job*,QByteArray)), SLOT(dataReceived(KIO::Job*,QByteArray)));
- connect(job, SIGNAL(finished(KJob*)), this, SLOT(fileChecked(KJob*)));
-}
-
-void BasicInfo::figureOutServer(const QUrl &url)
-{
- if (/*url == QLatin1String("/") ||*/ url.isEmpty()) {
- setResult(false);
- return;
- }
-
- m_json.clear();
-
- qDebug() << "Received url to figure out:" << url;
- // This needs 2x up cause first it just removes the status.php
- // and only the second call actually moves up
- QUrl urlUp = KIO::upUrl(KIO::upUrl(url));
- urlUp.setPath(urlUp.path() + '/' + "status.php");
-
- if (urlUp != url) {
- checkServer(urlUp.adjusted(QUrl::NormalizePathSegments));
- } else {
- setResult(false);
- }
-}
-
-void BasicInfo::dataReceived(KIO::Job *job, const QByteArray &data)
-{
- m_json.append(data);
-}
-
-void BasicInfo::fileChecked(KJob *job)
-{
- KIO::TransferJob *kJob = qobject_cast<KIO::TransferJob *>(job);
- if (kJob->error()) {
- qDebug() << job->errorString();
- qDebug() << job->errorText();
- figureOutServer(kJob->url());
- return;
- }
-
- QJsonDocument parser = QJsonDocument::fromJson(m_json);
- QJsonObject map = parser.object();
- if (!map.contains("version")) {
- figureOutServer(kJob->url());
- qDebug() << "No json";
- return;
- }
-
- m_server = kJob->url();
- m_server = m_server.adjusted(QUrl::RemoveFilename);
- qDebug() << m_server;
- setResult(true);
-
- Q_EMIT completeChanged();
-}
-
-void BasicInfo::setWorking(bool start)
-{
- working->setPixmap(QPixmap());
-
- if (!start) {
- m_painter->stop();
- return;
- }
-
- m_painter->start();
-}
-
-void BasicInfo::setResult(bool result)
-{
- QString icon;
- if (result) {
- icon = "dialog-ok-apply";
- } else {
- icon = "dialog-close";
- }
-
- m_validServer = result;
- setWorking(false);
- working->setPixmap(QIcon::fromTheme(icon).pixmap(working->sizeHint()));
-}
diff --git a/plugins/owncloud-ui/pages/basicinfo.h b/plugins/owncloud-ui/pages/basicinfo.h
deleted file mode 100644
index 48615a2..0000000
--- a/plugins/owncloud-ui/pages/basicinfo.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*************************************************************************************
- * Copyright (C) 2012 by Alejandro Fiestas Olivares <[email protected]> *
- * Copyright (C) 2015 by Martin Klapetek <[email protected]> *
- * *
- * 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) any later version. *
- * *
- * 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, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
- *************************************************************************************/
-
-#ifndef BASIC_INFO_H
-#define BASIC_INFO_H
-
-#include "ui_basicinfo.h"
-
-#include <QWizardPage>
-#include <KIO/AccessManager>
-
-namespace KIO
-{
- class Job;
-};
-class KJob;
-class OwnCloudWizard;
-class KPixmapSequenceOverlayPainter;
-class QTimer;
-
-class BasicInfo : public QWizardPage, Ui_Owncloud
-{
- Q_OBJECT
-
-public:
- BasicInfo(QWizard *parent);
- virtual ~BasicInfo();
-
- virtual void initializePage();
- virtual bool validatePage();
- virtual bool isComplete() const;
-
-private Q_SLOTS:
- void checkServer();
- void fileChecked(KJob* job);
- void dataReceived(KIO::Job *job, const QByteArray &data);
-
-private:
- bool validData() const;
- void checkServer(const QString &path);
- void checkServer(const QUrl &url);
- void figureOutServer(const QUrl &url);
-
- void setWorking(bool start);
- void setResult(bool result);
-
-private:
- QUrl m_server;
- bool m_validServer;
- QByteArray m_json;
- KPixmapSequenceOverlayPainter *m_painter;
- QWizard *m_wizard;
- QTimer *m_timer;
-};
-
-#endif //BASIC_INFO_H
diff --git a/plugins/owncloud-ui/pages/basicinfo.ui b/plugins/owncloud-ui/pages/basicinfo.ui
deleted file mode 100644
index b95957e..0000000
--- a/plugins/owncloud-ui/pages/basicinfo.ui
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Owncloud</class>
- <widget class="QWidget" name="Owncloud">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>470</width>
- <height>197</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>ownCloud</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="icon">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QGridLayout" name="gridLayout">
- <item row="1" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Password:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Username</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLineEdit" name="server">
- <property name="placeholderText">
- <string>http://my.owncloudserver.org</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLineEdit" name="password">
- <property name="echoMode">
- <enum>QLineEdit::Password</enum>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Server</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="username">
- <property name="text">
- <string/>
- </property>
- <property name="placeholderText">
- <string extracomment="A typical username that is used as a hint (placeHolderText) ">JohnDoe</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QLabel" name="working">
- <property name="minimumSize">
- <size>
- <width>24</width>
- <height>24</height>
- </size>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>0</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <tabstops>
- <tabstop>username</tabstop>
- <tabstop>password</tabstop>
- <tabstop>server</tabstop>
- </tabstops>
- <resources/>
- <connections/>
-</ui>
diff --git a/plugins/owncloud-ui/pages/connecting.cpp b/plugins/owncloud-ui/pages/connecting.cpp
deleted file mode 100644
index 89f6c0a..0000000
--- a/plugins/owncloud-ui/pages/connecting.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*************************************************************************************
- * Copyright (C) 2012 by Alejandro Fiestas Olivares <[email protected]> *
- * Copyright (C) 2015 by Martin Klapetek <[email protected]> *
- * *
- * 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) any later version. *
- * *
- * 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, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
- *************************************************************************************/
-
-#include "connecting.h"
-#include "../owncloud.h"
-
-#include <QDebug>
-
-#include <KPixmapSequenceOverlayPainter>
-#include <KIO/Job>
-
-Connecting::Connecting(QWizard *parent)
- : QWizardPage(parent)
- , m_wizard(parent)
-{
- setupUi(this);
- KPixmapSequenceOverlayPainter *painter = new KPixmapSequenceOverlayPainter(this);
- painter->setWidget(working);
- painter->start();
-}
-
-Connecting::~Connecting()
-{
-
-}
-
-void Connecting::initializePage()
-{
- QList <QWizard::WizardButton> list;
- list << QWizard::Stretch;
- list << QWizard::BackButton;
- list << QWizard::NextButton;
- list << QWizard::CancelButton;
- m_wizard->setButtonLayout(list);
-
- server->setText(m_wizard->property("server").toUrl().host());
-
- QMetaObject::invokeMethod(this, "checkAuth", Qt::QueuedConnection);
-}
-
-void Connecting::checkAuth()
-{
- QUrl url(m_wizard->property("server").toUrl());
-
- url.setUserName(m_wizard->property("username").toString());
- url.setPassword(m_wizard->property("password").toString());
-
- url = url.adjusted(QUrl::StripTrailingSlash);
- url.setPath(url.path() + '/' + "remote.php/webdav/");
- qDebug() << "FinalUrL: " << url;
- KIO::TransferJob *job = KIO::get(url, KIO::NoReload, KIO::HideProgressInfo);
- connect(job, SIGNAL(finished(KJob*)), this, SLOT(httpResult(KJob*)));
-
- job->setUiDelegate(0);
-}
-
-void Connecting::httpResult(KJob *job)
-{
- if (job->error()) {
- qDebug() << job->errorString();
- qDebug() << job->errorText();
- }
-
- KIO::TransferJob *kJob = qobject_cast<KIO::TransferJob*>(job);
- if (kJob->isErrorPage()) {
- error->setText(i18n("Unable to authenticate using the provided username and password"));
- return;
- }
-
- m_wizard->next();
-}
diff --git a/plugins/owncloud-ui/pages/connecting.h b/plugins/owncloud-ui/pages/connecting.h
deleted file mode 100644
index 9beef9e..0000000
--- a/plugins/owncloud-ui/pages/connecting.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*************************************************************************************
- * Copyright (C) 2012 by Alejandro Fiestas Olivares <[email protected]> *
- * Copyright (C) 2015 by Martin Klapetek <[email protected]> *
- * *
- * 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) any later version. *
- * *
- * 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, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
- *************************************************************************************/
-
-#ifndef CONNECTING_H
-#define CONNECTING_H
-
-#include "ui_connecting.h"
-
-#include <QWizardPage>
-#include <KJob>
-
-class KJob;
-
-class Connecting : public QWizardPage, Ui::Connecting
-{
- Q_OBJECT
-
-public:
- explicit Connecting(QWizard *parent);
- virtual ~Connecting();
-
- virtual void initializePage();
-
-private Q_SLOTS:
- void checkAuth();
- void httpResult(KJob *job);
-
-private:
- QWizard *m_wizard;
-};
-
-#endif //CONNECTING_H
diff --git a/plugins/owncloud-ui/pages/connecting.ui b/plugins/owncloud-ui/pages/connecting.ui
deleted file mode 100644
index ade98bc..0000000
--- a/plugins/owncloud-ui/pages/connecting.ui
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Connecting</class>
- <widget class="QWidget" name="Connecting">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>300</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QWidget" name="working" native="true">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>22</width>
- <height>22</height>
- </size>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>10</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="connecting">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Connecting to:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="server">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QLabel" name="error">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/plugins/owncloud-ui/pages/oservices.cpp b/plugins/owncloud-ui/pages/oservices.cpp
deleted file mode 100644
index 0d49b7b..0000000
--- a/plugins/owncloud-ui/pages/oservices.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/*************************************************************************************
- * Copyright (C) 2012 by Alejandro Fiestas Olivares <[email protected]> *
- * Copyright (C) 2015 by Martin Klapetek <[email protected]> *
- * *
- * 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) any later version. *
- * *
- * 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, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
- *************************************************************************************/
-
-#include "oservices.h"
-#include "../owncloud.h"
-
-#include <QCheckBox>
-#include <QVariant>
-
-OServices::OServices(QWizard *wizard)
- : QWizardPage()
- , m_wizard(wizard)
-{
- setupUi(this);
-}
-
-OServices::~OServices()
-{
-
-}
-
-void OServices::initializePage()
-{
- QList <QWizard::WizardButton> list;
- list << QWizard::Stretch;
- list << QWizard::FinishButton;
- m_wizard->setButtonLayout(list);
-
-// addOption("File", i18n("Files"));
-// addOption("Calendar", i18n("Calendar"));
- addOption("owncloud-contacts", i18n("Contacts"));
-}
-
-void OServices::addOption(const QString &id, const QString &displayText)
-{
- QCheckBox *option = new QCheckBox(displayText, this);
- option->setChecked(true);
- option->setProperty("id", id);
- connect(option, &QCheckBox::toggled, this, &OServices::optionToggled);
-
- d_layout->addWidget(option);
-}
-
-void OServices::optionToggled(bool checked)
-{
- if (!sender()) {
- return;
- }
-
- const QString service = sender()->property("id").toString();
-
- if (checked) {
- m_disabledServices.removeAll(service);
- } else {
- m_disabledServices.append(service);
- }
-}
-
-bool OServices::validatePage()
-{
- m_wizard->setProperty("disabledServices", m_disabledServices);
-
- return true;
-}
diff --git a/plugins/owncloud-ui/pages/oservices.h b/plugins/owncloud-ui/pages/oservices.h
deleted file mode 100644
index 4fd9876..0000000
--- a/plugins/owncloud-ui/pages/oservices.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*************************************************************************************
- * Copyright (C) 2012 by Alejandro Fiestas Olivares <[email protected]> *
- * Copyright (C) 2015 by Martin Klapetek <[email protected]> *
- * *
- * 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) any later version. *
- * *
- * 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, write to the Free Software *
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
- *************************************************************************************/
-
-#ifndef OSERVICES_H
-#define OSERVICES_H
-
-#include "ui_oservices.h"
-#include <QWizardPage>
-
-class OServices : public QWizardPage, Ui::Services
-{
- Q_OBJECT
-
-public:
- explicit OServices(QWizard *wizard);
- virtual ~OServices();
-
- virtual void initializePage();
- virtual bool validatePage();
-
-private Q_SLOTS:
- void optionToggled(bool checked);
-
-private:
- void addOption(const QString &id, const QString &displayText);
-
-private:
- QWizard *m_wizard;
- QStringList m_disabledServices;
-};
-
-#endif //OSERVICES_H
diff --git a/plugins/owncloud-ui/pages/oservices.ui b/plugins/owncloud-ui/pages/oservices.ui
deleted file mode 100644
index 940ded2..0000000
--- a/plugins/owncloud-ui/pages/oservices.ui
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Services</class>
- <widget class="QWidget" name="Services">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>517</width>
- <height>408</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Select what services you want to activate</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QScrollArea" name="scrollArea">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="widgetResizable">
- <bool>true</bool>
- </property>
- <widget class="QWidget" name="scrollAreaWidgetContents">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>501</width>
- <height>173</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <item>
- <layout class="QVBoxLayout" name="d_layout"/>
- </item>
- <item>
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>159</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/plugins/owncloud-ui/qmlhelper.h b/plugins/owncloud-ui/qmlhelper.h
index 36be67a..8c6201c 100644
--- a/plugins/owncloud-ui/qmlhelper.h
+++ b/plugins/owncloud-ui/qmlhelper.h
@@ -20,8 +20,7 @@
#define QMLHELPER_H
#include <QObject>
-
-#include <KIO/AccessManager>
+#include <QStringList>
namespace KIO
{