• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdenetwork API Reference
  • KDE Home
  • Contact Us
 

krfb

  • sources
  • kde-4.12
  • kdenetwork
  • krfb
  • krfb
invitationsrfbserver.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2009-2010 Collabora Ltd <info@collabora.co.uk>
3  @author George Goldberg <george.goldberg@collabora.co.uk>
4  @author George Kiagiadakis <george.kiagiadakis@collabora.co.uk>
5  Copyright (C) 2007 Alessandro Praduroux <pradu@pradu.it>
6  Copyright (C) 2001-2003 by Tim Jansen <tim@tjansen.de>
7 
8  This program is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public
10  License as published by the Free Software Foundation; either
11  version 2 of the License, or (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License
19  along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21 #include "invitationsrfbserver.h"
22 #include "invitationsrfbclient.h"
23 #include "krfbconfig.h"
24 #include "rfbservermanager.h"
25 #include <QtCore/QTimer>
26 #include <QtGui/QApplication>
27 #include <QtNetwork/QHostInfo>
28 #include <KNotification>
29 #include <KLocale>
30 #include <KMessageBox>
31 #include <KUser>
32 #include <DNSSD/PublicService>
33 
34 void InvitationsRfbServer::init()
35 {
36  InvitationsRfbServer *server;
37  server = new InvitationsRfbServer;
38  server->setListeningPort(KrfbConfig::port());
39  server->setListeningAddress("0.0.0.0"); // Listen on all available network addresses
40  server->setPasswordRequired(true);
41  QTimer::singleShot(0, server, SLOT(startAndCheck()));
42 }
43 
44 PendingRfbClient* InvitationsRfbServer::newClient(rfbClientPtr client)
45 {
46  return new PendingInvitationsRfbClient(client, this);
47 }
48 
49 void InvitationsRfbServer::startAndCheck()
50 {
51  if (!start()) {
52  KMessageBox::error(0, i18n("Failed to start the krfb server. Invitation-based sharing "
53  "will not work. Try setting another port in the settings and "
54  "restart krfb."));
55  } else {
56  //publish service
57  if (KrfbConfig::publishService()) {
58  DNSSD::PublicService *service = new DNSSD::PublicService(i18n("%1@%2 (shared desktop)",
59  KUser().loginName(),
60  QHostInfo::localHostName()),
61  "_rfb._tcp",
62  listeningPort());
63  service->publishAsync();
64  }
65 
66  //disconnect when qApp quits
67  connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(stop()));
68  }
69 }
70 
71 #include "invitationsrfbserver.moc"
InvitationsRfbServer::init
static void init()
Definition: invitationsrfbserver.cpp:34
RfbServer::setListeningPort
void setListeningPort(int port)
Definition: rfbserver.cpp:77
InvitationsRfbServer::InvitationsRfbServer
InvitationsRfbServer()
Definition: invitationsrfbserver.h:32
_rfbClientRec
Definition: libvncserver/rfb/rfb.h:417
KrfbConfig::publishService
static bool publishService()
Get Announce the service on the local network.
Definition: krfbconfig.h:41
RfbServer::listeningPort
int listeningPort() const
Definition: rfbserver.cpp:62
InvitationsRfbServer::newClient
virtual PendingRfbClient * newClient(rfbClientPtr client)
Definition: invitationsrfbserver.cpp:44
krfbconfig.h
RfbServer::start
bool start()
Definition: rfbserver.cpp:87
InvitationsRfbServer
Definition: invitationsrfbserver.h:25
RfbServer::stop
void stop(bool disconnectClients=true)
Definition: rfbserver.cpp:143
KrfbConfig::port
static int port()
Get This is the port on which krfb will listen.
Definition: krfbconfig.h:31
RfbServer::setPasswordRequired
void setPasswordRequired(bool passwordRequired)
Definition: rfbserver.cpp:82
invitationsrfbclient.h
RfbServer::setListeningAddress
void setListeningAddress(const QByteArray &address)
Definition: rfbserver.cpp:72
PendingInvitationsRfbClient
Definition: invitationsrfbclient.h:34
invitationsrfbserver.h
PendingRfbClient
Definition: pendingrfbclient.h:24
rfbservermanager.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:54:10 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

krfb

Skip menu "krfb"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal