• 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
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 void PendingTubesRfbClient::setContact(const Tp::ContactPtr & contact)
32 {
33  m_contact = contact;
34  if (m_processNewClientCalled) {
35  //processNewClient has already been called, so we need to act here
36  showConfirmationDialog();
37  }
38 }
39 
40 void PendingTubesRfbClient::processNewClient()
41 {
42  if (!m_contact) {
43  //no associated contact yet, hold.
44  m_processNewClientCalled = true; //act when a contact is set
45  } else {
46  //we have a contact, begin handling
47  showConfirmationDialog();
48  }
49 }
50 
51 void PendingTubesRfbClient::showConfirmationDialog()
52 {
53  QString name = m_contact->alias();
54 
55  if (!KrfbConfig::askOnConnect()) {
56  KNotification::event("NewConnectionAutoAccepted",
57  i18n("Accepted connection from %1", name));
58  accept(new TubesRfbClient(m_rfbClient, m_contact, parent()));
59  } else {
60  KNotification::event("NewConnectionOnHold",
61  i18n("Received connection from %1, on hold (waiting for confirmation)",
62  name));
63 
64  TubesConnectionDialog *dialog = new TubesConnectionDialog(0);
65  dialog->setContactName(name);
66  dialog->setAllowRemoteControl(KrfbConfig::allowDesktopControl());
67 
68  connect(dialog, SIGNAL(okClicked()), SLOT(dialogAccepted()));
69  connect(dialog, SIGNAL(cancelClicked()), SLOT(reject()));
70 
71  dialog->show();
72  }
73 }
74 
75 void PendingTubesRfbClient::dialogAccepted()
76 {
77  TubesConnectionDialog *dialog = qobject_cast<TubesConnectionDialog *>(sender());
78  Q_ASSERT(dialog);
79 
80  TubesRfbClient *client = new TubesRfbClient(m_rfbClient, m_contact, parent());
81  client->setControlEnabled(dialog->allowRemoteControl());
82  accept(client);
83 }
84 
85 #include "tubesrfbclient.moc"
connectiondialog.h
KrfbConfig::allowDesktopControl
static bool allowDesktopControl()
Get Allow remote connections to manage the desktop.
Definition: krfbconfig.h:51
TubesRfbClient
Definition: tubesrfbclient.h:24
krfbconfig.h
tubesrfbclient.h
PendingTubesRfbClient::processNewClient
virtual void processNewClient()
Definition: tubesrfbclient.cpp:40
PendingRfbClient::accept
void accept()
Definition: pendingrfbclient.cpp:30
PendingRfbClient::reject
void reject()
Definition: pendingrfbclient.cpp:40
PendingRfbClient::m_rfbClient
rfbClientPtr m_rfbClient
Definition: pendingrfbclient.h:43
PendingTubesRfbClient::setContact
void setContact(const Tp::ContactPtr &contact)
Definition: tubesrfbclient.cpp:31
KrfbConfig::askOnConnect
static bool askOnConnect()
Get Ask before allowing a remote connection.
Definition: krfbconfig.h:61
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-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