mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-24 02:42:52 +00:00
generic: ajdust to kdnssd library changes
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
1b786143e5
commit
37c3c8e323
4 changed files with 21 additions and 26 deletions
|
@ -42,9 +42,9 @@ RemoteDesktopsModel::RemoteDesktopsModel(QObject *parent)
|
|||
// Add RDP and NX if they start announcing via Zeroconf:
|
||||
m_protocols["_rfb._tcp"] = "vnc";
|
||||
|
||||
zeroconfBrowser = new DNSSD::ServiceBrowser("_rfb._tcp", true);
|
||||
zeroconfBrowser = new KDNSSD();
|
||||
connect(zeroconfBrowser, SIGNAL(finished()), this, SLOT(servicesChanged()));
|
||||
zeroconfBrowser->startBrowse();
|
||||
zeroconfBrowser->startBrowse("_rfb._tcp");
|
||||
kDebug(5010) << "Browsing for zeroconf hosts.";
|
||||
#endif
|
||||
}
|
||||
|
@ -276,19 +276,18 @@ void RemoteDesktopsModel::buildModelFromBookmarkGroup(const KBookmarkGroup &grou
|
|||
void RemoteDesktopsModel::servicesChanged()
|
||||
{
|
||||
//redo list because it is easier than finding and removing one that disappeared
|
||||
QList<DNSSD::RemoteService::Ptr> services = zeroconfBrowser->services();
|
||||
KUrl url;
|
||||
removeAllItemsFromSources(RemoteDesktop::Zeroconf);
|
||||
foreach(DNSSD::RemoteService::Ptr service, services) {
|
||||
url.setProtocol(m_protocols[service->type()].toLower());
|
||||
url.setHost(service->hostName());
|
||||
url.setPort(service->port());
|
||||
foreach(const KDNSSDService &service, zeroconfBrowser->services()) {
|
||||
url.setProtocol(m_protocols[service.type].toLower());
|
||||
url.setHost(service.hostname);
|
||||
url.setPort(service.port);
|
||||
|
||||
RemoteDesktop item;
|
||||
item.url = url.url();
|
||||
|
||||
if (!remoteDesktops.contains(item)) {
|
||||
item.title = service->serviceName();
|
||||
item.title = service.name;
|
||||
item.source = RemoteDesktop::Zeroconf;
|
||||
item.created = KDateTime::currentLocalDateTime();
|
||||
item.favorite = false;
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <KDateTime>
|
||||
|
||||
#ifdef BUILD_ZEROCONF
|
||||
#include <dnssd/servicebrowser.h>
|
||||
#include <kdnssd.h>
|
||||
#endif
|
||||
|
||||
class KBookmarkGroup;
|
||||
|
@ -81,7 +81,7 @@ private:
|
|||
KBookmarkManager *m_manager;
|
||||
|
||||
#ifdef BUILD_ZEROCONF
|
||||
DNSSD::ServiceBrowser *zeroconfBrowser;
|
||||
KDNSSD *zeroconfBrowser;
|
||||
QHash<QString, QString> m_protocols;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include <KUser>
|
||||
#include <KRandom>
|
||||
#include <KStringHandler>
|
||||
#include <DNSSD/PublicService>
|
||||
|
||||
//static
|
||||
InvitationsRfbServer *InvitationsRfbServer::instance;
|
||||
|
@ -41,12 +40,7 @@ InvitationsRfbServer *InvitationsRfbServer::instance;
|
|||
void InvitationsRfbServer::init()
|
||||
{
|
||||
instance = new InvitationsRfbServer;
|
||||
instance->m_publicService = new DNSSD::PublicService(
|
||||
i18n("%1@%2 (shared desktop)",
|
||||
KUser().loginName(),
|
||||
QHostInfo::localHostName()),
|
||||
"_rfb._tcp",
|
||||
KrfbConfig::port());
|
||||
instance->m_publicService = new KDNSSD();
|
||||
instance->setListeningAddress("0.0.0.0");
|
||||
instance->setListeningPort(KrfbConfig::port());
|
||||
instance->setPasswordRequired(true);
|
||||
|
@ -114,8 +108,13 @@ bool InvitationsRfbServer::allowUnattendedAccess() const
|
|||
bool InvitationsRfbServer::start()
|
||||
{
|
||||
if(RfbServer::start()) {
|
||||
if(KrfbConfig::publishService())
|
||||
m_publicService->publishAsync();
|
||||
if(KrfbConfig::publishService()) {
|
||||
m_publicService->publishService(
|
||||
"_rfb._tcp",
|
||||
KrfbConfig::port(),
|
||||
i18n("%1@%2 (shared desktop)", KUser().loginName(), QHostInfo::localHostName())
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -123,8 +122,8 @@ bool InvitationsRfbServer::start()
|
|||
|
||||
void InvitationsRfbServer::stop(bool disconnectClients)
|
||||
{
|
||||
if(m_publicService->isPublished())
|
||||
m_publicService->stop();
|
||||
if(m_publicService)
|
||||
m_publicService->unpublishService();
|
||||
RfbServer::stop(disconnectClients);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,10 +23,7 @@
|
|||
#include "rfbserver.h"
|
||||
|
||||
#include <kpasswdstore.h>
|
||||
|
||||
namespace DNSSD {
|
||||
class PublicService;
|
||||
}
|
||||
#include <kdnssd.h>
|
||||
|
||||
class InvitationsRfbServer : public RfbServer
|
||||
{
|
||||
|
@ -55,7 +52,7 @@ protected:
|
|||
virtual PendingRfbClient* newClient(rfbClientPtr client);
|
||||
|
||||
private:
|
||||
DNSSD::PublicService *m_publicService;
|
||||
KDNSSD *m_publicService;
|
||||
bool m_allowUnattendedAccess;
|
||||
QString m_desktopPassword;
|
||||
QString m_unattendedPassword;
|
||||
|
|
Loading…
Add table
Reference in a new issue