From 1137b4ea5c09b295ee32354c0abcbd2baa9f3f93 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 2 May 2013 19:02:06 +0200 Subject: [PATCH] remove associated items/widgets --- src/plasma/private/service_p.h | 2 - src/plasma/service.cpp | 70 ---------------------------------- src/plasma/service.h | 25 ------------ 3 files changed, 97 deletions(-) diff --git a/src/plasma/private/service_p.h b/src/plasma/private/service_p.h index 5ceb78c76..5180a458c 100644 --- a/src/plasma/private/service_p.h +++ b/src/plasma/private/service_p.h @@ -100,8 +100,6 @@ public: QMap operationsMap; KConfig *dummyConfig; DNSSD::PublicService *publicService; - QMultiHash associatedWidgets; - QMultiHash associatedItems; QSet disabledOperations; }; diff --git a/src/plasma/service.cpp b/src/plasma/service.cpp index b72edd343..6d29159be 100644 --- a/src/plasma/service.cpp +++ b/src/plasma/service.cpp @@ -170,16 +170,6 @@ Service::~Service() delete d; } -void ServicePrivate::associatedWidgetDestroyed(QObject *obj) -{ - associatedWidgets.remove(static_cast(obj)); -} - -void ServicePrivate::associatedItemDestroyed(QObject *obj) -{ - associatedItems.remove(static_cast(obj)); -} - KConfigGroup ServicePrivate::dummyGroup() { if (!dummyConfig) { @@ -259,31 +249,6 @@ ServiceJob *Service::startOperationCall(const QVariantMap &description, QObject return job; } -void Service::associateItem(QQuickItem *widget, const QString &operation) -{ - if (!widget) { - return; - } - - disassociateItem(widget); - d->associatedItems.insert(widget, operation); - connect(widget, SIGNAL(destroyed(QObject*)), - this, SLOT(associatedItemDestroyed(QObject*))); - - widget->setEnabled(!d->disabledOperations.contains(operation)); -} - -void Service::disassociateItem(QQuickItem *widget) -{ - if (!widget) { - return; - } - - disconnect(widget, SIGNAL(destroyed(QObject*)), - this, SLOT(associatedItemDestroyed(QObject*))); - d->associatedItems.remove(widget); -} - QString Service::name() const { return d->name; @@ -316,25 +281,6 @@ void Service::setOperationEnabled(const QString &operation, bool enable) d->disabledOperations.insert(operation); } - { - QHashIterator it(d->associatedWidgets); - while (it.hasNext()) { - it.next(); - if (it.value() == operation) { - it.key()->setEnabled(enable); - } - } - } - - { - QHashIterator it(d->associatedItems); - while (it.hasNext()) { - it.next(); - if (it.value() == operation) { - it.key()->setEnabled(enable); - } - } - } emit operationEnabledChanged(operation, enable); } @@ -359,22 +305,6 @@ void Service::setOperationsScheme(QIODevice *xml) reader.parse(&source, false); d->operationsMap = configLoaderHandler.groupsMap(); delete configLoaderPrivate; - - { - QHashIterator it(d->associatedWidgets); - while (it.hasNext()) { - it.next(); - it.key()->setEnabled(d->operationsMap.contains(it.value())); - } - } - - { - QHashIterator it(d->associatedItems); - while (it.hasNext()) { - it.next(); - it.key()->setEnabled(d->operationsMap.contains(it.value())); - } - } } void Service::registerOperationsScheme() diff --git a/src/plasma/service.h b/src/plasma/service.h index 393a5abeb..715b786ac 100644 --- a/src/plasma/service.h +++ b/src/plasma/service.h @@ -150,28 +150,6 @@ public: */ Q_INVOKABLE QString name() const; - /** - * Associates a graphics item with an operation, which allows the service to - * automatically manage, for example, the enabled state of the item. - * - * This will remove any previous associations the item had with - * operations on this engine. - * - * @param item the QGraphicsObject to associate with the service - * @param operation the operation to associate the item with - */ - Q_INVOKABLE void associateItem(QQuickItem *item, const QString &operation); - - /** - * Disassociates a graphics item if it has been associated with an operation - * on this service. - * - * This will not change the enabled state of the item. - * - * @param widget the QGraphicsItem to disassociate. - */ - Q_INVOKABLE void disassociateItem(QQuickItem *widget); - Q_SIGNALS: /** * Emitted when this service is ready for use @@ -237,9 +215,6 @@ protected: void setOperationEnabled(const QString &operation, bool enable); private: - Q_PRIVATE_SLOT(d, void associatedWidgetDestroyed(QObject *)) - Q_PRIVATE_SLOT(d, void associatedItemDestroyed(QObject *)) - ServicePrivate * const d; friend class DataEnginePrivate;