[SCM] ktp-contact-list packaging branch, master, updated. debian/15.12.1-2-1070-g6c56f91
Maximiliano Curia
maxy at moszumanska.debian.org
Sat May 28 00:07:43 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-list.git;a=commitdiff;h=616db2c
The following commit has been merged in the master branch:
commit 616db2cab51cf1da4945d7d05233d25a11f1703d
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Mon Oct 10 21:43:12 2011 +0100
Use Service availablity checker from git submodule
---
CMakeLists.txt | 2 +-
service-availability-checker.cpp | 107 ---------------------------------------
service-availability-checker.h | 50 ------------------
3 files changed, 1 insertion(+), 158 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b5b54fa..a258313 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,7 +47,6 @@ set (contactlist_SRCS
main.cpp
main-widget.cpp
fetch-avatar-job.cpp
- service-availability-checker.cpp
dialogs/add-contact-dialog.cpp
dialogs/join-chat-room-dialog.cpp
dialogs/remove-contact-dialog.cpp
@@ -60,6 +59,7 @@ set (contactlist_SRCS
common/models/groups-model-item.cpp
common/models/groups-model.cpp
common/models/proxy-tree-node.cpp
+ common/service-availability-checker.cpp
)
diff --git a/service-availability-checker.cpp b/service-availability-checker.cpp
deleted file mode 100644
index 9b9e1d5..0000000
--- a/service-availability-checker.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- Copyright (C) 2011 Collabora Ltd. <info at collabora.com>
- @author George Kiagiadakis <george.kiagiadakis at collabora.com>
-
- This library is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-#include "service-availability-checker.h"
-
-#include <QtDBus/QDBusConnectionInterface>
-#include <QtDBus/QDBusServiceWatcher>
-#include <QtDBus/QDBusPendingCall>
-#include <QtDBus/QDBusReply>
-
-#include <KDebug>
-
-struct ServiceAvailabilityChecker::Private
-{
- QString serviceName;
- bool serviceAvailable;
- bool serviceActivatable;
-};
-
-ServiceAvailabilityChecker::ServiceAvailabilityChecker(const QString & serviceName, QObject *parent)
- : QObject(parent), d(new Private)
-{
- d->serviceName = serviceName;
- d->serviceAvailable = false;
- d->serviceActivatable = false;
-
- QDBusServiceWatcher *serviceWatcher = new QDBusServiceWatcher(serviceName,
- QDBusConnection::sessionBus(),
- QDBusServiceWatcher::WatchForRegistration | QDBusServiceWatcher::WatchForUnregistration,
- this);
- connect(serviceWatcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)),
- this, SLOT(onServiceOwnerChanged(QString,QString,QString)));
-
- introspect();
-}
-
-ServiceAvailabilityChecker::~ServiceAvailabilityChecker()
-{
- delete d;
-}
-
-bool ServiceAvailabilityChecker::isAvailable() const
-{
- return d->serviceAvailable || d->serviceActivatable;
-}
-
-void ServiceAvailabilityChecker::introspect()
-{
- QDBusConnectionInterface *dbusIface = QDBusConnection::sessionBus().interface();
-
- QDBusPendingCall call = dbusIface->asyncCall(QLatin1String("ListActivatableNames"));
- QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this);
- connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
- this, SLOT(onCallFinished(QDBusPendingCallWatcher*)));
- watcher->setObjectName(QLatin1String("ListActivatableNamesWatcher"));
-
- call = dbusIface->asyncCall(QLatin1String("ListNames"));
- watcher = new QDBusPendingCallWatcher(call, this);
- connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
- this, SLOT(onCallFinished(QDBusPendingCallWatcher*)));
-}
-
-void ServiceAvailabilityChecker::onCallFinished(QDBusPendingCallWatcher *watcher)
-{
- QDBusReply<QStringList> reply = *watcher;
- if (!reply.isValid()) {
- kDebug() << "Got error while introspecting service availability:" << reply.error();
- } else {
- if (watcher->objectName() == QLatin1String("ListActivatableNamesWatcher")) {
- d->serviceActivatable = reply.value().contains(d->serviceName);
- } else {
- if (!d->serviceAvailable) {
- d->serviceAvailable = reply.value().contains(d->serviceName);
- }
- //else onServiceOwnerChanged() has been emitted before the introspection finished
- //so the reply we got here may be incorrect, claiming that the service is not available
- }
- }
-
- watcher->deleteLater();
-}
-
-void ServiceAvailabilityChecker::onServiceOwnerChanged(const QString & service,
- const QString & oldOwner, const QString & newOwner)
-{
- Q_UNUSED(oldOwner);
-
- if (service == d->serviceName) {
- d->serviceAvailable = !newOwner.isEmpty();
- }
-}
-
-#include "service-availability-checker.moc"
diff --git a/service-availability-checker.h b/service-availability-checker.h
deleted file mode 100644
index 8883fe6..0000000
--- a/service-availability-checker.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- Copyright (C) 2011 Collabora Ltd. <info at collabora.com>
- @author George Kiagiadakis <george.kiagiadakis at collabora.com>
-
- This library is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-#ifndef SERVICE_AVAILABILITY_CHECKER_H
-#define SERVICE_AVAILABILITY_CHECKER_H
-
-#include <QtCore/QObject>
-
-class QDBusPendingCallWatcher;
-
-/**
- * This class watches if a given d-bus service is either
- * available on the bus or can be activated on demand.
- */
-class ServiceAvailabilityChecker : public QObject
-{
- Q_OBJECT
-public:
- ServiceAvailabilityChecker(const QString & serviceName, QObject *parent = 0);
- virtual ~ServiceAvailabilityChecker();
-
- bool isAvailable() const;
-
-private Q_SLOTS:
- void introspect();
- void onCallFinished(QDBusPendingCallWatcher *watcher);
- void onServiceOwnerChanged(const QString & service,
- const QString & oldOwner,
- const QString & newOwner);
-
-private:
- struct Private;
- Private * const d;
-};
-
-#endif // SERVICE_AVAILABILITY_CHECKER_H
--
ktp-contact-list packaging
More information about the pkg-kde-commits
mailing list