diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,9 +99,6 @@ PURPOSE "The xfreerdp binary is needed for RDP support in KRDC (at runtime)" TYPE RUNTIME ) -# NX support is not ready for KDE 4.2; disabled (uwolfer) -# 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") include_directories( ${CMAKE_CURRENT_SOURCE_DIR} @@ -112,7 +109,6 @@ add_subdirectory(core) add_subdirectory(vnc) -add_subdirectory(nx) add_subdirectory(rdp) add_subdirectory(test) diff --git a/nx/CMakeLists.txt b/nx/CMakeLists.txt deleted file mode 100644 --- a/nx/CMakeLists.txt +++ /dev/null @@ -1,55 +0,0 @@ - -if(LIBNXCL_FOUND) - add_definitions(-DKDE_DEFAULT_DEBUG_AREA=5013) - - include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${LIBNXCL_INCLUDE_DIR} - ) - - set(nxplugin_SRCS - nxhostpreferences.cpp - nxclientthread.cpp - nxviewfactory.cpp - nxview.cpp - nxcallbacks.cpp - nxresumesessions.cpp - ) - - kde4_add_ui_files(nxplugin_SRCS - nxpreferences.ui - nxresumesessions.ui - ) - - kde4_add_plugin(krdc_nxplugin ${nxplugin_SRCS}) - - target_link_libraries(krdc_nxplugin - ${KDE4_KDECORE_LIBS} - ${KDE4_KDEUI_LIBS} - ${KDE4_KIO_LIBS} - ${LIBNXCL_LIBRARIES} - krdccore - ) - - set(kcm_krdc_nxplugin_SRCS - nxpreferences.cpp - ) - - kde4_add_plugin(kcm_krdc_nxplugin ${kcm_krdc_nxplugin_SRCS}) - - target_link_libraries(kcm_krdc_nxplugin - ${KDE4_KDEUI_LIBS} - krdccore - ) - - add_dependencies(kcm_krdc_nxplugin krdc_nxplugin) - - install(TARGETS kcm_krdc_nxplugin DESTINATION ${PLUGIN_INSTALL_DIR}) - install(TARGETS krdc_nxplugin DESTINATION ${PLUGIN_INSTALL_DIR}) - - install(FILES krdc_nx.desktop DESTINATION ${SERVICES_INSTALL_DIR}) - install(FILES krdc_nx_config.desktop DESTINATION ${SERVICES_INSTALL_DIR}) - - install(FILES nx.protocol DESTINATION ${SERVICES_INSTALL_DIR}) - install(FILES default.dsa.key DESTINATION ${DATA_INSTALL_DIR}/krdc) -endif(LIBNXCL_FOUND) diff --git a/nx/default.dsa.key b/nx/default.dsa.key deleted file mode 100644 --- a/nx/default.dsa.key +++ /dev/null @@ -1,12 +0,0 @@ ------BEGIN DSA PRIVATE KEY----- -MIIBuwIBAAKBgQCXv9AzQXjxvXWC1qu3CdEqskX9YomTfyG865gb4D02ZwWuRU/9 -C3I9/bEWLdaWgJYXIcFJsMCIkmWjjeSZyTmeoypI1iLifTHUxn3b7WNWi8AzKcVF -aBsBGiljsop9NiD1mEpA0G+nHHrhvTXz7pUvYrsrXcdMyM6rxqn77nbbnwIVALCi -xFdHZADw5KAVZI7r6QatEkqLAoGBAI4L1TQGFkq5xQ/nIIciW8setAAIyrcWdK/z -5/ZPeELdq70KDJxoLf81NL/8uIc4PoNyTRJjtT3R4f8Az1TsZWeh2+ReCEJxDWgG -fbk2YhRqoQTtXPFsI4qvzBWct42WonWqyyb1bPBHk+JmXFscJu5yFQ+JUVNsENpY -+Gkz3HqTAoGANlgcCuA4wrC+3Cic9CFkqiwO/Rn1vk8dvGuEQqFJ6f6LVfPfRTfa -QU7TGVLk2CzY4dasrwxJ1f6FsT8DHTNGnxELPKRuLstGrFY/PR7KeafeFZDf+fJ3 -mbX5nxrld3wi5titTnX+8s4IKv29HJguPvOK/SI7cjzA+SqNfD7qEo8CFDIm1xRf -8xAPsSKs6yZ6j1FNklfu ------END DSA PRIVATE KEY----- diff --git a/nx/krdc_nx.desktop b/nx/krdc_nx.desktop deleted file mode 100644 --- a/nx/krdc_nx.desktop +++ /dev/null @@ -1,121 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=KRDC/Plugin -Icon=krdc -Name=NX -Name[bg]=NX -Name[bs]=NX -Name[ca]=NX -Name[ca@valencia]=NX -Name[cs]=NX -Name[da]=NX -Name[de]=NX -Name[el]=NX -Name[en_GB]=NX -Name[eo]=NX -Name[es]=NX -Name[et]=NX -Name[eu]=NX -Name[fi]=NX -Name[fr]=NX -Name[ga]=NX -Name[gl]=NX -Name[hr]=NX -Name[hu]=NX -Name[ia]=NX -Name[is]=NX -Name[it]=NX -Name[ja]=NX -Name[kk]=NX -Name[km]=NX -Name[ko]=NX -Name[lt]=NX -Name[lv]=NX -Name[mr]=एन-एक्स -Name[nb]=NX -Name[nds]=NX -Name[nl]=NX -Name[nn]=NX -Name[pa]=NX -Name[pl]=NX -Name[pt]=NX -Name[pt_BR]=NX -Name[ro]=NX -Name[ru]=NX -Name[si]=NX -Name[sk]=NX -Name[sl]=NX -Name[sr]=НИкс -Name[sr@ijekavian]=НИкс -Name[sr@ijekavianlatin]=NX -Name[sr@latin]=NX -Name[sv]=NX -Name[tr]=NX -Name[ug]=NX -Name[uk]=NX -Name[wa]=NX -Name[x-test]=xxNXxx -Name[zh_CN]=NX -Name[zh_TW]=NX -Comment=Allows managing NX sessions through KRDC -Comment[bg]=Управление на сесии на NX с KRDC -Comment[bs]=Dopušta upravljanje NX sesijama kroz KRDC -Comment[ca]=Permet gestionar sessions NX mitjançant el KRDC -Comment[ca@valencia]=Permet gestionar sessions NX mitjançant el KRDC -Comment[cs]=Umožňuje spravování sezení NX pomocí KRDC -Comment[da]=Muliggør håndtering af NX-sessioner via KRDC -Comment[de]=Erlaubt die Verwaltung von NX-Sitzungen über KRDC -Comment[el]=Επιτρέπει τη διαχείριση συνεδριών NX μέσω του KRDC -Comment[en_GB]=Allows managing NX sessions through KRDC -Comment[es]=Permite la gestión de sesiones NX mediante KRDC -Comment[et]=NX-seansside haldamise võimaldamine KRDC kaudu -Comment[eu]=NX saioak KRDC bidez kudeatzea baimentzen du -Comment[fi]=Mahdollistaa NX-istuntojen hallinnan KRDC:llä -Comment[fr]=Permet de gérer des sessions « NX » au travers de KRDC -Comment[ga]=Ceadaíonn sé duit seisiúin NX a bhainistiú trí KRDC -Comment[gl]=Permite xestionar sesións NX por medio de KRDC -Comment[hr]=Omogućuje upravljanje sjednicama NX-a kroz KRDC -Comment[hu]=NX-elérés KRDC-ből -Comment[ia]=Permitte gerer sessiones NX per medio de KRDC -Comment[is]=Gefur kost á að stjórna NX setum með KRDC -Comment[it]=Permette di gestire sessioni NX con KRDC -Comment[ja]=KRDC から NX セッションを管理できるようにします -Comment[kk]=KRDC арқылы NX сеанстарын басқаруға мүмкіндік беру -Comment[km]=អនុញ្ញាត​ឲ្យ​គ្រប់គ្រង​សម័យ NX តាមរយៈ KRDC -Comment[ko]=KRDC를 통해서 NX 세션 관리하기 -Comment[lt]=Leidžia valdyti NX sesijas per KRDC -Comment[lv]=Ļauj pārvaldīt NX sesijas caur KRDC -Comment[nb]=Tillater å styre NX-økter gjennom KRDC -Comment[nds]=NX-Törns över KRDC plegen -Comment[nl]=Staat het beheren van NX-sessies toe via KRDC -Comment[nn]=Lèt deg handtera NX-økter gjennom KRDC -Comment[pl]=Pozwala na zarządzanie sesjami NX przez KRDC -Comment[pt]=Permite a gestão de sessões NX através do KRDC -Comment[pt_BR]=Permite o gerenciamento de sessões NX através do KRDC -Comment[ro]=Permite gestiunea sesiunilor NX prin KRDC -Comment[ru]=Разрешить управление сеансами NX через KRDC -Comment[si]=KRDC හරහා NX වාර පාලනයට ඉඩ දෙයි -Comment[sk]=Umožňuje spravovanie sedení NX pomocou aplikácie KRDC -Comment[sl]=Omogoča upravljanje sej NX prek KRDC -Comment[sr]=Управљање НИкс сесијама кроз КРДЦ -Comment[sr@ijekavian]=Управљање НИкс сесијама кроз КРДЦ -Comment[sr@ijekavianlatin]=Upravljanje NX sesijama kroz KRDC -Comment[sr@latin]=Upravljanje NX sesijama kroz KRDC -Comment[sv]=Tillåter hantering av NX-sessioner via KRDC -Comment[th]=อนุญาตให้ทำการจัดการวาระการเชื่อมต่อ NX ผ่านทางโปรแกรม KRDC -Comment[tr]=NX oturumlarını KRDC üzerinden yönetmeye izin verir -Comment[uk]=Надає змогу керувати сеансами NX за допомогою KRDC -Comment[x-test]=xxAllows managing NX sessions through KRDCxx -Comment[zh_CN]=允许用户通过 KRDC 管理 NX 会话 -Comment[zh_TW]=允許透過 KRDC 管理 NX 工作階段 - -X-KDE-PluginInfo-Author=David Gross -X-KDE-PluginInfo-Email=gdavid.devel@gmail.com -X-KDE-PluginInfo-Version=1.0 -X-KDE-PluginInfo-Category=Service -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=true -X-KDE-Library=krdc_nxplugin -X-KDE-PluginInfo-Name=krdc_nxplugin - -X-KDE-KRDC-Sorting=40 diff --git a/nx/krdc_nx_config.desktop b/nx/krdc_nx_config.desktop deleted file mode 100644 --- a/nx/krdc_nx_config.desktop +++ /dev/null @@ -1,61 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=KCModule -Name=NX -Name[bg]=NX -Name[bs]=NX -Name[ca]=NX -Name[ca@valencia]=NX -Name[cs]=NX -Name[da]=NX -Name[de]=NX -Name[el]=NX -Name[en_GB]=NX -Name[eo]=NX -Name[es]=NX -Name[et]=NX -Name[eu]=NX -Name[fi]=NX -Name[fr]=NX -Name[ga]=NX -Name[gl]=NX -Name[hr]=NX -Name[hu]=NX -Name[ia]=NX -Name[is]=NX -Name[it]=NX -Name[ja]=NX -Name[kk]=NX -Name[km]=NX -Name[ko]=NX -Name[lt]=NX -Name[lv]=NX -Name[mr]=एन-एक्स -Name[nb]=NX -Name[nds]=NX -Name[nl]=NX -Name[nn]=NX -Name[pa]=NX -Name[pl]=NX -Name[pt]=NX -Name[pt_BR]=NX -Name[ro]=NX -Name[ru]=NX -Name[si]=NX -Name[sk]=NX -Name[sl]=NX -Name[sr]=НИкс -Name[sr@ijekavian]=НИкс -Name[sr@ijekavianlatin]=NX -Name[sr@latin]=NX -Name[sv]=NX -Name[tr]=NX -Name[ug]=NX -Name[uk]=NX -Name[wa]=NX -Name[x-test]=xxNXxx -Name[zh_CN]=NX -Name[zh_TW]=NX - -X-KDE-Library=kcm_krdc_nxplugin -X-KDE-ParentComponents=krdc_nxplugin diff --git a/nx/nx.protocol b/nx/nx.protocol deleted file mode 100644 --- a/nx/nx.protocol +++ /dev/null @@ -1,12 +0,0 @@ -[Protocol] -exec=krdc '%u' -protocol=nx -input=none -output=none -helper=true -listing= -reading=false -writing=false -makedir=false -deleting=false -Icon=krdc diff --git a/nx/nxcallbacks.h b/nx/nxcallbacks.h deleted file mode 100644 --- a/nx/nxcallbacks.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2008 David Gross -** -** 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 NXCALLBACKS_H -#define NXCALLBACKS_H - -#include -#include - -#include -#include -#include -#include - -class NxCallbacks : public QObject, public nxcl::NXClientLibExternalCallbacks -{ - Q_OBJECT - -public: - NxCallbacks(); - virtual ~NxCallbacks(); - - virtual void write(std::string msg); - virtual void write(int num, std::string msg); - virtual void error(std::string msg); - virtual void debug(std::string msg); - virtual void stdoutSignal(std::string msg); - virtual void stderrSignal(std::string msg); - virtual void stdinSignal(std::string msg); - virtual void resumeSessionsSignal(std::list sessions); - virtual void noSessionsSignal(); - virtual void serverCapacitySignal(); - virtual void connectedSuccessfullySignal(); - -signals: - void progress(int, QString); - void suspendedSessions(QList); - void noSessions(); - void atCapacity(); - -}; - - -#endif diff --git a/nx/nxcallbacks.cpp b/nx/nxcallbacks.cpp deleted file mode 100644 --- a/nx/nxcallbacks.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** - * ** - * ** Copyright (C) 2008 David Gross - * ** - * ** 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 "nxcallbacks.h" - -NxCallbacks::NxCallbacks() -{ -} - -NxCallbacks::~NxCallbacks() -{ -} - -void NxCallbacks::write(std::string msg) -{ - Q_UNUSED(msg); -} - -void NxCallbacks::write(int num, std::string msg) -{ - emit progress(num, QString(msg.c_str())); -} - -void NxCallbacks::error(std::string msg) -{ - Q_UNUSED(msg); -} - -void NxCallbacks::debug(std::string msg) -{ - Q_UNUSED(msg); -} - -void NxCallbacks::stdoutSignal(std::string msg) -{ - Q_UNUSED(msg); -} - -void NxCallbacks::stderrSignal(std::string msg) -{ - Q_UNUSED(msg); -} - -void NxCallbacks::stdinSignal(std::string msg) -{ - Q_UNUSED(msg); -} - -void NxCallbacks::resumeSessionsSignal(std::list sessions) -{ - QList qsessions; - - for (std::list::const_iterator it = sessions.begin(); it != sessions.end(); ++it) - qsessions << (*it); - - emit suspendedSessions(qsessions); -} - -void NxCallbacks::noSessionsSignal() -{ - emit noSessions(); -} - -void NxCallbacks::serverCapacitySignal() -{ - emit atCapacity(); -} - -void NxCallbacks::connectedSuccessfullySignal() -{ -} diff --git a/nx/nxclientthread.h b/nx/nxclientthread.h deleted file mode 100644 --- a/nx/nxclientthread.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2008 David Gross -** -** 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 NXCLIENTTHREAD_H -#define NXCLIENTTHREAD_H - -#include -#include -#include - -#include "remoteview.h" - -#include -#include -#include - -#include - -#include -#include - -class NxCallbacks; - -class NxClientThread: public QThread -{ - Q_OBJECT - -public: - explicit NxClientThread(QObject *parent = 0); - ~NxClientThread(); - - void setCallbacks(NxCallbacks *callbacks); - void setHost(const QString &host); - void setPort(int port); - void setUserName(const QString &userName); - void setPassword(const QString &password); - void setResolution(int width, int height); - void setDesktopType(const QString &desktopType); - void setKeyboardLayout(const QString &keyboardLayout); - void setPrivateKey(const QString &privateKey); - void setSuspended(bool suspended); - void setId(const QString &id); - void stop(); - void startSession(); - -protected: - void run(); - -signals: - /** - * Emitted when the X Window ID of the main NX - * window is received. - * @param xid the X Window ID of the main NX window - */ - void hasXid(int xid); - -private: - nxcl::NXClientLib m_client; - nxcl::NXSessionData m_data; - - std::string m_host; - int m_port; - std::string m_privateKey; - int m_xid; - - bool m_stopped; - QMutex m_mutex; -}; - -#endif diff --git a/nx/nxclientthread.cpp b/nx/nxclientthread.cpp deleted file mode 100644 --- a/nx/nxclientthread.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2008 David Gross -** -** 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 "nxclientthread.h" -#include "nxcallbacks.h" - -#include -#include - -#include -#include -#include - -NxClientThread::NxClientThread(QObject *parent) - : QThread(parent), - m_host(std::string()), - m_port(0), - m_privateKey(std::string()), - m_xid(0), - m_stopped(false) -{ - m_client.setSessionData(&m_data); - - QDesktopWidget *desktop = QApplication::desktop(); - int currentScreen = desktop->screenNumber(); - QRect rect = desktop->screenGeometry(currentScreen); - m_client.setResolution(rect.width(), rect.height()); - m_client.setDepth(24); - m_client.setRender(true); - - m_data.sessionName = "krdcSession"; - m_data.cache = 8; - m_data.images = 32; - m_data.linkType = "adsl"; - m_data.render = true; - m_data.backingstore = "when_requested"; - m_data.imageCompressionMethod = 2; - m_data.keyboard = "defkeymap"; - m_data.media = false; - m_data.agentServer = ""; - m_data.agentUser = ""; - m_data.agentPass = ""; - m_data.cups = 0; - m_data.suspended = false; - m_data.fullscreen = false; - m_data.encryption = true; - m_data.terminate = false; -} - -NxClientThread::~NxClientThread() -{ - stop(); - wait(500); -} - -void NxClientThread::setCallbacks(NxCallbacks *callbacks) -{ - m_client.setExternalCallbacks(callbacks); -} - -void NxClientThread::setHost(const QString &host) -{ - QMutexLocker locker(&m_mutex); - QByteArray tmp = host.toAscii(); - m_host = tmp.data(); -} - -void NxClientThread::setPort(int port) -{ - QMutexLocker locker(&m_mutex); - m_port = port; -} - -void NxClientThread::setUserName(const QString &userName) -{ - QMutexLocker locker(&m_mutex); - std::string userNameStr = std::string(userName.toAscii().data()); - m_client.setUsername(userNameStr); -} - -void NxClientThread::setPassword(const QString &password) -{ - QMutexLocker locker(&m_mutex); - std::string passwordStr = std::string(password.toAscii()); - m_client.setPassword(passwordStr); -} - -void NxClientThread::setResolution(int width, int height) -{ - QMutexLocker locker(&m_mutex); - m_data.geometry = width + 'x' + height + "+0+0"; -} - -void NxClientThread::setDesktopType(const QString &desktopType) -{ - QMutexLocker locker(&m_mutex); - QByteArray tmp = desktopType.toAscii(); - m_data.sessionType = tmp.data(); -} - -void NxClientThread::setKeyboardLayout(const QString &keyboardLayout) -{ - QMutexLocker locker(&m_mutex); - QByteArray tmp = keyboardLayout.toAscii(); - m_data.kbtype = tmp.data(); -} - -void NxClientThread::setPrivateKey(const QString &privateKey) -{ - QMutexLocker locker(&m_mutex); - QByteArray tmp = privateKey.toAscii(); - m_privateKey = tmp.data(); -} - -void NxClientThread::setSuspended(bool suspended) -{ - QMutexLocker locker(&m_mutex); - m_data.suspended = suspended; -} - -void NxClientThread::setId(const QString &id) -{ - QMutexLocker locker(&m_mutex); - QByteArray tmp = id.toAscii(); - m_data.id = tmp.data(); -} - -void NxClientThread::stop() -{ - QMutexLocker locker(&m_mutex); - m_stopped = true; -} - -void NxClientThread::run() -{ - if (m_privateKey.compare("default") == 0) { - const QString keyfilename = QString("default.dsa.key"); - const QString keyfilepath = KGlobal::dirs()->findResource("appdata", keyfilename); - - QFile file(keyfilepath); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) - return; - - QByteArray key; - while (!file.atEnd()) - key += file.readLine(); - - m_client.invokeNXSSH("supplied", m_host, true, key.data(), m_port); - } else - m_client.invokeNXSSH("supplied", m_host, true, m_privateKey, m_port); - - nxcl::notQProcess* p; - while (!m_client.getIsFinished() && !m_stopped) { - if (!m_client.getReadyForProxy()) { - p = m_client.getNXSSHProcess(); - p->probeProcess(); - } else { - p = m_client.getNXSSHProcess(); - p->probeProcess(); - p = m_client.getNXProxyProcess(); - p->probeProcess(); - } - - if (!this->m_xid) { - this->m_xid = m_client.getXID(); - - if (this->m_xid) - emit hasXid(this->m_xid); - } - - usleep(1000); - } -} - -void NxClientThread::startSession() -{ - m_client.runSession(); -} - -#include "moc_nxclientthread.cpp" diff --git a/nx/nxhostpreferences.h b/nx/nxhostpreferences.h deleted file mode 100644 --- a/nx/nxhostpreferences.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2008 David Gross -** -** 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 NXHOSTPREFERENCES_H -#define NXHOSTPREFERENCES_H - -#include "hostpreferences.h" -#include "ui_nxpreferences.h" - -class NxHostPreferences : public HostPreferences -{ - Q_OBJECT - -public: - explicit NxHostPreferences(KConfigGroup configGroup, QObject *parent = 0); - ~NxHostPreferences(); - - void setHeight(int height); - int height(); - void setWidth(int width); - int width(); - void setDesktopType(const QString &desktopType); - QString desktopType() const; - void setKeyboardLayout(const QString &keyboardLayout); - QString keyboardLayout() const; - void setPrivateKey(const QString &privateKey); - QString privateKey() const; - -protected: - QWidget* createProtocolSpecificConfigPage(); - void acceptConfig(); - -private: - QString m_privateKey; - Ui::NxPreferences nxUi; - QWidget *nxPage; - -private slots: - void updateWidthHeight(int index); - void setDefaultPrivateKey(int state); - void updatePrivateKey(); - void chooseKeyFile(); -}; - -#endif diff --git a/nx/nxhostpreferences.cpp b/nx/nxhostpreferences.cpp deleted file mode 100644 --- a/nx/nxhostpreferences.cpp +++ /dev/null @@ -1,297 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2008 David Gross -** -** 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 "nxhostpreferences.h" - -#include "settings.h" - -#include -#include - -#include -#include -#include -#include - -static const QStringList keymaps = (QStringList() - << "ar" - << "cs" - << "da" - << "de" - << "de-ch" - << "en-dv" - << "en-gb" - << "en-us" - << "es" - << "et" - << "fi" - << "fo" - << "fr" - << "fr-be" - << "fr-ca" - << "fr-ch" - << "he" - << "hr" - << "hu" - << "is" - << "it" - << "ja" - << "ko" - << "lt" - << "lv" - << "mk" - << "nl" - << "nl-be" - << "no" - << "pl" - << "pt" - << "pt-br" - << "ru" - << "sl" - << "sv" - << "th" - << "tr" -); - -static const int defaultKeymap = 7; // en-us - -inline int keymap2int(const QString &keymap) -{ - const int index = keymaps.lastIndexOf(keymap); - return (index == -1) ? defaultKeymap : index; -} - -inline QString int2keymap(int layout) -{ - if (layout >= 0 && layout < keymaps.count()) - return keymaps.at(layout); - else - return keymaps.at(defaultKeymap); -} - -static const QStringList desktopTypes = (QStringList() - << "unix-kde" - << "unix-gnome" - << "unix-cde" - << "unix-xdm" -); - -static const int defaultDesktopType = 0; - -inline int desktopType2int(const QString &desktopType) -{ - const int index = desktopTypes.lastIndexOf(desktopType); - return (index == -1) ? defaultDesktopType : index; -} - -inline QString int2desktopType(int index) -{ - if (index >= 0 && index < desktopTypes.count()) - return desktopTypes.at(index); - else - return desktopTypes.at(defaultDesktopType); -} - -NxHostPreferences::NxHostPreferences(KConfigGroup configGroup, QObject *parent) - : HostPreferences(configGroup, parent) -{ -} - -NxHostPreferences::~NxHostPreferences() -{ -} - -QWidget* NxHostPreferences::createProtocolSpecificConfigPage() -{ - nxPage = new QWidget(); - nxUi.setupUi(nxPage); - - nxUi.kcfg_NxHeight->setValue(height()); - nxUi.kcfg_NxWidth->setValue(width()); - nxUi.kcfg_NxDesktopType->setCurrentIndex(desktopType2int(desktopType())); - nxUi.kcfg_NxKeyboardLayout->setCurrentIndex(keymap2int(keyboardLayout())); - - if (privateKey() == "default") { - nxUi.checkboxDefaultPrivateKey->setChecked(true); - nxUi.groupboxPrivateKey->setEnabled(false); - setDefaultPrivateKey(Qt::Checked); - } else { - nxUi.checkboxDefaultPrivateKey->setChecked(false); - nxUi.groupboxPrivateKey->setEnabled(true); - setDefaultPrivateKey(Qt::Unchecked); - } - - connect(nxUi.resolutionComboBox, SIGNAL(currentIndexChanged(int)), SLOT(updateWidthHeight(int))); - connect(nxUi.checkboxDefaultPrivateKey, SIGNAL(stateChanged(int)), SLOT(setDefaultPrivateKey(int))); - connect(nxUi.buttonImportPrivateKey, SIGNAL(pressed()), SLOT(chooseKeyFile())); - connect(nxUi.kcfg_NxPrivateKey, SIGNAL(textChanged()), SLOT(updatePrivateKey())); - - const QString resolutionString = QString::number(width()) + 'x' + QString::number(height()); - const int resolutionIndex = nxUi.resolutionComboBox->findText(resolutionString, Qt::MatchContains); - nxUi.resolutionComboBox->setCurrentIndex((resolutionIndex == -1) ? 5 : resolutionIndex); - - return nxPage; -} - -void NxHostPreferences::updateWidthHeight(int index) -{ - switch (index) { - case 0: - nxUi.kcfg_NxHeight->setValue(480); - nxUi.kcfg_NxWidth->setValue(640); - break; - case 1: - nxUi.kcfg_NxHeight->setValue(600); - nxUi.kcfg_NxWidth->setValue(800); - break; - case 2: - nxUi.kcfg_NxHeight->setValue(768); - nxUi.kcfg_NxWidth->setValue(1024); - break; - case 3: - nxUi.kcfg_NxHeight->setValue(1024); - nxUi.kcfg_NxWidth->setValue(1280); - break; - case 4: - nxUi.kcfg_NxHeight->setValue(1200); - nxUi.kcfg_NxWidth->setValue(1600); - break; - case 5: { - QDesktopWidget *desktop = QApplication::desktop(); - int currentScreen = desktop->screenNumber(nxUi.kcfg_NxHeight); - nxUi.kcfg_NxHeight->setValue(desktop->screenGeometry(currentScreen).height()); - nxUi.kcfg_NxWidth->setValue(desktop->screenGeometry(currentScreen).width()); - break; - } - case 6: - default: - break; - } - - bool enabled = (index == 6) ? true : false; - - nxUi.kcfg_NxHeight->setEnabled(enabled); - nxUi.kcfg_NxWidth->setEnabled(enabled); - nxUi.heightLabel->setEnabled(enabled); - nxUi.widthLabel->setEnabled(enabled); -} - -void NxHostPreferences::setDefaultPrivateKey(int state) -{ - if (state == Qt::Checked) { - setPrivateKey("default"); - nxUi.groupboxPrivateKey->setEnabled(false); - } else if (state == Qt::Unchecked) { - setPrivateKey(""); - nxUi.groupboxPrivateKey->setEnabled(true); - } -} - -void NxHostPreferences::updatePrivateKey() -{ - m_privateKey = nxUi.kcfg_NxPrivateKey->toPlainText(); -} - -void NxHostPreferences::chooseKeyFile() -{ - const QString fileName = KFileDialog::getOpenFileName(KUrl(QDir::homePath()), - "*.key|" + i18n("Key Files (*.key)"), - nxPage, i18n("Open DSA Key File")); - - QFile file(fileName); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) - return; - - QByteArray key; - while (!file.atEnd()) - key += file.readLine(); - - nxUi.kcfg_NxPrivateKey->setPlainText(QString(key)); - setPrivateKey(QString(key)); -} - -void NxHostPreferences::acceptConfig() -{ - HostPreferences::acceptConfig(); - - setHeight(nxUi.kcfg_NxHeight->value()); - setWidth(nxUi.kcfg_NxWidth->value()); - setDesktopType(int2desktopType(nxUi.kcfg_NxDesktopType->currentIndex())); - setKeyboardLayout(int2keymap(nxUi.kcfg_NxKeyboardLayout->currentIndex())); -} - -void NxHostPreferences::setHeight(int height) -{ - if (height >= 0) - m_configGroup.writeEntry("height", height); -} - -int NxHostPreferences::height() -{ - return m_configGroup.readEntry("height", Settings::nxHeight()); -} - -void NxHostPreferences::setWidth(int width) -{ - if (width >= 0) - m_configGroup.writeEntry("width", width); -} - -int NxHostPreferences::width() -{ - return m_configGroup.readEntry("width", Settings::nxWidth()); -} - -void NxHostPreferences::setDesktopType(const QString &desktopType) -{ - if (!desktopType.isNull()) - m_configGroup.writeEntry("desktopType", desktopType2int(desktopType)); -} - -QString NxHostPreferences::desktopType() const -{ - return int2desktopType(m_configGroup.readEntry("desktopType", Settings::nxDesktopType())); -} - -void NxHostPreferences::setKeyboardLayout(const QString &keyboardLayout) -{ - if (!keyboardLayout.isNull()) - m_configGroup.writeEntry("keyboardLayout", keymap2int(keyboardLayout)); -} - -QString NxHostPreferences::keyboardLayout() const -{ - return int2keymap(m_configGroup.readEntry("keyboardLayout", Settings::nxKeyboardLayout())); -} - -void NxHostPreferences::setPrivateKey(const QString &privateKey) -{ - if (!privateKey.isNull()) - m_configGroup.writeEntry("privateKey", privateKey); -} - -QString NxHostPreferences::privateKey() const -{ - return m_configGroup.readEntry("privateKey", Settings::nxPrivateKey()); -} - diff --git a/nx/nxpreferences.h b/nx/nxpreferences.h deleted file mode 100644 --- a/nx/nxpreferences.h +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Urs Wolfer -** -** 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 NXPREFERENCES_H -#define NXPREFERENCES_H - -#include "nxhostpreferences.h" - -#include - -class NxPreferences : public KCModule -{ - Q_OBJECT - -public: - explicit NxPreferences(QWidget *parent = 0, const QVariantList &args = QVariantList()); - ~NxPreferences(); - - virtual void save(); - virtual void load(); - -}; - -#endif // NXPREFERENCES_H diff --git a/nx/nxpreferences.cpp b/nx/nxpreferences.cpp deleted file mode 100644 --- a/nx/nxpreferences.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Urs Wolfer -** -** 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 "nxpreferences.h" -#include "remoteviewfactory.h" -#include "settings.h" - -#include "ui_nxpreferences.h" - -#include - -KRDC_PLUGIN_EXPORT(NxPreferences) - -NxPreferences::NxPreferences(QWidget *parent, const QVariantList &args) - : KCModule(KrdcFactory::componentData(), parent, args) -{ - Ui::NxPreferences nxUi; - nxUi.setupUi(this); - nxUi.resolutionComboBox->hide(); - nxUi.checkboxDefaultPrivateKey->hide(); - nxUi.buttonImportPrivateKey->hide(); - nxUi.labelPrivateKey->hide(); - nxUi.groupboxPrivateKey->hide(); - nxUi.kcfg_NxHeight->setEnabled(true); - nxUi.kcfg_NxWidth->setEnabled(true); - nxUi.heightLabel->setEnabled(true); - nxUi.widthLabel->setEnabled(true); - - addConfig(Settings::self(), this); -} - -NxPreferences::~NxPreferences() -{ -} - -void NxPreferences::load() -{ - KCModule::load(); -} - -void NxPreferences::save() -{ - KCModule::save(); -} - diff --git a/nx/nxpreferences.ui b/nx/nxpreferences.ui deleted file mode 100644 --- a/nx/nxpreferences.ui +++ /dev/null @@ -1,533 +0,0 @@ - - NxPreferences - - - - 0 - 0 - 561 - 471 - - - - - 0 - 0 - - - - - - - Connection - - - - - - - - Desktop &resolution: - - - resolutionComboBox - - - - - - - - - - - - - - - 280 - 0 - - - - Here you can specify the resolution of the remote desktop. This resolution determines the size of the desktop that will be presented to you. - - - 1 - - - - Minimal (640x480) - - - - - Small (800x600) - - - - - Normal (1024x768) - - - - - Large (1280x1024) - - - - - Very Large (1600x1200) - - - - - Current Screen Resolution - - - - - Custom Resolution (...) - - - - - - - - - - false - - - &Width: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - kcfg_NxWidth - - - - - - - false - - - This is the width of the remote desktop. You can only change this value manually if you select Custom as desktop resolution above. - - - 9999 - - - 800 - - - - - - - false - - - H&eight: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - kcfg_NxHeight - - - - - - - false - - - This is the height of the remote desktop. You can only change this value manually if you select Custom as desktop resolution above. - - - 9999 - - - 600 - - - - - - - - - - - Desktop &type: - - - kcfg_NxDesktopType - - - - - - - - 280 - 0 - - - - Here you can specify the desktop environment of the remote desktop. - - - - KDE - - - - - Gnome - - - - - CDE - - - - - XDM - - - - - - - - &Keyboard layout: - - - kcfg_NxKeyboardLayout - - - - - - - - 280 - 0 - - - - Use this to specify your keyboard layout. This layout setting is used to send the correct keyboard codes to the server. - - - 7 - - - - Arabic (ar) - - - - - Czech (cs) - - - - - Danish (da) - - - - - German (de) - - - - - Swiss German (de-ch) - - - - - American Dvorak (en-dv) - - - - - British English (en-gb) - - - - - US English (en-us) - - - - - Spanish (es) - - - - - Estonian (et) - - - - - Finnish (fi) - - - - - Faroese (fo) - - - - - French (fr) - - - - - Belgian (fr-be) - - - - - French Canadian (fr-ca) - - - - - Swiss French (fr-ch) - - - - - Hebrew (he) - - - - - Croatian (hr) - - - - - Hungarian (hu) - - - - - Icelandic (is) - - - - - Italian (it) - - - - - Japanese (ja) - - - - - Korean (ko) - - - - - Lithuanian (lt) - - - - - Latvian (lv) - - - - - Macedonian (mk) - - - - - Dutch (nl) - - - - - Belgian Dutch (nl-be) - - - - - Norwegian (no) - - - - - Polish (pl) - - - - - Portuguese (pt) - - - - - Brazilian (pt-br) - - - - - Russian (ru) - - - - - Slovenian (sl) - - - - - Swedish (sv) - - - - - Thai (th) - - - - - Turkish (tr) - - - - - - - - Private key: - - - - - - - - - The authentication on the NX server requires a private key. By default, it is the NoMachine DSA key. Use this box to choose the default key, or configure it by importing from a file or editing directly the textbox. - - - NoMachine Key - - - true - - - - - - - - - - - - Private Key Management - - - - - - - 0 - 0 - - - - Use this textbox to edit the private key for the authentication on the NX server. - - - - - - - - - - 0 - 0 - - - - Private DSA Key : - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - Use this button to import the private key from a file. - - - Import ... - - - - - - - - - - - - Qt::Vertical - - - - 428 - 16 - - - - - - - - - KComboBox - QComboBox -
kcombobox.h
-
- - KTextEdit - QTextEdit -
ktextedit.h
-
-
- - resolutionComboBox - kcfg_NxWidth - kcfg_NxHeight - kcfg_NxKeyboardLayout - - - -
diff --git a/nx/nxresumesessions.h b/nx/nxresumesessions.h deleted file mode 100644 --- a/nx/nxresumesessions.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2008 David Gross -** -** 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 NXRESUMESESSIONS_H -#define NXRESUMESESSIONS_H - -#include "ui_nxresumesessions.h" - -#include -#include -#include -#include - -class NxResumeSessions : public KDialog -{ - Q_OBJECT - -public: - explicit NxResumeSessions(); - ~NxResumeSessions(); - bool empty() const; - void clear(); - void addSessions(QList sessions); - void show(); - -private: - Ui::NxSessions nxUi; - -private slots: - void pressedNew(); - void pressedResume(); - -signals: - void newSession(); - void resumeSession(QString); -}; - -#endif diff --git a/nx/nxresumesessions.cpp b/nx/nxresumesessions.cpp deleted file mode 100644 --- a/nx/nxresumesessions.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2008 David Gross -** -** 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 "nxresumesessions.h" - -#include -#include -#include - -#include - -NxResumeSessions::NxResumeSessions() -{ - QWidget *nxPage = new QWidget(); - nxUi.setupUi(nxPage); - - setCaption(i18n("Available NX Sessions")); - setButtons(KDialog::None); - - QVBoxLayout *layout = new QVBoxLayout(); - - KTitleWidget *titleWidget = new KTitleWidget(); - titleWidget->setText(i18n("Available NX Sessions")); - titleWidget->setPixmap(KIcon("krdc")); - layout->addWidget(titleWidget); - layout->addWidget(nxPage); - - QWidget *mainWidget = new QWidget(); - mainWidget->setLayout(layout); - setMainWidget(mainWidget); - - connect(nxUi.buttonNew, SIGNAL(pressed()), this, SLOT(pressedNew())); - connect(nxUi.buttonResume, SIGNAL(pressed()), this, SLOT(pressedResume())); -} - -NxResumeSessions::~NxResumeSessions() -{ - if (!empty()) - clear(); -} - -bool NxResumeSessions::empty() const -{ - return nxUi.sessionsList->topLevelItemCount() == 0; -} - -void NxResumeSessions::clear() -{ - nxUi.sessionsList->clear(); -} - -void NxResumeSessions::addSessions(QList sessions) -{ - for (int i = 0; i < sessions.size(); ++i) { - const nxcl::NXResumeData session = sessions.at(i); - QTreeWidgetItem *tmp = new QTreeWidgetItem(); - tmp->setText(0, QString::number(session.display)); - tmp->setText(1, QString(session.sessionType.c_str())); - tmp->setText(2, QString(session.sessionID.c_str())); - tmp->setText(3, QString::number(session.depth)); - tmp->setText(4, QString(session.screen.c_str())); - tmp->setText(5, QString(session.sessionName.c_str())); - - nxUi.sessionsList->addTopLevelItem(tmp); - } -} - -void NxResumeSessions::show() -{ - adjustSize(); - - if (exec() == KDialog::Rejected) - pressedNew(); -} - -void NxResumeSessions::pressedNew() -{ - emit newSession(); -} - -void NxResumeSessions::pressedResume() -{ - emit resumeSession(QString("")); -} - diff --git a/nx/nxresumesessions.ui b/nx/nxresumesessions.ui deleted file mode 100644 --- a/nx/nxresumesessions.ui +++ /dev/null @@ -1,94 +0,0 @@ - - NxSessions - - - - 0 - 0 - 725 - 260 - - - - - 9 - - - 6 - - - - - - Display - - - - - Type - - - - - Session ID - - - - - Colour Depth - - - - - Resolution - - - - - Session Name - - - - - - - - 0 - - - 6 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - &New - - - - - - - &Resume - - - - - - - - - - diff --git a/nx/nxview.h b/nx/nxview.h deleted file mode 100644 --- a/nx/nxview.h +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2008 David Gross -** -** 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 NXVIEW_H -#define NXVIEW_H - -#include "remoteview.h" -#include "nxcallbacks.h" -#include "nxclientthread.h" -#include "nxhostpreferences.h" -#include "nxresumesessions.h" - -#include - -#define TCP_PORT_NX 22 - -class NxView : public RemoteView -{ - Q_OBJECT - -public: - explicit NxView(QWidget *parent = 0, const KUrl &url = KUrl(), KConfigGroup configGroup = KConfigGroup()); - virtual ~NxView(); - - // Start closing the connection - virtual void startQuitting(); - // If we are currently closing the connection - virtual bool isQuitting(); - // Open a connection - virtual bool start(); - - // Returns the size of the remote view - virtual QSize framebufferSize(); - // Returns the suggested size of the remote view - QSize sizeHint() const; - virtual void setGrabAllKeys(bool grabAllKeys); - - virtual bool supportsViewOnly() const; - - HostPreferences* hostPreferences(); - -public slots: - void switchFullscreen(bool on); - void hasXid(int xid); - void handleProgress(int id, QString msg); - void handleSuspendedSessions(QList sessions); - void handleNoSessions(); - void handleAtCapacity(); - void handleNewSession(); - void handleResumeSession(QString id); - void connectionOpened(); - void connectionClosed(); - -protected: - bool eventFilter(QObject *obj, QEvent *event); - -private: - // Thread that manage NX connection - NxClientThread m_clientThread; - // NX Callbacks - NxCallbacks m_callbacks; - // If we are currently closing the connection - bool m_quitFlag; - // Widget which contains the NX Window - QX11EmbedContainer *m_container; - // Dialog which allows user to choose NX preferences. - NxHostPreferences *m_hostPreferences; - // Dialog which allows user to resume NX sessions. - NxResumeSessions m_resumeSessions; -}; - -#endif diff --git a/nx/nxview.cpp b/nx/nxview.cpp deleted file mode 100644 --- a/nx/nxview.cpp +++ /dev/null @@ -1,282 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2008 David Gross -** -** 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 "nxview.h" -#include "settings.h" - -#include - -#include -#include -#include - -#include -#include - -NxView::NxView(QWidget *parent, const KUrl &url, KConfigGroup configGroup) - : RemoteView(parent), - m_quitFlag(false), - m_container(nullptr), - m_hostPreferences(nullptr) -{ - m_url = url; - m_host = url.host(); - m_port = url.port(); - - if (m_port <= 0 || m_port >= 65536) - m_port = TCP_PORT_NX; - - m_container = new QX11EmbedContainer(this); - m_container->installEventFilter(this); - - qRegisterMetaType >("QList"); - - m_clientThread.setCallbacks(&m_callbacks); - - connect(&m_clientThread, SIGNAL(hasXid(int)), this, SLOT(hasXid(int))); - connect(&m_callbacks, SIGNAL(progress(int,QString)), this, SLOT(handleProgress(int,QString))); - connect(&m_callbacks, SIGNAL(suspendedSessions(QList)), this, SLOT(handleSuspendedSessions(QList))); - connect(&m_callbacks, SIGNAL(noSessions()), this, SLOT(handleNoSessions())); - connect(&m_callbacks, SIGNAL(atCapacity()), this, SLOT(handleAtCapacity())); - connect(&m_resumeSessions, SIGNAL(newSession()), this, SLOT(handleNewSession())); - connect(&m_resumeSessions, SIGNAL(resumeSession(QString)), this, SLOT(handleResumeSession(QString))); - - m_hostPreferences = new NxHostPreferences(configGroup, this); -} - -NxView::~NxView() -{ -} - -// filter out key and mouse events to the container if we are view only -//FIXME: X11 events are passed to the app before getting caught in the Qt event processing -bool NxView::eventFilter(QObject *obj, QEvent *event) -{ - if (m_viewOnly) { - if (event->type() == QEvent::KeyPress || - event->type() == QEvent::KeyRelease || - event->type() == QEvent::MouseButtonDblClick || - event->type() == QEvent::MouseButtonPress || - event->type() == QEvent::MouseButtonRelease || - event->type() == QEvent::MouseMove) - return true; - } - - return RemoteView::eventFilter(obj, event); -} - -void NxView::startQuitting() -{ - kDebug(5013) << "about to quit"; - - const bool connected = status() == RemoteView::Connected; - setStatus(Disconnecting); - m_quitFlag = true; - - if (connected) - m_clientThread.stop(); - else - m_clientThread.quit(); - - m_clientThread.wait(500); - setStatus(Disconnected); - m_container->discardClient(); -} - -bool NxView::isQuitting() -{ - return m_quitFlag; -} - -bool NxView::start() -{ - m_clientThread.setResolution(m_hostPreferences->width(), m_hostPreferences->height()); - m_clientThread.setDesktopType(m_hostPreferences->desktopType()); - m_clientThread.setKeyboardLayout(m_hostPreferences->keyboardLayout()); - m_clientThread.setPrivateKey(m_hostPreferences->privateKey()); - - m_container->show(); - - if (m_hostPreferences->walletSupport()) { - if (m_url.userName().isEmpty()) { - QString userName; - bool ok = false; - - userName = KInputDialog::getText(i18n("Enter Username"), - i18n("Please enter the username you would like to use for login."), - QString(), &ok, this); - - if (ok) - m_url.setUserName(userName); - } - - if (!m_url.userName().isEmpty()) { - QString walletPassword = readWalletPassword(); - - if (!walletPassword.isNull()) - m_url.setPassword(walletPassword); - else { - KPasswordDialog dialog(this); - dialog.setPrompt(i18n("Access to the system requires a password.")); - if (dialog.exec() == KPasswordDialog::Accepted) { - m_url.setPassword(dialog.password()); - - if (m_hostPreferences->walletSupport()) - saveWalletPassword(dialog.password()); - } - } - } - } - - m_clientThread.setHost(m_host); - m_clientThread.setPort(m_port); - m_clientThread.setUserName(m_url.userName()); - m_clientThread.setPassword(m_url.password()); - m_clientThread.setResolution(m_hostPreferences->width(), m_hostPreferences->height()); - - setStatus(Connecting); - m_clientThread.start(); - - connect(m_container, SIGNAL(clientIsEmbedded()), SLOT(connectionOpened())); - connect(m_container, SIGNAL(clientClosed()), SLOT(connectionClosed())); - - return true; -} - -HostPreferences* NxView::hostPreferences() -{ - return m_hostPreferences; -} - -QSize NxView::framebufferSize() -{ - return m_container->minimumSizeHint(); -} - -QSize NxView::sizeHint() const -{ - return maximumSize(); -} - - -void NxView::switchFullscreen(bool on) -{ - setGrabAllKeys(on); -} - -void NxView::setGrabAllKeys(bool grabAllKeys) -{ - m_grabAllKeys = grabAllKeys; - - if (grabAllKeys) { - m_keyboardIsGrabbed = true; - m_container->grabKeyboard(); - } else if (m_keyboardIsGrabbed) - m_container->releaseKeyboard(); -} - -void NxView::hasXid(int xid) -{ - m_container->embedClient(xid); -} - -bool NxView::supportsViewOnly() const -{ - return true; -} - -void NxView::handleProgress(int id, QString msg) -{ - Q_UNUSED(msg); - switch (id) { - case NXCL_AUTH_FAILED: - KMessageBox::error(this, i18n("The authentication key is invalid."), i18n("Invalid authentication key")); - break; - case NXCL_LOGIN_FAILED: - KMessageBox::error(this, i18n("The username or password that you have entered is invalid."), i18n("Invalid username or password")); - break; - case NXCL_HOST_KEY_VERIFAILED: - KMessageBox::error(this, i18n("The host key verification has failed."), i18n("Host key verification failed")); - break; - case NXCL_PROCESS_ERROR: - KMessageBox::error(this, i18n("An error has occurred during the connection to the NX server."), i18n("Process error")); - break; - default: - break; - } -} - -void NxView::handleSuspendedSessions(QList sessions) -{ - if (!m_resumeSessions.empty()) - m_resumeSessions.clear(); - - m_resumeSessions.addSessions(sessions); - m_resumeSessions.show(); -} - -void NxView::handleNoSessions() -{ - m_clientThread.setSuspended(false); - m_clientThread.startSession(); -} - -void NxView::handleAtCapacity() -{ - KMessageBox::error(this, i18n("This NX server is running at capacity."), i18n("Server at capacity")); -} - -void NxView::handleNewSession() -{ - m_clientThread.setSuspended(false); - m_clientThread.startSession(); -} - -void NxView::handleResumeSession(QString id) -{ - m_clientThread.setId(id); - m_clientThread.setSuspended(true); - m_clientThread.startSession(); -} - -void NxView::connectionOpened() -{ - kDebug(5013) << "Connection opened"; - QSize size(m_hostPreferences->width(), m_hostPreferences->height()); - kDebug(5013) << "Size hint: " << size.width() << size.height(); - setStatus(Connected); - setFixedSize(size); - resize(size); - m_container->setFixedSize(size); - emit framebufferSizeChanged(size.width(), size.height()); - emit connected(); - setFocus(); -} - -void NxView::connectionClosed() -{ - emit disconnected(); - setStatus(Disconnected); - m_quitFlag = true; -} - diff --git a/nx/nxviewfactory.h b/nx/nxviewfactory.h deleted file mode 100644 --- a/nx/nxviewfactory.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Urs Wolfer -** -** 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 NXVIEWFACTORY_H -#define NXVIEWFACTORY_H - -#include "remoteviewfactory.h" - -#include "nxview.h" -#include "nxpreferences.h" - -class NxViewFactory : public RemoteViewFactory -{ - Q_OBJECT - -public: - explicit NxViewFactory(QObject *parent, const QVariantList &args); - - virtual ~NxViewFactory(); - - virtual bool supportsUrl(const KUrl &url) const; - - virtual RemoteView *createView(QWidget *parent, const KUrl &url, KConfigGroup configGroup); - - virtual HostPreferences *createHostPreferences(KConfigGroup configGroup, QWidget *parent); - - virtual QString scheme() const; - - virtual QString connectActionText() const; - - virtual QString connectButtonText() const; - - virtual QString connectToolTipText() const; -}; - -#endif // NXVIEWFACTORY_H diff --git a/nx/nxviewfactory.cpp b/nx/nxviewfactory.cpp deleted file mode 100644 --- a/nx/nxviewfactory.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2008 Urs Wolfer -** -** 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 "nxviewfactory.h" - -#include - -KRDC_PLUGIN_EXPORT(NxViewFactory) - -NxViewFactory::NxViewFactory(QObject *parent, const QVariantList &args) - : RemoteViewFactory(parent) -{ - Q_UNUSED(args); - - KGlobal::locale()->insertCatalog("krdc"); -} - -NxViewFactory::~NxViewFactory() -{ -} - -bool NxViewFactory::supportsUrl(const KUrl &url) const -{ - return (url.scheme().compare("nx", Qt::CaseInsensitive) == 0); -} - -RemoteView *NxViewFactory::createView(QWidget *parent, const KUrl &url, KConfigGroup configGroup) -{ - return new NxView(parent, url, configGroup); -} - -HostPreferences *NxViewFactory::createHostPreferences(KConfigGroup configGroup, QWidget *parent) -{ - return new NxHostPreferences(configGroup, parent); -} - -QString NxViewFactory::scheme() const -{ - return "nx"; -} - -QString NxViewFactory::connectActionText() const -{ - return i18n("New NX Connection..."); -} - -QString NxViewFactory::connectButtonText() const -{ - return i18n("Connect to a NX Remote Desktop"); -} - -QString NxViewFactory::connectToolTipText() const -{ - return i18n("Enter the address here.
" - "Example: nxserver (host)"); -} - -#include "moc_nxviewfactory.cpp"