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

Maximiliano Curia maxy at moszumanska.debian.org
Fri May 27 23:57:31 UTC 2016


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

The following commit has been merged in the master branch:
commit bb8dc766b12816fbe480ed4386496dd9a4ba8396
Author: George Goldberg <grundleborg at googlemail.com>
Date:   Fri Jul 24 19:15:43 2009 +0000

    Actually add the Account on the AM when we click Finish in the Add Account Assistant.
    
    Telepathy Accounts KCM now actually supports creating accounts. Yay!
    
    svn path=/trunk/playground/network/telepathy-accounts-kcm/; revision=1002011
---
 src/add-account-assistant.cpp | 54 +++++++++++++++++++++++++++++++++++++++++++
 src/add-account-assistant.h   |  7 ++++++
 2 files changed, 61 insertions(+)

diff --git a/src/add-account-assistant.cpp b/src/add-account-assistant.cpp
index f19bf55..2afd16e 100644
--- a/src/add-account-assistant.cpp
+++ b/src/add-account-assistant.cpp
@@ -20,6 +20,7 @@
 
 #include "add-account-assistant.h"
 
+#include "connection-manager-item.h"
 #include "parameter-edit-widget.h"
 #include "protocol-item.h"
 #include "protocol-select-widget.h"
@@ -30,6 +31,9 @@
 #include <KPageWidgetItem>
 #include <KTabWidget>
 
+#include <TelepathyQt4/PendingAccount>
+#include <TelepathyQt4/PendingOperation>
+
 class AddAccountAssistant::Private
 {
 public:
@@ -153,6 +157,46 @@ void AddAccountAssistant::accept()
     // Get the optional properties
     QMap<Tp::ProtocolParameter*, QVariant> optionalParameterValues =
             d->optionalParametersWidget->parameterValues();
+
+    // Get the ProtocolItem that was selected and the corresponding ConnectionManagerItem.
+    ProtocolItem *protocolItem = d->protocolSelectWidget->selectedProtocol();
+    ConnectionManagerItem *connectionManagerItem = qobject_cast<ConnectionManagerItem*>(protocolItem->parent());
+
+    if (!connectionManagerItem) {
+        kWarning() << "Invalid ConnectionManager item.";
+        return;
+    }
+
+    // Merge the parameters into a QVariantMap for submitting to the Telepathy AM.
+    QVariantMap parameters;
+
+    foreach (Tp::ProtocolParameter *pp, mandatoryParameterValues.keys()) {
+        QVariant value = mandatoryParameterValues.value(pp);
+
+        // Don't try and add empty parameters.
+        if (!value.isNull()) {
+            parameters.insert(pp->name(), value);
+        }
+    }
+
+    foreach (Tp::ProtocolParameter *pp, optionalParameterValues.keys()) {
+        QVariant value = optionalParameterValues.value(pp);
+
+        // Don't try and add empty parameters.
+        if (!value.isNull()) {
+            parameters.insert(pp->name(), value);
+        }
+    }
+
+    // FIXME: Ask the user to submit a Display Name
+    Tp::PendingAccount *pa = d->accountManager->createAccount(connectionManagerItem->connectionManager()->name(),
+                                                              protocolItem->protocol(),
+                                                              parameters.value("account").toString(),
+                                                              parameters);
+
+    connect(pa,
+            SIGNAL(finished(Tp::PendingOperation*)),
+            SLOT(onAccountCreated(Tp::PendingOperation*)));
 }
 
 void AddAccountAssistant::reject()
@@ -166,3 +210,13 @@ void AddAccountAssistant::reject()
     KAssistantDialog::reject();
 }
 
+void AddAccountAssistant::onAccountCreated(Tp::PendingOperation *op)
+{
+    if (op->isError()) {
+        kWarning() << "Adding Account failed:" << op->errorName() << op->errorMessage();
+        return;
+    }
+
+    KAssistantDialog::accept();
+}
+
diff --git a/src/add-account-assistant.h b/src/add-account-assistant.h
index f9c22af..f3bdce0 100644
--- a/src/add-account-assistant.h
+++ b/src/add-account-assistant.h
@@ -25,6 +25,10 @@
 
 #include <TelepathyQt4/AccountManager>
 
+namespace Tp {
+    class PendingOperation;
+}
+
 class AddAccountAssistant : public KAssistantDialog
 {
     Q_OBJECT
@@ -42,6 +46,9 @@ protected Q_SLOTS:
 Q_SIGNALS:
     void cancelled();
 
+private Q_SLOTS:
+    void onAccountCreated(Tp::PendingOperation *op);
+
 private:
     class Private;
     Private * const d;

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list