[SCM] ktp-contact-list packaging branch, master, updated. debian/15.12.1-2-1070-g6c56f91

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


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-list.git;a=commitdiff;h=8bf699d

The following commit has been merged in the master branch:
commit 8bf699dae6d8aa3b5b2f4f9ad59289a651be6c0c
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Wed Dec 28 00:05:16 2011 +0000

    Move AccountManager back to main class
---
 contact-list-widget.cpp | 57 +++++-----------------------------------------
 contact-list-widget.h   |  3 +--
 main-widget.cpp         | 60 +++++++++++++++++++++++++++++++++++++++++--------
 main-widget.h           |  5 ++++-
 4 files changed, 61 insertions(+), 64 deletions(-)

diff --git a/contact-list-widget.cpp b/contact-list-widget.cpp
index 7ebb38f..53bd04a 100644
--- a/contact-list-widget.cpp
+++ b/contact-list-widget.cpp
@@ -70,38 +70,6 @@ ContactListWidget::ContactListWidget(QWidget *parent)
     KSharedConfigPtr config = KGlobal::config();
     KConfigGroup guiConfigGroup(config, "GUI");
 
-    Tp::AccountFactoryPtr  accountFactory = Tp::AccountFactory::create(QDBusConnection::sessionBus(),
-                                                                       Tp::Features() << Tp::Account::FeatureCore
-                                                                       << Tp::Account::FeatureAvatar
-                                                                       << Tp::Account::FeatureCapabilities
-                                                                       << Tp::Account::FeatureProtocolInfo
-                                                                       << Tp::Account::FeatureProfile);
-
-    Tp::ConnectionFactoryPtr connectionFactory = Tp::ConnectionFactory::create(QDBusConnection::sessionBus(),
-                                                                               Tp::Features() << Tp::Connection::FeatureCore
-                                                                               << Tp::Connection::FeatureRosterGroups
-                                                                               << Tp::Connection::FeatureRoster
-                                                                               << Tp::Connection::FeatureSelfContact);
-
-    Tp::ContactFactoryPtr contactFactory = Tp::ContactFactory::create(Tp::Features()  << Tp::Contact::FeatureAlias
-                                                                      << Tp::Contact::FeatureAvatarData
-                                                                      << Tp::Contact::FeatureSimplePresence
-                                                                      << Tp::Contact::FeatureCapabilities);
-
-    Tp::ChannelFactoryPtr channelFactory = Tp::ChannelFactory::create(QDBusConnection::sessionBus());
-
-    d->accountManager = Tp::AccountManager::create(QDBusConnection::sessionBus(),
-                                                  accountFactory,
-                                                  connectionFactory,
-                                                  channelFactory,
-                                                  contactFactory);
-
-    connect(d->accountManager->becomeReady(), SIGNAL(finished(Tp::PendingOperation*)),
-            this, SLOT(onAccountManagerReady(Tp::PendingOperation*)));
-
-    connect(d->accountManager.data(), SIGNAL(newAccount(Tp::AccountPtr)),
-            this, SLOT(onNewAccountAdded(Tp::AccountPtr)));
-
     d->delegate = new ContactDelegate(this);
     d->compactDelegate = new ContactDelegateCompact(this);
 
@@ -141,23 +109,16 @@ ContactListWidget::~ContactListWidget()
 
 }
 
