[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:14 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=8602c36
The following commit has been merged in the master branch:
commit 8602c36facfc09fe4471e127e262b0d4f9d77621
Author: George Goldberg <george.goldberg at collabora.co.uk>
Date: Fri Dec 10 22:16:12 2010 +0000
Add a shutdown method, which allows the signals for the shutdown of an account and contacts to propogate throughout the system properly before they are destroyed on shutdown.
---
kpeople/nepomuk-feeder/account.cpp | 13 +++++++++++++
kpeople/nepomuk-feeder/account.h | 2 ++
kpeople/nepomuk-feeder/contact.cpp | 3 +++
kpeople/nepomuk-feeder/contact.h | 1 +
kpeople/nepomuk-feeder/controller.cpp | 20 +++++++++++++++++---
kpeople/nepomuk-feeder/controller.h | 4 +++-
kpeople/nepomuk-feeder/service.cpp | 4 +++-
kpeople/nepomuk-feeder/service.h | 5 +++++
8 files changed, 47 insertions(+), 5 deletions(-)
diff --git a/kpeople/nepomuk-feeder/account.cpp b/kpeople/nepomuk-feeder/account.cpp
index 02d1e74..a56b5fb 100644
--- a/kpeople/nepomuk-feeder/account.cpp
+++ b/kpeople/nepomuk-feeder/account.cpp
@@ -73,6 +73,19 @@ void Account::init()
Account::~Account()
{
+ kDebug();
+}
+
+void Account::shutdown()
+{
+ // Loop over all our children, and if they're Accounts, shut them down.
+ foreach (Contact *contact, m_contacts.values()) {
+ contact->shutdown();
+ }
+
+ kDebug();
+
+ // Emit a signal to say we were destroyed.
emit accountDestroyed(m_account->objectPath());
}
diff --git a/kpeople/nepomuk-feeder/account.h b/kpeople/nepomuk-feeder/account.h
index 829fa96..b2f7458 100644
--- a/kpeople/nepomuk-feeder/account.h
+++ b/kpeople/nepomuk-feeder/account.h
@@ -45,7 +45,9 @@ class Account : public QObject
public:
explicit Account(const Tp::AccountPtr &account, QObject *parent = 0);
~Account();
+
void init();
+ void shutdown();
Q_SIGNALS:
void created(const QString &path, const QString &id, const QString &protocol);
diff --git a/kpeople/nepomuk-feeder/contact.cpp b/kpeople/nepomuk-feeder/contact.cpp
index e74fc27..91bdcfd 100644
--- a/kpeople/nepomuk-feeder/contact.cpp
+++ b/kpeople/nepomuk-feeder/contact.cpp
@@ -88,7 +88,10 @@ void Contact::init()
Contact::~Contact()
{
kDebug();
+}
+void Contact::shutdown()
+{
// Signal this contact is destroyed so it can be removed from the Hash.
emit contactDestroyed(m_contact->id(), m_contact);
}
diff --git a/kpeople/nepomuk-feeder/contact.h b/kpeople/nepomuk-feeder/contact.h
index 3de2266..03da0f8 100644
--- a/kpeople/nepomuk-feeder/contact.h
+++ b/kpeople/nepomuk-feeder/contact.h
@@ -40,6 +40,7 @@ public:
~Contact();
void init();
+ void shutdown();
Q_SIGNALS:
void created(const QString &id);
diff --git a/kpeople/nepomuk-feeder/controller.cpp b/kpeople/nepomuk-feeder/controller.cpp
index 5338d2f..dc09e68 100644
--- a/kpeople/nepomuk-feeder/controller.cpp
+++ b/kpeople/nepomuk-feeder/controller.cpp
@@ -28,10 +28,13 @@
#include <TelepathyQt4/PendingReady>
-Controller::Controller(QObject *parent)
+Controller::Controller(Storage *storage, QObject *parent)
: QObject(parent),
- m_storage(new Storage(this))
+ m_storage(storage)
{
+ // Take ownership of the storage.
+ m_storage->setParent(this);
+
// Set up the Factories.
Tp::Features fAccountFactory;
fAccountFactory << Tp::Account::FeatureCore
@@ -79,7 +82,7 @@ Controller::Controller(QObject *parent)
Controller::~Controller()
{
-
+ kDebug();
}
void Controller::onAccountManagerReady(Tp::PendingOperation *op)
@@ -144,6 +147,17 @@ void Controller::onNewAccount(const Tp::AccountPtr &account)
acc->init();
}
+void Controller::shutdown()
+{
+ // Loop over all our children, and if they're Accounts, shut them down.
+ foreach (QObject *child, children()) {
+ Account *account = qobject_cast<Account*>(child);
+ if (account) {
+ account->shutdown();
+ }
+ }
+}
+
#include "controller.moc"
diff --git a/kpeople/nepomuk-feeder/controller.h b/kpeople/nepomuk-feeder/controller.h
index ac3fc18..f9b3232 100644
--- a/kpeople/nepomuk-feeder/controller.h
+++ b/kpeople/nepomuk-feeder/controller.h
@@ -45,9 +45,11 @@ class Controller : public QObject
Q_OBJECT
public:
- explicit Controller(QObject *parent = 0);
+ explicit Controller(Storage *storage, QObject *parent = 0);
~Controller();
+ void shutdown();
+
private Q_SLOTS:
void onAccountManagerReady(Tp::PendingOperation *op);
void onNewAccount(const Tp::AccountPtr &account);
diff --git a/kpeople/nepomuk-feeder/service.cpp b/kpeople/nepomuk-feeder/service.cpp
index 2d8c522..ca5a58b 100644
--- a/kpeople/nepomuk-feeder/service.cpp
+++ b/kpeople/nepomuk-feeder/service.cpp
@@ -23,6 +23,7 @@
#include "service.h"
#include "controller.h"
+#include "storage.h"
#include <KDebug>
#include <KPluginFactory>
@@ -38,7 +39,7 @@ TelepathyService::TelepathyService(QObject *parent, const QVariantList &)
Tp::registerTypes();
// Create an instance of the Telepathy Account Monitor.
- new Controller(this);
+ m_controller = new Controller(new Storage(), this);
setServiceInitialized(true);
@@ -47,6 +48,7 @@ TelepathyService::TelepathyService(QObject *parent, const QVariantList &)
TelepathyService::~TelepathyService()
{
+ m_controller->shutdown();
}
diff --git a/kpeople/nepomuk-feeder/service.h b/kpeople/nepomuk-feeder/service.h
index d2ff6b6..78127a5 100644
--- a/kpeople/nepomuk-feeder/service.h
+++ b/kpeople/nepomuk-feeder/service.h
@@ -25,6 +25,8 @@
#include <QtCore/QVariantList>
+class Controller;
+
class TelepathyService : public Nepomuk::Service
{
Q_OBJECT
@@ -32,6 +34,9 @@ class TelepathyService : public Nepomuk::Service
public:
TelepathyService(QObject* parent, const QVariantList&);
~TelepathyService();
+
+private:
+ Controller *m_controller;
};
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list