[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:52 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=a124f2f
The following commit has been merged in the master branch:
commit a124f2ff9b0d6c14633ab9f12ad7ecb6c5d516c5
Author: Martin Klapetek <mklapetek at kde.org>
Date: Sun Nov 17 11:52:14 2013 +0100
Port the actions plugin to kpeople2
---
kpeople/actionsplugin/kpeople-actions-plugin.cpp | 52 ++++++++++++++----------
kpeople/actionsplugin/kpeople-actions-plugin.h | 4 +-
2 files changed, 34 insertions(+), 22 deletions(-)
diff --git a/kpeople/actionsplugin/kpeople-actions-plugin.cpp b/kpeople/actionsplugin/kpeople-actions-plugin.cpp
index f98c57e..2737a63 100644
--- a/kpeople/actionsplugin/kpeople-actions-plugin.cpp
+++ b/kpeople/actionsplugin/kpeople-actions-plugin.cpp
@@ -28,12 +28,12 @@
#include "KTp/contact.h"
#include "KTp/actions.h"
-#include "KTp/im-persons-data-source.h"
+#include "KTp/core.h"
+#include "KTp/global-contact-manager.h"
#include <TelepathyQt/Account>
#include <TelepathyQt/ContactManager>
-
#include <kpeople/personpluginmanager.h>
#include <KPeople/PersonData>
@@ -101,35 +101,44 @@ QUrl IMAction::uri() const
return m_uri;
}
-KPeopleActionsPlugin::KPeopleActionsPlugin(QObject* parent, const QVariantList &args):
-AbstractPersonPlugin(parent)
+KPeopleActionsPlugin::KPeopleActionsPlugin(QObject *parent, const QVariantList &args)
+ : AbstractPersonPlugin(parent)
{
Q_UNUSED(args);
}
-QList<QAction*> KPeopleActionsPlugin::actionsForPerson(const KPeople::PersonDataPtr &personData, QObject *parent)
+QList<QAction*> KPeopleActionsPlugin::actionsForPerson(const KABC::Addressee &person,
+ const KABC::AddresseeList &contacts,
+ QObject *parent) const
{
QList<QAction*> actions;
- IMPersonsDataSource *dataSource = dynamic_cast<IMPersonsDataSource*>(KPeople::PersonPluginManager::presencePlugin());
- if (!dataSource) {
- return actions;
- }
+ 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;
- QStringList imContactsIds = personData->imAccounts();
+ 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")));
+ }
- for (int i = 0; i < imContactsIds.size(); i++) {
- const QString contactId = imContactsIds[i];
- const KTp::ContactPtr contact = dataSource->contactForContactId(contactId);
+ 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 = dataSource->accountForContact(contact);
+ const Tp::AccountPtr account = KTp::contactManager()->accountForAccountPath(accountContactList.at(i).first);
if (!account) {
continue;
}
+ //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")),
@@ -184,13 +193,14 @@ QList<QAction*> KPeopleActionsPlugin::actionsForPerson(const KPeople::PersonData
}
}
- QAction *action = new IMAction(i18n("Open Log Viewer..."),
- KIcon(QLatin1String("documentation")),
- personData->uri(),
- LogViewer,
- parent);
- connect(action, SIGNAL(triggered(bool)), SLOT(onActionTriggered()));
- actions << action;
+ //FIXME-KPEOPLE
+// QAction *action = new IMAction(i18n("Open Log Viewer..."),
+// KIcon(QLatin1String("documentation")),
+// personData->uri(),
+// LogViewer,
+// parent);
+// connect(action, SIGNAL(triggered(bool)), SLOT(onActionTriggered()));
+// actions << action;
return actions;
}
diff --git a/kpeople/actionsplugin/kpeople-actions-plugin.h b/kpeople/actionsplugin/kpeople-actions-plugin.h
index 4169dc0..219b173 100644
--- a/kpeople/actionsplugin/kpeople-actions-plugin.h
+++ b/kpeople/actionsplugin/kpeople-actions-plugin.h
@@ -26,7 +26,9 @@ class KPeopleActionsPlugin : public KPeople::AbstractPersonPlugin
Q_OBJECT
public:
KPeopleActionsPlugin(QObject *parent, const QVariantList &args);
- virtual QList<QAction*> actionsForPerson(const KPeople::PersonDataPtr &personData, QObject *parent);
+ virtual QList<QAction*> actionsForPerson(const KABC::Addressee &person,
+ const KABC::AddresseeList &contacts,
+ QObject *parent) const;
private Q_SLOTS:
void onActionTriggered();
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list