generic: drop Telepathy and KTP support

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-08-04 02:44:22 +03:00
parent 6876731c65
commit c58377bad7
31 changed files with 6 additions and 1647 deletions

View file

@ -19,13 +19,6 @@ set_package_properties(LibVNCServer PROPERTIES
# macro_optional_find_package(LibNXCL)
# macro_log_feature(LIBNXCL_FOUND "libnxcl" "NX X compression client library" "http://svn.berlios.de/svnroot/repos/freenx/trunk/freenx-client/nxcl/" FALSE "1.0" "Needed to build Krdc with NX support")
macro_optional_find_package(TelepathyQt4 0.9)
set_package_properties(TelepathyQt4 PROPERTIES
DESCRIPTION "Telepathy Qt Bindings"
URL "http://telepathy.freedesktop.org"
PURPOSE "Needed to build Telepathy Tubes support"
)
# v1.0.2 required
find_program(FREERDP_EXECUTABLE xfreerdp)
add_feature_info(xfreerdp
@ -33,11 +26,6 @@ add_feature_info(xfreerdp
"A free Remote Desktop Protocol (RDP) Implementation"
)
if(TelepathyQt4_FOUND)
add_definitions(-DTELEPATHY_SUPPORT)
include_directories(${TELEPATHY_QT4_INCLUDE_DIR})
endif()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/core/
@ -51,10 +39,6 @@ add_subdirectory(nx)
add_subdirectory(rdp)
add_subdirectory(test)
if(TelepathyQt4_FOUND)
add_subdirectory(krdc_approver)
endif()
add_definitions(
-DKDE_DEFAULT_DEBUG_AREA=5010
-DBUILD_ZEROCONF
@ -73,12 +57,6 @@ set(krdc_SRCS
main.cpp
)
if(TelepathyQt4_FOUND)
set(krdc_SRCS ${krdc_SRCS}
tubesmanager.cpp
)
endif()
add_executable(krdc ${krdc_SRCS})
target_link_libraries(krdc
@ -89,25 +67,9 @@ target_link_libraries(krdc
krdccore
)
if(TelepathyQt4_FOUND)
target_link_libraries(krdc
${TELEPATHY_QT4_LIBRARIES}
)
endif()
target_link_libraries(krdc ${KDE4_KDNSSD_LIBS})
install(TARGETS krdc ${INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES krdcui.rc DESTINATION ${KDE4_DATA_INSTALL_DIR}/krdc)
install(PROGRAMS krdc.desktop DESTINATION ${KDE4_XDG_APPS_INSTALL_DIR})
install(FILES pointcursor.png pointcursormask.png DESTINATION ${KDE4_DATA_INSTALL_DIR}/krdc/pics)
if(TelepathyQt4_FOUND)
configure_file(org.freedesktop.Telepathy.Client.krdc_rfb_handler.service.in
${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Telepathy.Client.krdc_rfb_handler.service)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Telepathy.Client.krdc_rfb_handler.service
DESTINATION ${KDE4_DBUS_SERVICES_INSTALL_DIR})
install(FILES krdc_rfb_handler.client DESTINATION ${KDE4_SHARE_INSTALL_PREFIX}/telepathy/clients/)
endif()

View file

@ -1,23 +0,0 @@
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set (krdc_rfb_approver_SRCS
main.cpp
approvermanager.cpp
approver.cpp
)
add_executable(krdc_rfb_approver ${krdc_rfb_approver_SRCS})
target_link_libraries(krdc_rfb_approver ${KDE4_KDEUI_LIBS}
${TELEPATHY_QT4_LIBRARIES}
)
install(TARGETS krdc_rfb_approver ${INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES krdc_rfb_approver.notifyrc DESTINATION ${KDE4_DATA_INSTALL_DIR}/krdc_rfb_approver)
configure_file(org.freedesktop.Telepathy.Client.krdc_rfb_approver.service.in
${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Telepathy.Client.krdc_rfb_approver.service)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Telepathy.Client.krdc_rfb_approver.service
DESTINATION ${KDE4_DBUS_SERVICES_INSTALL_DIR})
# FIXME any better macro for ${XDG_DATA_DIRS} ?
install(FILES krdc_rfb_approver.client DESTINATION ${KDE4_SHARE_INSTALL_PREFIX}/telepathy/clients/)

View file

@ -1,150 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Collabora Ltd <info@collabora.co.uk>
** Copyright (C) 2009 Abner Silva <abner.silva@kdemail.net>
**
** This file is part of KDE.
**
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "approver.h"
#include <KDebug>
#include <KNotification>
#include <KLocalizedString>
#include <TelepathyQt/Contact>
#include <TelepathyQt/Connection>
#include <TelepathyQt/ReferencedHandles>
#include <TelepathyQt/PendingReady>
#include <TelepathyQt/ChannelDispatchOperation>
Approver::Approver(const Tp::MethodInvocationContextPtr<> &context,
const QList<Tp::ChannelPtr> &channels,
const Tp::ChannelDispatchOperationPtr &dispatchOperation,
QObject *parent)
: QObject(parent),
m_context(context),
m_channels(channels),
m_dispatchOp(dispatchOperation),
m_notification(0)
{
kDebug() << "Initializing approver";
connect(m_dispatchOp->becomeReady(),
SIGNAL(finished(Tp::PendingOperation*)),
SLOT(onDispatchOperationReady(Tp::PendingOperation*)));
}
void Approver::onDispatchOperationReady(Tp::PendingOperation *op)
{
if (op->isError()) {
kError() << "Dispatch operation failed to become ready"
<< op->errorName() << op->errorMessage();
m_context->setFinishedWithError(op->errorName(), op->errorMessage());
emit finished();
return;
}
kDebug() << "DispatchOp ready!";
Tp::ChannelPtr channel = m_dispatchOp->channels()[0];
connect(channel->becomeReady(),
SIGNAL(finished(Tp::PendingOperation*)),
SLOT(onChannelReady(Tp::PendingOperation*)));
}
void Approver::onChannelReady(Tp::PendingOperation *op)
{
if (op->isError()) {
kError() << "Channel failed to become ready"
<< op->errorName() << op->errorMessage();
m_context->setFinishedWithError(op->errorName(), op->errorMessage());
emit finished();
return;
}
kDebug() << "Channel ready!";
Tp::ContactPtr contact = m_dispatchOp->channels()[0]->initiatorContact();
KNotification *notification = new KNotification("newrfb", NULL, KNotification::Persistent);
notification->setTitle(i18n("Invitation to view remote desktop"));
notification->setText(i18n("%1 wants to share his/her desktop with you", contact->alias()));
notification->setActions(QStringList() << i18n("Accept") << i18n("Reject"));
Tp::Client::ConnectionInterfaceAvatarsInterface *avatarIface =
m_dispatchOp->channels()[0]->connection()->optionalInterface<Tp::Client::ConnectionInterfaceAvatarsInterface>();
if (avatarIface) {
QDBusPendingReply<QByteArray, QString> reply = avatarIface->RequestAvatar(
contact->handle().takeFirst());
reply.waitForFinished();
if (!reply.isError()) {
QPixmap avatar;
avatar.loadFromData(reply.value());
notification->setPixmap(avatar);
}
}
connect(notification, SIGNAL(action1Activated()), SLOT(onAccepted()));
connect(notification, SIGNAL(action2Activated()), SLOT(onRejected()));
connect(notification, SIGNAL(ignored()), SLOT(onRejected()));
notification->sendEvent();
m_notification = notification;
m_context->setFinished();
}
Approver::~Approver()
{
kDebug() << "Destroying approver";
}
void Approver::onAccepted()
{
kDebug() << "Channel approved";
m_dispatchOp->handleWith(TP_QT_IFACE_CLIENT + ".krdc_rfb_handler");
emit finished();
}
void Approver::onRejected()
{
kDebug() << "Channel rejected";
connect(m_dispatchOp->claim(), SIGNAL(finished(Tp::PendingOperation*)),
SLOT(onClaimFinished(Tp::PendingOperation*)));
}
void Approver::onClaimFinished(Tp::PendingOperation *op)
{
if (op->isError()) {
kError() << "Claim operation failed"
<< op->errorName() << op->errorMessage();
m_context->setFinishedWithError(op->errorName(), op->errorMessage());
}
else {
foreach(const Tp::ChannelPtr &channel, m_channels)
channel->requestClose();
}
emit finished();
}

View file

@ -1,66 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Collabora Ltd <info@collabora.co.uk>
** Copyright (C) 2009 Abner Silva <abner.silva@kdemail.net>
**
** This file is part of KDE.
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef APPROVER_H
#define APPROVER_H
#include <QObject>
#include <TelepathyQt/Channel>
class KNotification;
class Approver : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(Approver)
public:
~Approver();
private Q_SLOTS:
void onAccepted();
void onRejected();
void onDispatchOperationReady(Tp::PendingOperation*);
void onChannelReady(Tp::PendingOperation*);
void onClaimFinished(Tp::PendingOperation*);
Q_SIGNALS:
void finished();
private:
Approver(const Tp::MethodInvocationContextPtr<> &context,
const QList<Tp::ChannelPtr> &channels,
const Tp::ChannelDispatchOperationPtr &dispatchOperation,
QObject *parent);
private:
Tp::MethodInvocationContextPtr<> m_context;
QList<Tp::ChannelPtr> m_channels;
Tp::ChannelDispatchOperationPtr m_dispatchOp;
QPointer<KNotification> m_notification;
friend class ApproverManager;
};
#endif

View file

@ -1,88 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Collabora Ltd <info@collabora.co.uk>
** Copyright (C) 2009 Abner Silva <abner.silva@kdemail.net>
**
** This file is part of KDE.
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "approvermanager.h"
#include "approver.h"
#include <QtDBus/qdbusextratypes.h>
#include <QDBusConnection>
#include <KApplication>
#include <KDebug>
#include <TelepathyQt/Account>
#include <TelepathyQt/ChannelClassSpecList>
#include <TelepathyQt/ChannelDispatchOperation>
#include <TelepathyQt/Connection>
#include <TelepathyQt/PendingOperation>
#include <TelepathyQt/PendingReady>
#include <TelepathyQt/Debug>
static inline Tp::ChannelClassSpecList channelClassSpecList()
{
Tp::ChannelClassSpec spec = Tp::ChannelClassSpec();
spec.setChannelType(TP_QT_IFACE_CHANNEL_TYPE_STREAM_TUBE);
spec.setTargetHandleType(Tp::HandleTypeContact);
spec.setRequested(false);
spec.setProperty(TP_QT_IFACE_CHANNEL_TYPE_STREAM_TUBE + ".Service",
QVariant("rfb"));
return Tp::ChannelClassSpecList() << spec;
}
ApproverManager::ApproverManager(QObject *parent)
: QObject(parent),
AbstractClientApprover(channelClassSpecList())
{
kDebug() << "Initializing approver manager";
}
ApproverManager::~ApproverManager()
{
kDebug() << "Destroying approver manager";
}
void ApproverManager::addDispatchOperation(const Tp::MethodInvocationContextPtr<> &context,
const Tp::ChannelDispatchOperationPtr &dispatchOperation)
{
kDebug() << "New channel for approving arrived";
Approver *approver = new Approver(context, dispatchOperation->channels(), dispatchOperation, this);
connect(approver, SIGNAL(finished()), SLOT(onFinished()));
m_approvers << approver;
}
void ApproverManager::onFinished()
{
kDebug() << "Approver finished";
Approver *approver = qobject_cast<Approver*>(sender());
m_approvers.removeOne(approver);
approver->deleteLater();
if (m_approvers.empty()) {
kDebug() << "Quitting approver manager";
KApplication::kApplication()->quit();
}
}

View file

@ -1,49 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Collabora Ltd <info@collabora.co.uk>
** Copyright (C) 2009 Abner Silva <abner.silva@kdemail.net>
**
** This file is part of KDE.
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef APPROVERMANAGER_H
#define APPROVERMANAGER_H
#include <TelepathyQt/AbstractClientApprover>
class Approver;
class ApproverManager : public QObject, public Tp::AbstractClientApprover
{
Q_OBJECT
public:
explicit ApproverManager(QObject *parent);
virtual ~ApproverManager();
virtual void addDispatchOperation(const Tp::MethodInvocationContextPtr<> &context,
const Tp::ChannelDispatchOperationPtr &dispatchOperation);
private Q_SLOTS:
void onFinished();
private:
QList<Approver *> m_approvers;
};
#endif

View file

@ -1,8 +0,0 @@
[org.freedesktop.Telepathy.Client]
Interfaces=org.freedesktop.Telepathy.Client.Approver;
[org.freedesktop.Telepathy.Client.Approver.ApproverChannelFilter 0]
org.freedesktop.Telepathy.Channel.ChannelType s=org.freedesktop.Telepathy.Channel.Type.StreamTube
org.freedesktop.Telepathy.Channel.Type.StreamTube.Service s=rfb
org.freedesktop.Telepathy.Channel.Requested b=false

View file

@ -1,173 +0,0 @@
[Global]
IconName=krdc
Comment=KRDC
Comment[ast]=KRDC
Comment[bg]=KRDC
Comment[bs]=KRDC
Comment[ca]=KRDC
Comment[ca@valencia]=KRDC
Comment[cs]=KRDC
Comment[da]=KRDC
Comment[de]=KRDC
Comment[el]=KRDC
Comment[en_GB]=KRDC
Comment[eo]=KRDC
Comment[es]=KRDC
Comment[et]=KRDC
Comment[eu]=KRDC
Comment[fi]=KRDC
Comment[fr]=KRDC
Comment[ga]=KRDC
Comment[gl]=KRDC
Comment[hr]=KRDC
Comment[hu]=KRDC
Comment[ia]=KRDC
Comment[is]=KRDC
Comment[it]=KRDC
Comment[ja]=KRDC
Comment[kk]=KRDC
Comment[km]=KRDC
Comment[ko]=KRDC
Comment[lt]=KRDC
Comment[lv]=KRDC
Comment[mr]=के-आर-डी-सी
Comment[nb]=KRDC
Comment[nds]=KRDC
Comment[nl]=KRDC
Comment[nn]=KRDC
Comment[pa]=KRDC
Comment[pl]=KRDC
Comment[pt]=KRDC
Comment[pt_BR]=KRDC
Comment[ro]=KRDC
Comment[ru]=KRDC
Comment[si]=KRDC
Comment[sk]=KRDC
Comment[sl]=KRDC
Comment[sr]=КРДЦ
Comment[sr@ijekavian]=КРДЦ
Comment[sr@ijekavianlatin]=KRDC
Comment[sr@latin]=KRDC
Comment[sv]=KRDC
Comment[tr]=KRDC
Comment[ug]=KRDC
Comment[uk]=KRDC
Comment[wa]=KRDC
Comment[x-test]=xxKRDCxx
Comment[zh_CN]=KRDC
Comment[zh_TW]=KRDC 遠端桌面連線遙控
Name=KRDC
Name[ar]=KRDC
Name[ast]=KRDC
Name[bg]=KRDC
Name[bs]=KRDC
Name[ca]=KRDC
Name[ca@valencia]=KRDC
Name[cs]=KRDC
Name[da]=KRDC
Name[de]=KRDC
Name[el]=KRDC
Name[en_GB]=KRDC
Name[eo]=KRDC
Name[es]=KRDC
Name[et]=KRDC
Name[eu]=KRDC
Name[fi]=KRDC
Name[fr]=KRDC
Name[ga]=KRDC
Name[gl]=KRDC
Name[hne]=केआरडीसी
Name[hr]=KRDC
Name[hu]=KRDC
Name[ia]=KRDC
Name[is]=KRDC
Name[it]=KRDC
Name[ja]=KRDC
Name[kk]=KRDC
Name[km]=KRDC
Name[ko]=KRDC
Name[lt]=KDE nutolusio darbastalio klientas
Name[lv]=KRDC
Name[ml]=കെആര്‍ഡിസി
Name[mr]=के-आर-डी-सी
Name[nb]=KRDC
Name[nds]=KRDC
Name[nl]=KRDC
Name[nn]=KRDC
Name[pa]=KRDC
Name[pl]=KRDC
Name[pt]=KRDC
Name[pt_BR]=KRDC
Name[ro]=KRDC
Name[ru]=KRDC
Name[si]=KRDC
Name[sk]=KRDC
Name[sl]=KRDC
Name[sq]=KRDC
Name[sr]=КРДЦ
Name[sr@ijekavian]=КРДЦ
Name[sr@ijekavianlatin]=KRDC
Name[sr@latin]=KRDC
Name[sv]=KRDC
Name[tr]=KRDC
Name[ug]=KRDC
Name[uk]=KRDC
Name[wa]=KRDC
Name[x-test]=xxKRDCxx
Name[zh_CN]=KRDC
Name[zh_TW]=遠端桌面_KRDC
[Event/newrfb]
Name=Incoming RFB Tube
Name[ast]=RFB Tube entrante
Name[bg]=Входяща връзка RFB
Name[bs]=Dolazna RFB cijev
Name[ca]=Tub RFB entrant
Name[ca@valencia]=Tub RFB entrant
Name[cs]=Příchozí kanál RFB
Name[da]=Indkommende RFB-tube
Name[de]=Eingehender RFB-Tunnel
Name[el]=Δίαυλος εισερχόμενου RFB
Name[en_GB]=Incoming RFB Tube
Name[es]=RFB Tube entrante
Name[et]=Sisenev RFB-tube
Name[eu]=Sarrerako RFB hodia
Name[fi]=Saapuva RFB-putki
Name[fr]=Canal entrant « RFB »
Name[ga]=Tiúb RFB Isteach
Name[gl]=Tubo RFB entrante
Name[hr]=Dolazeći RFB Tube
Name[hu]=Bejövő RFB-csatorna
Name[ia]=RFB Tube in arrivata
Name[is]=Innsend RFB-túba
Name[it]=Canale RFB in arrivo
Name[kk]=Кіріс RFB арнасы
Name[km]=RFB Tube ចូល
Name[ko]=들어오는 RFB Tube
Name[lt]=Įeinantis RFB kanalas
Name[lv]=Ienākoša RFB truba
Name[nb]=Innkommende RFB-rør
Name[nds]=Ankamen RFB-Kanaal
Name[nl]=Inkomende RFB-buis
Name[nn]=Innkommande RFB-tube
Name[pa]=ਆ ਰਹੀ RFB ਟਿਊਬ
Name[pl]=Przychodząca RFB Tube
Name[pt]=Ligação de RFB Recebida
Name[pt_BR]=Ligação de RFB recebida
Name[ro]=Tub RFB de intrare
Name[ru]=Входящее подключение RFB
Name[si]=පැමිණෙන RFB නලය
Name[sk]=Prichádzajúci RFB kanál
Name[sl]=Prejet oddaljen slikovni medpomnilnik
Name[sr]=Долазна РФБ цев
Name[sr@ijekavian]=Долазна РФБ цев
Name[sr@ijekavianlatin]=Dolazna RFB cev
Name[sr@latin]=Dolazna RFB cev
Name[sv]=Inkommande RFB-rör
Name[tr]=Gelen RFB Tube
Name[uk]=Вхідний канал RFB
Name[x-test]=xxIncoming RFB Tubexx
Name[zh_CN]=收到的 RFB 点对点请求
Name[zh_TW]=進來的 RFB Tube
Action=Popup
Flags=Persistent

View file

@ -1,63 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Collabora Ltd <info@collabora.co.uk>
** Copyright (C) 2009 Abner Silva <abner.silva@kdemail.net>
**
** This file is part of KDE.
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "approvermanager.h"
#include <KAboutData>
#include <KCmdLineArgs>
#include <KLocalizedString>
#include <KUniqueApplication>
#include <TelepathyQt/Types>
#include <TelepathyQt/Debug>
#include <TelepathyQt/ClientRegistrar>
int main(int argc, char **argv)
{
KAboutData aboutData("krdc_rfb_approver", "KRDC", ki18n("KRDC"), "0.1",
ki18n("Approver for KRDC"), KAboutData::License_GPL,
ki18n("(C) 2009, Abner Silva"));
aboutData.setProgramIconName("krdc");
aboutData.addAuthor(ki18nc("@info:credit", "Abner Silva"), KLocalizedString(),
"abner.silva@kdemail.net");
KCmdLineArgs::init(argc, argv, &aboutData);
if (!KUniqueApplication::start())
return 0;
KUniqueApplication app;
app.disableSessionManagement();
Tp::registerTypes();
Tp::enableDebug(true);
Tp::enableWarnings(true);
Tp::ClientRegistrarPtr registrar = Tp::ClientRegistrar::create();
Tp::SharedPtr<ApproverManager> approverManager;
approverManager = Tp::SharedPtr<ApproverManager>(new ApproverManager(0));
registrar->registerClient(Tp::AbstractClientPtr::dynamicCast(approverManager), "krdc_rfb_approver");
return app.exec();
}

View file

@ -1,3 +0,0 @@
[D-BUS Service]
Name=org.freedesktop.Telepathy.Client.krdc_rfb_approver
Exec=@CMAKE_INSTALL_PREFIX@/bin/krdc_rfb_approver

View file

@ -1,7 +0,0 @@
[org.freedesktop.Telepathy.Client]
Interfaces=org.freedesktop.Telepathy.Client.Handler;
[org.freedesktop.Telepathy.Client.Handler.HandlerChannelFilter 0]
org.freedesktop.Telepathy.Channel.ChannelType s=org.freedesktop.Telepathy.Channel.Type.StreamTube
org.freedesktop.Telepathy.Channel.Type.StreamTube.Service s=rfb
org.freedesktop.Telepathy.Channel.Requested b=false

View file

@ -55,7 +55,6 @@ int main(int argc, char **argv)
"bradh@frogmouth.net");
aboutData.addCredit(ki18n("LibVNCServer / LibVNCClient developers"), ki18n("VNC client library"),
"libvncserver-common@lists.sf.net", "http://libvncserver.sourceforge.net/");
aboutData.addAuthor(ki18n("Abner Silva"), ki18n("Telepathy Tubes Integration"), "abner.silva@kdemail.net");
KCmdLineArgs::init(argc, argv, &aboutData);

View file

@ -35,10 +35,6 @@
#include "tabbedviewwidget.h"
#include "hostpreferences.h"
#ifdef TELEPATHY_SUPPORT
#include "tubesmanager.h"
#endif
#include <KAction>
#include <KActionCollection>
#include <KActionMenu>
@ -83,9 +79,6 @@ MainWindow::MainWindow(QWidget *parent)
m_systemTrayIcon(0),
m_dockWidgetTableView(0),
m_newConnectionTableView(0),
#ifdef TELEPATHY_SUPPORT
m_tubesManager(0),
#endif
m_newConnectionWidget(0)
{
loadAllPlugins();
@ -243,12 +236,6 @@ void MainWindow::loadAllPlugins()
continue;
}
}
#ifdef TELEPATHY_SUPPORT
/* Start tube handler */
m_tubesManager = new TubesManager(this);
connect(m_tubesManager, SIGNAL(newConnection(KUrl)), SLOT(newConnection(KUrl)));
#endif
}
RemoteViewFactory *MainWindow::createPluginFromService(const KService::Ptr &service)
@ -583,9 +570,6 @@ void MainWindow::disconnectHost()
view->startQuitting(); // some deconstructors can't properly quit, so quit early
m_tabWidget->removePage(widgetToDelete);
widgetToDelete->deleteLater();
#ifdef TELEPATHY_SUPPORT
m_tubesManager->closeTube(view->url());
#endif
// if closing the last connection, create new connection tab
if (m_tabWidget->count() == 0) {
@ -606,9 +590,6 @@ void MainWindow::closeTab(QWidget *widget)
RemoteView *view = m_remoteViewMap.value(widget);
m_remoteViewMap.remove(m_remoteViewMap.key(view));
view->startQuitting();
#ifdef TELEPATHY_SUPPORT
m_tubesManager->closeTube(view->url());
#endif
widget->deleteLater();
}

View file

@ -30,6 +30,12 @@
#include <KService>
#include <KXmlGuiWindow>
#include <QScrollArea>
#include <QModelIndex>
#include <QTableView>
#include <QApplication>
#include <QDesktopWidget>
#include <QtGui/qevent.h>
class KComboBox;
class KLineEdit;
@ -44,14 +50,6 @@ class RemoteView;
class SystemTrayIcon;
class TabbedViewWidget;
#include <QScrollArea>
#include <QModelIndex>
#include <QTableView>
#ifdef TELEPATHY_SUPPORT
class TubesManager;
#endif
class MainWindow : public KXmlGuiWindow
{
Q_OBJECT
@ -132,16 +130,9 @@ private:
QTableView *m_dockWidgetTableView;
QTableView *m_newConnectionTableView;
RemoteDesktopsModel *m_remoteDesktopsModel;
#ifdef TELEPATHY_SUPPORT
TubesManager *m_tubesManager;
#endif
QWidget *m_newConnectionWidget;
};
#include <QApplication>
#include <QDesktopWidget>
#include <QtGui/qevent.h>
class MinimizePixel : public QWidget
{
Q_OBJECT
@ -162,8 +153,6 @@ protected:
}
};
#include <QScrollArea>
class RemoteViewScrollArea : public QScrollArea
{
Q_OBJECT

View file

@ -1,3 +0,0 @@
[D-BUS Service]
Name=org.freedesktop.Telepathy.Client.krdc_rfb_handler
Exec=@CMAKE_INSTALL_PREFIX@/bin/krdc

View file

@ -1,88 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009-2011 Collabora Ltd <info@collabora.co.uk>
** Copyright (C) 2009 Abner Silva <abner.silva@kdemail.net>
**
** This file is part of KDE.
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "tubesmanager.h"
#include <TelepathyQt/IncomingStreamTubeChannel>
#include <TelepathyQt/Debug>
#include <KDebug>
TubesManager::TubesManager(QObject *parent)
: QObject(parent)
{
kDebug() << "Initializing tubes manager";
Tp::enableDebug(true);
Tp::enableWarnings(true);
/* Registering telepathy types */
Tp::registerTypes();
m_stubeClient = Tp::StreamTubeClient::create(
QStringList() << QLatin1String("rfb"),
QStringList(),
QLatin1String("krdc_rfb_handler"));
m_stubeClient->setToAcceptAsTcp();
connect(m_stubeClient.data(),
SIGNAL(tubeAcceptedAsTcp(QHostAddress,quint16,QHostAddress,quint16,
Tp::AccountPtr,Tp::IncomingStreamTubeChannelPtr)),
SLOT(onTubeAccepted(QHostAddress,quint16,QHostAddress,quint16,
Tp::AccountPtr,Tp::IncomingStreamTubeChannelPtr)));
}
TubesManager::~TubesManager()
{
kDebug() << "Destroying tubes manager";
}
void TubesManager::closeTube(const KUrl& url)
{
if (m_tubes.contains(url)) {
m_tubes.take(url)->requestClose();
}
}
void TubesManager::onTubeAccepted(
const QHostAddress & listenAddress, quint16 listenPort,
const QHostAddress & sourceAddress, quint16 sourcePort,
const Tp::AccountPtr & account,
const Tp::IncomingStreamTubeChannelPtr & tube)
{
Q_UNUSED(sourceAddress);
Q_UNUSED(sourcePort);
Q_UNUSED(account);
KUrl url;
url.setScheme("vnc");
url.setHost(listenAddress.toString());
url.setPort(listenPort);
kDebug() << "newConnection:" << url;
m_tubes.insert(url, tube);
emit newConnection(url);
}

View file

@ -1,59 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009-2011 Collabora Ltd <info@collabora.co.uk>
** Copyright (C) 2009 Abner Silva <abner.silva@kdemail.net>
**
** This file is part of KDE.
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef TUBESMANAGER_H
#define TUBESMANAGER_H
#include <TelepathyQt/StreamTubeClient>
#include <QtNetwork/QHostAddress>
#include <KUrl>
class TubesManager : public QObject
{
Q_OBJECT
public:
explicit TubesManager(QObject *parent);
virtual ~TubesManager();
void closeTube(const KUrl & url);
Q_SIGNALS:
void newConnection(KUrl);
private Q_SLOTS:
void onTubeAccepted(
const QHostAddress & listenAddress,
quint16 listenPort,
const QHostAddress & sourceAddress,
quint16 sourcePort,
const Tp::AccountPtr & account,
const Tp::IncomingStreamTubeChannelPtr & tube);
private:
Tp::StreamTubeClientPtr m_stubeClient;
QHash<KUrl, Tp::IncomingStreamTubeChannelPtr> m_tubes;
};
#endif

View file

@ -9,20 +9,6 @@ endif()
find_package(LibVNCServer REQUIRED)
macro_optional_find_package(TelepathyQt4 0.9)
set_package_properties(TelepathyQt4 PROPERTIES
DESCRIPTION "Telepathy Qt Bindings"
URL "http://telepathy.freedesktop.org"
PURPOSE "Needed to build Telepathy Tubes support"
)
macro_optional_find_package(KTp)
set_package_properties(KTp PROPERTIES
DESCRIPTION "KDE Telepathy"
URL "https://projects.kde.org/projects/extragear/network/telepathy"
PURPOSE "Needed to build KDE IM Contacts Display in KRFB"
)
macro_bool_to_01(X11_Xdamage_FOUND HAVE_XDAMAGE)
macro_bool_to_01(X11_XShm_FOUND HAVE_XSHM)

View file

@ -42,16 +42,6 @@ install (FILES
# Second target: krfb - the app
# itself.
if(TelepathyQt4_FOUND)
add_definitions(-DKRFB_WITH_TELEPATHY_TUBES)
include_directories(${TELEPATHY_QT4_INCLUDE_DIR})
endif()
if(KTP_FOUND)
add_definitions(-DKRFB_WITH_KDE_TELEPATHY)
include_directories(${KTP_INCLUDE_DIR})
endif()
set(krfb_SRCS
connectiondialog.cpp
events.cpp
@ -71,15 +61,6 @@ set(krfb_SRCS
mainwidget.ui
)
if(TelepathyQt4_FOUND)
set (krfb_SRCS
${krfb_SRCS}
tubesrfbserver.cpp
tubesrfbclient.cpp
tubesconnectionwidget.ui
)
endif()
kde4_add_kcfg_files (krfb_SRCS krfbconfig.kcfgc)
add_executable (krfb ${krfb_SRCS})
@ -97,20 +78,6 @@ target_link_libraries (krfb
${LIBVNCSERVER_LIBRARIES}
)
if(TelepathyQt4_FOUND)
target_link_libraries(krfb
${TELEPATHY_QT4_LIBRARIES}
)
endif()
if(KTP_FOUND)
target_link_libraries(krfb
${KTP_LIBRARIES}
${KTP_MODELS_LIBRARIES}
${KTP_WIDGETS_LIBRARIES}
)
endif()
if (X11_XTest_FOUND)
target_link_libraries (krfb
${X11_XTest_LIB}
@ -121,15 +88,6 @@ install (TARGETS krfb
${INSTALL_TARGETS_DEFAULT_ARGS}
)
if(TelepathyQt4_FOUND)
configure_file(org.freedesktop.Telepathy.Client.krfb_rfb_handler.service.in
org.freedesktop.Telepathy.Client.krfb_rfb_handler.service)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Telepathy.Client.krfb_rfb_handler.service
DESTINATION ${KDE4_DBUS_SERVICES_INSTALL_DIR})
install(FILES krfb_rfb_handler.client DESTINATION ${CMAKE_INSTALL_PREFIX}/share/telepathy/clients/)
endif()
########### install files ###############
install (PROGRAMS krfb.desktop

View file

@ -67,22 +67,4 @@ void InvitationsConnectionDialog::setRemoteHost(const QString &host)
m_ui.remoteHost->setText(host);
}
//**********
#ifdef KRFB_WITH_TELEPATHY_TUBES
TubesConnectionDialog::TubesConnectionDialog(QWidget *parent)
: ConnectionDialog<Ui::TubesConnectionWidget>(parent)
{
}
void TubesConnectionDialog::setContactName(const QString & name)
{
QString txt = i18n("You have requested to share your desktop with %1. If you proceed, "
"you will allow the remote user to watch your desktop.", name);
m_ui.mainTextLabel->setText(txt);
}
#endif // KRFB_WITH_TELEPATHY_TUBES
#include "moc_connectiondialog.cpp"

View file

@ -63,20 +63,5 @@ public:
void setRemoteHost(const QString & host);
};
//*********
#ifdef KRFB_WITH_TELEPATHY_TUBES
# include "ui_tubesconnectionwidget.h"
class TubesConnectionDialog : public ConnectionDialog<Ui::TubesConnectionWidget>
{
Q_OBJECT
public:
TubesConnectionDialog(QWidget *parent);
void setContactName(const QString & name);
};
#endif // KRFB_WITH_TELEPATHY_TUBES
#endif // CONNECTIONDIALOG_H

View file

@ -1,7 +0,0 @@
[org.freedesktop.Telepathy.Client]
Interfaces=org.freedesktop.Telepathy.Client.Handler;
[org.freedesktop.Telepathy.Client.Handler.HandlerChannelFilter 0]
org.freedesktop.Telepathy.Channel.ChannelType s=org.freedesktop.Telepathy.Channel.Type.StreamTube
org.freedesktop.Telepathy.Channel.Type.StreamTube.Service s=rfb
org.freedesktop.Telepathy.Channel.Requested b=true

View file

@ -33,10 +33,6 @@
#include <QtGui/QPixmap>
#include <QtGui/qwindowdefs.h>
#ifdef KRFB_WITH_TELEPATHY_TUBES
# include "tubesrfbserver.h"
#endif
#include <signal.h>
#include <X11/extensions/XTest.h>
@ -71,9 +67,6 @@ int main(int argc, char *argv[])
"(c) 2000-2001, Const Kaplinsky\n"
"(c) 2000, Tridia Corporation\n"
"(c) 1999, AT&T Laboratories Boston\n"));
aboutData.addAuthor(ki18n("George Goldberg"),
ki18n("Telepathy tubes support"),
"george.goldberg@collabora.co.uk");
aboutData.addAuthor(ki18n("George Kiagiadakis"),
KLocalizedString(),
"george.kiagiadakis@collabora.co.uk");
@ -104,10 +97,6 @@ int main(int argc, char *argv[])
//init the core
InvitationsRfbServer::init();
#ifdef KRFB_WITH_TELEPATHY_TUBES
TubesRfbServer::init();
#endif
//init the GUI
MainWindow mainWindow;
TrayIcon trayicon(&mainWindow);

View file

@ -30,16 +30,6 @@
#include <QtGui/QSizePolicy>
#include <QtNetwork/QNetworkInterface>
#ifdef KRFB_WITH_KDE_TELEPATHY
#include "tubesrfbserver.h"
#include <TelepathyQt/PendingReady>
#include <TelepathyQt/PendingChannelRequest>
#include <KTp/actions.h>
#include <KTp/Widgets/contact-view-widget.h>
#include <KTp/Models/contacts-list-model.h>
#include <KTp/Models/contacts-filter-model.h>
#endif
class TCP: public QWidget, public Ui::TCP
{
public:
@ -108,31 +98,6 @@ MainWindow::MainWindow(QWidget *parent)
m_ui.passwordDisplayLabel->setText(
InvitationsRfbServer::instance->desktopPassword());
#ifdef KRFB_WITH_KDE_TELEPATHY
m_contactViewWidget = new KTp::ContactViewWidget(
TubesRfbServer::instance->contactsListModel(), this);
m_contactViewWidget->setEnabled(false);
connect(m_ui.enableSharingCheckBox, SIGNAL(toggled(bool)),
m_contactViewWidget, SLOT(setEnabled(bool)));
m_contactViewWidget->setIconSize(QSize(32,32));
m_contactViewWidget->setMinimumWidth(120);
m_contactViewWidget->setMaximumWidth(360);
m_contactViewWidget->setMinimumHeight(300);
m_contactViewWidget->contactFilterLineEdit()->setClickMessage(i18n("Search in Contacts..."));
m_contactViewWidget->filter()->setPresenceTypeFilterFlags(KTp::ContactsFilterModel::ShowOnlyConnected);
m_contactViewWidget->filter()->setTubesFilterStrings(QStringList("rfb"));
m_contactViewWidget->filter()->setCapabilityFilterFlags(KTp::ContactsFilterModel::FilterByTubes);
m_contactViewWidget->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
m_ui.tpContactsLayout->addWidget(m_contactViewWidget);
connect(m_contactViewWidget, SIGNAL(contactDoubleClicked(const Tp::AccountPtr &, const KTp::ContactPtr &)),
this, SLOT(onContactDoubleClicked(const Tp::AccountPtr &, const KTp::ContactPtr &)));
#endif
KStandardAction::quit(QCoreApplication::instance(), SLOT(quit()), actionCollection());
KStandardAction::preferences(this, SLOT(showConfiguration()), actionCollection());
@ -215,25 +180,6 @@ void MainWindow::aboutUnattendedMode()
i18n("KDE Desktop Sharing"));
}
#ifdef KRFB_WITH_KDE_TELEPATHY
void MainWindow::onContactDoubleClicked(const Tp::AccountPtr &account, const KTp::ContactPtr &contact)
{
Tp::PendingOperation *op = KTp::Actions::startDesktopSharing(account, contact);
connect(op, SIGNAL(finished(Tp::PendingOperation*)),
this, SLOT(pendingDesktopShareFinished(Tp::PendingOperation*)));
}
void MainWindow::pendingDesktopShareFinished(Tp::PendingOperation *operation)
{
if(operation->isError()) {
KMessageBox::error(this,
operation->errorName() + ": " + operation->errorMessage());
}
}
#endif
void MainWindow::showConfiguration()
{
if (KConfigDialog::showDialog("settings")) {

View file

@ -15,17 +15,6 @@
#include <KXmlGuiWindow>
#ifdef KRFB_WITH_KDE_TELEPATHY
#include <KTp/contact.h>
#include <TelepathyQt/PendingReady>
namespace KTp {
class ContactViewWidget;
}
namespace Tp {
class PendingOperation;
}
#endif
class KLineEdit;
class MainWindow : public KXmlGuiWindow
@ -50,19 +39,11 @@ class MainWindow : public KXmlGuiWindow
void passwordChanged(const QString&);
void aboutConnectionAddress();
void aboutUnattendedMode();
#ifdef KRFB_WITH_KDE_TELEPATHY
void onContactDoubleClicked(const Tp::AccountPtr &, const KTp::ContactPtr &);
void pendingDesktopShareFinished(Tp::PendingOperation*);
#endif
private:
Ui::MainWidget m_ui;
bool m_passwordEditable;
KLineEdit *m_passwordLineEdit;
#ifdef KRFB_WITH_KDE_TELEPATHY
KTp::ContactViewWidget *m_contactViewWidget;
#endif
};
#endif

View file

@ -1,3 +0,0 @@
[D-BUS Service]
Name=org.freedesktop.Telepathy.Client.krfb_rfb_handler
Exec=@CMAKE_INSTALL_PREFIX@/bin/krfb --nodialog

View file

@ -1,114 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TubesConnectionWidget</class>
<widget class="QWidget" name="TubesConnectionWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>162</height>
</rect>
</property>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="pixmapLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>128</width>
<height>128</height>
</size>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="TextLabel5">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Confirmation</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="indent">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="mainTextLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="lineWidth">
<number>-1</number>
</property>
<property name="midLineWidth">
<number>5</number>
</property>
<property name="text">
<string/>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="indent">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbAllowRemoteControl">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="whatsThis">
<string>If you turn this option on, the remote user can enter keystrokes and use your mouse pointer. This gives them full control over your computer, so be careful. When the option is disabled the remote user can only watch your screen.</string>
</property>
<property name="text">
<string>Allow remote user to &amp;control keyboard and mouse</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -1,87 +0,0 @@
/*
Copyright (C) 2009-2010 Collabora Ltd. <info@collabora.co.uk>
@author George Goldberg <george.goldberg@collabora.co.uk>
@author George Kiagiadakis <george.kiagiadakis@collabora.co.uk>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "tubesrfbclient.h"
#include "krfbconfig.h"
#include "connectiondialog.h"
#include <KNotification>
#include <KLocale>
QString TubesRfbClient::name() const
{
return m_contact->alias();
}
//********
PendingTubesRfbClient::PendingTubesRfbClient(rfbClientPtr client, QObject* parent) :
PendingRfbClient(client, parent),
m_processNewClientCalled(false)
{
processNewClient();
}
void PendingTubesRfbClient::setContact(const Tp::ContactPtr & contact)
{
m_contact = contact;
if (m_processNewClientCalled) {
//processNewClient has already been called, so we need to act here
showConfirmationDialog();
}
}
void PendingTubesRfbClient::processNewClient()
{
if (!m_contact) {
//no associated contact yet, hold.
m_processNewClientCalled = true; //act when a contact is set
} else {
//we have a contact, begin handling
showConfirmationDialog();
}
}
void PendingTubesRfbClient::showConfirmationDialog()
{
QString name = m_contact->alias();
KNotification::event("NewConnectionOnHold",
i18n("Received connection from %1, on hold (waiting for confirmation)",
name));
TubesConnectionDialog *dialog = new TubesConnectionDialog(0);
dialog->setContactName(name);
dialog->setAllowRemoteControl(KrfbConfig::allowDesktopControl());
connect(dialog, SIGNAL(okClicked()), SLOT(dialogAccepted()));
connect(dialog, SIGNAL(cancelClicked()), SLOT(reject()));
dialog->show();
}
void PendingTubesRfbClient::dialogAccepted()
{
TubesConnectionDialog *dialog = qobject_cast<TubesConnectionDialog *>(sender());
Q_ASSERT(dialog);
TubesRfbClient *client = new TubesRfbClient(m_rfbClient, m_contact, parent());
client->setControlEnabled(dialog->allowRemoteControl());
accept(client);
}
#include "moc_tubesrfbclient.cpp"

View file

@ -1,60 +0,0 @@
/*
Copyright (C) 2010 Collabora Ltd. <info@collabora.co.uk>
@author George Kiagiadakis <george.kiagiadakis@collabora.co.uk>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TUBESRFBCLIENT_H
#define TUBESRFBCLIENT_H
#include "rfbclient.h"
#include <TelepathyQt/Contact>
class TubesRfbClient : public RfbClient
{
public:
TubesRfbClient(rfbClientPtr client,
const Tp::ContactPtr &contact, QObject *parent=0)
: RfbClient(client, parent), m_contact(contact)
{}
virtual QString name() const;
private:
Tp::ContactPtr m_contact;
};
//*********
class PendingTubesRfbClient : public PendingRfbClient
{
Q_OBJECT
public:
PendingTubesRfbClient(rfbClientPtr client, QObject* parent = 0);
void setContact(const Tp::ContactPtr & contact);
protected Q_SLOTS:
virtual void processNewClient();
private Q_SLOTS:
void showConfirmationDialog();
void dialogAccepted();
private:
Tp::ContactPtr m_contact;
bool m_processNewClientCalled;
};
#endif // TUBESRFBCLIENT_H

View file

@ -1,262 +0,0 @@
/*
Copyright (C) 2009-2011 Collabora Ltd. <info@collabora.co.uk>
@author George Goldberg <george.goldberg@collabora.co.uk>
@author George Kiagiadakis <george.kiagiadakis@collabora.co.uk>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "tubesrfbserver.h"
#include "tubesrfbclient.h"
#include "sockethelpers.h"
#include <KDebug>
#include <KRandom>
#include <TelepathyQt/Debug>
#include <TelepathyQt/Contact>
#include <TelepathyQt/AccountFactory>
#include <TelepathyQt/ConnectionFactory>
#include <TelepathyQt/ContactFactory>
#include <TelepathyQt/ChannelFactory>
#include <TelepathyQt/OutgoingStreamTubeChannel>
#include <TelepathyQt/StreamTubeServer>
#ifdef KRFB_WITH_KDE_TELEPATHY
#include <TelepathyQt/AccountSet>
#include <TelepathyQt/AccountManager>
#include <TelepathyQt/PendingReady>
#include <KTp/Models/contacts-list-model.h>
#include <KTp/contact-factory.h>
#endif
struct TubesRfbServer::Private
{
Tp::StreamTubeServerPtr stubeServer;
QHash<quint16, Tp::ContactPtr> contactsPerPort;
QHash<quint16, PendingTubesRfbClient*> clientsPerPort;
};
//static
TubesRfbServer *TubesRfbServer::instance;
//static
void TubesRfbServer::init()
{
instance = new TubesRfbServer;
//RfbServerManager takes care of deletion
instance->startAndCheck();
}
TubesRfbServer::TubesRfbServer(QObject *parent)
: RfbServer(parent), d(new Private)
{
kDebug() << "starting";
Tp::enableDebug(true);
Tp::enableWarnings(true);
Tp::registerTypes();
Tp::AccountFactoryPtr accountFactory = Tp::AccountFactory::create(
QDBusConnection::sessionBus(),
Tp::Features() << Tp::Account::FeatureCore
<< Tp::Account::FeatureAvatar
<< Tp::Account::FeatureCapabilities
<< Tp::Account::FeatureProtocolInfo
<< Tp::Account::FeatureProfile);
Tp::ConnectionFactoryPtr connectionFactory = Tp::ConnectionFactory::create(
QDBusConnection::sessionBus(),
Tp::Features() << Tp::Connection::FeatureCore
<< Tp::Connection::FeatureSelfContact);
Tp::ChannelFactoryPtr channelFactory = Tp::ChannelFactory::create(
QDBusConnection::sessionBus());
#ifdef KRFB_WITH_KDE_TELEPATHY
Tp::ContactFactoryPtr contactFactory = KTp::ContactFactory::create(
Tp::Features() << Tp::Contact::FeatureAlias
<<Tp::Contact::FeatureAvatarToken
<<Tp::Contact::FeatureAvatarData
<<Tp::Contact::FeatureSimplePresence
<<Tp::Contact::FeatureCapabilities
<<Tp::Contact::FeatureClientTypes);
m_accountManager = Tp::AccountManager::create(
QDBusConnection::sessionBus(),
accountFactory,
connectionFactory,
channelFactory,
contactFactory);
d->stubeServer = Tp::StreamTubeServer::create(
m_accountManager,
QStringList() << QLatin1String("rfb"),
QStringList(),
QLatin1String("krfb_rfb_handler"),
true);
connect(m_accountManager->becomeReady(),
SIGNAL(finished(Tp::PendingOperation*)),
this,
SLOT(onAccountManagerReady()));
m_contactsListModel = new KTp::ContactsListModel(this);
#else
Tp::ContactFactoryPtr contactFactory = Tp::ContactFactory::create(
Tp::Contact::FeatureAlias);
d->stubeServer = Tp::StreamTubeServer::create(
QStringList() << QLatin1String("rfb"),
QStringList(),
QLatin1String("krfb_rfb_handler"),
true,
accountFactory,
connectionFactory,
channelFactory,
contactFactory);
#endif //KRFB_WITH_KDE_TELEPATHY
connect(d->stubeServer.data(),
SIGNAL(tubeRequested(Tp::AccountPtr,Tp::OutgoingStreamTubeChannelPtr,
QDateTime,Tp::ChannelRequestHints)),
SLOT(onTubeRequested()));
connect(d->stubeServer.data(),
SIGNAL(tubeClosed(Tp::AccountPtr,Tp::OutgoingStreamTubeChannelPtr,QString,QString)),
SLOT(onTubeClosed()));
connect(d->stubeServer.data(),
SIGNAL(newTcpConnection(QHostAddress,quint16,Tp::AccountPtr,
Tp::ContactPtr,Tp::OutgoingStreamTubeChannelPtr)),
SLOT(onNewTcpConnection(QHostAddress,quint16,Tp::AccountPtr,
Tp::ContactPtr,Tp::OutgoingStreamTubeChannelPtr)));
connect(d->stubeServer.data(),
SIGNAL(tcpConnectionClosed(QHostAddress,quint16,Tp::AccountPtr,Tp::ContactPtr,
QString,QString,Tp::OutgoingStreamTubeChannelPtr)),
SLOT(onTcpConnectionClosed(QHostAddress,quint16,Tp::AccountPtr,Tp::ContactPtr,
QString,QString,Tp::OutgoingStreamTubeChannelPtr)));
// Pick a random port in the private range (4915265535)
setListeningPort((KRandom::random() % 16383) + 49152);
// Listen only on the loopback network interface
setListeningAddress("127.0.0.1");
setPasswordRequired(false);
}
TubesRfbServer::~TubesRfbServer()
{
kDebug();
stop();
delete d;
}
#ifdef KRFB_WITH_KDE_TELEPATHY
KTp::ContactsListModel *TubesRfbServer::contactsListModel()
{
return m_contactsListModel;
}
#endif
void TubesRfbServer::startAndCheck()
{
if (!start()) {
//try a few times with different ports
bool ok = false;
for (int i=0; !ok && i<5; i++) {
setListeningPort((KRandom::random() % 16383) + 49152);
ok = start();
}
if (!ok) {
kError() << "Failed to start tubes rfb server";
return;
}
}
//TODO listeningAddress() should be a QHostAddress
d->stubeServer->exportTcpSocket(QHostAddress(QString::fromAscii(listeningAddress())),
listeningPort());
}
void TubesRfbServer::onTubeRequested()
{
kDebug() << "Got a tube";
}
void TubesRfbServer::onTubeClosed()
{
kDebug() << "tube closed";
}
void TubesRfbServer::onNewTcpConnection(const QHostAddress & sourceAddress,
quint16 sourcePort,
const Tp::AccountPtr & account,
const Tp::ContactPtr & contact,
const Tp::OutgoingStreamTubeChannelPtr & tube)
{
Q_UNUSED(account);
Q_UNUSED(tube);
kDebug() << "CM signaled tube connection from" << sourceAddress << ":" << sourcePort;
d->contactsPerPort[sourcePort] = contact;
if (d->clientsPerPort.contains(sourcePort)) {
kDebug() << "client already exists";
d->clientsPerPort[sourcePort]->setContact(contact);
}
}
void TubesRfbServer::onTcpConnectionClosed(const QHostAddress& sourceAddress,
quint16 sourcePort,
const Tp::AccountPtr& account,
const Tp::ContactPtr& contact,
const QString& error,
const QString& message,
const Tp::OutgoingStreamTubeChannelPtr& tube)
{
Q_UNUSED(account);
Q_UNUSED(contact);
Q_UNUSED(tube);
kDebug() << "Connection from" << sourceAddress << ":" << sourcePort << "closed."
<< error << message;
d->clientsPerPort.remove(sourcePort);
d->contactsPerPort.remove(sourcePort);
}
PendingRfbClient* TubesRfbServer::newClient(rfbClientPtr client)
{
PendingTubesRfbClient *c = new PendingTubesRfbClient(client, this);
quint16 port = peerPort(client->sock);
kDebug() << "new tube client on port" << port;
d->clientsPerPort[port] = c;
if (d->contactsPerPort.contains(port)) {
kDebug() << "already have a contact";
c->setContact(d->contactsPerPort[port]);
}
return c;
}
#ifdef KRFB_WITH_KDE_TELEPATHY
void TubesRfbServer::onAccountManagerReady()
{
m_contactsListModel->setAccountManager(m_accountManager);
}
#endif
#include "moc_tubesrfbserver.cpp"

View file

@ -1,86 +0,0 @@
/*
Copyright (C) 2009-2011 Collabora Ltd. <info@collabora.co.uk>
@author George Goldberg <george.goldberg@collabora.co.uk>
@author George Kiagiadakis <george.kiagiadakis@collabora.co.uk>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TUBESRFBSERVER_H
#define TUBESRFBSERVER_H
#include "rfbserver.h"
#include <QtNetwork/QHostAddress>
#include <TelepathyQt/Types>
#ifdef KRFB_WITH_KDE_TELEPATHY
namespace KTp {
class ContactsListModel;
}
#endif
class TubesRfbServer : public RfbServer
{
Q_OBJECT
public:
static TubesRfbServer *instance;
static void init();
virtual ~TubesRfbServer();
#ifdef KRFB_WITH_KDE_TELEPATHY
KTp::ContactsListModel *contactsListModel();
#endif
protected:
TubesRfbServer(QObject *parent = 0);
virtual PendingRfbClient* newClient(rfbClientPtr client);
private Q_SLOTS:
void startAndCheck();
void onTubeRequested();
void onTubeClosed();
void onNewTcpConnection(
const QHostAddress &sourceAddress,
quint16 sourcePort,
const Tp::AccountPtr &account,
const Tp::ContactPtr &contact,
const Tp::OutgoingStreamTubeChannelPtr &tube);
void onTcpConnectionClosed(
const QHostAddress &sourceAddress,
quint16 sourcePort,
const Tp::AccountPtr &account,
const Tp::ContactPtr &contact,
const QString &error,
const QString &message,
const Tp::OutgoingStreamTubeChannelPtr &tube);
#ifdef KRFB_WITH_KDE_TELEPATHY
void onAccountManagerReady();
#endif
private:
struct Private;
Private *const d;
#ifdef KRFB_WITH_KDE_TELEPATHY
KTp::ContactsListModel *m_contactsListModel;
Tp::AccountManagerPtr m_accountManager;
#endif
};
#endif // TUBESRFBSERVER_H