service.cpp | service.cpp | |||
---|---|---|---|---|
skipping to change at line 29 | skipping to change at line 29 | |||
#include "service.h" | #include "service.h" | |||
#include "servicejob.h" | #include "servicejob.h" | |||
#include "private/authorizationmanager_p.h" | #include "private/authorizationmanager_p.h" | |||
#include "private/service_p.h" | #include "private/service_p.h" | |||
#include "private/serviceprovider_p.h" | #include "private/serviceprovider_p.h" | |||
#include "config-plasma.h" | #include "config-plasma.h" | |||
#include <QFile> | #include <QFile> | |||
#include <QGraphicsWidget> | ||||
#include <QTimer> | #include <QTimer> | |||
#include <kdebug.h> | #include <kdebug.h> | |||
#include <kservice.h> | #include <kservice.h> | |||
#include <kservicetypetrader.h> | #include <kservicetypetrader.h> | |||
#include <ksharedconfig.h> | #include <ksharedconfig.h> | |||
#include <kstandarddirs.h> | #include <kstandarddirs.h> | |||
#include <dnssd/publicservice.h> | #include <dnssd/publicservice.h> | |||
#include <dnssd/servicebrowser.h> | #include <dnssd/servicebrowser.h> | |||
skipping to change at line 96 | skipping to change at line 97 | |||
emit q->finished(static_cast<ServiceJob*>(job)); | emit q->finished(static_cast<ServiceJob*>(job)); | |||
} | } | |||
void ServicePrivate::associatedWidgetDestroyed(QObject *obj) | void ServicePrivate::associatedWidgetDestroyed(QObject *obj) | |||
{ | { | |||
associatedWidgets.remove(static_cast<QWidget*>(obj)); | associatedWidgets.remove(static_cast<QWidget*>(obj)); | |||
} | } | |||
void ServicePrivate::associatedGraphicsWidgetDestroyed(QObject *obj) | void ServicePrivate::associatedGraphicsWidgetDestroyed(QObject *obj) | |||
{ | { | |||
associatedGraphicsWidgets.remove(static_cast<QGraphicsWidget*>(obj)); | associatedGraphicsWidgets.remove(static_cast<QGraphicsObject*>(obj)); | |||
} | } | |||
void ServicePrivate::publish(AnnouncementMethods methods, const QString &na me, const PackageMetadata &metadata) | void ServicePrivate::publish(AnnouncementMethods methods, const QString &na me, const PackageMetadata &metadata) | |||
{ | { | |||
#ifdef ENABLE_REMOTE_WIDGETS | #ifdef ENABLE_REMOTE_WIDGETS | |||
if (!serviceProvider) { | if (!serviceProvider) { | |||
AuthorizationManager::self()->d->prepareForServicePublication(); | AuthorizationManager::self()->d->prepareForServicePublication(); | |||
serviceProvider = new ServiceProvider(name, q); | serviceProvider = new ServiceProvider(name, q); | |||
skipping to change at line 279 | skipping to change at line 280 | |||
return; | return; | |||
} | } | |||
disconnect(widget, SIGNAL(destroyed(QObject*)), | disconnect(widget, SIGNAL(destroyed(QObject*)), | |||
this, SLOT(associatedWidgetDestroyed(QObject*))); | this, SLOT(associatedWidgetDestroyed(QObject*))); | |||
d->associatedWidgets.remove(widget); | d->associatedWidgets.remove(widget); | |||
} | } | |||
void Service::associateWidget(QGraphicsWidget *widget, const QString &opera tion) | void Service::associateWidget(QGraphicsWidget *widget, const QString &opera tion) | |||
{ | { | |||
associateItem(widget, operation); | ||||
} | ||||
void Service::disassociateWidget(QGraphicsWidget *widget) | ||||
{ | ||||
disassociateItem(widget); | ||||
} | ||||
void Service::associateItem(QGraphicsObject *widget, const QString &operati | ||||
on) | ||||
{ | ||||
if (!widget) { | if (!widget) { | |||
return; | return; | |||
} | } | |||
disassociateWidget(widget); | disassociateItem(widget); | |||
d->associatedGraphicsWidgets.insert(widget, operation); | d->associatedGraphicsWidgets.insert(widget, operation); | |||
connect(widget, SIGNAL(destroyed(QObject*)), | connect(widget, SIGNAL(destroyed(QObject*)), | |||
this, SLOT(associatedGraphicsWidgetDestroyed(QObject*))); | this, SLOT(associatedGraphicsWidgetDestroyed(QObject*))); | |||
widget->setEnabled(!d->disabledOperations.contains(operation)); | widget->setEnabled(!d->disabledOperations.contains(operation)); | |||
} | } | |||
void Service::disassociateWidget(QGraphicsWidget *widget) | void Service::disassociateItem(QGraphicsObject *widget) | |||
{ | { | |||
if (!widget) { | if (!widget) { | |||
return; | return; | |||
} | } | |||
disconnect(widget, SIGNAL(destroyed(QObject*)), | disconnect(widget, SIGNAL(destroyed(QObject*)), | |||
this, SLOT(associatedGraphicsWidgetDestroyed(QObject*))); | this, SLOT(associatedGraphicsWidgetDestroyed(QObject*))); | |||
d->associatedGraphicsWidgets.remove(widget); | d->associatedGraphicsWidgets.remove(widget); | |||
} | } | |||
skipping to change at line 346 | skipping to change at line 357 | |||
QHashIterator<QWidget *, QString> it(d->associatedWidgets); | QHashIterator<QWidget *, QString> it(d->associatedWidgets); | |||
while (it.hasNext()) { | while (it.hasNext()) { | |||
it.next(); | it.next(); | |||
if (it.value() == operation) { | if (it.value() == operation) { | |||
it.key()->setEnabled(enable); | it.key()->setEnabled(enable); | |||
} | } | |||
} | } | |||
} | } | |||
{ | { | |||
QHashIterator<QGraphicsWidget *, QString> it(d->associatedGraphicsW idgets); | QHashIterator<QGraphicsObject *, QString> it(d->associatedGraphicsW idgets); | |||
while (it.hasNext()) { | while (it.hasNext()) { | |||
it.next(); | it.next(); | |||
if (it.value() == operation) { | if (it.value() == operation) { | |||
it.key()->setEnabled(enable); | it.key()->setEnabled(enable); | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
bool Service::isOperationEnabled(const QString &operation) const | bool Service::isOperationEnabled(const QString &operation) const | |||
skipping to change at line 383 | skipping to change at line 394 | |||
{ | { | |||
QHashIterator<QWidget *, QString> it(d->associatedWidgets); | QHashIterator<QWidget *, QString> it(d->associatedWidgets); | |||
while (it.hasNext()) { | while (it.hasNext()) { | |||
it.next(); | it.next(); | |||
it.key()->setEnabled(d->config->hasGroup(it.value())); | it.key()->setEnabled(d->config->hasGroup(it.value())); | |||
} | } | |||
} | } | |||
{ | { | |||
QHashIterator<QGraphicsWidget *, QString> it(d->associatedGraphicsW idgets); | QHashIterator<QGraphicsObject *, QString> it(d->associatedGraphicsW idgets); | |||
while (it.hasNext()) { | while (it.hasNext()) { | |||
it.next(); | it.next(); | |||
it.key()->setEnabled(d->config->hasGroup(it.value())); | it.key()->setEnabled(d->config->hasGroup(it.value())); | |||
} | } | |||
} | } | |||
} | } | |||
void Service::registerOperationsScheme() | void Service::registerOperationsScheme() | |||
{ | { | |||
if (d->config) { | if (d->config) { | |||
End of changes. 7 change blocks. | ||||
5 lines changed or deleted | 17 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |