1
0
mirror of https://invent.kde.org/network/krfb synced 2024-07-01 07:24:29 +00:00

Initial port to Qt5/KF5.

Fixed FindLibVNCServer to use CheckStructHasMember.
Ported from kDebug to qDebug
Runs and seems to work, but probably missed some things.
This commit is contained in:
Jeremy Whiting 2015-09-06 15:31:29 -06:00
parent cb43be430c
commit 6306bf85cf
28 changed files with 198 additions and 178 deletions

View File

@ -1,33 +1,41 @@
cmake_minimum_required(VERSION 2.8.9)
cmake_minimum_required(VERSION 2.8.12)
project(krfb)
if(NOT INSIDE_KDENETWORK)
message("Not building inside KDENetwork, loading KDE CMake Macros.")
include(FeatureSummary)
find_package(Qt5 REQUIRED COMPONENTS Core DBus Widgets X11Extras)
find_package(KDE4 REQUIRED)
find_package(ECM 1.7.0 NO_MODULE REQUIRED)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
include(KDE4Defaults)
include(MacroLibrary)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings)
include(ECMInstallIcons)
include(ECMAddAppIcon)
include(CheckIncludeFile)
include(CheckIncludeFiles)
include(CheckSymbolExists)
include(CheckFunctionExists)
include(CheckLibraryExists)
include(CheckPrototypeExists)
include(CheckTypeSize)
find_package(KF5 REQUIRED COMPONENTS
I18n
Crash
CoreAddons
DNSSD
DocTools
KDELibs4Support
Wallet
WidgetsAddons
)
set(CMAKE_REQUIRED_DEFINITIONS ${_KDE4_PLATFORM_DEFINITIONS})
if(WIN32)
set(CMAKE_REQUIRED_LIBRARIES ${KDEWIN32_LIBRARIES})
set(CMAKE_REQUIRED_INCLUDES ${KDEWIN32_INCLUDES})
endif(WIN32)
add_definitions(${QT_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS} ${KDE4_DEFINITIONS})
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES})
endif(NOT INSIDE_KDENETWORK)
find_package(X11 REQUIRED)
set(IS_KTP_INTERNAL_MODULE TRUE)
if(WIN32)
set(CMAKE_REQUIRED_LIBRARIES ${KDEWIN32_LIBRARIES})
set(CMAKE_REQUIRED_INCLUDES ${KDEWIN32_INCLUDES})
endif(WIN32)
add_definitions(${QT_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS})
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} )
# set(IS_KTP_INTERNAL_MODULE TRUE)
set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
${CMAKE_MODULE_PATH}
@ -35,14 +43,22 @@ set(CMAKE_MODULE_PATH
find_package(LibVNCServer REQUIRED)
macro_optional_find_package(TelepathyQt4)
macro_log_feature(TelepathyQt4_FOUND "telepathy-qt" "Telepathy Qt Bindings" "http://telepathy.freedesktop.org" FALSE "0.9" "Needed to build Telepathy Tubes support.")
# macro_optional_find_package(TelepathyQt4)
# macro_log_feature(TelepathyQt4_FOUND "telepathy-qt" "Telepathy Qt Bindings" "http://telepathy.freedesktop.org" FALSE "0.9" "Needed to build Telepathy Tubes support.")
macro_optional_find_package(KTp)
macro_log_feature(KTP_FOUND "KTP" "KDE Telepathy" "https://projects.kde.org/projects/extragear/network/telepathy" FALSE "" "Needed to build KDE IM Contacts Display in KRFB.")
# macro_optional_find_package(KTp)
# macro_log_feature(KTP_FOUND "KTP" "KDE Telepathy" "https://projects.kde.org/projects/extragear/network/telepathy" FALSE "" "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)
if (HAVE_XDAMAGE)
set(X11_Xdamage_FOUND 1)
else()
set(X11_Xdamage_FOUND 0)
endif()
if (HAVE_XSHM)
set(X11_XShm_FOUND 1)
else()
set(X11_XShm_FOUND 0)
endif()
include_directories ("${CMAKE_CURRENT_BINARY_DIR}/krfb"
"${CMAKE_CURRENT_SOURCE_DIR}/krfb"
@ -58,7 +74,3 @@ endif(Q_WS_X11)
add_subdirectory(krfb)
add_subdirectory(framebuffers)
add_subdirectory(doc)
if (NOT INSIDE_KDENETWORK)
macro_display_feature_log()
endif ()

View File

@ -6,7 +6,7 @@
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
INCLUDE(CheckPointerMember)
INCLUDE(CheckStructHasMember)
IF (LIBVNCSERVER_INCLUDE_DIR AND LIBVNCSERVER_LIBRARIES)
# Already in cache, be silent
@ -25,7 +25,7 @@ FIND_LIBRARY(LIBVNCCLIENT_LIBRARIES NAMES vncclient libvncclient)
IF (LIBVNCSERVER_INCLUDE_DIR AND LIBVNCSERVER_LIBRARIES)
SET(CMAKE_REQUIRED_INCLUDES "${LIBVNCSERVER_INCLUDE_DIR}" "${CMAKE_REQUIRED_INCLUDES}")
CHECK_POINTER_MEMBER(rfbClient* GotXCutText rfb/rfbclient.h LIBVNCSERVER_FOUND)
CHECK_STRUCT_HAS_MEMBER("struct _rfbClient" GotXCutText rfb/rfbclient.h LIBVNCSERVER_FOUND)
ENDIF (LIBVNCSERVER_INCLUDE_DIR AND LIBVNCSERVER_LIBRARIES)
IF (LIBVNCSERVER_FOUND)

View File

@ -1,2 +1,2 @@
########### install files ###############
kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR krfb)
kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR krfb)

