Allow contitional build with tdehwlib

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/2/head
Slávek Banko 10 years ago
parent 69da674b30
commit 107220694f

@ -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 <kdemacros.h>
#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 )

@ -36,7 +36,9 @@
#include <tdemessagebox.h>
#include <tdelocale.h>
#include <tdetempfile.h>
#ifdef __TDE_HAVE_TDEHWLIB
#include <tdehardwaredevices.h>
#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

@ -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 )

@ -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 () {

@ -35,7 +35,11 @@
#include <dcopobject.h>
#include <libtderandr/libtderandr.h>
#ifdef __TDE_HAVE_TDEHWLIB
#include <tdehardwaredevices.h>
#else
#define TDEGenericDevice void
#endif
#include "monitorworkspace.h"
#include "displayconfigbase.h"

@ -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()

@ -25,7 +25,11 @@
#include <kglobalaccel.h>
#include <libtderandr/libtderandr.h>
#ifdef __TDE_HAVE_TDEHWLIB
#include <tdehardwaredevices.h>
#else
#define TDEGenericDevice void
#endif
class KHelpMenu;
class TDEPopupMenu;

@ -52,7 +52,9 @@
#include <kdebug.h>
#include <tdeglobal.h>
#include <tdeglobalsettings.h>
#ifdef __TDE_HAVE_TDEHWLIB
#include <tdehardwaredevices.h>
#endif
#include <kiconloader.h>
#include <klineedit.h>
#include <tdelocale.h>
@ -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()

@ -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
}
}

@ -23,7 +23,9 @@ Copyright (C) 2000 Matthias Ettrich <ettrich@kde.org>
#include <tqtimer.h>
#include <dcopobject.h>
#ifdef __TDE_HAVE_TDEHWLIB
#include <tdehardwaredevices.h>
#endif
#include "server2.h"
@ -251,7 +253,9 @@ private:
WindowMap legacyWindows;
#ifdef __TDE_HAVE_TDEHWLIB
TDEHardwareDevices* hwDevices;
#endif
int initialClientCount;
int phase2ClientCount;
int protectionTimerCounter;

@ -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
}
}

@ -33,7 +33,9 @@ Copyright (C) 2000 Matthias Ettrich <ettrich@kde.org>
#include <tdelocale.h>
#include <tdeconfig.h>
#include <tdeapplication.h>
#ifdef __TDE_HAVE_TDEHWLIB
#include <tdehardwaredevices.h>
#endif
#include <kdebug.h>
#include <kpushbutton.h>
#include <kstdguiitem.h>
@ -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();

@ -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}
)

@ -28,7 +28,9 @@
#include <tqlabel.h>
#include <tqcheckbox.h>
#include <tqpushbutton.h>
#ifdef __TDE_HAVE_TDEHWLIB
#include <tdehardwaredevices.h>
#endif
#include "actionlistboxitem.h"
#include "notificationdialogview.h"

@ -33,7 +33,9 @@
#include <kprocess.h>
#include <tdestartupinfo.h>
#include <kmimetype.h>
#ifdef __TDE_HAVE_TDEHWLIB
#include <tdehardwaredevices.h>
#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));

@ -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

@ -27,7 +27,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define KGAPP_H
#include <tdeapplication.h>
#ifdef __TDE_HAVE_TDEHWLIB
#include <tdehardwaredevices.h>
#else
#define TDEGenericDevice void
#endif
class GreeterApp : public TDEApplication {
Q_OBJECT

Loading…
Cancel
Save