-void ContactListWidget::onAccountManagerReady(Tp::PendingOperation* op)
+void ContactListWidget::setAccountManager(const Tp::AccountManagerPtr &accountManager)
 {
     Q_D(ContactListWidget);
 
-    if (op->isError()) {
-        kDebug() << op->errorName();
-        kDebug() << op->errorMessage();
 
-        KMessageBox::error(this,
-                           i18n("Something unexpected happened to the core part of your Instant Messaging system "
-                           "and it couldn't be initialized. Try restarting the Contact List."),
-                           i18n("IM system failed to initialize"));
+    connect(accountManager.data(), SIGNAL(newAccount(Tp::AccountPtr)),
+                this, SLOT(onNewAccountAdded(Tp::AccountPtr)));
 
-                           return;
-    }
 
-    d->model = new AccountsModel(d->accountManager, this);
+    d->model = new AccountsModel(accountManager, this);
     d->groupsModel = new GroupsModel(d->model, this);
     d->modelFilter = new AccountsFilterModel(this);
     d->modelFilter->setDynamicSortFilter(true);
@@ -175,7 +136,7 @@ void ContactListWidget::onAccountManagerReady(Tp::PendingOperation* op)
     connect(d->groupsModel, SIGNAL(operationFinished(Tp::PendingOperation*)),
             this, SIGNAL(genericOperationFinished(Tp::PendingOperation*)));
 
-    QList<Tp::AccountPtr> accounts = d->accountManager->allAccounts();
+    QList<Tp::AccountPtr> accounts = accountManager->allAccounts();
 
     if(accounts.count() == 0) {
         if (KMessageBox::questionYesNo(this,
@@ -192,14 +153,6 @@ void ContactListWidget::onAccountManagerReady(Tp::PendingOperation* op)
 
     expandAll();
 
-    emit accountManagerReady(op);
-}
-
-const Tp::AccountManagerPtr ContactListWidget::accountManager() const
-{
-    Q_D(const ContactListWidget);
-
-    return d->accountManager;
 }
 
 AccountsModel* ContactListWidget::accountsModel()
diff --git a/contact-list-widget.h b/contact-list-widget.h
index 067fc12..154fc8f 100644
--- a/contact-list-widget.h
+++ b/contact-list-widget.h
@@ -43,7 +43,7 @@ public:
     virtual ~ContactListWidget();
 
     AccountsModel *accountsModel();
-    const Tp::AccountManagerPtr accountManager() const;
+    void setAccountManager(const Tp::AccountManagerPtr &accountManager);
 
 public Q_SLOTS:
     void toggleOfflineContacts(bool show);
@@ -57,7 +57,6 @@ public Q_SLOTS:
     void onSwitchToCompactView();
 
 private Q_SLOTS:
-    void onAccountManagerReady(Tp::PendingOperation* op);
     void onNewAccountAdded(const Tp::AccountPtr &account);
     void onContactListClicked(const QModelIndex &index);
     void onContactListDoubleClicked(const QModelIndex &index);
diff --git a/main-widget.cpp b/main-widget.cpp
index 3ce8c54..5c4eb84 100644
--- a/main-widget.cpp
+++ b/main-widget.cpp
@@ -34,6 +34,7 @@
 #include <TelepathyQt/PendingChannelRequest>
 #include <TelepathyQt/PendingContacts>
 #include <TelepathyQt/ContactManager>
+#include <TelepathyQt/PendingReady>
 
 #include <KTp/Models/accounts-model.h>
 #include <KTp/Models/contact-model-item.h>
@@ -75,6 +76,7 @@ MainWidget::MainWidget(QWidget *parent)
     setWindowIcon(KIcon("telepathy-kde"));
     setAutoSaveSettings();
 
+
     KSharedConfigPtr config = KGlobal::config();
     KConfigGroup guiConfigGroup(config, "GUI");
 
@@ -91,6 +93,37 @@ MainWidget::MainWidget(QWidget *parent)
 
     m_toolBar->addAction(m_groupContactsAction);
 
+    Tp::AccountFactoryPtr  accountFactory = Tp::AccountFactory::create(QDBusConnection::sessionBus(),
+                                                                       Tp::Features() << Tp::Account::FeatureCore
+                                                                       << Tp::Account::FeatureAvatar
+                                                                       << Tp::Account::FeatureCapabilities
+                                                                       << Tp::Account::FeatureProtocolInfo
+                                                                       << Tp::Account::FeatureProfile);
+
+    Tp::ConnectionFactoryPtr connectionFactory = Tp::ConnectionFactory::create(QDBusConnection::sessionBus(),
+                                                                               Tp::Features() << Tp::Connection::FeatureCore
+                                                                               << Tp::Connection::FeatureRosterGroups
+                                                                               << Tp::Connection::FeatureRoster
+                                                                               << Tp::Connection::FeatureSelfContact);
+
+    Tp::ContactFactoryPtr contactFactory = Tp::ContactFactory::create(Tp::Features()  << Tp::Contact::FeatureAlias
+                                                                      << Tp::Contact::FeatureAvatarData
+                                                                      << Tp::Contact::FeatureSimplePresence
+                                                                      << Tp::Contact::FeatureCapabilities);
+
+    Tp::ChannelFactoryPtr channelFactory = Tp::ChannelFactory::create(QDBusConnection::sessionBus());
+
+    m_accountManager = Tp::AccountManager::create(QDBusConnection::sessionBus(),
+                                                  accountFactory,
+                                                  connectionFactory,
+                                                  channelFactory,
+                                                  contactFactory);
+
+    connect(m_accountManager->becomeReady(), SIGNAL(finished(Tp::PendingOperation*)),
+            this, SLOT(onAccountManagerReady(Tp::PendingOperation*)));
+
+
+
     m_showOfflineAction = new KAction(KIcon("meeting-attending-tentative"), i18n("Hide/Show offline users"), this);
     m_showOfflineAction->setCheckable(true);
     m_showOfflineAction->setChecked(false);
@@ -174,9 +207,6 @@ MainWidget::MainWidget(QWidget *parent)
     connect(m_searchContactAction, SIGNAL(triggered(bool)),
             this, SLOT(toggleSearchWidget(bool)));
 
-    connect(m_contactsListView, SIGNAL(accountManagerReady(Tp::PendingOperation*)),
-            this, SLOT(onAccountManagerReady(Tp::PendingOperation*)));
-
     if (guiConfigGroup.readEntry("pin_filterbar", true)) {
         toggleSearchWidget(true);
         m_searchContactAction->setChecked(true);
@@ -197,7 +227,17 @@ MainWidget::~MainWidget()
 
 void MainWidget::onAccountManagerReady(Tp::PendingOperation* op)
 {
-    Q_UNUSED(op)
+    if (op->isError()) {
+        kDebug() << op->errorName();
+        kDebug() << op->errorMessage();
+
+        KMessageBox::error(this,
+                           i18n("Something unexpected happened to the core part of your Instant Messaging system "
+                           "and it couldn't be initialized. Try restarting the Contact List."),
+                           i18n("IM system failed to initialize"));
+
+                           return;
+    }
 
     connect(m_showOfflineAction, SIGNAL(toggled(bool)),
             m_contactsListView, SLOT(toggleOfflineContacts(bool)));
@@ -217,8 +257,8 @@ void MainWidget::onAccountManagerReady(Tp::PendingOperation* op)
     connect(m_contactsListView, SIGNAL(genericOperationFinished(Tp::PendingOperation*)),
             this, SLOT(onGenericOperationFinished(Tp::PendingOperation*)));
 
-    m_accountButtons->setAccountManager(m_contactsListView->accountManager());
-    m_presenceChooser->setAccountManager(m_contactsListView->accountManager());
+    m_accountButtons->setAccountManager(m_accountManager);
+    m_presenceChooser->setAccountManager(m_accountManager);
 
     KSharedConfigPtr config = KGlobal::config();
     KConfigGroup guiConfigGroup(config, "GUI");
@@ -232,6 +272,8 @@ void MainWidget::onAccountManagerReady(Tp::PendingOperation* op)
     bool sortByPresence = guiConfigGroup.readEntry("sort_by_presence", true);
     m_sortByPresenceAction->setActive(sortByPresence);
 
+
+    m_contactsListView->setAccountManager(m_accountManager);
     m_contactsListView->toggleGroups(useGroups);
     m_contactsListView->toggleOfflineContacts(showOffline);
     m_contactsListView->toggleSortByPresence(sortByPresence);
@@ -324,7 +366,7 @@ void MainWidget::onGenericOperationFinished(Tp::PendingOperation* operation)
 
 void MainWidget::onJoinChatRoomRequested()
 {
-    QWeakPointer<JoinChatRoomDialog> dialog = new JoinChatRoomDialog(m_contactsListView->accountManager());
+    QWeakPointer<JoinChatRoomDialog> dialog = new JoinChatRoomDialog(m_accountManager);
 
     if (dialog.data()->exec() == QDialog::Accepted) {
         Tp::AccountPtr account = dialog.data()->selectedAccount();
@@ -406,7 +448,7 @@ void MainWidget::goOffline()
 {
     //FIXME use global presence
     kDebug() << "Setting all accounts offline...";
-    foreach (const Tp::AccountPtr &account, m_contactsListView->accountManager()->allAccounts()) {
+    foreach (const Tp::AccountPtr &account, m_accountManager->allAccounts()) {
         if (account->isEnabled() && account->isValid()) {
             account->setRequestedPresence(Tp::Presence::offline());
         }
@@ -415,7 +457,7 @@ void MainWidget::goOffline()
 
 bool MainWidget::isAnyAccountOnline() const
 {
-    foreach (const Tp::AccountPtr &account, m_contactsListView->accountManager()->allAccounts()) {
+    foreach (const Tp::AccountPtr &account, m_accountManager->allAccounts()) {
         if (account->isEnabled() && account->isValid() && account->isOnline()) {
             return true;
         }
diff --git a/main-widget.h b/main-widget.h
index 20d52f1..0dfe8b7 100644
--- a/main-widget.h
+++ b/main-widget.h
@@ -27,7 +27,7 @@
 #include <QtGui/QWidget>
 #include <QtGui/QStyledItemDelegate>
 
-#include <TelepathyQt/AccountManager>
+#include <TelepathyQt/Types>
 
 #include <KXmlGuiWindow>
 #include <KAction>
@@ -96,12 +96,15 @@ private:
     KMenu                  *m_accountMenu;
     KSelectAction          *m_setStatusAction;
 
+
     KAction                *m_addContactAction;
     KAction                *m_groupContactsAction;
     KAction                *m_showOfflineAction;
     KAction                *m_searchContactAction;
     KDualAction            *m_sortByPresenceAction;
 
+    Tp::AccountManagerPtr  m_accountManager;
+
     ContextMenu            *m_contextMenu;
 };
 

-- 
ktp-contact-list packaging



More information about the pkg-kde-commits mailing list