[SCM] ktp-accounts-kcm packaging branch, master, updated. debian/15.12.1-1-1157-gc4589c5

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:00:56 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-accounts-kcm.git;a=commitdiff;h=5207551

The following commit has been merged in the master branch:
commit 5207551faeae5ef54c55c492f84debb8a2a97374
Author: Florian Reinhard <florian.reinhard at googlemail.com>
Date:   Wed Dec 28 19:26:47 2011 +0100

    New fancy shiny AddAccount dialog.
    
    Tells you if a major telepathy connection manager is missing. (haze/gabble)
    
    REVIEW: 103562
    Reviewed-by: David Edmundson <kde at davidedmundson.co.uk>
    Reviewed-by: Martin Klapetek <martin.klapetek at gmail.com>
---
 src/KCMTelepathyAccounts/CMakeLists.txt            |   5 +
 src/KCMTelepathyAccounts/profile-item.cpp          |   2 +-
 src/KCMTelepathyAccounts/profile-item.h            |   2 +-
 src/KCMTelepathyAccounts/profile-select-widget.cpp |   4 +-
 src/KCMTelepathyAccounts/profile-select-widget.h   |   4 +-
 .../simple-profile-select-widget.cpp               | 192 +++++++++++++++++++++
 ...ect-widget.h => simple-profile-select-widget.h} |  19 +-
 .../simple-profile-select-widget.ui                |  54 ++++++
 src/add-account-assistant.cpp                      | 112 ++++++++----
 src/add-account-assistant.h                        |   5 +-
 10 files changed, 353 insertions(+), 46 deletions(-)

