From 107220694fe3387df4051dcd94ae6c9995cb45f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sat, 18 Oct 2014 14:19:37 +0200 Subject: [PATCH] Allow contitional build with tdehwlib MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- ConfigureChecks.cmake | 18 +++++++++ drkonqi/backtrace.cpp | 4 ++ kcontrol/CMakeLists.txt | 2 +- kcontrol/displayconfig/displayconfig.cpp | 4 ++ kcontrol/displayconfig/displayconfig.h | 4 ++ kcontrol/randr/tderandrtray.cpp | 4 ++ kcontrol/randr/tderandrtray.h | 4 ++ kicker/kicker/ui/k_new_mnu.cpp | 20 ++++++---- ksmserver/server.cpp | 4 ++ ksmserver/server.h | 4 ++ ksmserver/shutdown.cpp | 4 ++ ksmserver/shutdowndlg.cpp | 6 ++- tdeioslave/media/mediamanager/CMakeLists.txt | 37 +++++++------------ .../medianotifier/notificationdialog.cpp | 2 + .../mounthelper/tdeio_media_mounthelper.cpp | 4 ++ tdm/kfrontend/kgapp.cpp | 4 ++ tdm/kfrontend/kgapp.h | 4 ++ 17 files changed, 95 insertions(+), 34 deletions(-) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 1980d3ce0..18e2b5014 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -78,6 +78,24 @@ if( WITH_HAL ) endif( ) +# tdehwlib (drkonqi, kcontrol, kicker, ksmserver, tdeioslaves, tdm) +if( WITH_TDEHWLIB ) + tde_save_and_set( CMAKE_REQUIRED_INCLUDES "${TDE_INCLUDE_DIR}" ) + check_cxx_source_compiles( " + #include + #ifndef __TDE_HAVE_TDEHWLIB + #error tdecore is not build with tdehwlib + #endif + int main() { return 0; } " + HAVE_TDEHWLIB + ) + tde_restore( CMAKE_REQUIRED_INCLUDES ) + if( NOT HAVE_TDEHWLIB ) + tde_message_fatal( "tdehwlib is required, but not built in tdecore" ) + endif( NOT HAVE_TDEHWLIB ) +endif( ) + + # udev (tsak) if( BUILD_TSAK ) pkg_search_module( UDEV udev ) diff --git a/drkonqi/backtrace.cpp b/drkonqi/backtrace.cpp index 2acd74df5..70bb35fa7 100644 --- a/drkonqi/backtrace.cpp +++ b/drkonqi/backtrace.cpp @@ -36,7 +36,9 @@ #include #include #include +#ifdef __TDE_HAVE_TDEHWLIB #include +#endif #ifdef HAVE_ELFICON // Elven things @@ -356,6 +358,7 @@ void BackTrace::processBacktrace() } #endif // HAVE_ELFICON +#ifdef __TDE_HAVE_TDEHWLIB // Append potentially important hardware information m_strBt.append("\n==== (tdehwlib) hardware information ====\n"); TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); @@ -374,6 +377,7 @@ void BackTrace::processBacktrace() m_strBt.append("\n"); } } +#endif { // Clean up hard to read debug blocks diff --git a/kcontrol/CMakeLists.txt b/kcontrol/CMakeLists.txt index ffd8e8346..d45828d10 100644 --- a/kcontrol/CMakeLists.txt +++ b/kcontrol/CMakeLists.txt @@ -64,9 +64,9 @@ if( BUILD_KCONTROL ) add_subdirectory( kthememanager ) add_subdirectory( tdefontinst ) add_subdirectory( access ) - add_subdirectory( hwmanager ) tde_conditional_add_subdirectory( WITH_XRANDR displayconfig ) + tde_conditional_add_subdirectory( WITH_TDEHWLIB hwmanager ) tde_conditional_add_subdirectory( WITH_SAMBA samba ) tde_conditional_add_subdirectory( WITH_XRANDR randr ) tde_conditional_add_subdirectory( WITH_LIBRAW1394 view1394 ) diff --git a/kcontrol/displayconfig/displayconfig.cpp b/kcontrol/displayconfig/displayconfig.cpp index db371fc42..d326740b7 100644 --- a/kcontrol/displayconfig/displayconfig.cpp +++ b/kcontrol/displayconfig/displayconfig.cpp @@ -742,8 +742,10 @@ void KDisplayConfig::setRealResolutionSliderValue(int index) { KDisplayConfig::KDisplayConfig(TQWidget *parent, const char *name, const TQStringList &) : TDECModule(KDisplayCFactory::instance(), parent, name), iccTab(0), numberOfProfiles(0), numberOfScreens(0), m_randrsimple(0), activeProfileName(""), m_gammaApplyTimer(0) { +#ifdef __TDE_HAVE_TDEHWLIB TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); connect(hwdevices, TQT_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQT_SLOT(deviceChanged(TDEGenericDevice*))); +#endif m_randrsimple = new KRandrSimpleAPI(); @@ -859,6 +861,7 @@ KDisplayConfig::~KDisplayConfig() } void KDisplayConfig::deviceChanged (TDEGenericDevice* device) { +#ifdef __TDE_HAVE_TDEHWLIB if (device->type() == TDEGenericDeviceType::Monitor) { if (base->rescanHardware->isEnabled()) { base->rescanHardware->setEnabled(false); @@ -866,6 +869,7 @@ void KDisplayConfig::deviceChanged (TDEGenericDevice* device) { base->rescanHardware->setEnabled(true); } } +#endif } void KDisplayConfig::updateExtendedMonitorInformation () { diff --git a/kcontrol/displayconfig/displayconfig.h b/kcontrol/displayconfig/displayconfig.h index a52ebb3fc..92fa1f421 100644 --- a/kcontrol/displayconfig/displayconfig.h +++ b/kcontrol/displayconfig/displayconfig.h @@ -35,7 +35,11 @@ #include #include +#ifdef __TDE_HAVE_TDEHWLIB #include +#else +#define TDEGenericDevice void +#endif #include "monitorworkspace.h" #include "displayconfigbase.h" diff --git a/kcontrol/randr/tderandrtray.cpp b/kcontrol/randr/tderandrtray.cpp index d6a711db7..a443c3781 100644 --- a/kcontrol/randr/tderandrtray.cpp +++ b/kcontrol/randr/tderandrtray.cpp @@ -92,8 +92,10 @@ KRandRSystemTray::KRandRSystemTray(TQWidget* parent, const char *name) applyIccConfiguration(cur_profile, NULL); } +#ifdef __TDE_HAVE_TDEHWLIB TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); connect(hwdevices, TQT_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQT_SLOT(deviceChanged(TDEGenericDevice*))); +#endif } /*! @@ -886,6 +888,7 @@ void KRandRSystemTray::slotOutputChanged(int parameter) } void KRandRSystemTray::deviceChanged (TDEGenericDevice* device) { +#ifdef __TDE_HAVE_TDEHWLIB if (device->type() == TDEGenericDeviceType::Monitor) { KRandrPassivePopup::message( i18n("New display output options are available!"), @@ -895,6 +898,7 @@ void KRandRSystemTray::deviceChanged (TDEGenericDevice* device) { reloadDisplayConfiguration(); applyHotplugRules(locateLocal("config", "/", true)); } +#endif } void KRandRSystemTray::slotHelpContents() diff --git a/kcontrol/randr/tderandrtray.h b/kcontrol/randr/tderandrtray.h index 09a1b2671..8f382922f 100644 --- a/kcontrol/randr/tderandrtray.h +++ b/kcontrol/randr/tderandrtray.h @@ -25,7 +25,11 @@ #include #include +#ifdef __TDE_HAVE_TDEHWLIB #include +#else +#define TDEGenericDevice void +#endif class KHelpMenu; class TDEPopupMenu; diff --git a/kicker/kicker/ui/k_new_mnu.cpp b/kicker/kicker/ui/k_new_mnu.cpp index 70efdea79..a5641168f 100644 --- a/kicker/kicker/ui/k_new_mnu.cpp +++ b/kicker/kicker/ui/k_new_mnu.cpp @@ -52,7 +52,9 @@ #include #include #include +#ifdef __TDE_HAVE_TDEHWLIB #include +#endif #include #include #include @@ -1365,10 +1367,10 @@ void KMenu::insertStaticExitItems() } bool maysd = false; -#ifdef COMPILE_HALBACKEND +#if defined(COMPILE_HALBACKEND) if (ksmserver.readBoolEntry( "offerShutdown", true ) && DM().canShutdown()) maysd = true; -#else +#elif defined(__TDE_HAVE_TDEHWLIB) TDERootSystemDevice* rootDevice = TDEGlobal::hardwareDevices()->rootSystemDevice(); if( rootDevice ) { maysd = rootDevice->canPowerOff(); @@ -3798,7 +3800,7 @@ void KMenu::insertSuspendOption( int &nId, int &index ) bool suspend_freeze = false; bool standby = false; bool suspend_disk = false; -#ifdef COMPILE_HALBACKEND +#if defined(COMPILE_HALBACKEND) suspend_ram = libhal_device_get_property_bool(m_halCtx, "/org/freedesktop/Hal/devices/computer", "power_management.can_suspend", @@ -3813,7 +3815,7 @@ void KMenu::insertSuspendOption( int &nId, int &index ) "/org/freedesktop/Hal/devices/computer", "power_management.can_hibernate", NULL); -#else // COMPILE_HALBACKEND +#elif defined(__TDE_HAVE_TDEHWLIB) // COMPILE_HALBACKEND TDERootSystemDevice* rootDevice = TDEGlobal::hardwareDevices()->rootSystemDevice(); if (rootDevice) { suspend_ram = rootDevice->canSuspend(); @@ -3874,7 +3876,7 @@ void KMenu::slotSuspend(int id) DCOPRef("kdesktop", "KScreensaverIface").call("lock()"); } -#ifdef COMPILE_HALBACKEND +#if defined(COMPILE_HALBACKEND) DBusMessage* msg = NULL; if (m_dbusConn) { @@ -3907,7 +3909,7 @@ void KMenu::slotSuspend(int id) } dbus_message_unref(msg); } -#else // COMPILE_HALBACKEND +#elif defined(__TDE_HAVE_TDEHWLIB) // COMPILE_HALBACKEND TDERootSystemDevice* rootDevice = TDEGlobal::hardwareDevices()->rootSystemDevice(); if (rootDevice) { if (id == 1) { @@ -3922,10 +3924,12 @@ void KMenu::slotSuspend(int id) return; } } +#else + error = false; #endif - if (error) + if (error) { KMessageBox::error(this, i18n("Suspend failed")); - + } } void KMenu::runUserCommand() diff --git a/ksmserver/server.cpp b/ksmserver/server.cpp index 257d5f20c..c9a037397 100644 --- a/ksmserver/server.cpp +++ b/ksmserver/server.cpp @@ -598,7 +598,9 @@ KSMServer::KSMServer( const TQString& windowManager, const TQString& windowManag clientInteracting = 0; xonCommand = config->readEntry( "xonCommand", "xon" ); +#ifdef __TDE_HAVE_TDEHWLIB hwDevices = TDEGlobal::hardwareDevices(); +#endif connect( &knotifyTimeoutTimer, TQT_SIGNAL( timeout()), TQT_SLOT( knotifyTimeout())); connect( &startupSuspendTimeoutTimer, TQT_SIGNAL( timeout()), TQT_SLOT( startupSuspendTimeout())); @@ -720,6 +722,7 @@ void KSMServer::cleanUp() DM().shutdown( shutdownType, shutdownMode, bootOption ); } else { +#ifdef __TDE_HAVE_TDEHWLIB TDERootSystemDevice* rootDevice = hwDevices->rootSystemDevice(); if (rootDevice) { if (shutdownType == TDEApplication::ShutdownTypeHalt) { @@ -729,6 +732,7 @@ void KSMServer::cleanUp() rootDevice->setPowerState(TDESystemPowerState::Reboot); } } +#endif } } diff --git a/ksmserver/server.h b/ksmserver/server.h index f5e0d37c6..bc677752c 100644 --- a/ksmserver/server.h +++ b/ksmserver/server.h @@ -23,7 +23,9 @@ Copyright (C) 2000 Matthias Ettrich #include #include +#ifdef __TDE_HAVE_TDEHWLIB #include +#endif #include "server2.h" @@ -251,7 +253,9 @@ private: WindowMap legacyWindows; +#ifdef __TDE_HAVE_TDEHWLIB TDEHardwareDevices* hwDevices; +#endif int initialClientCount; int phase2ClientCount; int protectionTimerCounter; diff --git a/ksmserver/shutdown.cpp b/ksmserver/shutdown.cpp index d7eaafb0e..a40bffc3b 100644 --- a/ksmserver/shutdown.cpp +++ b/ksmserver/shutdown.cpp @@ -152,6 +152,7 @@ bool KSMServer::checkStatus( bool &logoutConfirmed, bool &maysd, bool &mayrb, mayrb = true; } else { +#ifdef __TDE_HAVE_TDEHWLIB TDERootSystemDevice* rootDevice = hwDevices->rootSystemDevice(); if (rootDevice) { if (rootDevice->canPowerOff()) { @@ -161,6 +162,7 @@ bool KSMServer::checkStatus( bool &logoutConfirmed, bool &maysd, bool &mayrb, mayrb = true; } } +#endif } } if (!maysd) { @@ -239,6 +241,7 @@ void KSMServer::shutdownInternal( TDEApplication::ShutdownConfirm confirm, // If this is not done the desktop of the locked session will be shown after suspend/hibernate until the lock fully engages! kapp->dcopClient()->call("kdesktop", "KScreensaverIface", "lock()", TQCString(""), replyType, replyData); } +#ifdef __TDE_HAVE_TDEHWLIB TDERootSystemDevice* rootDevice = hwDevices->rootSystemDevice(); if (rootDevice) { if (selection == 1) { // Suspend @@ -251,6 +254,7 @@ void KSMServer::shutdownInternal( TDEApplication::ShutdownConfirm confirm, rootDevice->setPowerState(TDESystemPowerState::Freeze); } } +#endif } } diff --git a/ksmserver/shutdowndlg.cpp b/ksmserver/shutdowndlg.cpp index 6b3b02428..d4881ad85 100644 --- a/ksmserver/shutdowndlg.cpp +++ b/ksmserver/shutdowndlg.cpp @@ -33,7 +33,9 @@ Copyright (C) 2000 Matthias Ettrich #include #include #include +#ifdef __TDE_HAVE_TDEHWLIB #include +#endif #include #include #include @@ -805,7 +807,7 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, bool canSuspend = false; bool canHibernate = false; -#ifdef COMPILE_HALBACKEND +#if defined(COMPILE_HALBACKEND) // Query HAL for suspend/resume support m_halCtx = libhal_ctx_new(); @@ -860,7 +862,7 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent, canHibernate = true; } } -#else // COMPILE_HALBACKEND +#elif defined(__TDE_HAVE_TDEHWLIB) // COMPILE_HALBACKEND TDERootSystemDevice* rootDevice = TDEGlobal::hardwareDevices()->rootSystemDevice(); if (rootDevice) { canFreeze = rootDevice->canFreeze(); diff --git a/tdeioslave/media/mediamanager/CMakeLists.txt b/tdeioslave/media/mediamanager/CMakeLists.txt index 5a73f3708..21faaeaf7 100644 --- a/tdeioslave/media/mediamanager/CMakeLists.txt +++ b/tdeioslave/media/mediamanager/CMakeLists.txt @@ -36,30 +36,21 @@ install( FILES mediamanager.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded ) set( target kded_mediamanager ) if( WITH_HAL ) - set( ${target}_SRCS - mediamanager.cpp mediamanager.skel medialist.cpp - backendbase.cpp fstabbackend.cpp removablebackend.cpp - mediadirnotify.cpp mediadirnotify.skel - decryptdialog.ui dialog.cpp - halbackend.cpp linuxcdpolling.cpp tdehardwarebackend.cpp - ) + set( HAL_MEDIA_BACKEND halbackend.cpp linuxcdpolling.cpp ) + set( HAL_MEDIA_LIBRARIES ${HAL_LIBRARIES} -lhal-storage ${DBUS_TQT_LIBRARIES} ) +endif( ) - tde_add_kpart( ${target} AUTOMOC - SOURCES ${${target}_SRCS} - LINK mediacommon-static tdeinit_kded-shared ${HAL_LIBRARIES} -lhal-storage ${DBUS_TQT_LIBRARIES} - DESTINATION ${PLUGIN_INSTALL_DIR} - ) -else( ) - set( ${target}_SRCS +if( WITH_TDEHWLIB ) + set( TDEHWBACKEND tdehardwarebackend.cpp ) +endif( WITH_TDEHWLIB ) + +tde_add_kpart( ${target} AUTOMOC + SOURCES mediamanager.cpp mediamanager.skel medialist.cpp backendbase.cpp fstabbackend.cpp removablebackend.cpp decryptdialog.ui dialog.cpp - mediadirnotify.cpp mediadirnotify.skel tdehardwarebackend.cpp - ) - - tde_add_kpart( ${target} AUTOMOC - SOURCES ${${target}_SRCS} - LINK mediacommon-static tdeinit_kded-shared - DESTINATION ${PLUGIN_INSTALL_DIR} - ) -endif( ) + mediadirnotify.cpp mediadirnotify.skel + ${HAL_MEDIA_BACKEND} ${TDEHWBACKEND} + LINK mediacommon-static tdeinit_kded-shared ${HAL_MEDIA_LIBRARIES} + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tdeioslave/media/medianotifier/notificationdialog.cpp b/tdeioslave/media/medianotifier/notificationdialog.cpp index c9a920f99..7e4004e8c 100644 --- a/tdeioslave/media/medianotifier/notificationdialog.cpp +++ b/tdeioslave/media/medianotifier/notificationdialog.cpp @@ -28,7 +28,9 @@ #include #include #include +#ifdef __TDE_HAVE_TDEHWLIB #include +#endif #include "actionlistboxitem.h" #include "notificationdialogview.h" diff --git a/tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp b/tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp index 5357bc68d..3f0319f9f 100644 --- a/tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp +++ b/tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp @@ -33,7 +33,9 @@ #include #include #include +#ifdef __TDE_HAVE_TDEHWLIB #include +#endif #include "dialog.h" #include "tdeio_media_mounthelper.h" @@ -187,6 +189,7 @@ MountHelper::MountHelper() : TDEApplication() void MountHelper::invokeEject(const TQString &device, bool quiet) { +#ifdef __TDE_HAVE_TDEHWLIB // Try TDE HW library eject first... TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); TDEGenericDevice *hwdevice = hwdevices->findByDeviceNode(device); @@ -197,6 +200,7 @@ void MountHelper::invokeEject(const TQString &device, bool quiet) ::exit(0); } } +#endif // Then fall back to tdeeject if needed TDEProcess *proc = new TDEProcess(TQT_TQOBJECT(this)); diff --git a/tdm/kfrontend/kgapp.cpp b/tdm/kfrontend/kgapp.cpp index f172521bc..2d630485e 100644 --- a/tdm/kfrontend/kgapp.cpp +++ b/tdm/kfrontend/kgapp.cpp @@ -123,11 +123,14 @@ void GreeterApp::init() startTimer( pingInterval * 60000 ); } +#ifdef __TDE_HAVE_TDEHWLIB TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); connect(hwdevices, TQT_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQT_SLOT(deviceChanged(TDEGenericDevice*))); +#endif } void GreeterApp::deviceChanged(TDEGenericDevice* device) { +#ifdef __TDE_HAVE_TDEHWLIB #ifdef WITH_XRANDR if (device->type() == TDEGenericDeviceType::Monitor) { KRandrSimpleAPI *randrsimple = new KRandrSimpleAPI(); @@ -135,6 +138,7 @@ void GreeterApp::deviceChanged(TDEGenericDevice* device) { delete randrsimple; } #endif // WITH_XRANDR +#endif // __TDE_HAVE_TDEHWLIB } void diff --git a/tdm/kfrontend/kgapp.h b/tdm/kfrontend/kgapp.h index 6150b4f5d..c9e2802c1 100644 --- a/tdm/kfrontend/kgapp.h +++ b/tdm/kfrontend/kgapp.h @@ -27,7 +27,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define KGAPP_H #include +#ifdef __TDE_HAVE_TDEHWLIB #include +#else +#define TDEGenericDevice void +#endif class GreeterApp : public TDEApplication { Q_OBJECT