Make kdeconnect core compile without KDELibs4Support

This meant to add a lot of dependencies to each plugin since we had
KDELibs4support as PUBLIC link meaning that anything linking against
kdeconnectcore was linking at the same time to mostly all frameworks.

Now each plugin has more or less its dependencies in the CMake some
still depend on KDELibs4Support.

For the mousepad plugin I needed to add a fixX11.h file that basically
undefines/defines again some stuff xlib has that conflcits with normal
C++ and Qt.

Before it was not conflicting because some lib within KDELibs4Support
was including this file, but now we have to do it ourselves.
This commit is contained in:
Àlex Fiestas 2014-09-22 02:37:10 +02:00
parent c2f6956d93
commit dbea3171bd
27 changed files with 349 additions and 26 deletions

View file

@ -33,12 +33,16 @@ set(kded_kdeconnect_SRCS
add_library(kdeconnectcore SHARED ${kded_kdeconnect_SRCS})
target_link_libraries(kdeconnectcore
PUBLIC
KF5::KDELibs4Support
Qt5::Network
PRIVATE
${QCA2_LIBRARIES}
Qt5::DBus
Qt5::Gui
KF5::KIOWidgets
KF5::KCMUtils
Qt5::Network
KF5::I18n
KF5::ConfigCore
KF5::Notifications
)
set_target_properties(kdeconnectcore PROPERTIES

View file

@ -31,6 +31,7 @@
#include <KConfig>
#include <KConfigGroup>
#include <KSharedConfig>
#include "core_debug.h"
#include "networkpackage.h"

View file

@ -30,12 +30,9 @@
#include <KSharedConfig>
#include <KConfigGroup>
#include <KPluginSelector>
#include <KServiceTypeTrader>
#include <KNotification>
#include <KLocalizedString>
#include <QIcon>
#include <KGlobal>
#include <KComponentData>
#include "core_debug.h"
#include "kdeconnectplugin.h"

View file

@ -24,12 +24,12 @@
#include <QIODevice>
#include <QTime>
#include <QTemporaryFile>
#include <QSharedPointer>
#include <KJob>
#include <QUrl>
#include <KIO/FileJob>
#include <KIO/Job>
#include <KSharedPtr>
class FileTransferJob
: public KJob

View file

@ -24,9 +24,6 @@
#include <QObject>
#include <QVariantList>
#include <KPluginFactory>
#include <KPluginLoader>
#include "kdeconnectcore_export.h"
#include "networkpackage.h"
#include "device.h"

View file

@ -5,7 +5,7 @@ set(kdeconnect_battery_SRCS
add_library(kdeconnect_battery MODULE ${kdeconnect_battery_SRCS})
target_link_libraries(kdeconnect_battery kdeconnectcore KF5::KDELibs4Support)
target_link_libraries(kdeconnect_battery kdeconnectcore KF5::Service KF5::KDELibs4Support)
install(TARGETS kdeconnect_battery DESTINATION ${PLUGIN_INSTALL_DIR} )
install(FILES kdeconnect_battery.desktop DESTINATION ${SERVICES_INSTALL_DIR} )

View file

@ -23,6 +23,7 @@
#include <KNotification>
#include <QIcon>
#include <KLocalizedString>
#include <KPluginFactory>
#include "batterydbusinterface.h"

View file

@ -4,7 +4,7 @@ set(kdeconnect_clipboard_SRCS
add_library(kdeconnect_clipboard MODULE ${kdeconnect_clipboard_SRCS})
target_link_libraries(kdeconnect_clipboard kdeconnectcore Qt5::Gui)
target_link_libraries(kdeconnect_clipboard kdeconnectcore KF5::Service Qt5::Gui)
install(TARGETS kdeconnect_clipboard DESTINATION ${PLUGIN_INSTALL_DIR} )
install(FILES kdeconnect_clipboard.desktop DESTINATION ${SERVICES_INSTALL_DIR} )

View file

@ -21,7 +21,9 @@
#include "clipboardplugin.h"
#include <QClipboard>
#include <QApplication>
#include <QGuiApplication>
#include <KPluginFactory>
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< ClipboardPlugin >(); )
@ -30,7 +32,7 @@ Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_CLIPBOARD, "kdeconnect.plugin.clipboard")
ClipboardPlugin::ClipboardPlugin(QObject *parent, const QVariantList &args)
: KdeConnectPlugin(parent, args)
, ignore_next_clipboard_change(false)
, clipboard(QApplication::clipboard())
, clipboard(QGuiApplication::clipboard())
{
connect(clipboard, SIGNAL(changed(QClipboard::Mode)), this, SLOT(clipboardChanged(QClipboard::Mode)));
}

View file

@ -9,7 +9,7 @@ kde4_add_plugin(kdeconnect_mousepad ${kdeconnect_mousepad_SRCS})
include_directories(${XTEST_INCLUDE_DIRS} ${X11_INCLUDE_DIR})
target_link_libraries(kdeconnect_mousepad kdeconnectcore ${QT_QTGUI_LIBRARY} ${X11_LIBRARIES} ${XTEST_LIBRARIES})
target_link_libraries(kdeconnect_mousepad KF5::Service kdeconnectcore ${QT_QTGUI_LIBRARY} ${X11_LIBRARIES} ${XTEST_LIBRARIES})
install(TARGETS kdeconnect_mousepad DESTINATION ${PLUGIN_INSTALL_DIR} )
install(FILES kdeconnect_mousepad.desktop DESTINATION ${SERVICES_INSTALL_DIR} )

301
plugins/mousepad/fixx11h.h Normal file
View file

@ -0,0 +1,301 @@
/****************************************************************************
Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
****************************************************************************/
//#ifdef don't do this, this file is supposed to be included
//#define multiple times
#include <QtCore/QtGlobal>
/* Usage:
If you get compile errors caused by X11 includes (the line
where first error appears contains word like None, Unsorted,
Below, etc.), put #include <fixx11h.h> in the .cpp file
(not .h file!) between the place where X11 headers are
included and the place where the file with compile
error is included (or the place where the compile error
in the .cpp file occurs).
This file remaps X11 #defines to const variables or
inline functions. The side effect may be that these
symbols may now refer to different variables
(e.g. if X11 #defined NoButton, after this file
is included NoButton would no longer be X11's
NoButton, but Qt::NoButton instead). At this time,
there's no conflict known that could cause problems.
The original X11 symbols are still accessible
(e.g. for None) as X::None, XNone, and also still
None, unless name lookup finds different None
first (in the current class, etc.)
Use 'Unsorted', 'Bool' and 'index' as templates.
*/
namespace X
{
// template --->
// Affects: Should be without side effects.
#ifdef Unsorted
#ifndef FIXX11H_Unsorted
#define FIXX11H_Unsorted
const int XUnsorted = Unsorted;
#undef Unsorted
const int Unsorted = XUnsorted;
#endif
#undef Unsorted
#endif
// template <---
// Affects: Should be without side effects.
#ifdef None
#ifndef FIXX11H_None
#define FIXX11H_None
const XID XNone = None;
#undef None
const XID None = XNone;
#endif
#undef None
#endif
// template --->
// Affects: Should be without side effects.
#ifdef Bool
#ifndef FIXX11H_Bool
#define FIXX11H_Bool
#ifdef _XTYPEDEF_BOOL /* Xdefs.h has typedef'ed Bool already */
#undef Bool
#else
typedef Bool XBool;
#undef Bool
typedef XBool Bool;
#endif
#endif
#undef Bool
#define _XTYPEDEF_BOOL
#endif
// template <---
// Affects: Should be without side effects.
#ifdef KeyPress
#ifndef FIXX11H_KeyPress
#define FIXX11H_KeyPress
const int XKeyPress = KeyPress;
#undef KeyPress
const int KeyPress = XKeyPress;
#endif
#undef KeyPress
#endif
// Affects: Should be without side effects.
#ifdef KeyRelease
#ifndef FIXX11H_KeyRelease
#define FIXX11H_KeyRelease
const int XKeyRelease = KeyRelease;
#undef KeyRelease
const int KeyRelease = XKeyRelease;
#endif
#undef KeyRelease
#endif
// Affects: Should be without side effects.
#ifdef Above
#ifndef FIXX11H_Above
#define FIXX11H_Above
const int XAbove = Above;
#undef Above
const int Above = XAbove;
#endif
#undef Above
#endif
// Affects: Should be without side effects.
#ifdef Below
#ifndef FIXX11H_Below
#define FIXX11H_Below
const int XBelow = Below;
#undef Below
const int Below = XBelow;
#endif
#undef Below
#endif
// Affects: Should be without side effects.
#ifdef FocusIn
#ifndef FIXX11H_FocusIn
#define FIXX11H_FocusIn
const int XFocusIn = FocusIn;
#undef FocusIn
const int FocusIn = XFocusIn;
#endif
#undef FocusIn
#endif
// Affects: Should be without side effects.
#ifdef FocusOut
#ifndef FIXX11H_FocusOut
#define FIXX11H_FocusOut
const int XFocusOut = FocusOut;
#undef FocusOut
const int FocusOut = XFocusOut;
#endif
#undef FocusOut
#endif
// Affects: Should be without side effects.
#ifdef Always
#ifndef FIXX11H_Always
#define FIXX11H_Always
const int XAlways = Always;
#undef Always
const int Always = XAlways;
#endif
#undef Always
#endif
// Affects: Should be without side effects.
#ifdef Expose
#ifndef FIXX11H_Expose
#define FIXX11H_Expose
const int XExpose = Expose;
#undef Expose
const int Expose = XExpose;
#endif
#undef Expose
#endif
// Affects: Should be without side effects.
#ifdef Success
#ifndef FIXX11H_Success
#define FIXX11H_Success
const int XSuccess = Success;
#undef Success
const int Success = XSuccess;
#endif
#undef Success
#endif
// Affects: Should be without side effects.
#ifdef GrayScale
#ifndef FIXX11H_GrayScale
#define FIXX11H_GrayScale
const int XGrayScale = GrayScale;
#undef GrayScale
const int GrayScale = XGrayScale;
#endif
#undef GrayScale
#endif
// Affects: Should be without side effects.
#ifdef Status
#ifndef FIXX11H_Status
#define FIXX11H_Status
typedef Status XStatus;
#undef Status
typedef XStatus Status;
#endif
#undef Status
#endif
// template --->
// Affects: Should be without side effects.
#ifdef CursorShape
#ifndef FIXX11H_CursorShape
#define FIXX11H_CursorShape
const int XCursorShape = CursorShape;
#undef CursorShape
const int CursorShape = XCursorShape;
#endif
#undef CursorShape
#endif
// template <---
// template --->
// Affects: Should be without side effects.
#ifdef FontChange
#ifndef FIXX11H_FontChange
#define FIXX11H_FontChange
const int XFontChange = FontChange;
#undef FontChange
const int FontChange = XFontChange;
#endif
#undef FontChange
#endif
// template <---
// Affects: Should be without side effects.
#ifdef NormalState
#ifndef FIXX11H_NormalState
#define FIXX11H_NormalState
const int XNormalState = NormalState;
#undef NormalState
const int NormalState = XNormalState;
#endif
#undef NormalState
#endif
// template --->
// Affects: Should be without side effects.
#ifdef index
#ifndef FIXX11H_index
#define FIXX11H_index
inline
const char *Xindex(const char *s, int c)
{
return index(s, c);
}
#undef index
inline
const char *index(const char *s, int c)
{
return Xindex(s, c);
}
#endif
#undef index
#endif
// template <---
#ifdef rindex
// Affects: Should be without side effects.
#ifndef FIXX11H_rindex
#define FIXX11H_rindex
inline
const char *Xrindex(const char *s, int c)
{
return rindex(s, c);
}
#undef rindex
inline
const char *rindex(const char *s, int c)
{
return Xrindex(s, c);
}
#endif
#undef rindex
#endif
}
using namespace X;

View file

@ -19,9 +19,10 @@
*/
#include "mousepadplugin.h"
#include <X11/extensions/XTest.h>
#include <KPluginFactory>
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< MousepadPlugin >(); )
// Source: http://bharathisubramanian.wordpress.com/2010/04/01/x11-fake-mouse-events-generation-using-xtest/

View file

@ -24,6 +24,7 @@
#include <QtGui/QCursor>
#include <core/kdeconnectplugin.h>
#include <X11/Xlib.h>
#include "fixx11h.h"
#define PACKAGE_TYPE_MOUSEPAD QLatin1String("kdeconnect.mousepad")

View file

@ -16,7 +16,7 @@ qt5_add_dbus_interface(
add_library(kdeconnect_mpriscontrol MODULE ${kdeconnect_mpriscontrol_SRCS})
target_link_libraries(kdeconnect_mpriscontrol kdeconnectcore)
target_link_libraries(kdeconnect_mpriscontrol Qt5::DBus KF5::Service kdeconnectcore)
install(TARGETS kdeconnect_mpriscontrol DESTINATION ${PLUGIN_INSTALL_DIR} )
install(FILES kdeconnect_mpriscontrol.desktop DESTINATION ${SERVICES_INSTALL_DIR} )

View file

@ -28,6 +28,8 @@
#include <QDBusReply>
#include <QDBusMessage>
#include <KPluginFactory>
#include <core/device.h>
#include "mprisdbusinterface.h"
#include "propertiesdbusinterface.h"

View file

@ -6,7 +6,7 @@ set(kdeconnect_notifications_SRCS
add_library(kdeconnect_notifications MODULE ${kdeconnect_notifications_SRCS})
target_link_libraries(kdeconnect_notifications kdeconnectcore KF5::KDELibs4Support)
target_link_libraries(kdeconnect_notifications kdeconnectcore KF5::Service KF5::Notifications KF5::KDELibs4Support)
install(TARGETS kdeconnect_notifications DESTINATION ${PLUGIN_INSTALL_DIR} )
install(FILES kdeconnect_notifications.desktop DESTINATION ${SERVICES_INSTALL_DIR} )

View file

@ -23,6 +23,8 @@
#include "notificationsdbusinterface.h"
#include "notification_debug.h"
#include <KPluginFactory>
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< NotificationsPlugin >(); )
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_NOTIFICATION, "kdeconnect.plugin.notification")

View file

@ -5,6 +5,10 @@ set(kdeconnect_pausemusic_SRCS
add_library(kdeconnect_pausemusic MODULE ${kdeconnect_pausemusic_SRCS})
target_link_libraries(kdeconnect_pausemusic
Qt5::Core
Qt5::DBus
KF5::ConfigCore
KF5::Service
kdeconnectcore
)
@ -20,7 +24,7 @@ ki18n_wrap_ui( kdeconnect_pausemusic_config_SRCS pausemusic_config.ui )
add_library(kdeconnect_pausemusic_config MODULE ${kdeconnect_pausemusic_config_SRCS} )
target_link_libraries( kdeconnect_pausemusic_config
Qt5::Core
KF5::KDELibs4Support
)

View file

@ -28,6 +28,7 @@
#include <KSharedConfig>
#include <KConfigGroup>
#include <KPluginFactory>
#include <core/networkpackage.h>

View file

@ -24,6 +24,7 @@
#include <QIcon>
#include <QDebug>
#include <KLocalizedString>
#include <KPluginFactory>
#include <core/device.h>
#include <QDBusConnection>

View file

@ -6,7 +6,7 @@ set(kdeconnect_sftp_SRCS
add_library(kdeconnect_sftp MODULE ${kdeconnect_sftp_SRCS})
target_link_libraries(kdeconnect_sftp kdeconnectcore)
target_link_libraries(kdeconnect_sftp kdeconnectcore KF5::KDELibs4Support KF5::Service)
install(TARGETS kdeconnect_sftp DESTINATION ${PLUGIN_INSTALL_DIR} )
install(FILES kdeconnect_sftp.desktop DESTINATION ${SERVICES_INSTALL_DIR} )

View file

@ -33,7 +33,7 @@
#include <KRun>
#include <QStandardPaths>
#include <KFilePlacesModel>
#include <kde_file.h>
#include <KPluginFactory>
#include "sftp_config.h"
#include "mounter.h"

View file

@ -5,7 +5,14 @@ set(kdeconnect_share_SRCS
add_library(kdeconnect_share MODULE ${kdeconnect_share_SRCS})
target_link_libraries(kdeconnect_share kdeconnectcore ${KDE4_KFILE_LIBS} KF5::KIOWidgets)
target_link_libraries(kdeconnect_share
kdeconnectcore
Qt5::DBus
KF5::Service
KF5::Notifications
KF5::I18n
KF5::KIOWidgets
)
install(TARGETS kdeconnect_share DESTINATION ${PLUGIN_INSTALL_DIR} )
install(FILES kdeconnect_share.desktop DESTINATION ${SERVICES_INSTALL_DIR} )

View file

@ -21,13 +21,13 @@
#include "shareplugin.h"
#include "share_debug.h"
#include <KGlobalSettings>
#include <QIcon>
#include <KLocalizedString>
#include <QStandardPaths>
#include <KSharedConfig>
#include <KConfigGroup>
#include <KJobTrackerInterface>
#include <KPluginFactory>
#include <qprocess.h>
#include <QDir>

View file

@ -4,7 +4,7 @@ set(kdeconnect_telephony_SRCS
add_library(kdeconnect_telephony MODULE ${kdeconnect_telephony_SRCS})
target_link_libraries(kdeconnect_telephony kdeconnectcore KF5::KDELibs4Support)
target_link_libraries(kdeconnect_telephony kdeconnectcore KF5::Service KF5::KDELibs4Support)
install(TARGETS kdeconnect_telephony DESTINATION ${PLUGIN_INSTALL_DIR} )
install(FILES kdeconnect_telephony.desktop DESTINATION ${SERVICES_INSTALL_DIR} )

View file

@ -24,6 +24,8 @@
#include <QIcon>
#include <QDebug>
#include <KPluginFactory>
K_PLUGIN_FACTORY( KdeConnectPluginFactory, registerPlugin< TelephonyPlugin >(); )
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_TELEPHONY, "kdeconnect.plugin.telephony")

View file

@ -22,10 +22,9 @@
#include "core/networkpackage.h"
#include <qtest_kde.h>
#include <QtTest>
QTEST_KDEMAIN(NetworkPackageTests, NoGUI);
QTEST_GUILESS_MAIN(NetworkPackageTests);
void NetworkPackageTests::initTestCase()
{