View File

@ -7,14 +7,15 @@ set (krfb_framebuffer_qt_SRCS
qtframebufferplugin.cpp
)
kde4_add_plugin (krfb_framebuffer_qt
add_library(krfb_framebuffer_qt
MODULE
${krfb_framebuffer_qt_SRCS}
)
target_link_libraries (krfb_framebuffer_qt
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${KDE4_KDEUI_LIBS}
Qt5::Core
Qt5::Gui
KF5::KDELibs4Support
krfbprivate
)

View File

@ -25,7 +25,7 @@
#include <kdemacros.h>
#include <QtGui/QWidget>
#include <QWidget>
class FrameBuffer;

View File

@ -7,17 +7,19 @@ set (krfb_framebuffer_x11_SRCS
x11framebufferplugin.cpp
)
kde4_add_plugin (krfb_framebuffer_x11
add_library(krfb_framebuffer_x11
MODULE
${krfb_framebuffer_x11_SRCS}
)
target_link_libraries (krfb_framebuffer_x11
${KDE4_KDEUI_LIBS}
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
Qt5::Core
Qt5::Gui
${X11_X11_LIB}
${X11_Xdamage_LIB}
${X11_Xext_LIB}
KF5::KDELibs4Support
krfbprivate
)

View File

@ -17,7 +17,7 @@
#include <QDesktopWidget>
#include <KApplication>
#include <KDebug>
#include <QDebug>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@ -56,7 +56,7 @@ X11FrameBuffer::X11FrameBuffer(WId id, QObject *parent)
{
#ifdef HAVE_XSHM
d->useShm = XShmQueryExtension(QX11Info::display());
kDebug() << "shm: " << d->useShm;
//qDebug() << "shm: " << d->useShm;
#else
d->useShm = false;
#endif
@ -94,7 +94,7 @@ X11FrameBuffer::X11FrameBuffer(WId id, QObject *parent)
;
}
kDebug() << "Got image. bpp: " << d->framebufferImage->bits_per_pixel
qDebug() << "Got image. bpp: " << d->framebufferImage->bits_per_pixel
<< ", depth: " << d->framebufferImage->depth
<< ", padded width: " << d->framebufferImage->bytes_per_line
<< " (sent: " << d->framebufferImage->width * 4 << ")"
@ -207,25 +207,25 @@ void X11FrameBuffer::cleanupRects()
QList<QRect> cpy = tiles;
bool inserted = false;
tiles.clear();
// kDebug() << "before cleanup: " << cpy.size();
// //qDebug() << "before cleanup: " << cpy.size();
foreach(const QRect & r, cpy) {
if (tiles.size() > 0) {
for (int i = 0; i < tiles.size(); i++) {
// kDebug() << r << tiles[i];
// //qDebug() << r << tiles[i];
if (r.intersects(tiles[i])) {
tiles[i] |= r;
inserted = true;
break;
// kDebug() << "merged into " << tiles[i];
// //qDebug() << "merged into " << tiles[i];
}
}
if (!inserted) {
tiles.append(r);
// kDebug() << "appended " << r;
// //qDebug() << "appended " << r;
}
} else {
// kDebug() << "appended " << r;
// //qDebug() << "appended " << r;
tiles.append(r);
}
}
@ -250,7 +250,7 @@ void X11FrameBuffer::cleanupRects()
}
}
// kDebug() << "after cleanup: " << tiles.size();
// //qDebug() << "after cleanup: " << tiles.size();
}
void X11FrameBuffer::acquireEvents()
@ -258,11 +258,13 @@ void X11FrameBuffer::acquireEvents()
XEvent ev;
#ifdef HAVE_XDAMAGE
while (XCheckTypedEvent(QX11Info::display(), d->xdamageBaseEvent + XDamageNotify, &ev)) {
handleXDamage(&ev);
}
XDamageSubtract(QX11Info::display(), d->damage, None, None);
#endif
}
QList< QRect > X11FrameBuffer::modifiedTiles()
@ -283,7 +285,7 @@ QList< QRect > X11FrameBuffer::modifiedTiles()
#ifdef HAVE_XSHM
foreach(const QRect & r, tiles) {
// kDebug() << r;
// //qDebug() << r;
gl |= r;
int y = r.y();
int x = r.x();
@ -298,7 +300,7 @@ QList< QRect > X11FrameBuffer::modifiedTiles()
x = d->framebufferImage->width - d->updateTile->width;
}
// kDebug() << "x: " << x << " (" << r.x() << ") y: " << y << " (" << r.y() << ") " << r;
// //qDebug() << "x: " << x << " (" << r.x() << ") y: " << y << " (" << r.y() << ") " << r;
XShmGetImage(QX11Info::display(), win, d->updateTile, x, y, AllPlanes);
int pxsize = d->framebufferImage->bits_per_pixel / 8;
char *dest = fb + ((d->framebufferImage->bytes_per_line * y) + (x * pxsize));
@ -336,8 +338,8 @@ QList< QRect > X11FrameBuffer::modifiedTiles()
}
}
// kDebug() << "tot: " << gl;
// kDebug() << tiles.size();
// //qDebug() << "tot: " << gl;
// //qDebug() << tiles.size();
ret = tiles;
tiles.clear();
return ret;

