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

krfb

  • sources
  • kde-4.14
  • kdenetwork
  • krfb
  • krfb
tubesrfbclient.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 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 #include "tubesrfbclient.h"
20 #include "krfbconfig.h"
21 #include "connectiondialog.h"
22 #include <KNotification>
23 #include <KLocale>
24 
25 QString TubesRfbClient::name() const
26 {
27  return m_contact->alias();
28 }
29 
30 //********
31 
32 PendingTubesRfbClient::PendingTubesRfbClient(rfbClientPtr client, QObject* parent) :
33  PendingRfbClient(client, parent),
34  m_processNewClientCalled(false)
35 {
36  processNewClient();
37 }
38 
39 void PendingTubesRfbClient::setContact(const Tp::ContactPtr & contact)
40 {
41  m_contact = contact;
42  if (m_processNewClientCalled) {
43  //processNewClient has already been called, so we need to act here
44  showConfirmationDialog();
45  }
46 }
47 
48 void PendingTubesRfbClient::processNewClient()
49 {
50  if (!m_contact) {
51  //no associated contact yet, hold.
52  m_processNewClientCalled = true; //act when a contact is set
53  } else {
54  //we have a contact, begin handling
55  showConfirmationDialog();
56  }
57 }
58 
59 void PendingTubesRfbClient::showConfirmationDialog()
60 {
61  QString name = m_contact->alias();
62 
63  KNotification::event("NewConnectionOnHold",
64  i18n("Received connection from %1, on hold (waiting for confirmation)",
65  name));
66 
67  TubesConnectionDialog *dialog = new TubesConnectionDialog(0);
68  dialog->setContactName(name);
69  dialog->setAllowRemoteControl(KrfbConfig::allowDesktopControl());
70 
71  connect(dialog, SIGNAL(okClicked()), SLOT(dialogAccepted()));
72  connect(dialog, SIGNAL(cancelClicked()), SLOT(reject()));
73 
74  dialog->show();
75 }
76 
77 void PendingTubesRfbClient::dialogAccepted()
78 {
79  TubesConnectionDialog *dialog = qobject_cast<TubesConnectionDialog *>(sender());
80  Q_ASSERT(dialog);
81 
82  TubesRfbClient *client = new TubesRfbClient(m_rfbClient, m_contact, parent());
83  client->setControlEnabled(dialog->allowRemoteControl());
84  accept(client);
85 }
86 
87 #include "tubesrfbclient.moc"
connectiondialog.h
QObject::sender
QObject * sender() const
KrfbConfig::allowDesktopControl
static bool allowDesktopControl()
Get Allow remote connections to manage the desktop.
Definition: krfbconfig.h:51
_rfbClientRec
Definition: libvncserver/rfb/rfb.h:417
QObject::name
const char * name() const
TubesRfbClient
Definition: tubesrfbclient.h:24
krfbconfig.h
tubesrfbclient.h
QObject
PendingTubesRfbClient::PendingTubesRfbClient
PendingTubesRfbClient(rfbClientPtr client, QObject *parent=0)
Definition: tubesrfbclient.cpp:32
QString
PendingTubesRfbClient::processNewClient
virtual void processNewClient()
Definition: tubesrfbclient.cpp:48
PendingRfbClient::accept
void accept(RfbClient *newClient)
Definition: rfbclient.cpp:179
PendingRfbClient::reject
void reject()
Definition: rfbclient.cpp:192
PendingRfbClient::m_rfbClient
rfbClientPtr m_rfbClient
Definition: krfb/rfbclient.h:106
PendingRfbClient
Definition: krfb/rfbclient.h:72
PendingTubesRfbClient::setContact
void setContact(const Tp::ContactPtr &contact)
Definition: tubesrfbclient.cpp:39
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QObject::parent
QObject * parent() const
TubesRfbClient::name
virtual QString name() const
Returns a name for the client, to be shown to the user.
Definition: tubesrfbclient.cpp:25
RfbClient::setControlEnabled
void setControlEnabled(bool enabled)
Definition: rfbclient.cpp:77
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:40 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
  • Namespace List
  • 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