Commit b5ba599e authored by Martin Klapetek's avatar Martin Klapetek
Browse files

[owncloud] Implement the service selection as the last step

parent 6998a40d
......@@ -114,6 +114,10 @@ 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));
......
......@@ -20,7 +20,8 @@
#include "oservices.h"
#include "../owncloud.h"
// #include "google/pages/serviceoption.h"
#include <QCheckBox>
#include <QVariant>
OServices::OServices(QWizard *wizard)
: QWizardPage()
......@@ -41,23 +42,39 @@ void OServices::initializePage()
list << QWizard::FinishButton;
m_wizard->setButtonLayout(list);
addOption("File", i18n("Files"));
addOption("Calendar", i18n("Calendar"));
addOption("Contact", i18n("Contacts"));
// addOption("File", i18n("Files"));
// addOption("Calendar", i18n("Calendar"));
addOption("owncloud-contacts", i18n("Contacts"));
}
void OServices::addOption(const QString &text, const QString &displayText)
void OServices::addOption(const QString &id, const QString &displayText)
{
// ServiceOption *option = new ServiceOption(text, displayText, this);
// option->setBinary(true);
// connect(option, SIGNAL(toggled(QString, bool)), this, SLOT(optionToggled(QString, bool)));
//
// m_wizard->activateOption(text, true);
//
// d_layout->addWidget(option);
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(const QString &name, bool checked)
void OServices::optionToggled(bool checked)
{
// m_wizard->activateOption(name, 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;
}
......@@ -32,15 +32,17 @@ public:
virtual ~OServices();
virtual void initializePage();
virtual bool validatePage();
private Q_SLOTS:
void optionToggled(const QString &name, bool checked);
void optionToggled(bool checked);
private:
void addOption(const QString &text, const QString &displayText);
void addOption(const QString &id, const QString &displayText);
private:
QWizard *m_wizard;
QStringList m_disabledServices;
};
#endif //OSERVICES_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment