[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:21 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-accounts-kcm.git;a=commitdiff;h=9d6ac6e
The following commit has been merged in the master branch:
commit 9d6ac6e8ab01e5624586d9f6a9278f272356c10f
Author: George Goldberg <grundleborg at googlemail.com>
Date: Wed Jul 22 19:03:41 2009 +0000
Continue to the next page of the add account assistant if a protocol is selected.
svn path=/trunk/playground/network/telepathy-accounts-kcm/; revision=1001251
---
src/add-account-assistant.cpp | 18 +++++++++++++++++-
src/protocol-list-model.cpp | 5 +++++
src/protocol-list-model.h | 6 ++++++
src/protocol-select-widget.cpp | 24 ++++++++++++++++++++++++
src/protocol-select-widget.h | 4 ++++
5 files changed, 56 insertions(+), 1 deletion(-)
diff --git a/src/add-account-assistant.cpp b/src/add-account-assistant.cpp
index 05bc797..81440cd 100644
--- a/src/add-account-assistant.cpp
+++ b/src/add-account-assistant.cpp
@@ -36,7 +36,9 @@ public:
}
ProtocolSelectWidget *widgetOne;
+ QWidget *widgetTwo;
KPageWidgetItem *pageOne;
+ KPageWidgetItem *pageTwo;
};
AddAccountAssistant::AddAccountAssistant(QWidget *parent)
@@ -49,8 +51,12 @@ AddAccountAssistant::AddAccountAssistant(QWidget *parent)
d->widgetOne = new ProtocolSelectWidget(this);
d->pageOne = new KPageWidgetItem(d->widgetOne);
d->pageOne->setHeader(i18n("Step 1: Select an Instant Messaging Network."));
+ d->widgetTwo = new QWidget(this);
+ d->pageTwo = new KPageWidgetItem(d->widgetTwo);
+ d->pageTwo->setHeader(i18n("Step 2: Fill in the required Parameters."));
addPage(d->pageOne);
+ addPage(d->pageTwo);
}
AddAccountAssistant::~AddAccountAssistant()
@@ -71,7 +77,17 @@ void AddAccountAssistant::next()
{
kDebug();
- // TODO: Implement me!
+ // Check which page we are on.
+ if (currentPage() == d->pageOne) {
+ kDebug() << "Current page: Page 1.";
+ // Page 1
+
+ // Check if the protocol is selected. If it is, continue to the next page.
+ if (d->widgetOne->selectedProtocol()) {
+ kDebug() << "Protocol is selected. Continue to the next page.";
+ KAssistantDialog::next();
+ }
+ }
}
void AddAccountAssistant::accept()
diff --git a/src/protocol-list-model.cpp b/src/protocol-list-model.cpp
index b69d06a..28d5ec6 100644
--- a/src/protocol-list-model.cpp
+++ b/src/protocol-list-model.cpp
@@ -123,6 +123,11 @@ void ProtocolListModel::onNewProtocol(const QString& protocol)
endInsertRows();
}
+ProtocolItem *ProtocolListModel::itemForIndex(const QModelIndex &index) const
+{
+ return m_protocolItems.at(index.row());
+}
+
#include "protocol-list-model.moc"
diff --git a/src/protocol-list-model.h b/src/protocol-list-model.h
index 227ce30..3718e8f 100644
--- a/src/protocol-list-model.h
+++ b/src/protocol-list-model.h
@@ -36,11 +36,17 @@ class ProtocolListModel : public QAbstractListModel
public:
explicit ProtocolListModel(QObject *parent = 0);
virtual ~ProtocolListModel();
+
virtual int rowCount(const QModelIndex &index) const;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+
+ ProtocolItem *itemForIndex(const QModelIndex &index) const;
+
void addConnectionManager(Tp::ConnectionManagerPtr connectionManager);
void addProtocolItem(ProtocolItem *item);
+
+
private Q_SLOTS:
void onNewProtocol(const QString& protocol);
diff --git a/src/protocol-select-widget.cpp b/src/protocol-select-widget.cpp
index 97874e8..783ffbb 100644
--- a/src/protocol-select-widget.cpp
+++ b/src/protocol-select-widget.cpp
@@ -20,6 +20,7 @@
#include "protocol-select-widget.h"
+#include "protocol-item.h"
#include "protocol-list-model.h"
#include "ui_protocol-select-widget.h"
@@ -103,3 +104,26 @@ void ProtocolSelectWidget::onConnectionManagerListGot(Tp::PendingOperation *op)
}
}
+// Return the selected ProtocolItem or 0 if nothing is selected.
+ProtocolItem *ProtocolSelectWidget::selectedProtocol()
+{
+ kDebug();
+
+ // Get the indexes of the selected items from the view
+ QModelIndexList selectedIndexes = d->ui->protocolListView->selectionModel()->selectedIndexes();
+
+ // If more than 1 protocol is selected (shouldn't be possible, but just in case) error.
+ if (selectedIndexes.size() > 1) {
+ kWarning() << "More than 1 protocol is selected.";
+ return 0;
+ }
+
+ // If no indexes are selected, return 0.
+ if (selectedIndexes.size() == 0) {
+ return 0;
+ }
+
+ // 1 index is selected. Return the ProtocolItem for that.
+ return d->model->itemForIndex(selectedIndexes.at(0));
+}
+
diff --git a/src/protocol-select-widget.h b/src/protocol-select-widget.h
index 01463f9..b93d2a9 100644
--- a/src/protocol-select-widget.h
+++ b/src/protocol-select-widget.h
@@ -23,6 +23,8 @@
#include <QtGui/QWidget>
+class ProtocolItem;
+
namespace Tp {
class PendingOperation;
}
@@ -35,6 +37,8 @@ public:
explicit ProtocolSelectWidget(QWidget *parent = 0);
~ProtocolSelectWidget();
+ ProtocolItem *selectedProtocol();
+
private Q_SLOTS:
void getConnectionManagerList();
void onConnectionManagerListGot(Tp::PendingOperation *op);
--
ktp-accounts-kcm packaging
More information about the pkg-kde-commits
mailing list