[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:04:25 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=03fb483
The following commit has been merged in the master branch:
commit 03fb483d3f7db28d05be47f84c7c32f9aeed878e
Author: George Goldberg <grundleborg at googlemail.com>
Date: Thu Feb 11 21:23:06 2010 +0000
Move getting 'me' from Nepomuk to the AccountMonitor class setup, to avoid doing it extra times. Also cleanup TelepathyAccount class a bit.
svn path=/trunk/playground/network/telepathy-integration-daemon/; revision=1088896
---
kpeople/nepomuk-feeder/telepathyaccount.cpp | 36 +----------------
kpeople/nepomuk-feeder/telepathyaccount.h | 19 +++++----
kpeople/nepomuk-feeder/telepathyaccountmonitor.cpp | 47 ++++++++++++++++++++++
kpeople/nepomuk-feeder/telepathyaccountmonitor.h | 5 +++
4 files changed, 65 insertions(+), 42 deletions(-)
diff --git a/kpeople/nepomuk-feeder/telepathyaccount.cpp b/kpeople/nepomuk-feeder/telepathyaccount.cpp
index 75c9b36..dfbcea0 100644
--- a/kpeople/nepomuk-feeder/telepathyaccount.cpp
+++ b/kpeople/nepomuk-feeder/telepathyaccount.cpp
@@ -101,41 +101,7 @@ void TelepathyAccount::onAccountReady(Tp::PendingOperation *op)
void TelepathyAccount::doNepomukSetup()
{
- // FIXME: Move getting hold of "me" into the parent class so we
- // don't repeat it for each account?
- // Get the PIMO:Person for "me" from nepomuk
- // FIXME: Port to new OSCAF standard for accessing "me" as soon as it
- // becomes available.
- Nepomuk::Thing me(QUrl::fromEncoded("nepomuk:/myself"));
-
- // FIXME: We should not create "me" if it doesn't exist once the above
- // fixme has been dealt with.
- if (!me.exists()) {
- // The PIMO:Person representing "me" does not exist, so we need to create it.
- me.addType(Nepomuk::Vocabulary::PIMO::Person());
- }
-
- Nepomuk::PersonContact mePersonContact;
-
- // Loop through all the grounding instances of this person
- Q_FOREACH (Nepomuk::Resource resource, me.groundingOccurrences()) {
- // See if this grounding instance is of type nco:contact.
- if (resource.hasType(Nepomuk::Vocabulary::NCO::PersonContact())) {
- // FIXME: We are going to assume the first NCO::PersonContact is the
- // right one. Can we improve this?
- mePersonContact = resource;
- break;
- }
- }
-
- if (!mePersonContact.exists()) {
- kWarning() << "Me NCO:PersonContact doesn't exist. Creating it...";
- // FIXME: We shouldn't create this person contact, but for now we will
- // to ease development :) (see above comments)
- mePersonContact = Nepomuk::PersonContact("nepomuk:/myself-person-contact");
- me.addGroundingOccurrence(mePersonContact);
- }
-
+ Nepomuk::PersonContact mePersonContact = m_parent->mePersonContact();
Nepomuk::IMAccount imAccount;
imAccount = getNepomukImAccount(mePersonContact);
diff --git a/kpeople/nepomuk-feeder/telepathyaccount.h b/kpeople/nepomuk-feeder/telepathyaccount.h
index dd1277f..f224d51 100644
--- a/kpeople/nepomuk-feeder/telepathyaccount.h
+++ b/kpeople/nepomuk-feeder/telepathyaccount.h
@@ -1,7 +1,8 @@
/*
* This file is part of telepathy-integration-daemon
*
- * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2009-2010 Collabora Ltd. <info at collabora.co.uk>
+ * @author George Goldberg <george.goldberg at collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -30,20 +31,25 @@
#include <TelepathyQt4/Account>
#include <TelepathyQt4/Connection>
+class KJob;
+class TelepathyAccountMonitor;
+
namespace Tp {
class PendingOperation;
}
-class KJob;
-
-class TelepathyAccountMonitor;
-
+/**
+ * This class takes care of one TelepathyAccount on the Account Manager.
+ * It is responsible for keeping that account synced to Nepomuk, as well
+ * as creating TelepathyContact objects for the contents of that account's
+ * buddy list.
+ */
class TelepathyAccount : public QObject
{
Q_OBJECT
public:
- TelepathyAccount(const QString &path, TelepathyAccountMonitor *parent = 0);
+ explicit TelepathyAccount(const QString &path, TelepathyAccountMonitor *parent = 0);
~TelepathyAccount();
private Q_SLOTS:
@@ -61,7 +67,6 @@ private:
QString m_path;
Tp::AccountPtr m_account;
-
Tp::ConnectionPtr m_connection;
Nepomuk::IMAccount accountResource;
diff --git a/kpeople/nepomuk-feeder/telepathyaccountmonitor.cpp b/kpeople/nepomuk-feeder/telepathyaccountmonitor.cpp
index a2a0e21..210a8e4 100644
--- a/kpeople/nepomuk-feeder/telepathyaccountmonitor.cpp
+++ b/kpeople/nepomuk-feeder/telepathyaccountmonitor.cpp
@@ -21,9 +21,14 @@
#include "telepathyaccountmonitor.h"
+// Ontology Vocabularies
+#include "nco.h"
+#include "pimo.h"
+
#include <KDebug>
#include <Nepomuk/ResourceManager>
+#include <Nepomuk/Thing>
#include <QtCore/QString>
@@ -46,6 +51,9 @@ TelepathyAccountMonitor::TelepathyAccountMonitor(QObject *parent)
connect(m_resourceManager,
SIGNAL(error(QString, int)),
SLOT(onNepomukError(QString, int)));
+
+ // Now do the initialization stuff for Nepomuk.
+ doNepomukSetup();
}
TelepathyAccountMonitor::~TelepathyAccountMonitor()
@@ -53,6 +61,40 @@ TelepathyAccountMonitor::~TelepathyAccountMonitor()
// Don't delete the Nepomuk Resource manager. Nepomuk should take care of this itself.
}
+void TelepathyAccountMonitor::doNepomukSetup()
+{
+ // Here we get the "me" person contact.
+ // FIXME: Port to new OSCAF standard for accessing "me" as soon as it
+ // becomes available.
+ Nepomuk::Thing me(QUrl::fromEncoded("nepomuk:/myself"));
+
+ // FIXME: We should not create "me" if it doesn't exist once the above
+ // fixme has been dealt with.
+ if (!me.exists()) {
+ // The PIMO:Person representing "me" does not exist, so we need to create it.
+ me.addType(Nepomuk::Vocabulary::PIMO::Person());
+ }
+
+ // Loop through all the grounding instances of this person
+ Q_FOREACH (Nepomuk::Resource resource, me.groundingOccurrences()) {
+ // See if this grounding instance is of type nco:contact.
+ if (resource.hasType(Nepomuk::Vocabulary::NCO::PersonContact())) {
+ // FIXME: We are going to assume the first NCO::PersonContact is the
+ // right one. Can we improve this?
+ m_mePersonContact = resource;
+ break;
+ }
+ }
+
+ if (!m_mePersonContact.exists()) {
+ kWarning() << "Me NCO:PersonContact doesn't exist. Creating it...";
+ // FIXME: We shouldn't create this person contact, but for now we will
+ // to ease development :) (see above FIXME's)
+ m_mePersonContact = Nepomuk::PersonContact("nepomuk:/myself-person-contact");
+ me.addGroundingOccurrence(m_mePersonContact);
+ }
+}
+
void TelepathyAccountMonitor::onAccountManagerReady(Tp::PendingOperation *op)
{
if (op->isError()) {
@@ -83,6 +125,11 @@ Tp::AccountManagerPtr TelepathyAccountMonitor::accountManager() const
return m_accountManager;
}
+Nepomuk::PersonContact TelepathyAccountMonitor::mePersonContact() const
+{
+ return m_mePersonContact;
+}
+
void TelepathyAccountMonitor::onNepomukError(const QString &uri, int errorCode)
{
kWarning() << "A Nepomuk Error occurred:" << uri << errorCode;
diff --git a/kpeople/nepomuk-feeder/telepathyaccountmonitor.h b/kpeople/nepomuk-feeder/telepathyaccountmonitor.h
index 4f8a464..ac7fa7d 100644
--- a/kpeople/nepomuk-feeder/telepathyaccountmonitor.h
+++ b/kpeople/nepomuk-feeder/telepathyaccountmonitor.h
@@ -53,6 +53,7 @@ public:
~TelepathyAccountMonitor();
Tp::AccountManagerPtr accountManager() const;
+ Nepomuk::PersonContact mePersonContact() const;
private Q_SLOTS:
void onAccountManagerReady(Tp::PendingOperation *op);
@@ -62,9 +63,13 @@ private Q_SLOTS:
private:
Q_DISABLE_COPY(TelepathyAccountMonitor);
+ void doNepomukSetup();
+
Tp::AccountManagerPtr m_accountManager;
Nepomuk::ResourceManager *m_resourceManager;
+ Nepomuk::PersonContact m_mePersonContact;
+
};
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list