diff --git a/CMakeLists.txt b/CMakeLists.txt index 31008264..edb05672 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 () diff --git a/cmake/modules/FindLibVNCServer.cmake b/cmake/modules/FindLibVNCServer.cmake index 5927ab26..503e135c 100644 --- a/cmake/modules/FindLibVNCServer.cmake +++ b/cmake/modules/FindLibVNCServer.cmake @@ -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) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 3c1f565f..3420b89e 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -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) diff --git a/framebuffers/qt/CMakeLists.txt b/framebuffers/qt/CMakeLists.txt index 194b405f..c6870090 100644 --- a/framebuffers/qt/CMakeLists.txt +++ b/framebuffers/qt/CMakeLists.txt @@ -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 ) diff --git a/framebuffers/qt/qtframebufferplugin.h b/framebuffers/qt/qtframebufferplugin.h index a69e7d97..08e2aec3 100644 --- a/framebuffers/qt/qtframebufferplugin.h +++ b/framebuffers/qt/qtframebufferplugin.h @@ -25,7 +25,7 @@ #include -#include +#include class FrameBuffer; diff --git a/framebuffers/x11/CMakeLists.txt b/framebuffers/x11/CMakeLists.txt index 8a46445a..731bc877 100644 --- a/framebuffers/x11/CMakeLists.txt +++ b/framebuffers/x11/CMakeLists.txt @@ -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 ) diff --git a/framebuffers/x11/x11framebuffer.cpp b/framebuffers/x11/x11framebuffer.cpp index 517d4eb8..e9cce663 100644 --- a/framebuffers/x11/x11framebuffer.cpp +++ b/framebuffers/x11/x11framebuffer.cpp @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include @@ -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 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; diff --git a/framebuffers/x11/x11framebuffer.h b/framebuffers/x11/x11framebuffer.h index 7b70e1ef..e8822a9a 100644 --- a/framebuffers/x11/x11framebuffer.h +++ b/framebuffers/x11/x11framebuffer.h @@ -13,6 +13,7 @@ #include class X11FrameBuffer; +typedef union _XEvent XEvent; class EvWidget: public QWidget { diff --git a/framebuffers/x11/x11framebufferplugin.h b/framebuffers/x11/x11framebufferplugin.h index 01b72e8f..8c8ae142 100644 --- a/framebuffers/x11/x11framebufferplugin.h +++ b/framebuffers/x11/x11framebufferplugin.h @@ -25,7 +25,7 @@ #include -#include +#include class FrameBuffer; diff --git a/krfb.kdev4 b/krfb.kdev4 new file mode 100644 index 00000000..b521cf3c --- /dev/null +++ b/krfb.kdev4 @@ -0,0 +1,3 @@ +[Project] +Manager=KDevCMakeManager +Name=krfb diff --git a/krfb/CMakeLists.txt b/krfb/CMakeLists.txt index 100b49b6..0bd467f6 100644 --- a/krfb/CMakeLists.txt +++ b/krfb/CMakeLists.txt @@ -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} ) diff --git a/krfb/connectiondialog.cpp b/krfb/connectiondialog.cpp index 5975a8c2..eed13528 100644 --- a/krfb/connectiondialog.cpp +++ b/krfb/connectiondialog.cpp @@ -21,12 +21,11 @@ #include "connectiondialog.h" -#include +#include #include #include -#include -#include +#include template ConnectionDialog::ConnectionDialog(QWidget *parent) diff --git a/krfb/events.cpp b/krfb/events.cpp index 3d9e8d27..c7878b6f 100644 --- a/krfb/events.cpp +++ b/krfb/events.cpp @@ -24,9 +24,9 @@ #include "events.h" -#include -#include -#include +#include +#include +#include #include #include diff --git a/krfb/framebuffer.h b/krfb/framebuffer.h index db8fe399..f6430a38 100644 --- a/krfb/framebuffer.h +++ b/krfb/framebuffer.h @@ -12,19 +12,19 @@ #include "rfb.h" -#include +#include "krfbprivate_export.h" #include #include #include +#include -#include class FrameBuffer; /** @author Alessandro Praduroux */ -class KDE_EXPORT FrameBuffer : public QObject +class KRFBPRIVATE_EXPORT FrameBuffer : public QObject { Q_OBJECT public: diff --git a/krfb/framebuffermanager.cpp b/krfb/framebuffermanager.cpp index 7527532f..38d80810 100644 --- a/krfb/framebuffermanager.cpp +++ b/krfb/framebuffermanager.cpp @@ -23,7 +23,7 @@ #include "framebufferplugin.h" #include "krfbconfig.h" -#include +#include #include #include @@ -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(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 FrameBufferManager::frameBuffer(WId id) { - kDebug(); + //qDebug(); // See if there is still an existing framebuffer to this WId. if (m_frameBuffers.contains(id)) { QWeakPointer 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 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(iter.value()->frameBuffer(id)); @@ -125,7 +125,7 @@ QSharedPointer 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(); } diff --git a/krfb/framebuffermanager.h b/krfb/framebuffermanager.h index d018c6aa..6a1e86bd 100644 --- a/krfb/framebuffermanager.h +++ b/krfb/framebuffermanager.h @@ -23,19 +23,19 @@ #include "framebuffer.h" -#include +#include "krfbprivate_export.h" #include #include #include #include -#include +#include class FrameBufferPlugin; class KPluginFactory; -class KDE_EXPORT FrameBufferManager : public QObject +class KRFBPRIVATE_EXPORT FrameBufferManager : public QObject { Q_OBJECT friend class FrameBufferManagerStatic; diff --git a/krfb/framebufferplugin.h b/krfb/framebufferplugin.h index 11ab081e..ff239fba 100644 --- a/krfb/framebufferplugin.h +++ b/krfb/framebufferplugin.h @@ -21,15 +21,15 @@ #ifndef LIB_KRFB_FRAMEBUFFERPLUGIN_H #define LIB_KRFB_FRAMEBUFFERPLUGIN_H -#include +#include "krfbprivate_export.h" #include +#include -#include class FrameBuffer; -class KDE_EXPORT FrameBufferPlugin : public QObject +class KRFBPRIVATE_EXPORT FrameBufferPlugin : public QObject { Q_OBJECT diff --git a/krfb/invitationsrfbclient.cpp b/krfb/invitationsrfbclient.cpp index 588763b6..caade958 100644 --- a/krfb/invitationsrfbclient.cpp +++ b/krfb/invitationsrfbclient.cpp @@ -26,6 +26,8 @@ #include "connectiondialog.h" #include #include +#include + #include #include @@ -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(), diff --git a/krfb/invitationsrfbserver.cpp b/krfb/invitationsrfbserver.cpp index 386fed57..f30f9a93 100644 --- a/krfb/invitationsrfbserver.cpp +++ b/krfb/invitationsrfbserver.cpp @@ -23,16 +23,18 @@ #include "krfbconfig.h" #include "rfbservermanager.h" #include -#include +#include #include -#include +#include + #include -#include #include #include #include #include -#include +#include + +#include 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"); diff --git a/krfb/invitationsrfbserver.h b/krfb/invitationsrfbserver.h index bba830a4..7dba9271 100644 --- a/krfb/invitationsrfbserver.h +++ b/krfb/invitationsrfbserver.h @@ -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; diff --git a/krfb/main.cpp b/krfb/main.cpp index eb9952cc..c5cbb3e6 100644 --- a/krfb/main.cpp +++ b/krfb/main.cpp @@ -19,18 +19,16 @@ #include "trayicon.h" #include "invitationsrfbserver.h" -#include -#include -#include +#include #include #include -#include +#include #include #include -#include -#include -#include +#include +#include +#include #ifdef KRFB_WITH_TELEPATHY_TUBES # include "tubesrfbserver.h" @@ -39,6 +37,7 @@ #include #include +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" diff --git a/krfb/mainwindow.cpp b/krfb/mainwindow.cpp index 55dc2af8..27daaa6f 100644 --- a/krfb/mainwindow.cpp +++ b/krfb/mainwindow.cpp @@ -18,16 +18,13 @@ #include #include #include -#include -#include -#include #include #include #include #include -#include -#include +#include +#include #include #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(); } diff --git a/krfb/rfbclient.cpp b/krfb/rfbclient.cpp index dc002d41..aaccb8d2 100644 --- a/krfb/rfbclient.cpp +++ b/krfb/rfbclient.cpp @@ -23,8 +23,7 @@ #include "sockethelpers.h" #include "events.h" #include -#include -#include +#include #include #include //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; diff --git a/krfb/rfbserver.cpp b/krfb/rfbserver.cpp index f8d0b456..dab3384c 100644 --- a/krfb/rfbserver.cpp +++ b/krfb/rfbserver.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include 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(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(cl->clientData); RfbServerManager::instance()->removeClient(client); diff --git a/krfb/rfbservermanager.cpp b/krfb/rfbservermanager.cpp index 6447b96d..c48cad08 100644 --- a/krfb/rfbservermanager.cpp +++ b/krfb/rfbservermanager.cpp @@ -25,11 +25,11 @@ #include "sockethelpers.h" #include "krfbconfig.h" #include -#include -#include +#include +#include #include #include -#include +#include #include #include #include @@ -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 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(); } diff --git a/krfb/trayicon.cpp b/krfb/trayicon.cpp index eb6df8a4..d0df5270 100644 --- a/krfb/trayicon.cpp +++ b/krfb/trayicon.cpp @@ -26,32 +26,32 @@ #include #include #include +#include #include -#include +#include #include -#include - +#include 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" diff --git a/krfb/trayicon.h b/krfb/trayicon.h index 499893d3..fbcca505 100644 --- a/krfb/trayicon.h +++ b/krfb/trayicon.h @@ -19,7 +19,6 @@ #define TRAYICON_H #include -#include class KDialog; class RfbClient; @@ -42,7 +41,7 @@ public Q_SLOTS: void showAbout(); private: - KAction *m_aboutAction; + QAction *m_aboutAction; QHash m_clientActions; }; diff --git a/krfb/tubesrfbserver.cpp b/krfb/tubesrfbserver.cpp index d99ae49b..e765c28f 100644 --- a/krfb/tubesrfbserver.cpp +++ b/krfb/tubesrfbserver.cpp @@ -20,7 +20,7 @@ #include "tubesrfbclient.h" #include "sockethelpers.h" -#include +#include #include #include @@ -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]); }