diff --git a/src/KCMTelepathyAccounts/CMakeLists.txt b/src/KCMTelepathyAccounts/CMakeLists.txt
index 0991b4d..d886b45 100644
--- a/src/KCMTelepathyAccounts/CMakeLists.txt
+++ b/src/KCMTelepathyAccounts/CMakeLists.txt
@@ -13,6 +13,7 @@ set (libktpaccountskcminternal_SRCS
      generic-advanced-options-widget.cpp
      account-edit-widget.cpp
      profile-select-widget.cpp
+     simple-profile-select-widget.cpp
      profile-list-model.cpp
      profile-item.cpp
      parameter-edit-widget.cpp
@@ -34,6 +35,7 @@ set (libktpaccountskcminternal_HDRS
      plugin-macros.h
      plugin-manager.h
      profile-select-widget.h
+     simple-profile-select-widget.h
      profile-item.h
      parameter-edit-widget.h
      parameter-edit-model.h
@@ -60,6 +62,7 @@ kde4_add_ui_files (libktpaccountskcminternal_SRCS
                    account-edit-widget.ui
                    parameter-edit-widget.ui
                    profile-select-widget.ui
+                   simple-profile-select-widget.ui
 )
 
 kde4_add_library (ktpaccountskcminternal
@@ -70,9 +73,11 @@ kde4_add_library (ktpaccountskcminternal
 target_link_libraries (ktpaccountskcminternal
                        ${QT_LIBRARIES}
                        ${KDE4_KDEUI_LIBS}
+                       ${KDE4_KIO_LIBS}
                        ${TELEPATHY_QT4_LIBRARIES}
 )
 
+
 set_target_properties (ktpaccountskcminternal PROPERTIES
                        VERSION ${GENERIC_LIB_VERSION}
                        SOVERSION ${GENERIC_LIB_SOVERSION}
diff --git a/src/KCMTelepathyAccounts/profile-item.cpp b/src/KCMTelepathyAccounts/profile-item.cpp
index de42b52..099c71e 100644
--- a/src/KCMTelepathyAccounts/profile-item.cpp
+++ b/src/KCMTelepathyAccounts/profile-item.cpp
@@ -28,7 +28,7 @@
 #include <KDebug>
 #include <KIcon>
 
-ProfileItem::ProfileItem(const Tp::ProfilePtr &profile, ProfileListModel *parent)
+ProfileItem::ProfileItem(const Tp::ProfilePtr &profile, QObject *parent)
  : QObject(parent),
    m_profile(profile),
    m_icon(0)
diff --git a/src/KCMTelepathyAccounts/profile-item.h b/src/KCMTelepathyAccounts/profile-item.h
index dc492a5..d1fabc2 100644
--- a/src/KCMTelepathyAccounts/profile-item.h
+++ b/src/KCMTelepathyAccounts/profile-item.h
@@ -37,7 +37,7 @@ class KCM_TELEPATHY_ACCOUNTS_EXPORT ProfileItem : public QObject
     Q_DISABLE_COPY(ProfileItem);
 
 public:
-    explicit ProfileItem(const Tp::ProfilePtr &profile, ProfileListModel *parent);
+    explicit ProfileItem(const Tp::ProfilePtr &profile, QObject *parent);
     virtual ~ProfileItem();
 
     QString serviceName() const;
diff --git a/src/KCMTelepathyAccounts/profile-select-widget.cpp b/src/KCMTelepathyAccounts/profile-select-widget.cpp
index dc8b9cc..0800df3 100644
--- a/src/KCMTelepathyAccounts/profile-select-widget.cpp
+++ b/src/KCMTelepathyAccounts/profile-select-widget.cpp
@@ -85,7 +85,7 @@ ProfileSelectWidget::ProfileSelectWidget(QWidget *parent, bool enableSalut)
             SLOT(onSelectionChanged(QItemSelection)));
     connect(d->ui->profileListView,
             SIGNAL(doubleClicked(QModelIndex)),
-            SIGNAL(profileDoubleClicked()));
+            SIGNAL(profileChosen()));
 
     d->profileManager = Tp::ProfileManager::create(QDBusConnection::sessionBus());
 
@@ -145,7 +145,7 @@ void ProfileSelectWidget::onSelectionChanged(const QItemSelection &selected)
 {
     kDebug();
 
-    Q_EMIT profileGotSelected(!selected.isEmpty());
+    Q_EMIT profileSelected(!selected.isEmpty());
 }
 
 
diff --git a/src/KCMTelepathyAccounts/profile-select-widget.h b/src/KCMTelepathyAccounts/profile-select-widget.h
index 52c6f89..8f3ad2a 100644
--- a/src/KCMTelepathyAccounts/profile-select-widget.h
+++ b/src/KCMTelepathyAccounts/profile-select-widget.h
@@ -50,8 +50,8 @@ private Q_SLOTS:
     void onSelectionChanged(const QItemSelection &selected);
 
 Q_SIGNALS:
-    void profileGotSelected(bool selected);
-    void profileDoubleClicked();
+    void profileSelected(bool selected);
+    void profileChosen();
 
 private:
     class Private;
diff --git a/src/KCMTelepathyAccounts/simple-profile-select-widget.cpp b/src/KCMTelepathyAccounts/simple-profile-select-widget.cpp
new file mode 100644
index 0000000..228232d
--- /dev/null
+++ b/src/KCMTelepathyAccounts/simple-profile-select-widget.cpp
@@ -0,0 +1,192 @@
+/*
+ * This file is part of telepathy-accounts-kcm
+ *
+ * Copyright (C) 2011 Florian Reinhard <florian.reinhard at googlemail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "simple-profile-select-widget.h"
+
+#include "profile-item.h"
+#include "profile-list-model.h"
+
+#include "ui_simple-profile-select-widget.h"
+
+#include <KDebug>
+
+#include <TelepathyQt/PendingReady>
+#include <TelepathyQt/ProfileManager>
+#include <TelepathyQt/Feature>
+
+#include <QSortFilterProxyModel>
+#include <QItemSelectionModel>
+#include <QCommandLinkButton>
+#include <QSignalMapper>
+
+class SimpleProfileSelectWidget::Private
+{
+public:
+    Private()
+     : profileManager(0),
+       ui(0),
+       signalMapper(0),
+       profileItem(0)
+    {
+        kDebug();
+    }
+
+    Tp::ProfileManagerPtr profileManager;
+    Ui::SimpleProfileSelectWidget *ui;
+    QSignalMapper *signalMapper;
+    ProfileItem *profileItem;
+    QString profileName;
+};
+
+SimpleProfileSelectWidget::SimpleProfileSelectWidget(QWidget *parent)
+ : QWidget(parent),
+   d(new Private)
+{
+    kDebug();
+
+    // Set up the models
+    d->signalMapper = new QSignalMapper(this);
+
+    // Set up the widget
+    d->ui = new Ui::SimpleProfileSelectWidget;
+    d->ui->setupUi(this);
+
+    // Create the buttons for the Major Profiles
+    QCommandLinkButton *buttonJabber = new QCommandLinkButton("Jabber / XMPP");
+    buttonJabber->setIcon(KIcon("im-jabber"));
+    buttonJabber->setIconSize(QSize(32,32));
+
+    QCommandLinkButton *buttonGTalk = new QCommandLinkButton("Google Talk");
+    buttonGTalk->setIcon(KIcon("im-google-talk"));
+    buttonGTalk->setIconSize(QSize(32,32));
+
+    QCommandLinkButton *buttonFacebook = new QCommandLinkButton("Facebook Chat");
+    buttonFacebook->setIcon(KIcon("im-facebook"));
+    buttonFacebook->setIconSize(QSize(32,32));
+
+    QCommandLinkButton *buttonIcq = new QCommandLinkButton("ICQ");
+    buttonIcq->setIcon(KIcon("im-icq"));
+    buttonIcq->setIconSize(QSize(32,32));
+
+    QCommandLinkButton *buttonMsn = new QCommandLinkButton("Windows Live Messenger");
+    buttonMsn->setIcon(KIcon("im-msn"));
+    buttonMsn->setIconSize(QSize(32,32));
+
+    QCommandLinkButton *buttonOthers = new QCommandLinkButton("Others", "AOL, Gadu-Gadu, IRC, Yahoo and more...");
+    buttonOthers->setIcon(KIcon("go-next"));
+    buttonOthers->setIconSize(QSize(32,32));
+
+    // Add them to the SignalMapper
+    d->signalMapper->setMapping(buttonJabber,   "jabber");
+    d->signalMapper->setMapping(buttonGTalk,    "google-talk");
+    d->signalMapper->setMapping(buttonFacebook, "facebook");
+    d->signalMapper->setMapping(buttonIcq,      "haze-icq");
+    d->signalMapper->setMapping(buttonMsn,      "haze-msn");
+
+    // Connect them to the SignalMapper
+    connect(buttonJabber,   SIGNAL(clicked()), d->signalMapper, SLOT(map()));
+    connect(buttonGTalk,    SIGNAL(clicked()), d->signalMapper, SLOT(map()));
+    connect(buttonFacebook, SIGNAL(clicked()), d->signalMapper, SLOT(map()));
+    connect(buttonIcq,      SIGNAL(clicked()), d->signalMapper, SLOT(map()));
+    connect(buttonMsn,      SIGNAL(clicked()), d->signalMapper, SLOT(map()));
+    connect(buttonOthers,   SIGNAL(clicked()), this,            SIGNAL(othersChosen()));
+
+    connect(d->signalMapper,SIGNAL(mapped(const QString &)),
+            this,           SLOT(onProfileClicked(const QString &)));
+
+    // Add them to the Layout
+    d->ui->verticalLayout->addWidget(buttonJabber);
+    d->ui->verticalLayout->addWidget(buttonGTalk);
+    d->ui->verticalLayout->addWidget(buttonFacebook);
+    d->ui->verticalLayout->addWidget(buttonIcq);
+    d->ui->verticalLayout->addWidget(buttonMsn);
+    d->ui->verticalLayout->addWidget(buttonOthers);
+    d->ui->verticalLayout->addStretch();
+
+    // Disable everything until Tp::ProfileManager is ready
+    d->ui->verticalLayout->setEnabled(false);
+
+    d->profileManager = Tp::ProfileManager::create(QDBusConnection::sessionBus());
+
+    // FIXME: Until all distros ship correct profile files, we should fake them
+    connect(d->profileManager->becomeReady(Tp::Features() << Tp::ProfileManager::FeatureFakeProfiles),
+            SIGNAL(finished(Tp::PendingOperation*)),
+            SLOT(onProfileManagerReady(Tp::PendingOperation*)));
+}
+
+SimpleProfileSelectWidget::~SimpleProfileSelectWidget()
+{
+    kDebug();
+
+    delete d->ui;
+    delete d;
+}
+
+void SimpleProfileSelectWidget::onProfileManagerReady(Tp::PendingOperation *op)
+{
+    kDebug();
+
+    // Check the pending operation completed successfully.
+    if (op->isError()) {
+        kDebug() << "becomeReady() failed:" << op->errorName() << op->errorMessage();
+        return;
+    }
+    else {
+        // Enable the buttons
+        d->ui->verticalLayout->setEnabled(true);
+    }
+}
+
+// Return the selected ProfileItem or 0 if nothing is selected.
+ProfileItem *SimpleProfileSelectWidget::selectedProfile()
+{
+    kDebug();
+
+    if (d->profileItem != NULL) {
+        delete d->profileItem;
+    }
+
+    Tp::ProfilePtr profilePtr = d->profileManager->profileForService(d->profileName);
+
+    if (profilePtr.isNull()) {
+        kDebug() << "Profile is missing, we need to install some packages here.";
+        return 0;
+    }
+    else {
+        d->profileItem = new ProfileItem(profilePtr, this);
+        return d->profileItem;
+    }
+
+}
+
+// FIXME: before we proceed here, we should check if there's everything installed we need.
+void SimpleProfileSelectWidget::onProfileClicked(QString profileName)
+{
+    kDebug();
+
+    d->profileName = profileName;
+
+    kDebug() << "Selected profile: " << d->profileName;
+
+    Q_EMIT profileChosen();
+}
+
+#include "simple-profile-select-widget.moc"
+
diff --git a/src/KCMTelepathyAccounts/profile-select-widget.h b/src/KCMTelepathyAccounts/simple-profile-select-widget.h
similarity index 68%
copy from src/KCMTelepathyAccounts/profile-select-widget.h
copy to src/KCMTelepathyAccounts/simple-profile-select-widget.h
index 52c6f89..88caa0a 100644
--- a/src/KCMTelepathyAccounts/profile-select-widget.h
+++ b/src/KCMTelepathyAccounts/simple-profile-select-widget.h
@@ -1,8 +1,7 @@
 /*
  * This file is part of telepathy-accounts-kcm
  *
- * Copyright (C) 2009 Collabora Ltd. <info at collabora.com>
- * Copyright (C) 2011 Thomas Richard <thomas.richard at proan.be>
+ * Copyright (C) 2011 Florian Reinhard <florian.reinhard at googlemail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -19,8 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef TELEPATHY_ACCOUNTS_KCM_PROFILE_SELECT_WIDGET_H
-#define TELEPATHY_ACCOUNTS_KCM_PROFILE_SELECT_WIDGET_H
+#ifndef TELEPATHY_ACCOUNTS_KCM_SIMPLE_PROFILE_SELECT_WIDGET_H
+#define TELEPATHY_ACCOUNTS_KCM_SIMPLE_PROFILE_SELECT_WIDGET_H
 
 #include "kcm_telepathy_accounts_export.h"
 
@@ -35,23 +34,23 @@ class QItemSelection;
 
 class QModelIndex;
 
-class KCM_TELEPATHY_ACCOUNTS_EXPORT ProfileSelectWidget : public QWidget
+class KCM_TELEPATHY_ACCOUNTS_EXPORT SimpleProfileSelectWidget : public QWidget
 {
     Q_OBJECT
 
 public:
-    explicit ProfileSelectWidget(QWidget *parent = 0, bool enableSalut = false);
-    ~ProfileSelectWidget();
+    explicit SimpleProfileSelectWidget(QWidget *parent = 0);
+    ~SimpleProfileSelectWidget();
 
     ProfileItem *selectedProfile();
 
 private Q_SLOTS:
     void onProfileManagerReady(Tp::PendingOperation *op);
-    void onSelectionChanged(const QItemSelection &selected);
+    void onProfileClicked(QString profileName);
 
 Q_SIGNALS:
-    void profileGotSelected(bool selected);
-    void profileDoubleClicked();
+    void profileChosen();
+    void othersChosen();
 
 private:
     class Private;
diff --git a/src/KCMTelepathyAccounts/simple-profile-select-widget.ui b/src/KCMTelepathyAccounts/simple-profile-select-widget.ui
new file mode 100644
index 0000000..5d36e39
--- /dev/null
+++ b/src/KCMTelepathyAccounts/simple-profile-select-widget.ui
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SimpleProfileSelectWidget</class>
+ <widget class="QWidget" name="SimpleProfileSelectWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>98</width>
+    <height>28</height>
+   </rect>
+  </property>
+  <property name="font">
+   <font>
+    <pointsize>12</pointsize>
+    <weight>50</weight>
+    <bold>false</bold>
+   </font>
+  </property>
+  <layout class="QHBoxLayout" name="horizontalLayout">
+   <item>
+    <spacer name="horizontalSpacer_2">
+     <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>
+    <layout class="QVBoxLayout" name="verticalLayout"/>
+   </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>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src/add-account-assistant.cpp b/src/add-account-assistant.cpp
index dee6e88..6ca2993 100644
--- a/src/add-account-assistant.cpp
+++ b/src/add-account-assistant.cpp
@@ -30,6 +30,7 @@
 #include "KCMTelepathyAccounts/plugin-manager.h"
 #include "KCMTelepathyAccounts/profile-item.h"
 #include "KCMTelepathyAccounts/profile-select-widget.h"
+#include "KCMTelepathyAccounts/simple-profile-select-widget.h"
 
 #include <KDebug>
 #include <KLocale>
@@ -52,7 +53,8 @@ public:
        profileSelectWidget(0),
        accountEditWidget(0),
        pageOne(0),
-       pageTwo(0)
+       pageTwo(0),
+       pageThree(0)
     {
         kDebug();
     }
@@ -61,10 +63,12 @@ public:
     Tp::ConnectionManagerPtr connectionManager;
     ProfileItem *currentProfileItem;
     ProfileSelectWidget *profileSelectWidget;
+    SimpleProfileSelectWidget *simpleProfileSelectWidget;
     AccountEditWidget *accountEditWidget;
-    QWidget *pageTwoWidget;
+    QWidget *pageThreeWidget;
     KPageWidgetItem *pageOne;
     KPageWidgetItem *pageTwo;
+    KPageWidgetItem *pageThree;
 };
 
 AddAccountAssistant::AddAccountAssistant(Tp::AccountManagerPtr accountManager, QWidget *parent)
@@ -76,26 +80,43 @@ AddAccountAssistant::AddAccountAssistant(Tp::AccountManagerPtr accountManager, Q
     d->accountManager = accountManager;
 
     // Set up the pages of the Assistant.
-    d->profileSelectWidget = new ProfileSelectWidget(this);
-    d->pageOne = new KPageWidgetItem(d->profileSelectWidget);
+    d->profileSelectWidget       = new ProfileSelectWidget(this);
+    d->simpleProfileSelectWidget = new SimpleProfileSelectWidget(this);
+    d->pageOne = new KPageWidgetItem(d->simpleProfileSelectWidget);
+    d->pageTwo = new KPageWidgetItem(d->profileSelectWidget);
+
     d->pageOne->setHeader(i18n("Step 1: Select an Instant Messaging Network."));
+    d->pageTwo->setHeader(i18n("Step 1: Select an Instant Messaging Network."));
+
     setValid(d->pageOne, false);
+    setValid(d->pageTwo, false);
+
     connect(d->profileSelectWidget,
-            SIGNAL(profileGotSelected(bool)),
+            SIGNAL(profileSelected(bool)),
             SLOT(onProfileSelected(bool)));
     connect(d->profileSelectWidget,
-            SIGNAL(profileDoubleClicked()),
-            SLOT(next()));
+            SIGNAL(profileChosen()),
+            SLOT(goToPageThree()));
+
+    connect(d->simpleProfileSelectWidget,
+            SIGNAL(profileChosen()),
+            SLOT(goToPageThree()));
+    connect(d->simpleProfileSelectWidget,
+            SIGNAL(othersChosen()),
+            SLOT(goToPageTwo()));
 
     // we will build the page widget later, but the constructor of
     // KPageWidgetItem requires the widget at this point, so...
-    d->pageTwoWidget = new QWidget(this);
-    new QHBoxLayout(d->pageTwoWidget);
-    d->pageTwo = new KPageWidgetItem(d->pageTwoWidget);
-    d->pageTwo->setHeader(i18n("Step 2: Fill in the required Parameters."));
+    d->pageThreeWidget = new QWidget(this);
+    new QHBoxLayout(d->pageThreeWidget);
+    d->pageThree = new KPageWidgetItem(d->pageThreeWidget);
+    d->pageThree->setHeader(i18n("Step 2: Fill in the required Parameters."));
 
     addPage(d->pageOne);
     addPage(d->pageTwo);
+    addPage(d->pageThree);
+
+    KAssistantDialog::setAppropriate(d->pageTwo, false);
 
     resize(QSize(400, 480));
 }
@@ -107,21 +128,30 @@ AddAccountAssistant::~AddAccountAssistant()
     delete d;
 }
 
-// FIXME: This method *works*, but is really not very elegant. I don't want to waste time tidying it
-// up at the moment, but I'm sure it could have a *lot* less code in it if it were tidied up at some
-// point in the future.
-void AddAccountAssistant::next()
+void AddAccountAssistant::goToPageTwo()
 {
     kDebug();
 
-    // Check which page we are on.
-    if (currentPage() == d->pageOne) {
-        kDebug() << "Current page: Page 1.";
+    KAssistantDialog::setAppropriate(d->pageTwo, true);
+    KAssistantDialog::next();
+}
 
-        Q_ASSERT(d->profileSelectWidget->selectedProfile());
+void AddAccountAssistant::goToPageThree()
+{
+    kDebug();
+    ProfileItem *selectedItem;
 
-        ProfileItem *selectedItem = d->profileSelectWidget->selectedProfile();
+    if (currentPage() == d->pageTwo) {
+        kDebug() << "Current Page seems to be page two";
+        selectedItem = d->profileSelectWidget->selectedProfile();
+    }
+    else {
+        kDebug() << "Current Page seems to be page one";
+        selectedItem = d->simpleProfileSelectWidget->selectedProfile();
+    }
 
+    // FIXME: untill packages for missing profiles aren't installed this needs to stay here
+    if (selectedItem != 0) {
         // Set up the next page.
         if(d->currentProfileItem != selectedItem) {
             d->currentProfileItem = selectedItem;
@@ -132,17 +162,41 @@ void AddAccountAssistant::next()
                     SLOT(onConnectionManagerReady(Tp::PendingOperation*)));
         }
         else {
-            pageTwo();
+            pageThree();
         }
     }
+    else {
+        KMessageBox::error(this, i18n("To connect to this IM network, you need to install additional plugins. Please install the telepathy-haze and telepathy-gabble packages using your package manager."),i18n("Missing Telepathy Connection Manager"));
+    }
+}
+
+void AddAccountAssistant::next()
+{
+    kDebug();
+    // the next button is disabled on the first page
+    // so ::next is called from the second page
+    // so we go to page three now
+    goToPageThree();
+}
+
+void AddAccountAssistant::back()
+{
+    kDebug();
+
+    // Disable pageTwo once we're going back to pageOne
+    if (currentPage() == d->pageTwo) {
+        KAssistantDialog::setAppropriate(d->pageTwo, false);
+    }
+
+    KAssistantDialog::back();
 }
 
 void AddAccountAssistant::accept()
 {
     kDebug();
 
-    // Check we are being called from page 2.
-    if (currentPage() != d->pageTwo) {
+    // Check we are being called from page 3.
+    if (currentPage() != d->pageThree) {
         kWarning() << "Called accept() from a non-final page :(.";
         return;
     }
@@ -256,7 +310,6 @@ void AddAccountAssistant::onAccountCreated(Tp::PendingOperation *op)
         account->setRequestedPresence(Tp::Presence::available(QString("Online")));
     }
     account->setServiceName(d->currentProfileItem->serviceName());
-
     KAssistantDialog::accept();
 }
 
@@ -272,18 +325,19 @@ void AddAccountAssistant::onConnectionManagerReady(Tp::PendingOperation *op)
         kWarning() << "Invalid ConnectionManager";
     }
 
-    pageTwo();
+    pageThree();
 }
 
 void AddAccountAssistant::onProfileSelected(bool value)
 {
     kDebug();
     //if a protocol is selected, enable the next button on the first page
-    setValid(d->pageOne, value);
+    setValid(d->pageTwo, value);
 }
 
-void AddAccountAssistant::pageTwo()
+void AddAccountAssistant::pageThree()
 {
+    kDebug();
     // Get the protocol's parameters and values.
     Tp::ProtocolInfo protocolInfo = d->connectionManager->protocol(d->currentProfileItem->protocolName());
     Tp::ProtocolParameterList parameters = protocolInfo.parameters();
@@ -302,12 +356,12 @@ void AddAccountAssistant::pageTwo()
     d->accountEditWidget = new AccountEditWidget(d->currentProfileItem->profile(),
                                                  parameterModel,
                                                  doConnectOnAdd,
-                                                 d->pageTwoWidget);
+                                                 d->pageThreeWidget);
     connect(this,
             SIGNAL(feedbackMessage(QString,QString,KMessageWidget::MessageType)),
             d->accountEditWidget,
             SIGNAL(feedbackMessage(QString,QString,KMessageWidget::MessageType)));
-    d->pageTwoWidget->layout()->addWidget(d->accountEditWidget);
+    d->pageThreeWidget->layout()->addWidget(d->accountEditWidget);
 
     KAssistantDialog::next();
 }
diff --git a/src/add-account-assistant.h b/src/add-account-assistant.h
index 9be243f..b20c35b 100644
--- a/src/add-account-assistant.h
+++ b/src/add-account-assistant.h
@@ -40,9 +40,12 @@ public:
     ~AddAccountAssistant();
 
 protected Q_SLOTS:
+    virtual void back();
     virtual void next();
     virtual void accept();
     virtual void reject();
+    void goToPageTwo();
+    void goToPageThree();
 
 Q_SIGNALS:
     void cancelled();
@@ -54,7 +57,7 @@ private Q_SLOTS:
     void onProfileSelected(bool value);
 
 private:
-    void pageTwo();
+    void pageThree();
 
     class Private;
     Private * const d;

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list