[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:23:11 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=82eaf61

The following commit has been merged in the master branch:
commit 82eaf61cdf84b29bb48b84f9eff930990a76cc3f
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Wed Jan 16 00:36:21 2013 +0000

    Port invite contact dialog to new models
    
    REVIEW: 108431
---
 app/chat-window.cpp           |  5 ++++-
 app/invite-contact-dialog.cpp | 15 +++++++--------
 app/invite-contact-dialog.h   |  6 +++---
 app/main.cpp                  | 13 +++++++++----
 app/telepathy-chat-ui.cpp     | 10 ++++++++--
 app/telepathy-chat-ui.h       |  9 ++++++---
 6 files changed, 37 insertions(+), 21 deletions(-)

diff --git a/app/chat-window.cpp b/app/chat-window.cpp
index 53d4b2e..b48f148 100644
--- a/app/chat-window.cpp
+++ b/app/chat-window.cpp
@@ -59,6 +59,7 @@
 
 #include "emoticon-text-edit-action.h"
 #include "invite-contact-dialog.h"
+#include "telepathy-chat-ui.h"
 
 #define PREFERRED_RFB_HANDLER "org.freedesktop.Telepathy.Client.krfb_rfb_handler"
 
@@ -390,7 +391,9 @@ void ChatWindow::onGenericOperationFinished(Tp::PendingOperation* op)
 void ChatWindow::onInviteToChatTriggered()
 {
     ChatTab *currChat = qobject_cast<ChatTab*>(m_tabWidget->currentWidget());
-    InviteContactDialog *dialog = new InviteContactDialog(currChat->account(), currChat->textChannel(), this);
+
+    TelepathyChatUi *app = qobject_cast<TelepathyChatUi*>(KApplication::instance());
+    InviteContactDialog *dialog = new InviteContactDialog(app->accountManager(), currChat->account(), currChat->textChannel(), this);
     dialog->setAttribute(Qt::WA_DeleteOnClose);
     dialog->show();
 }
diff --git a/app/invite-contact-dialog.cpp b/app/invite-contact-dialog.cpp
index 21f6b3d..8681044 100644
--- a/app/invite-contact-dialog.cpp
+++ b/app/invite-contact-dialog.cpp
@@ -31,25 +31,24 @@
 #include <TelepathyQt/TextChannel>
 
 #include <KTp/debug.h>
-#include <KTp/Models/contacts-model.h>
-#include <KTp/Models/accounts-filter-model.h>
+#include <KTp/Models/contacts-list-model.h>
+#include <KTp/Models/contacts-filter-model.h>
 #include <KTp/Widgets/contact-grid-widget.h>
 #include <telepathy-qt4/TelepathyQt/PendingChannelRequest>
 
-InviteContactDialog::InviteContactDialog(const Tp::AccountPtr &account, const Tp::TextChannelPtr &channel, QWidget *parent) :
+InviteContactDialog::InviteContactDialog(const Tp::AccountManagerPtr &accountManager, const Tp::AccountPtr &account, const Tp::TextChannelPtr &channel, QWidget *parent) :
     KDialog(parent),
     m_account(account),
-    m_channel(channel)
+    m_channel(channel),
+    m_contactsModel(new KTp::ContactsListModel(this))
 {
     resize(500,450);
 
-    m_contactsModel = new ContactsModel(this);
-    m_contactsModel->onNewAccount(account);
-
+    m_contactsModel->setAccountManager(accountManager);
 
     m_contactGridWidget = new KTp::ContactGridWidget(m_contactsModel, this);
     m_contactGridWidget->contactFilterLineEdit()->setClickMessage(i18n("Search in Contacts..."));
-    m_contactGridWidget->filter()->setPresenceTypeFilterFlags(AccountsFilterModel::ShowOnlyConnected);
+    m_contactGridWidget->filter()->setPresenceTypeFilterFlags(KTp::ContactsFilterModel::ShowOnlyConnected);
     setMainWidget(m_contactGridWidget);
 
     connect(m_contactGridWidget,
diff --git a/app/invite-contact-dialog.h b/app/invite-contact-dialog.h
index 6dbef53..78d77f0 100644
--- a/app/invite-contact-dialog.h
+++ b/app/invite-contact-dialog.h
@@ -34,9 +34,9 @@ class PendingOperation;
 
 namespace KTp {
 class ContactGridWidget;
+class ContactsListModel;
 }
 
-class ContactsModel;
 
 class InviteContactDialog : public KDialog
 {
@@ -44,7 +44,7 @@ class InviteContactDialog : public KDialog
     Q_DISABLE_COPY(InviteContactDialog)
 
 public:
-    InviteContactDialog(const Tp::AccountPtr &account, const Tp::TextChannelPtr &channel, QWidget *parent);
+    InviteContactDialog(const Tp::AccountManagerPtr &accountManager, const Tp::AccountPtr &account, const Tp::TextChannelPtr &channel, QWidget *parent);
     Tp::AccountPtr account() const;
     Tp::TextChannelPtr channel() const;
 
@@ -55,7 +55,7 @@ private Q_SLOTS:
 private:
     Tp::AccountPtr m_account;
     Tp::TextChannelPtr m_channel;
-    ContactsModel *m_contactsModel;
+    KTp::ContactsListModel *m_contactsModel;
     KTp::ContactGridWidget *m_contactGridWidget;
 };
 
diff --git a/app/main.cpp b/app/main.cpp
index af0e7e7..d17797b 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -29,6 +29,10 @@
 #include <TelepathyQt/ContactFactory>
 #include <TelepathyQt/TextChannel>
 #include <TelepathyQt/OutgoingFileTransferChannel>
+#include <TelepathyQt/AccountManager>
+
+
+#include <KTp/contact-factory.h>
 
 #include <KAboutData>
 #include <KCmdLineArgs>
@@ -70,7 +74,7 @@ int main(int argc, char *argv[])
     channelFactory->addFeaturesForTextChatrooms(textFeatures);
     channelFactory->addFeaturesForOutgoingFileTransfers(Tp::OutgoingFileTransferChannel::FeatureCore);
 
-    Tp::ContactFactoryPtr contactFactory = Tp::ContactFactory::create(
+    Tp::ContactFactoryPtr contactFactory = KTp::ContactFactory::create(
         Tp::Features() << Tp::Contact::FeatureAlias
                        << Tp::Contact::FeatureAvatarToken
                        << Tp::Contact::FeatureAvatarData
@@ -78,10 +82,11 @@ int main(int argc, char *argv[])
                        << Tp::Contact::FeatureSimplePresence
     );
 
-    Tp::ClientRegistrarPtr registrar = Tp::ClientRegistrar::create(accountFactory, connectionFactory,
-                                                                   channelFactory, contactFactory);
+    Tp::AccountManagerPtr accountManager = Tp::AccountManager::create(QDBusConnection::sessionBus(), accountFactory, connectionFactory, channelFactory, contactFactory);
+
+    Tp::ClientRegistrarPtr registrar = Tp::ClientRegistrar::create(accountManager);
 
-    Tp::SharedPtr<TelepathyChatUi> app = Tp::SharedPtr<TelepathyChatUi>(new TelepathyChatUi);
+    Tp::SharedPtr<TelepathyChatUi> app = Tp::SharedPtr<TelepathyChatUi>(new TelepathyChatUi(accountManager));
     Tp::AbstractClientPtr handler = Tp::AbstractClientPtr(app);
     registrar->registerClient(handler, QLatin1String(KTP_TEXTUI_CLIENT_NAME));
 
diff --git a/app/telepathy-chat-ui.cpp b/app/telepathy-chat-ui.cpp
index e9a35e5..9aabe10 100644
--- a/app/telepathy-chat-ui.cpp
+++ b/app/telepathy-chat-ui.cpp
@@ -39,8 +39,9 @@ inline Tp::ChannelClassSpecList channelClassList()
 }
 
 
-TelepathyChatUi::TelepathyChatUi()
-    : KTp::TelepathyHandlerApplication(true, -1, -1), AbstractClientHandler(channelClassList())
+TelepathyChatUi::TelepathyChatUi(const Tp::AccountManagerPtr &accountManager)
+    : KTp::TelepathyHandlerApplication(true, -1, -1), AbstractClientHandler(channelClassList()),
+      m_accountManager(accountManager)
 {
     kDebug();
 
@@ -185,3 +186,8 @@ bool TelepathyChatUi::bypassApproval() const
     return false;
 }
 
+Tp::AccountManagerPtr TelepathyChatUi::accountManager() const
+{
+    return m_accountManager;
+}
+
diff --git a/app/telepathy-chat-ui.h b/app/telepathy-chat-ui.h
index 606b45e..70800f4 100644
--- a/app/telepathy-chat-ui.h
+++ b/app/telepathy-chat-ui.h
@@ -22,6 +22,8 @@
 #define TELEPATHYCHATUI_H
 
 #include <TelepathyQt/AbstractClientHandler>
+#include <TelepathyQt/AccountManager>
+
 #include <KTp/telepathy-handler-application.h>
 
 class ChatTab;
@@ -31,7 +33,7 @@ class TelepathyChatUi : public KTp::TelepathyHandlerApplication, public Tp::Abst
 {
     Q_OBJECT
 public:
-    TelepathyChatUi();
+    TelepathyChatUi(const Tp::AccountManagerPtr &accountManager);
     ~TelepathyChatUi();
 
     enum TabOpenMode {
@@ -40,7 +42,6 @@ public:
         LastWindow
     };
 
-
     virtual void handleChannels(const Tp::MethodInvocationContextPtr<> & context,
             const Tp::AccountPtr &account,
             const Tp::ConnectionPtr &connection,
@@ -51,14 +52,16 @@ public:
 
     virtual bool bypassApproval() const;
 
+    Tp::AccountManagerPtr accountManager() const;
+
 private Q_SLOTS:
     void removeWindow(ChatWindow *window);
     void dettachTab(ChatTab *tab);
 
 private:
-
     ChatWindow* createWindow();
 
+    Tp::AccountManagerPtr m_accountManager;
     QList<ChatWindow*> m_chatWindows;
     TabOpenMode m_openMode;
 };

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list