[SCM] ktp-contact-applet packaging branch, master, updated. debian/15.12.1-1-966-gde83ac5
Maximiliano Curia
maxy at moszumanska.debian.org
Sat May 28 00:15:46 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-desktop-applets.git;a=commitdiff;h=a584cd0
The following commit has been merged in the master branch:
commit a584cd02ff1e374c238ded422fc75900d01abcce
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Tue Nov 20 23:15:24 2012 +0900
Phase out use of ContactModelItem
REVIEW: 107396
---
declarative-plugin/contact-list.cpp | 26 +++++++++++-----------
declarative-plugin/contact-list.h | 3 ++-
.../contents/ui/ListContactDelegate.qml | 22 +++++++++---------
3 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/declarative-plugin/contact-list.cpp b/declarative-plugin/contact-list.cpp
index 92a6022..52ee06b 100644
--- a/declarative-plugin/contact-list.cpp
+++ b/declarative-plugin/contact-list.cpp
@@ -23,13 +23,13 @@
#include <TelepathyQt/ConnectionFactory>
#include <TelepathyQt/AccountManager>
#include <TelepathyQt/PendingReady>
+#include <TelepathyQt/PendingChannelRequest>
#include <KDebug>
#include <KTp/Models/contact-model-item.h>
#include <KTp/Models/accounts-model-item.h>
-
-#define PREFERRED_TEXTCHAT_HANDLER "org.freedesktop.Telepathy.Client.KTp.TextUi"
+#include <KTp/actions.h>
ContactList::ContactList(QObject *parent)
: QObject(parent),
@@ -97,20 +97,20 @@ AccountsFilterModel * ContactList::filterModel() const
return m_filterModel;
}
-void ContactList::startChat(ContactModelItem *contactItem)
+void ContactList::startChat(const Tp::AccountPtr &account, const Tp::ContactPtr &contact)
{
-
- Tp::ContactPtr contact = contactItem->contact();
-
kDebug() << "Requesting chat for contact" << contact->alias();
- Tp::AccountPtr account = m_contactsModel->accountForContactItem(contactItem);
+ kDebug() << "account is" << account->normalizedName();
- Tp::ChannelRequestHints hints;
- hints.setHint("org.freedesktop.Telepathy.ChannelRequest","DelegateToPreferredHandler", QVariant(true));
+ Tp::PendingOperation *op = KTp::Actions::startChat(account, contact, true);
+ connect(op, SIGNAL(finished(Tp::PendingOperation*)), SLOT(onGenericOperationFinished(Tp::PendingOperation*)));
+}
- Tp::PendingChannelRequest *channelRequest = account->ensureTextChat(contact,
- QDateTime::currentDateTime(),
- PREFERRED_TEXTCHAT_HANDLER,
- hints);
+void ContactList::onGenericOperationFinished(Tp::PendingOperation *op)
+{
+ if (op->isError()) {
+ kDebug() << op->errorName();
+ kDebug() << op->errorMessage();
+ }
}
diff --git a/declarative-plugin/contact-list.h b/declarative-plugin/contact-list.h
index dee39ee..5997ec3 100644
--- a/declarative-plugin/contact-list.h
+++ b/declarative-plugin/contact-list.h
@@ -41,10 +41,11 @@ public:
public slots:
- void startChat(ContactModelItem *contact);
+ void startChat(const Tp::AccountPtr &account, const Tp::ContactPtr &contact);
private slots:
void onAccountManagerReady(Tp::PendingOperation *op);
+ void onGenericOperationFinished(Tp::PendingOperation *op);
private:
ContactsModel* m_contactsModel;
diff --git a/org.kde.ktp.contactlist/contents/ui/ListContactDelegate.qml b/org.kde.ktp.contactlist/contents/ui/ListContactDelegate.qml
index 0f78f87..dcdf53c 100644
--- a/org.kde.ktp.contactlist/contents/ui/ListContactDelegate.qml
+++ b/org.kde.ktp.contactlist/contents/ui/ListContactDelegate.qml
@@ -25,10 +25,10 @@ import org.kde.qtextracomponents 0.1 as ExtraComponents
Item {
id: delegate;
enabled: true
-
+
height: 36;
width: parent.width
-
+
PlasmaCore.FrameSvgItem {
id: padding
imagePath: "widgets/viewitem"
@@ -36,25 +36,25 @@ Item {
opacity: 0
anchors.fill: parent
}
-
+
Item {
anchors.fill: parent
anchors.topMargin: padding.margins.top
anchors.bottomMargin: padding.margins.bottom
anchors.leftMargin: padding.margins.left
anchors.rightMargin: padding.margins.right
-
+
ExtraComponents.QIconItem {
id: avatarLabel;
width: 30;
height: parent.height;
-
+
icon : (avatar ? avatar : "im-user")
anchors {
left: parent.left;
verticalCenter: parent.verticalCenter;
- }
+ }
}
PlasmaComponents.Label {
@@ -70,7 +70,7 @@ Item {
verticalCenter: parent.verticalCenter;
}
}
-
+
ExtraComponents.QIconItem {
id: presenceLabel
width: 22
@@ -83,16 +83,16 @@ Item {
}
}
}
-
+
MouseArea {
anchors.fill: parent
-
+
hoverEnabled: true
onDoubleClicked: {
- contactList.startChat(item);
+ contactList.startChat(model.account, model.contact);
}
-
+
onEntered: {
contactsList.currentIndex = index;
contactsList.highlightItem.opacity = 1;
--
ktp-contact-applet packaging
More information about the pkg-kde-commits
mailing list