[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9
Maximiliano Curia
maxy at moszumanska.debian.org
Mon May 9 09:07:57 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=6c1f892
The following commit has been merged in the master branch:
commit 6c1f8920729f7ad5d7e2daf2c982abd1ab5eba61
Author: Martin Klapetek <mklapetek at kde.org>
Date: Fri Jan 3 18:24:52 2014 +0100
Streamline the kpeople-actions plugin a bit
Currently it offers actions only for the "most online contact" of a
Person. In the (near) future it needs to query the subcontacts as well
and gather all the capabilities onto the Person.
Reviewed-by: David Edmundson
---
kpeople/actionsplugin/kpeople-actions-plugin.cpp | 135 +++++++++++------------
1 file changed, 64 insertions(+), 71 deletions(-)
diff --git a/kpeople/actionsplugin/kpeople-actions-plugin.cpp b/kpeople/actionsplugin/kpeople-actions-plugin.cpp
index 8a09e49..1f58ee1 100644
--- a/kpeople/actionsplugin/kpeople-actions-plugin.cpp
+++ b/kpeople/actionsplugin/kpeople-actions-plugin.cpp
@@ -112,84 +112,77 @@ QList<QAction*> KPeopleActionsPlugin::actionsForPerson(const KABC::Addressee &pe
{
QList<QAction*> actions;
+ // === TODO ===
+ // This creates actions just for the "most online contact", what we want is to query all
+ // the subcontacts for all capabilities and fill them in on the Person, so if eg. one of
+ // the subcontacts can do audio calls and the other can do video calls, the Person
+ // should have both actions present.
+ Q_UNUSED(contacts);
+
const QString &accountPath = person.custom(QLatin1String("telepathy"), QLatin1String("accountPath"));
const QString &contactId = person.custom(QLatin1String("telepathy"), QLatin1String("contactId"));
- // List of pair<accountPath, contactId> - these two always need to be together
- QList<QPair<QString, QString> > accountContactList;
-
- accountContactList << qMakePair(accountPath, contactId);
-
- Q_FOREACH (const KABC::Addressee &contact, contacts) {
- accountContactList << qMakePair(contact.custom(QLatin1String("telepathy"), QLatin1String("accountPath")),
- contact.custom(QLatin1String("telepathy"), QLatin1String("contactId")));
+ const Tp::AccountPtr account = KTp::contactManager()->accountForAccountPath(accountPath);
+ if (!account) {
+ return actions;
}
- for (int i = 0; i < accountContactList.size(); i++) {
- const KTp::ContactPtr contact = KTp::contactManager()->contactForContactId(accountContactList.at(i).first,
- accountContactList.at(i).second);
- if (!contact || !contact->manager()) {
- continue;
- }
- const Tp::AccountPtr account = KTp::contactManager()->accountForAccountPath(accountContactList.at(i).first);
-
- if (!account) {
- continue;
- }
+ const KTp::ContactPtr contact = KTp::contactManager()->contactForContactId(accountPath, contactId);
+ if (!contact || !contact->manager()) {
+ return actions;
+ }
- //FIXME - already in master
- if (true) { //no such query for text chat capability, added an "if true" because makes the code look consistent
- QAction *action = new IMAction(i18n("Start Chat Using %1...", account->displayName()),
- KIcon(QLatin1String("text-x-generic")),
- contact,
- account,
- TextChannel,
- parent);
- connect (action, SIGNAL(triggered(bool)), SLOT(onActionTriggered()));
- actions << action;
- }
- if (contact->audioCallCapability()) {
- QAction *action = new IMAction(i18n("Start Audio Call Using %1...", account->displayName()),
- KIcon(QLatin1String("audio-headset")),
- contact,
- account,
- AudioChannel,
- parent);
- connect (action, SIGNAL(triggered(bool)), SLOT(onActionTriggered()));
- actions << action;
- }
- if (contact->videoCallCapability()) {
- QAction *action = new IMAction(i18n("Start Video Call Using %1...", account->displayName()),
- KIcon(QLatin1String("camera-web")),
- contact,
- account,
- VideoChannel,
- parent);
- connect (action, SIGNAL(triggered(bool)), SLOT(onActionTriggered()));
- actions << action;
- }
+ if (contact->textChatCapability()) {
+ QAction *action = new IMAction(i18n("Start Chat Using %1...", account->displayName()),
+ KIcon(QLatin1String("text-x-generic")),
+ contact,
+ account,
+ TextChannel,
+ parent);
+ connect (action, SIGNAL(triggered(bool)), SLOT(onActionTriggered()));
+ actions << action;
+ }
+ if (contact->audioCallCapability()) {
+ QAction *action = new IMAction(i18n("Start Audio Call Using %1...", account->displayName()),
+ KIcon(QLatin1String("audio-headset")),
+ contact,
+ account,
+ AudioChannel,
+ parent);
+ connect (action, SIGNAL(triggered(bool)), SLOT(onActionTriggered()));
+ actions << action;
+ }
+ if (contact->videoCallCapability()) {
+ QAction *action = new IMAction(i18n("Start Video Call Using %1...", account->displayName()),
+ KIcon(QLatin1String("camera-web")),
+ contact,
+ account,
+ VideoChannel,
+ parent);
+ connect (action, SIGNAL(triggered(bool)), SLOT(onActionTriggered()));
+ actions << action;
+ }
- if (contact->fileTransferCapability()) {
- QAction *action = new IMAction(i18n("Send a File Using %1...", account->displayName()),
- KIcon(QLatin1String("mail-attachment")),
- contact,
- account,
- FileTransfer,
- parent);
- action->setDisabled(true); //FIXME: we need to prompt for file
- connect (action, SIGNAL(triggered(bool)), SLOT(onActionTriggered()));
- actions << action;
- }
- if (contact->collaborativeEditingCapability()) {
- QAction *action = new IMAction(i18n("Collaboratively edit a document Using %1...", account->displayName()),
- KIcon(QLatin1String("document-edit")),
- contact,
- account,
- CollabEditing,
- parent);
- connect (action, SIGNAL(triggered(bool)), SLOT(onActionTriggered()));
- actions << action;
- }
+ if (contact->fileTransferCapability()) {
+ QAction *action = new IMAction(i18n("Send a File Using %1...", account->displayName()),
+ KIcon(QLatin1String("mail-attachment")),
+ contact,
+ account,
+ FileTransfer,
+ parent);
+ action->setDisabled(true); //FIXME: we need to prompt for file
+ connect (action, SIGNAL(triggered(bool)), SLOT(onActionTriggered()));
+ actions << action;
+ }
+ if (contact->collaborativeEditingCapability()) {
+ QAction *action = new IMAction(i18n("Collaboratively edit a document Using %1...", account->displayName()),
+ KIcon(QLatin1String("document-edit")),
+ contact,
+ account,
+ CollabEditing,
+ parent);
+ connect (action, SIGNAL(triggered(bool)), SLOT(onActionTriggered()));
+ actions << action;
}
//FIXME-KPEOPLE
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list