[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:16 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-accounts-kcm.git;a=commitdiff;h=b77c625
The following commit has been merged in the master branch:
commit b77c625bd75cfacfb854f4f81fdfe42773ba66a9
Author: George Goldberg <grundleborg at googlemail.com>
Date: Wed Jul 22 13:10:30 2009 +0000
When we load the first ProtocolSelectWidget, get the list of Telepathy Connection Managers installed on the system.
svn path=/trunk/playground/network/telepathy-accounts-kcm/; revision=1001015
---
src/protocol-select-widget.cpp | 41 +++++++++++++++++++++++++++++++++++++++++
src/protocol-select-widget.h | 8 ++++++++
2 files changed, 49 insertions(+)
diff --git a/src/protocol-select-widget.cpp b/src/protocol-select-widget.cpp
index 5ab6fc1..553dd24 100644
--- a/src/protocol-select-widget.cpp
+++ b/src/protocol-select-widget.cpp
@@ -24,6 +24,10 @@
#include <KDebug>
+#include <TelepathyQt4/ConnectionManager>
+#include <TelepathyQt4/PendingOperation>
+#include <TelepathyQt4/PendingStringList>
+
class ProtocolSelectWidget::Private
{
public:
@@ -45,6 +49,9 @@ ProtocolSelectWidget::ProtocolSelectWidget(QWidget *parent)
// Set up the widget
d->ui = new Ui::ProtocolSelectWidget;
d->ui->setupUi(this);
+
+ // Load the list of all installed Telepathy Connection Managers Asynchronously
+ QTimer::singleShot(0, this, SLOT(getConnectionManagerList()));
}
ProtocolSelectWidget::~ProtocolSelectWidget()
@@ -54,3 +61,37 @@ ProtocolSelectWidget::~ProtocolSelectWidget()
delete d;
}
+void ProtocolSelectWidget::getConnectionManagerList()
+{
+ kDebug();
+
+ // Ask TpQt4 for the list of all installed Connection Managers.
+ Tp::PendingStringList *psl = Tp::ConnectionManager::listNames();
+
+ connect(psl,
+ SIGNAL(finished(Tp::PendingOperation*)),
+ SLOT(onConnectionManagerListGot(Tp::PendingOperation*)));
+}
+
+void ProtocolSelectWidget::onConnectionManagerListGot(Tp::PendingOperation *op)
+{
+ kDebug();
+
+ // Check the operation completed successfully.
+ if (op->isError()) {
+ kWarning() << "Operation failed:" << op->errorName() << op->errorMessage();
+ return;
+ }
+
+ // Check the operation we were passed is of the correct type.
+ Tp::PendingStringList *psl = qobject_cast<Tp::PendingStringList*>(op);
+ if (!psl) {
+ kWarning() << "Operation is not of type PendingStringList.";
+ return;
+ }
+
+ foreach (QString cmName, psl->result()) {
+ // TODO: Add that CM to the protocol-list-model
+ }
+}
+
diff --git a/src/protocol-select-widget.h b/src/protocol-select-widget.h
index c978d6d..01463f9 100644
--- a/src/protocol-select-widget.h
+++ b/src/protocol-select-widget.h
@@ -23,6 +23,10 @@
#include <QtGui/QWidget>
+namespace Tp {
+ class PendingOperation;
+}
+
class ProtocolSelectWidget : public QWidget
{
Q_OBJECT
@@ -31,6 +35,10 @@ public:
explicit ProtocolSelectWidget(QWidget *parent = 0);
~ProtocolSelectWidget();
+private Q_SLOTS:
+ void getConnectionManagerList();
+ void onConnectionManagerListGot(Tp::PendingOperation *op);
+
private:
class Private;
Private * const d;
--
ktp-accounts-kcm packaging
More information about the pkg-kde-commits
mailing list