[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:17 UTC 2016


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

The following commit has been merged in the master branch:
commit f53e23153c619087d20bc26f49140021a8622ebf
Author: George Goldberg <grundleborg at googlemail.com>
Date:   Wed Jul 22 17:15:32 2009 +0000

    Add bare bones of the model and items for the ProtocolSelectWidget.
    
    svn path=/trunk/playground/network/telepathy-accounts-kcm/; revision=1001207
---
 src/CMakeLists.txt                                 |   3 +
 ...ccount-item.cpp => connection-manager-item.cpp} |  44 +++++----
 src/{account-item.h => connection-manager-item.h}  |  30 +++----
 src/{add-account-assistant.h => protocol-item.cpp} |  34 ++++---
 src/{add-account-assistant.h => protocol-item.h}   |  27 +++---
 src/protocol-list-model.cpp                        | 100 +++++++++++++++++++++
 ...accounts-list-model.h => protocol-list-model.h} |  30 +++----
 7 files changed, 178 insertions(+), 90 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a752aca..80679cd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -10,6 +10,9 @@ set (telepathy_accounts_kcm_SRCS
      account-item.cpp
      add-account-assistant.cpp
      protocol-select-widget.cpp
+     protocol-list-model.cpp
+     connection-manager-item.cpp
+     protocol-item.cpp
 )
 
 kde4_add_ui_files (telepathy_accounts_kcm_SRCS
diff --git a/src/account-item.cpp b/src/connection-manager-item.cpp
similarity index 54%
copy from src/account-item.cpp
copy to src/connection-manager-item.cpp
index b44c48d..0b29ce1 100644
--- a/src/account-item.cpp
+++ b/src/connection-manager-item.cpp
@@ -18,56 +18,52 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include "account-item.h"
+#include "connection-manager-item.h"
 
-#include "accounts-list-model.h"
+#include "protocol-list-model.h"
 
 #include <KDebug>
 
-#include <QtCore/QTimer>
-
 #include <TelepathyQt4/PendingOperation>
 #include <TelepathyQt4/PendingReady>
 
-AccountItem::AccountItem(Tp::AccountPtr account, AccountsListModel *parent)
+ConnectionManagerItem::ConnectionManagerItem(const Tp::ConnectionManagerPtr &connectionManager,
+                                             ProtocolListModel *parent)
  : QObject(parent),
-   m_account(account)
+   m_connectionManager(connectionManager)
 {
-    // We should look to see if the "account" instance we are passed is ready
-    // yet. If not, we should get it ready now.
-    // FIXME: What features should we check are ready?
-    if (m_account->isReady()) {
-        QTimer::singleShot(0, this, SIGNAL(ready()));
-    } else {
-        // FIXME: What features should we get ready with?
-        connect(m_account->becomeReady(),
-                SIGNAL(finished(Tp::PendingOperation*)),
-                SLOT(onAccountReady(Tp::PendingOperation*)));
-    }
+    kDebug();
+
+    // Get the connection manager ready
+    connect(m_connectionManager->becomeReady(Tp::ConnectionManager::FeatureCore),
+            SIGNAL(finished(Tp::PendingOperation*)),
+            SLOT(onConnectionManagerReady(Tp::PendingOperation*)));
 }
 
-AccountItem::~AccountItem()
+ConnectionManagerItem::~ConnectionManagerItem()
 {
+    kDebug();
+
     // TODO: Implement me...
 }
 
-Tp::AccountPtr AccountItem::account() const
+Tp::ConnectionManagerPtr ConnectionManagerItem::connectionManager() const
 {
-    return m_account;
+    return m_connectionManager;
 }
 
-void AccountItem::onAccountReady(Tp::PendingOperation *op)
+void ConnectionManagerItem::onConnectionManagerReady(Tp::PendingOperation *op)
 {
     if (op->isError()) {
-        kDebug() << "An error occurred in making and Account ready."
+        kDebug() << "An error occurred in making the Connection Manager ready."
                  << op->errorName()
                  << op->errorMessage();
         return;
     }
 
-    Q_EMIT ready();
+    // TODO: Implement me!
 }
 
 
-#include "account-item.moc"
+#include "connection-manager-item.moc"
 
diff --git a/src/account-item.h b/src/connection-manager-item.h
similarity index 61%
copy from src/account-item.h
copy to src/connection-manager-item.h
index e754c5d..a42436f 100644
--- a/src/account-item.h
+++ b/src/connection-manager-item.h
@@ -18,39 +18,35 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef TELEPATHY_ACCOUNTS_KCM_ACCOUNT_ITEM_H
-#define TELEPATHY_ACCOUNTS_KCM_ACCOUNT_ITEM_H
+#ifndef TELEPATHY_ACCOUNTS_KCM_CONNECTION_MANAGER_ITEM_H
+#define TELEPATHY_ACCOUNTS_KCM_CONNECTION_MANAGER_ITEM_H
 
 #include <QtCore/QObject>
 
-#include <TelepathyQt4/Account>
+#include <TelepathyQt4/ConnectionManager>
 
-class AccountsListModel;
+class ProtocolListModel;
 
-namespace Telepathy {
+namespace Tp {
     class PendingOperation;
 }
 
-class AccountItem : public QObject
+class ConnectionManagerItem : public QObject
 {
     Q_OBJECT
-    Q_DISABLE_COPY(AccountItem);
+    Q_DISABLE_COPY(ConnectionManagerItem);
 
 public:
-    explicit AccountItem(Tp::AccountPtr account, AccountsListModel *parent = 0);
-    virtual ~AccountItem();
-    Tp::AccountPtr account() const;
+    explicit ConnectionManagerItem(const Tp::ConnectionManagerPtr &connectionManager,
+                                   ProtocolListModel *parent = 0);
+    virtual ~ConnectionManagerItem();
+    Tp::ConnectionManagerPtr connectionManager() const;
 
 private Q_SLOTS:
-    void onAccountReady(Tp::PendingOperation *op);
-
-Q_SIGNALS:
-    void ready();
-    void removed();
-    void updated();
+    void onConnectionManagerReady(Tp::PendingOperation *op);
 
 private:
-    Tp::AccountPtr m_account;
+    Tp::ConnectionManagerPtr m_connectionManager;
 };
 
 
diff --git a/src/add-account-assistant.h b/src/protocol-item.cpp
similarity index 63%
copy from src/add-account-assistant.h
copy to src/protocol-item.cpp
index 2d5705e..889cc76 100644
--- a/src/add-account-assistant.h
+++ b/src/protocol-item.cpp
@@ -18,30 +18,28 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef TELEPATHY_ACCOUNTS_KCM_ADD_ACCOUNT_ASSISTANT_H
-#define TELEPATHY_ACCOUNTS_KCM_ADD_ACCOUNT_ASSISTANT_H
+#include "protocol-item.h"
 
-#include <KAssistantDialog>
+#include "connection-manager-item.h"
 
-class AddAccountAssistant : public KAssistantDialog
+#include <KDebug>
+
+ProtocolItem::ProtocolItem(const QString &protocol, ConnectionManagerItem *parent)
+ : QObject(parent),
+   m_protocol(protocol)
 {
-    Q_OBJECT
+    kDebug();
 
-public:
-    explicit AddAccountAssistant(QWidget *parent = 0);
-    ~AddAccountAssistant();
+    // TODO: Implement me!
+}
 
-protected Q_SLOTS:
-    virtual void back();
-    virtual void next();
-    virtual void accept();
-    virtual void reject();
+ProtocolItem::~ProtocolItem()
+{
+    kDebug();
 
-private:
-    class Private;
-    Private * const d;
-};
+    // TODO: Implement me...
+}
 
 
-#endif  // Header guard
+#include "protocol-item.moc"
 
diff --git a/src/add-account-assistant.h b/src/protocol-item.h
similarity index 66%
copy from src/add-account-assistant.h
copy to src/protocol-item.h
index 2d5705e..6979e04 100644
--- a/src/add-account-assistant.h
+++ b/src/protocol-item.h
@@ -18,30 +18,27 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef TELEPATHY_ACCOUNTS_KCM_ADD_ACCOUNT_ASSISTANT_H
-#define TELEPATHY_ACCOUNTS_KCM_ADD_ACCOUNT_ASSISTANT_H
+#ifndef TELEPATHY_ACCOUNTS_KCM_PROTOCOL_ITEM_H
+#define TELEPATHY_ACCOUNTS_KCM_PROTOCOL_ITEM_H
 
-#include <KAssistantDialog>
+#include <QtCore/QObject>
 
-class AddAccountAssistant : public KAssistantDialog
+class ConnectionManagerItem;
+
+class ProtocolItem : public QObject
 {
     Q_OBJECT
+    Q_DISABLE_COPY(ProtocolItem);
 
 public:
-    explicit AddAccountAssistant(QWidget *parent = 0);
-    ~AddAccountAssistant();
-
-protected Q_SLOTS:
-    virtual void back();
-    virtual void next();
-    virtual void accept();
-    virtual void reject();
+    explicit ProtocolItem(const QString &protocol,
+                          ConnectionManagerItem *parent = 0);
+    virtual ~ProtocolItem();
 
 private:
-    class Private;
-    Private * const d;
+    QString m_protocol;
 };
 
 
-#endif  // Header guard
+#endif // header guard
 
diff --git a/src/protocol-list-model.cpp b/src/protocol-list-model.cpp
new file mode 100644
index 0000000..700475d
--- /dev/null
+++ b/src/protocol-list-model.cpp
@@ -0,0 +1,100 @@
+/*
+ * This file is part of telepathy-accounts-kcm
+ *
+ * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ *
+ * 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 "protocol-list-model.h"
+
+#include "connection-manager-item.h"
+#include "protocol-item.h"
+
+#include <KDebug>
+
+ProtocolListModel::ProtocolListModel(QObject *parent)
+ : QAbstractListModel(parent)
+{
+    kDebug();
+
+    m_connectionManagerItems.clear();
+    m_protocolItems.clear();
+}
+
+ProtocolListModel::~ProtocolListModel()
+{
+    kDebug();
+
+    // TODO: Implement me!
+}
+
+int ProtocolListModel::rowCount(const QModelIndex &index) const
+{
+    kDebug();
+
+    // If the index is the root item, then return the row count.
+    if (index == QModelIndex()) {
+       return m_protocolItems.size();
+    }
+
+    // Otherwise, return 0 (as this is a list model, so all items
+    // are children of the root item).
+    return 0;
+}
+
+QVariant ProtocolListModel::data(const QModelIndex &index, int role) const
+{
+    // FIXME: This is a basic implementation just so I can see what's going
+    // on while developing this code further. Needs expanding.
+    QVariant data;
+
+    switch(role)
+    {
+    case Qt::DisplayRole:
+   //     data = QVariant(m_readyAccounts.at(index.row())->account()->displayName());
+        break;
+    default:
+        break;
+    }
+
+    return data;
+}
+
+void ProtocolListModel::addConnectionManager(Tp::ConnectionManagerPtr connectionManager)
+{
+    kDebug() << "Creating a new ConnectionManagerItem from account:"
+             << connectionManager.data();
+
+    // Check if the cm is already in the list.
+    foreach (const ConnectionManagerItem* cmi, m_connectionManagerItems) {
+        if (cmi->connectionManager() == connectionManager) {
+            kWarning() << "Connection Manager: "
+                       << cmi->connectionManager()->name()
+                       << " is already in the list.";
+            return;
+        }
+    }
+
+    kDebug() << "Connection Manager not already in list. Create new ConnectionManagerItem from cm:"
+             << connectionManager.data();
+
+    ConnectionManagerItem *item = new ConnectionManagerItem(connectionManager, this);
+    m_connectionManagerItems.append(item);
+}
+
+
+#include "protocol-list-model.moc"
+
diff --git a/src/accounts-list-model.h b/src/protocol-list-model.h
similarity index 65%
copy from src/accounts-list-model.h
copy to src/protocol-list-model.h
index 016c2e1..1543fde 100644
--- a/src/accounts-list-model.h
+++ b/src/protocol-list-model.h
@@ -18,37 +18,35 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef TELEPATHY_ACCOUNTS_KCM_ACCOUNTS_LIST_MODEL_H
-#define TELEPATHY_ACCOUNTS_KCM_ACCOUNTS_LIST_MODEL_H
+#ifndef TELEPATHY_ACCOUNTS_KCM_PROTOCOL_LIST_MODEL_H
+#define TELEPATHY_ACCOUNTS_KCM_PROTOCOL_LIST_MODEL_H
 
 #include <QtCore/QAbstractListModel>
 
-#include <TelepathyQt4/Account>
+#include <TelepathyQt4/ConnectionManager>
 
-class AccountItem;
+class ProtocolItem;
+class ConnectionManagerItem;
 
-class AccountsListModel : public QAbstractListModel
+class ProtocolListModel : public QAbstractListModel
 {
     Q_OBJECT
-    Q_DISABLE_COPY(AccountsListModel);
+    Q_DISABLE_COPY(ProtocolListModel);
 
 public:
-    explicit AccountsListModel(QObject *parent = 0);
-    virtual ~AccountsListModel();
+    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;
-    void addAccount(Tp::AccountPtr account);
-
-private Q_SLOTS:
-    void onAccountItemReady();
-    void onAccountItemRemoved();
-    void onAccountItemUpdated();
+    void addConnectionManager(Tp::ConnectionManagerPtr connectionManager);
+    void addProtocolItem(ProtocolItem *item);
 
 private:
-    QList<AccountItem*> m_unreadyAccounts;
-    QList<AccountItem*> m_readyAccounts;
+    QList<ConnectionManagerItem*> m_connectionManagerItems;
+    QList<ProtocolItem*> m_protocolItems;
 };
 
 
 #endif // header guard
 
+

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list