• 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
pendingrfbclient.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 Collabora Ltd. <info@collabora.co.uk>
3  @author George Kiagiadakis <george.kiagiadakis@collabora.co.uk>
4 
5  This library is free software; you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published
7  by the Free Software Foundation; either version 2.1 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #include "pendingrfbclient.h"
19 #include "connectiondialog.h"
20 #include "krfbconfig.h"
21 #include <KDebug>
22 #include <KNotification>
23 
24 PendingRfbClient::PendingRfbClient(rfbClientPtr client, QObject *parent)
25  : QObject(parent), m_client(0), m_rfbClient(client)
26 {
27  QMetaObject::invokeMethod(this, "processNewClient", Qt::QueuedConnection);
28 }
29 
30 void PendingRfbClient::accept()
31 {
32  kDebug() << "accepted connection";
33 
34  Q_ASSERT(m_client);
35  m_client->setOnHold(false);
36  Q_EMIT finished(m_client);
37  deleteLater();
38 }
39 
40 void PendingRfbClient::reject()
41 {
42  kDebug() << "refused connection";
43 
44  rfbCloseClient(m_rfbClient);
45  rfbClientConnectionGone(m_rfbClient);
46  Q_EMIT finished(NULL);
47  deleteLater();
48 }
49 
50 void PendingRfbClient::showUserConfirmationDialog()
51 {
52  kDebug();
53  Q_ASSERT(m_client);
54 
55  if (!KrfbConfig::askOnConnect()) {
56  KNotification::event("NewConnectionAutoAccepted",
57  i18n("Accepted connection from %1", m_client->name()));
58  accept();
59  } else {
60  KNotification::event("NewConnectionOnHold",
61  i18n("Received connection from %1, on hold (waiting for confirmation)",
62  m_client->name()));
63 
64  ConnectionDialog *dialog = new ConnectionDialog(0);
65  dialog->setRemoteHost(m_client->name());
66  dialog->setAllowRemoteControl(KrfbConfig::allowDesktopControl());
67 
68  connect(dialog, SIGNAL(okClicked()), SLOT(dialogAccepted()));
69  connect(dialog, SIGNAL(cancelClicked()), SLOT(dialogRejected()));
70 
71  dialog->show();
72  }
73 }
74 
75 void PendingRfbClient::dialogAccepted()
76 {
77  ConnectionDialog *dialog = qobject_cast<ConnectionDialog *>(sender());
78  Q_ASSERT(dialog);
79  m_client->setControlEnabled(dialog->cbAllowRemoteControl->isChecked());
80  accept();
81 }
82 
83 void PendingRfbClient::dialogRejected()
84 {
85  reject();
86 }
PendingRfbClient::showUserConfirmationDialog
void showUserConfirmationDialog()
Definition: pendingrfbclient.cpp:50
connectiondialog.h
RfbClient::setOnHold
void setOnHold(bool onHold)
Definition: rfbclient.cpp:90
KrfbConfig::allowDesktopControl
static bool allowDesktopControl()
Get Allow remote connections to manage the desktop.
Definition: krfbconfig.h:51
QObject
ConnectionDialog::setAllowRemoteControl
void setAllowRemoteControl(bool b)
Definition: connectiondialog.h:44
ConnectionDialog
Definition: connectiondialog.h:29
_rfbClientRec
Definition: libvncserver/rfb/rfb.h:417
PendingRfbClient::PendingRfbClient
PendingRfbClient(rfbClientPtr client, QObject *parent=0)
Definition: pendingrfbclient.cpp:24
krfbconfig.h
PendingRfbClient::finished
void finished(RfbClient *client)
pendingrfbclient.h
PendingRfbClient::accept
void accept()
Definition: pendingrfbclient.cpp:30
PendingRfbClient::reject
void reject()
Definition: pendingrfbclient.cpp:40
RfbClient::name
virtual QString name() const
Returns a name for the client, to be shown to the user.
Definition: rfbclient.cpp:61
PendingRfbClient::m_rfbClient
rfbClientPtr m_rfbClient
Definition: pendingrfbclient.h:43
KrfbConfig::askOnConnect
static bool askOnConnect()
Get Ask before allowing a remote connection.
Definition: krfbconfig.h:61
PendingRfbClient::m_client
RfbClient * m_client
Definition: pendingrfbclient.h:42
RfbClient::setControlEnabled
void setControlEnabled(bool enabled)
Definition: rfbclient.cpp:77
rfbClientConnectionGone
void rfbClientConnectionGone(rfbClientPtr cl)
rfbCloseClient
void rfbCloseClient(rfbClientPtr cl)
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