View File

@ -13,6 +13,7 @@
#include <QWidget>
class X11FrameBuffer;
typedef union _XEvent XEvent;
class EvWidget: public QWidget
{

View File

@ -25,7 +25,7 @@
#include <kdemacros.h>
#include <QtGui/QWidget>
#include <QWidget>
class FrameBuffer;

3
krfb.kdev4 Normal file
View File

@ -0,0 +1,3 @@
[Project]
Manager=KDevCMakeManager
Name=krfb

View File

@ -2,6 +2,8 @@ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config-krfb.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/config-krfb.h
)
include(GenerateExportHeader)
#####################################
# First target: libkrfbprivate - a library
# for linking plugins against.
@ -11,21 +13,23 @@ set (krfbprivate_SRCS
framebufferplugin.cpp
)
kde4_add_library (krfbprivate
add_library (krfbprivate
SHARED
${krfbprivate_SRCS}
)
generate_export_header(krfbprivate BASE_NAME krfbprivate)
target_link_libraries (krfbprivate
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
Qt5::Core
Qt5::Widgets
Qt5::X11Extras
${X11_X11_LIB}
${LIBVNCSERVER_LIBRARIES}
)
set_target_properties (krfbprivate PROPERTIES
VERSION ${GENERIC_LIB_VERSION}
SOVERSION ${GENERIC_LIB_VERSION}
VERSION 5
SOVERSION 5.0
)
install (TARGETS krfbprivate
@ -75,11 +79,11 @@ if(TelepathyQt4_FOUND)
)
endif()
kde4_add_kcfg_files (krfb_SRCS
kconfig_add_kcfg_files (krfb_SRCS
krfbconfig.kcfgc
)
kde4_add_ui_files (krfb_SRCS
ki18n_wrap_ui (krfb_SRCS
ui/configtcp.ui
ui/configsecurity.ui
ui/connectionwidget.ui
@ -87,10 +91,10 @@ kde4_add_ui_files (krfb_SRCS
)
if(TelepathyQt4_FOUND)
kde4_add_ui_files(krfb_SRCS ui/tubesconnectionwidget.ui)
ki18n_wrap_ui(krfb_SRCS ui/tubesconnectionwidget.ui)
endif()
kde4_add_executable (krfb
add_executable (krfb
${krfb_SRCS}
)
@ -101,9 +105,11 @@ target_link_libraries (krfb
${X11_Xext_LIB}
${X11_X11_LIB}
${X11_Xdamage_LIB}
${QT_QTNETWORK_LIBRARY}
${KDE4_KDNSSD_LIBS}
${KDE4_KDEUI_LIBS}
Qt5::Network
KF5::DNSSD
KF5::KDELibs4Support
KF5::Wallet
KF5::WidgetsAddons
${LIBVNCSERVER_LIBRARIES}
)

View File

@ -21,12 +21,11 @@
#include "connectiondialog.h"
#include <KIconLoader>
#include <KIcon>
#include <KLocale>
#include <KStandardGuiItem>
#include <QtGui/QCheckBox>
#include <QtGui/QLabel>
#include <QCheckBox>
template <typename UI>
ConnectionDialog<UI>::ConnectionDialog(QWidget *parent)

View File

@ -24,9 +24,9 @@
#include "events.h"
#include <QtGui/QApplication>
#include <QtGui/QX11Info>
#include <QtGui/QDesktopWidget>
#include <QApplication>
#include <QX11Info>
#include <QDesktopWidget>
#include <KGlobal>
#include <X11/Xutil.h>

View File

@ -12,19 +12,19 @@
#include "rfb.h"
#include <kdemacros.h>
#include "krfbprivate_export.h"
#include <QtCore/QObject>
#include <QtCore/QRect>
#include <QtCore/QList>
#include <QWidget>
#include <QtGui/QWidget>
class FrameBuffer;
/**
@author Alessandro Praduroux <pradu@pradu.it>
*/
class KDE_EXPORT FrameBuffer : public QObject
class KRFBPRIVATE_EXPORT FrameBuffer : public QObject
{
Q_OBJECT
public:

View File

@ -23,7 +23,7 @@
#include "framebufferplugin.h"
#include "krfbconfig.h"
#include <KDebug>
#include <QDebug>
#include <KGlobal>
#include <KServiceTypeTrader>
@ -39,26 +39,26 @@ K_GLOBAL_STATIC(FrameBufferManagerStatic, frameBufferManagerStatic)
FrameBufferManager::FrameBufferManager()
{
kDebug();
//qDebug();
loadPlugins();
}
FrameBufferManager::~FrameBufferManager()
{
kDebug();
//qDebug();
}
FrameBufferManager *FrameBufferManager::instance()
{
kDebug();
//qDebug();
return &frameBufferManagerStatic->instance;
}
void FrameBufferManager::loadPlugins()
{
kDebug();
//qDebug();
// Load the all the plugin factories here, for use later.
KService::List offers = KServiceTypeTrader::self()->query("krfb/framebuffer");
@ -72,34 +72,34 @@ void FrameBufferManager::loadPlugins()
KPluginFactory *factory = KPluginLoader(service->library()).factory();
if (!factory) {
kWarning() << "KPluginFactory could not load the plugin:" << service->library();
qWarning() << "KPluginFactory could not load the plugin:" << service->library();
continue;
}
FrameBufferPlugin *plugin = factory->create<FrameBufferPlugin>(this);
if (plugin) {
kDebug() << "Loaded plugin:" << service->name();
//qDebug() << "Loaded plugin:" << service->name();
m_plugins.insert(service->library(), plugin);
} else {
kDebug() << error;
//qDebug() << error;
}
}
}
QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id)
{
kDebug();
//qDebug();
// See if there is still an existing framebuffer to this WId.
if (m_frameBuffers.contains(id)) {
QWeakPointer<FrameBuffer> weakFrameBuffer = m_frameBuffers.value(id);
if (weakFrameBuffer) {
kDebug() << "Found cached frame buffer.";
//qDebug() << "Found cached frame buffer.";
return weakFrameBuffer.toStrongRef();
} else {
kDebug() << "Found deleted cached frame buffer. Don't use.";
//qDebug() << "Found deleted cached frame buffer. Don't use.";
m_frameBuffers.remove(id);
}
}
@ -110,7 +110,7 @@ QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id)
while (iter != m_plugins.constEnd()) {
if (iter.key() == KrfbConfig::preferredFrameBufferPlugin()) {
kDebug() << "Using FrameBuffer:" << KrfbConfig::preferredFrameBufferPlugin();
//qDebug() << "Using FrameBuffer:" << KrfbConfig::preferredFrameBufferPlugin();
QSharedPointer<FrameBuffer> frameBuffer(iter.value()->frameBuffer(id));
@ -125,7 +125,7 @@ QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id)
}
// No valid framebuffer plugin found.
kDebug() << "No valid framebuffer found. returning null.";
//qDebug() << "No valid framebuffer found. returning null.";
return QSharedPointer<FrameBuffer>();
}

View File

@ -23,19 +23,19 @@
#include "framebuffer.h"
#include <kdemacros.h>
#include "krfbprivate_export.h"
#include <QtCore/QMap>
#include <QtCore/QObject>
#include <QtCore/QSharedPointer>
#include <QtCore/QWeakPointer>
#include <QtGui/QWidget>
#include <QWidget>
class FrameBufferPlugin;
class KPluginFactory;
class KDE_EXPORT FrameBufferManager : public QObject
class KRFBPRIVATE_EXPORT FrameBufferManager : public QObject
{
Q_OBJECT
friend class FrameBufferManagerStatic;

View File

@ -21,15 +21,15 @@
#ifndef LIB_KRFB_FRAMEBUFFERPLUGIN_H
#define LIB_KRFB_FRAMEBUFFERPLUGIN_H
#include <kdemacros.h>
#include "krfbprivate_export.h"
#include <QtCore/QVariantList>
#include <QWidget>
#include <QtGui/QWidget>
class FrameBuffer;
class KDE_EXPORT FrameBufferPlugin : public QObject
class KRFBPRIVATE_EXPORT FrameBufferPlugin : public QObject
{
Q_OBJECT

View File

@ -26,6 +26,8 @@
#include "connectiondialog.h"
#include <KNotification>
#include <KLocale>
#include <QDebug>
#include <QtCore/QSocketNotifier>
#include <poll.h>
@ -111,7 +113,7 @@ void PendingInvitationsRfbClient::onSocketActivated()
//the clientGoneHook which in turn will remove this RfbClient instance
//from the server manager and will call deleteLater() to delete it
if (d->client->sock == -1) {
kDebug() << "disconnected from socket signal";
qDebug() << "disconnected from socket signal";
d->notifier->setEnabled(false);
rfbClientConnectionGone(d->client);
break;
@ -122,7 +124,7 @@ void PendingInvitationsRfbClient::onSocketActivated()
bool PendingInvitationsRfbClient::checkPassword(const QByteArray & encryptedPassword)
{
QByteArray password ;
kDebug() << "about to start autentication";
qDebug() << "about to start autentication";
if(InvitationsRfbServer::instance->allowUnattendedAccess() && vncAuthCheckPassword(
InvitationsRfbServer::instance->unattendedPassword().toLocal8Bit(),

View File

@ -23,16 +23,18 @@
#include "krfbconfig.h"
#include "rfbservermanager.h"
#include <QtCore/QTimer>
#include <QtGui/QApplication>
#include <QApplication>
#include <QtNetwork/QHostInfo>
#include <KNotification>
#include <QDebug>
#include <KLocale>
#include <KMessageBox>
#include <KUser>
#include <KRandom>
#include <KStringHandler>
#include <KWallet/Wallet>
#include <DNSSD/PublicService>
#include <KGlobal>
#include <dnssd/publicservice.h>
using KWallet::Wallet;
//static
@ -42,7 +44,7 @@ InvitationsRfbServer *InvitationsRfbServer::instance;
void InvitationsRfbServer::init()
{
instance = new InvitationsRfbServer;
instance->m_publicService = new DNSSD::PublicService(
instance->m_publicService = new KDNSSD::PublicService(
i18n("%1@%2 (shared desktop)",
KUser().loginName(),
QHostInfo::localHostName()),
@ -170,7 +172,7 @@ void InvitationsRfbServer::walletOpened(bool opened)
} else {
kDebug() << "Could not open KWallet, Falling back to config file";
qDebug() << "Could not open KWallet, Falling back to config file";
KSharedConfigPtr config = KGlobal::config();
KConfigGroup krfbConfig(config,"Security");

View File

@ -26,7 +26,7 @@ namespace KWallet {
class Wallet;
}
namespace DNSSD {
namespace KDNSSD {
class PublicService;
}
@ -60,7 +60,7 @@ private Q_SLOTS:
void walletOpened(bool);
private:
DNSSD::PublicService *m_publicService;
KDNSSD::PublicService *m_publicService;
bool m_allowUnattendedAccess;
QString m_desktopPassword;
QString m_unattendedPassword;

View File

@ -19,18 +19,16 @@
#include "trayicon.h"
#include "invitationsrfbserver.h"
#include <KAboutApplicationDialog>
#include <KAboutData>
#include <KAction>
#include <K4AboutData>
#include <KUniqueApplication>
#include <KCmdLineArgs>
#include <KDebug>
#include <QDebug>
#include <KLocale>
#include <KMessageBox>
#include <KNotification>
#include <QtGui/QPixmap>
#include <QtGui/qwindowdefs.h>
#include <QPixmap>
#include <qwindowdefs.h>
#include <QX11Info>
#ifdef KRFB_WITH_TELEPATHY_TUBES
# include "tubesrfbserver.h"
@ -39,6 +37,7 @@
#include <signal.h>
#include <X11/extensions/XTest.h>
static const char KRFB_VERSION[] = I18N_NOOP("5.0");
static const char description[] = I18N_NOOP("VNC-compatible server to share "
"KDE desktops");
@ -61,8 +60,8 @@ static bool checkX11Capabilities()
int main(int argc, char *argv[])
{
KAboutData aboutData("krfb", 0, ki18n("Desktop Sharing"), KDE_VERSION_STRING,
ki18n(description), KAboutData::License_GPL,
K4AboutData aboutData("krfb", 0, ki18n("Desktop Sharing"), KRFB_VERSION,
ki18n(description), K4AboutData::License_GPL,
ki18n("(c) 2009-2010, Collabora Ltd.\n"
"(c) 2007, Alessandro Praduroux\n"
"(c) 2001-2003, Tim Jansen\n"

View File

@ -18,16 +18,13 @@
#include <KIcon>
#include <KLocale>
#include <KMessageBox>
#include <KStandardGuiItem>
#include <KSystemTimeZone>
#include <KToolInvocation>
#include <KStandardAction>
#include <KActionCollection>
#include <KLineEdit>
#include <KNewPasswordDialog>
#include <QtGui/QWidget>
#include <QtGui/QSizePolicy>
#include <QWidget>
#include <QSizePolicy>
#include <QtNetwork/QNetworkInterface>
#ifdef KRFB_WITH_KDE_TELEPATHY
@ -243,7 +240,8 @@ void MainWindow::showConfiguration()
KConfigDialog *dialog = new KConfigDialog(this, "settings", KrfbConfig::self());
dialog->addPage(new TCP, i18n("Network"), "network-workgroup");
dialog->addPage(new Security, i18n("Security"), "security-high");
dialog->setHelp(QString(), "krfb");
// TODO: Fix for KF5 release
// dialog->setHelp(QString(), "krfb");
dialog->show();
}

View File

@ -23,8 +23,7 @@
#include "sockethelpers.h"
#include "events.h"
#include <QtCore/QSocketNotifier>
#include <KDebug>
#include <KNotification>
#include <QDebug>
#include <poll.h>
#include <strings.h> //for bzero()
@ -54,7 +53,7 @@ RfbClient::RfbClient(rfbClientPtr client, QObject* parent)
RfbClient::~RfbClient()
{
kDebug();
//qDebug();
delete d;
}
@ -140,7 +139,7 @@ void RfbClient::onSocketActivated()
//the clientGoneHook which in turn will remove this RfbClient instance
//from the server manager and will call deleteLater() to delete it
if (d->client->sock == -1) {
kDebug() << "disconnected from socket signal";
//qDebug() << "disconnected from socket signal";
d->notifier->setEnabled(false);
rfbClientConnectionGone(d->client);
break;
@ -159,7 +158,7 @@ void RfbClient::update()
//the clientGoneHook which in turn will remove this RfbClient instance
//from the server manager and will call deleteLater() to delete it
if (d->client->sock == -1) {
kDebug() << "disconnected during update";
//qDebug() << "disconnected during update";
d->notifier->setEnabled(false);
rfbClientConnectionGone(d->client);
}
@ -178,7 +177,7 @@ PendingRfbClient::~PendingRfbClient()
void PendingRfbClient::accept(RfbClient *newClient)
{
kDebug() << "accepted connection";
//qDebug() << "accepted connection";
m_rfbClient->clientData = newClient;
newClient->setOnHold(false);
@ -191,7 +190,7 @@ static void clientGoneHookNoop(rfbClientPtr cl) { Q_UNUSED(cl); }
void PendingRfbClient::reject()
{
kDebug() << "refused connection";
//qDebug() << "refused connection";
//override the clientGoneHook that was previously set by RfbServer
m_rfbClient->clientGoneHook = clientGoneHookNoop;

View File

@ -22,7 +22,7 @@
#include <QtCore/QSocketNotifier>
#include <QApplication>
#include <QClipboard>
#include <KDebug>
#include <QDebug>
struct RfbServer::Private
{
@ -122,14 +122,14 @@ bool RfbServer::start()
d->screen->authPasswdData = (void *)0;
}
kDebug() << "Starting server. Listen port:" << listeningPort()
qDebug() << "Starting server. Listen port:" << listeningPort()
<< "Listen Address:" << listeningAddress()
<< "Password enabled:" << passwordRequired();
rfbInitServer(d->screen);
if (!rfbIsActive(d->screen)) {
kDebug() << "Failed to start server";
//qDebug() << "Failed to start server";
rfbShutdownServer(d->screen, false);
return false;
};
@ -187,13 +187,13 @@ void krfb_rfbSetCursorPosition(rfbScreenInfoPtr screen, rfbClientPtr client, int
/* Inform all clients about this cursor movement. */
iterator = rfbGetClientIterator(screen);
while ((cl = rfbClientIteratorNext(iterator)) != NULL) {
cl->cursorWasMoved = TRUE;
cl->cursorWasMoved = true;
}
rfbReleaseClientIterator(iterator);
/* The cursor was moved by this client, so don't send CursorPos. */
if (client) {
client->cursorWasMoved = FALSE;
client->cursorWasMoved = false;
}
}
@ -220,7 +220,7 @@ void RfbServer::onListenSocketActivated()
void RfbServer::pendingClientFinished(RfbClient *client)
{
kDebug();
//qDebug();
if (client) {
RfbServerManager::instance()->addClient(client);
client->getRfbClientPtr()->clientGoneHook = clientGoneHook;
@ -230,7 +230,7 @@ void RfbServer::pendingClientFinished(RfbClient *client)
//static
rfbNewClientAction RfbServer::newClientHook(rfbClientPtr cl)
{
kDebug() << "New client";
//qDebug() << "New client";
RfbServer *server = static_cast<RfbServer*>(cl->screen->screenData);
PendingRfbClient *pendingClient = server->newClient(cl);
@ -243,7 +243,7 @@ rfbNewClientAction RfbServer::newClientHook(rfbClientPtr cl)
//static
void RfbServer::clientGoneHook(rfbClientPtr cl)
{
kDebug() << "client gone";
//qDebug() << "client gone";
RfbClient *client = static_cast<RfbClient*>(cl->clientData);
RfbServerManager::instance()->removeClient(client);

View File

@ -25,11 +25,11 @@
#include "sockethelpers.h"
#include "krfbconfig.h"
#include <QtCore/QTimer>
#include <QtGui/QApplication>
#include <QtGui/QDesktopWidget>
#include <QApplication>
#include <QDesktopWidget>
#include <QtNetwork/QHostInfo>
#include <KGlobal>
#include <KDebug>
#include <QDebug>
#include <KLocale>
#include <KUser>
#include <KNotification>
@ -114,7 +114,7 @@ RfbServerManager::~RfbServerManager()
void RfbServerManager::init()
{
kDebug();
//qDebug();
d->fb = FrameBufferManager::instance()->frameBuffer(QApplication::desktop()->winId());
d->myCursor = rfbMakeXCursor(19, 19, (char *) cur, (char *) mask);
@ -147,7 +147,7 @@ void RfbServerManager::updateScreens()
void RfbServerManager::cleanup()
{
kDebug();
//qDebug();
//copy because d->servers is going to be modified while we delete the servers
QSet<RfbServer*> servers = d->servers;
@ -187,7 +187,7 @@ rfbScreenInfoPtr RfbServerManager::newScreen()
bpp = 4;
}
kDebug() << "bpp: " << bpp;
//qDebug() << "bpp: " << bpp;
rfbLogEnable(0);
@ -206,7 +206,7 @@ rfbScreenInfoPtr RfbServerManager::newScreen()
void RfbServerManager::addClient(RfbClient* cc)
{
if (d->clients.size() == 0) {
kDebug() << "Starting framebuffer monitor";
//qDebug() << "Starting framebuffer monitor";
d->fb->startMonitor();
d->rfbUpdateTimer.start(50);
}
@ -222,7 +222,7 @@ void RfbServerManager::removeClient(RfbClient* cc)
{
d->clients.remove(cc);
if (d->clients.size() == 0) {
kDebug() << "Stopping framebuffer monitor";
//qDebug() << "Stopping framebuffer monitor";
d->fb->stopMonitor();
d->rfbUpdateTimer.stop();
}

View File

@ -26,32 +26,32 @@
#include <KActionCollection>
#include <KDialog>
#include <KGlobal>
#include <KIcon>
#include <KLocale>
#include <KMenu>
#include <QMenu>
#include <KStandardAction>
#include <KDebug>
#include <KToggleAction>
class ClientActions
{
public:
ClientActions(RfbClient *client, KMenu *menu, QAction *before);
ClientActions(RfbClient *client, QMenu *menu, QAction *before);
virtual ~ClientActions();
private:
KMenu *m_menu;
QMenu *m_menu;
QAction *m_title;
QAction *m_disconnectAction;
QAction *m_enableControlAction;
QAction *m_separator;
};
ClientActions::ClientActions(RfbClient* client, KMenu* menu, QAction* before)
ClientActions::ClientActions(RfbClient* client, QMenu* menu, QAction* before)
: m_menu(menu)
{
m_title = m_menu->addTitle(client->name(), before);
m_title = m_menu->insertSection(before, client->name());
m_disconnectAction = new KAction(i18n("Disconnect"), m_menu);
m_disconnectAction = new QAction(i18n("Disconnect"), m_menu);
m_menu->insertAction(before, m_disconnectAction);
QObject::connect(m_disconnectAction, SIGNAL(triggered()), client, SLOT(closeConnection()));
@ -74,8 +74,6 @@ ClientActions::ClientActions(RfbClient* client, KMenu* menu, QAction* before)
ClientActions::~ClientActions()
{
kDebug();
m_menu->removeAction(m_title);
delete m_title;
@ -106,14 +104,12 @@ TrayIcon::TrayIcon(QWidget *mainWindow)
connect(RfbServerManager::instance(), SIGNAL(clientDisconnected(RfbClient*)),
this, SLOT(onClientDisconnected(RfbClient*)));
m_aboutAction = KStandardAction::aboutApp(this, SLOT(showAbout()), actionCollection());
m_aboutAction = KStandardAction::aboutApp(this, SLOT(showAbout()), this);
contextMenu()->addAction(m_aboutAction);
}
void TrayIcon::onClientConnected(RfbClient* client)
{
kDebug();
if (m_clientActions.isEmpty()) { //first client connected
setIconByName("krfb");
setToolTipTitle(i18n("Desktop Sharing - connected with %1", client->name()));
@ -127,8 +123,6 @@ void TrayIcon::onClientConnected(RfbClient* client)
void TrayIcon::onClientDisconnected(RfbClient* client)
{
kDebug();
ClientActions *actions = m_clientActions.take(client);
delete actions;
@ -144,9 +138,10 @@ void TrayIcon::onClientDisconnected(RfbClient* client)
void TrayIcon::showAbout()
{
KDialog *dlg = new KAboutApplicationDialog(KGlobal::mainComponent().aboutData());
dlg->setAttribute(Qt::WA_DeleteOnClose, true);
dlg->show();
// TODO: Port to KF5 equivalent
// KDialog *dlg = new KAboutApplicationDialog(KGlobal::mainComponent().aboutData());
// dlg->setAttribute(Qt::WA_DeleteOnClose, true);
// dlg->show();
}
#include "trayicon.moc"

View File

@ -19,7 +19,6 @@
#define TRAYICON_H
#include <KStatusNotifierItem>
#include <KToggleAction>
class KDialog;
class RfbClient;
@ -42,7 +41,7 @@ public Q_SLOTS:
void showAbout();
private:
KAction *m_aboutAction;
QAction *m_aboutAction;
QHash<RfbClient*, ClientActions*> m_clientActions;
};

View File

@ -20,7 +20,7 @@
#include "tubesrfbclient.h"
#include "sockethelpers.h"
#include <KDebug>
#include <QDebug>
#include <KRandom>
#include <TelepathyQt/Debug>
@ -62,7 +62,7 @@ void TubesRfbServer::init()
TubesRfbServer::TubesRfbServer(QObject *parent)
: RfbServer(parent), d(new Private)
{
kDebug() << "starting";
//qDebug() << "starting";
Tp::enableDebug(true);
Tp::enableWarnings(true);
@ -156,7 +156,7 @@ TubesRfbServer::TubesRfbServer(QObject *parent)
TubesRfbServer::~TubesRfbServer()
{
kDebug();
//qDebug();
stop();
delete d;
}
@ -179,7 +179,7 @@ void TubesRfbServer::startAndCheck()
}
if (!ok) {
kError() << "Failed to start tubes rfb server";
qCritical() << "Failed to start tubes rfb server";
return;
}
}
@ -191,12 +191,12 @@ void TubesRfbServer::startAndCheck()
void TubesRfbServer::onTubeRequested()
{
kDebug() << "Got a tube";
//qDebug() << "Got a tube";
}
void TubesRfbServer::onTubeClosed()
{
kDebug() << "tube closed";
//qDebug() << "tube closed";
}
void TubesRfbServer::onNewTcpConnection(const QHostAddress & sourceAddress,
@ -208,11 +208,11 @@ void TubesRfbServer::onNewTcpConnection(const QHostAddress & sourceAddress,
Q_UNUSED(account);
Q_UNUSED(tube);
kDebug() << "CM signaled tube connection from" << sourceAddress << ":" << sourcePort;
//qDebug() << "CM signaled tube connection from" << sourceAddress << ":" << sourcePort;
d->contactsPerPort[sourcePort] = contact;
if (d->clientsPerPort.contains(sourcePort)) {
kDebug() << "client already exists";
//qDebug() << "client already exists";
d->clientsPerPort[sourcePort]->setContact(contact);
}
}
@ -229,7 +229,7 @@ void TubesRfbServer::onTcpConnectionClosed(const QHostAddress& sourceAddress,
Q_UNUSED(contact);
Q_UNUSED(tube);
kDebug() << "Connection from" << sourceAddress << ":" << sourcePort << "closed."
//qDebug() << "Connection from" << sourceAddress << ":" << sourcePort << "closed."
<< error << message;
d->clientsPerPort.remove(sourcePort);
@ -241,11 +241,11 @@ PendingRfbClient* TubesRfbServer::newClient(rfbClientPtr client)
PendingTubesRfbClient *c = new PendingTubesRfbClient(client, this);
quint16 port = peerPort(client->sock);
kDebug() << "new tube client on port" << port;
//qDebug() << "new tube client on port" << port;
d->clientsPerPort[port] = c;
if (d->contactsPerPort.contains(port)) {
kDebug() << "already have a contact";
//qDebug() << "already have a contact";
c->setContact(d->contactsPerPort[port]);
}