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

krdc

  • sources
  • kde-4.12
  • kdenetwork
  • krdc
tubesmanager.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2009-2011 Collabora Ltd <info@collabora.co.uk>
4 ** Copyright (C) 2009 Abner Silva <abner.silva@kdemail.net>
5 **
6 ** This file is part of KDE.
7 **
8 ** This program is free software; you can redistribute it and/or modify
9 ** it under the terms of the GNU General Public License as published by
10 ** the Free Software Foundation; either version 2 of the License, or
11 ** (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 General Public License
19 ** along with this program; see the file COPYING. If not, write to
20 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 ** Boston, MA 02110-1301, USA.
22 **
23 ****************************************************************************/
24 
25 #include "tubesmanager.h"
26 
27 #include <TelepathyQt/IncomingStreamTubeChannel>
28 #include <TelepathyQt/Debug>
29 
30 #include <KDebug>
31 
32 
33 TubesManager::TubesManager(QObject *parent)
34  : QObject(parent)
35 {
36  kDebug() << "Initializing tubes manager";
37 
38  Tp::enableDebug(true);
39  Tp::enableWarnings(true);
40 
41  /* Registering telepathy types */
42  Tp::registerTypes();
43 
44  m_stubeClient = Tp::StreamTubeClient::create(
45  QStringList() << QLatin1String("rfb"),
46  QStringList(),
47  QLatin1String("krdc_rfb_handler"));
48 
49  m_stubeClient->setToAcceptAsTcp();
50 
51  connect(m_stubeClient.data(),
52  SIGNAL(tubeAcceptedAsTcp(QHostAddress,quint16,QHostAddress,quint16,
53  Tp::AccountPtr,Tp::IncomingStreamTubeChannelPtr)),
54  SLOT(onTubeAccepted(QHostAddress,quint16,QHostAddress,quint16,
55  Tp::AccountPtr,Tp::IncomingStreamTubeChannelPtr)));
56 }
57 
58 TubesManager::~TubesManager()
59 {
60  kDebug() << "Destroying tubes manager";
61 }
62 
63 void TubesManager::closeTube(const KUrl& url)
64 {
65  if (m_tubes.contains(url)) {
66  m_tubes.take(url)->requestClose();
67  }
68 }
69 
70 void TubesManager::onTubeAccepted(
71  const QHostAddress & listenAddress, quint16 listenPort,
72  const QHostAddress & sourceAddress, quint16 sourcePort,
73  const Tp::AccountPtr & account,
74  const Tp::IncomingStreamTubeChannelPtr & tube)
75 {
76  Q_UNUSED(sourceAddress);
77  Q_UNUSED(sourcePort);
78  Q_UNUSED(account);
79 
80  KUrl url;
81  url.setScheme("vnc");
82  url.setHost(listenAddress.toString());
83  url.setPort(listenPort);
84 
85  kDebug() << "newConnection:" << url;
86  m_tubes.insert(url, tube);
87  emit newConnection(url);
88 }
TubesManager::newConnection
void newConnection(KUrl)
TubesManager::closeTube
void closeTube(const KUrl &url)
Definition: tubesmanager.cpp:63
tubesmanager.h
QObject
TubesManager::~TubesManager
virtual ~TubesManager()
Definition: tubesmanager.cpp:58
TubesManager::TubesManager
TubesManager(QObject *parent)
Definition: tubesmanager.cpp:33
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:54:04 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

krdc

Skip menu "krdc"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

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