ws fix
svn path=/trunk/KDE/kdelibs/; revision=1130848
This commit is contained in:
parent
0f956bc95e
commit
ac465edd15
134
service.cpp
134
service.cpp
@ -112,88 +112,88 @@ Service *Service::access(const KUrl &url, QObject *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ServicePrivate::jobFinished(KJob *job)
|
void ServicePrivate::jobFinished(KJob *job)
|
||||||
{
|
{
|
||||||
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<QGraphicsWidget*>(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServicePrivate::publish(AnnouncementMethods methods, const QString &name, PackageMetadata metadata)
|
void ServicePrivate::publish(AnnouncementMethods methods, const QString &name, 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);
|
||||||
|
|
||||||
if (methods.testFlag(ZeroconfAnnouncement) &&
|
if (methods.testFlag(ZeroconfAnnouncement) &&
|
||||||
(DNSSD::ServiceBrowser::isAvailable() == DNSSD::ServiceBrowser::Working)) {
|
(DNSSD::ServiceBrowser::isAvailable() == DNSSD::ServiceBrowser::Working)) {
|
||||||
//TODO: dynamically pick a free port number.
|
//TODO: dynamically pick a free port number.
|
||||||
publicService = new DNSSD::PublicService(name, "_plasma._tcp", 4000);
|
publicService = new DNSSD::PublicService(name, "_plasma._tcp", 4000);
|
||||||
|
|
||||||
QMap<QString, QByteArray> textData;
|
QMap<QString, QByteArray> textData;
|
||||||
textData["name"] = name.toUtf8();
|
textData["name"] = name.toUtf8();
|
||||||
textData["plasmoidname"] = metadata.name().toUtf8();
|
textData["plasmoidname"] = metadata.name().toUtf8();
|
||||||
textData["description"] = metadata.description().toUtf8();
|
textData["description"] = metadata.description().toUtf8();
|
||||||
publicService->setTextData(textData);
|
publicService->setTextData(textData);
|
||||||
kDebug() << "about to publish";
|
kDebug() << "about to publish";
|
||||||
|
|
||||||
publicService->publishAsync();
|
publicService->publishAsync();
|
||||||
} else if (methods.testFlag(ZeroconfAnnouncement) &&
|
} else if (methods.testFlag(ZeroconfAnnouncement) &&
|
||||||
(DNSSD::ServiceBrowser::isAvailable() != DNSSD::ServiceBrowser::Working)) {
|
(DNSSD::ServiceBrowser::isAvailable() != DNSSD::ServiceBrowser::Working)) {
|
||||||
kDebug() << "sorry, but your zeroconf daemon doesn't seem to be running.";
|
kDebug() << "sorry, but your zeroconf daemon doesn't seem to be running.";
|
||||||
}
|
|
||||||
} else {
|
|
||||||
kDebug() << "already published!";
|
|
||||||
}
|
}
|
||||||
#else
|
} else {
|
||||||
kWarning() << "libplasma is compiled without support for remote widgets. not publishing.";
|
kDebug() << "already published!";
|
||||||
#endif
|
}
|
||||||
|
#else
|
||||||
|
kWarning() << "libplasma is compiled without support for remote widgets. not publishing.";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void ServicePrivate::unpublish()
|
||||||
|
{
|
||||||
|
if (serviceProvider) {
|
||||||
|
delete serviceProvider;
|
||||||
|
serviceProvider = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServicePrivate::unpublish()
|
if (publicService) {
|
||||||
{
|
delete publicService;
|
||||||
if (serviceProvider) {
|
publicService = 0;
|
||||||
delete serviceProvider;
|
}
|
||||||
serviceProvider = 0;
|
}
|
||||||
|
|
||||||
|
bool ServicePrivate::isPublished() const
|
||||||
|
{
|
||||||
|
if (serviceProvider) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
KConfigGroup ServicePrivate::dummyGroup()
|
||||||
|
{
|
||||||
|
if (!dummyConfig) {
|
||||||
|
if (!tempFile) {
|
||||||
|
tempFile = new KTemporaryFile;
|
||||||
|
tempFile->open();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (publicService) {
|
dummyConfig = new KConfig(tempFile->fileName());
|
||||||
delete publicService;
|
|
||||||
publicService = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ServicePrivate::isPublished() const
|
return KConfigGroup(dummyConfig, "DummyGroup");
|
||||||
{
|
}
|
||||||
if (serviceProvider) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
KConfigGroup ServicePrivate::dummyGroup()
|
|
||||||
{
|
|
||||||
if (!dummyConfig) {
|
|
||||||
if (!tempFile) {
|
|
||||||
tempFile = new KTemporaryFile;
|
|
||||||
tempFile->open();
|
|
||||||
}
|
|
||||||
|
|
||||||
dummyConfig = new KConfig(tempFile->fileName());
|
|
||||||
}
|
|
||||||
|
|
||||||
return KConfigGroup(dummyConfig, "DummyGroup");
|
|
||||||
}
|
|
||||||
|
|
||||||
void Service::setDestination(const QString &destination)
|
void Service::setDestination(const QString &destination)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user