Git commit 326c4099a02c6550c98ac8f180f97bbeed9b3c21 by Alex Fiestas. Committed on 17/04/2012 at 16:27. Pushed by mklapetek into branch 'master'. Add the service page C +18 -40 oservices.cpp [from: owncloud.cpp - 050% similarity] A +45 -0 oservices.h [License: GPL (v2+)] M +6 -0 owncloud.cpp http://commits.kde.org/kaccounts-providers/326c4099a02c6550c98ac8f180f97bbe= ed9b3c21 diff --git a/owncloud.cpp b/oservices.cpp similarity index 50% copy from owncloud.cpp copy to oservices.cpp index 022f47e..f3a0915 100644 --- a/owncloud.cpp +++ b/oservices.cpp @@ -16,63 +16,41 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1= 301, USA * *************************************************************************= ************/ = +#include "oservices.h" #include "owncloud.h" -#include "basicinfo.h" -#include "connecting.h" = -#include -#include -#include +#include "google/serviceoption.h" = -OwnCloudWizard::OwnCloudWizard(QWidget* parent, Qt::WindowFlags flags): QW= izard(parent, flags) +OServices::OServices(OwnCloudWizard* wizard) + : QWizardPage() + , m_wizard(wizard) { - BasicInfo *basicInfo =3D new BasicInfo(this); - Connecting *connecting =3D new Connecting(this); - - addPage(basicInfo); - addPage(connecting); - - setButton(QWizard::BackButton, new KPushButton(KStandardGuiItem::back(= KStandardGuiItem::UseRTL))); - setButton(QWizard::NextButton, new KPushButton(KStandardGuiItem::forwa= rd(KStandardGuiItem::UseRTL))); - setButton(QWizard::FinishButton, new KPushButton(KStandardGuiItem::app= ly())); - setButton(QWizard::CancelButton, new KPushButton(KStandardGuiItem::can= cel())); - - //We do not want "Forward" as text - setButtonText(QWizard::NextButton, i18nc("Action to go to the next pag= e on the wizard", "Next")); - setButtonText(QWizard::FinishButton, i18nc("Action to finish the wizar= d", "Finish")); + setupUi(this); } = -OwnCloudWizard::~OwnCloudWizard() +OServices::~OServices() { = } = -void OwnCloudWizard::setUsername(const QString& username) +void OServices::initializePage() { - m_username =3D username; + addOption("File", i18n("Chat")); + addOption("Calendar", i18n("Calendar")); + addOption("Contact", i18n("Contacts")); } = -void OwnCloudWizard::setPassword(const QString& password) +void OServices::addOption(const QString& text, const QString& displayText) { - m_password =3D password; -} + ServiceOption *option =3D new ServiceOption(text, displayText, this); + connect(option, SIGNAL(toggled(QString, bool)), this, SLOT(optionToggl= ed(QString, bool))); = -void OwnCloudWizard::setServer(const KUrl& server) -{ - m_server =3D server; -} + m_wizard->activateOption(text, true); = -const QString OwnCloudWizard::username() const -{ - return m_username; + d_layout->addWidget(option); } = -const QString OwnCloudWizard::password() const +void OServices::optionToggled(const QString& name, bool checked) { - return m_password; + m_wizard->activateOption(name, checked); } - -const KUrl OwnCloudWizard::server() const -{ - return m_server; -} \ No newline at end of file diff --git a/oservices.h b/oservices.h new file mode 100644 index 0000000..ba405de --- /dev/null +++ b/oservices.h @@ -0,0 +1,45 @@ +/*************************************************************************= ************ + * Copyright (C) 2012 by Alejandro Fiestas Olivares = * + * = * + * 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-1= 301, USA * + *************************************************************************= ************/ + +#ifndef OSERVICES_H +#define OSERVICES_H + +#include "ui_services.h" +#include + +class OwnCloudWizard; +class OServices : public QWizardPage, Ui::Services +{ + Q_OBJECT + public: + explicit OServices(OwnCloudWizard *wizard); + virtual ~OServices(); + + virtual void initializePage(); + + private Q_SLOTS: + void optionToggled(const QString &name, bool checked); + + private: + void addOption(const QString& text, const QString& displayText); + + private: + OwnCloudWizard *m_wizard; +}; + +#endif //OSERVICES_H \ No newline at end of file diff --git a/owncloud.cpp b/owncloud.cpp index 022f47e..152d0ea 100644 --- a/owncloud.cpp +++ b/owncloud.cpp @@ -19,18 +19,24 @@ #include "owncloud.h" #include "basicinfo.h" #include "connecting.h" +#include "oservices.h" = #include #include #include = +#include + +using namespace KWallet; OwnCloudWizard::OwnCloudWizard(QWidget* parent, Qt::WindowFlags flags): QW= izard(parent, flags) { BasicInfo *basicInfo =3D new BasicInfo(this); Connecting *connecting =3D new Connecting(this); + OServices *services =3D new OServices(this); = addPage(basicInfo); addPage(connecting); + addPage(services); = setButton(QWizard::BackButton, new KPushButton(KStandardGuiItem::back(= KStandardGuiItem::UseRTL))); setButton(QWizard::NextButton, new KPushButton(KStandardGuiItem::forwa= rd(KStandardGuiItem::UseRTL)));