[tdebase/ksmserver] added UPower support

pull/2/head
Serghei Amelian 12 years ago
parent 39c1afd3f8
commit b5236f1d75

@ -77,6 +77,7 @@ option( WITH_XINERAMA "Enable xinerama extension support" ${WITH_ALL_OPTIONS} )
option( WITH_ARTS "Enable aRts support" ${WITH_ALL_OPTIONS} )
option( WITH_I8K "Enable Dell laptop support (ksysguard)" ${WITH_ALL_OPTIONS} )
option( WITH_HAL "Enable HAL support" ${WITH_ALL_OPTIONS} )
option( WITH_UPOWER "Enable UPOWER support" ${WITH_ALL_OPTIONS} )
option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} )
@ -205,7 +206,7 @@ tde_conditional_add_subdirectory( BUILD_KSYSGUARD ksysguard )
tde_conditional_add_subdirectory( BUILD_KXKB kxkb )
tde_conditional_add_subdirectory( BUILD_TSAK tsak )
tde_conditional_add_subdirectory( BUILD_KROOTBACKING krootbacking )
tde_conditional_add_subdirectory( BUILD_TQT3INTEGRATION tqt3integration )
tde_conditional_add_subdirectory( BUILD_TQT3INTEGRATION tqt3integration )
##### install starttde & related stuff ##########

@ -1,6 +1,6 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# (C) 2010-2012 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
@ -215,7 +215,7 @@ find_package( TQt )
find_package( TDE )
# dbus-tqt need Qt flags
# dbus (tdm, ksmserver)
if( BUILD_TDM OR BUILD_KSMSERVER )
@ -224,19 +224,33 @@ if( BUILD_TDM OR BUILD_KSMSERVER )
tde_message_fatal( "dbus-1 is required, but was not found on your system" )
endif( )
# check for dbus-tqt
pkg_check_modules( DBUS_TQT REQUIRED dbus-tqt )
tde_save( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
set( CMAKE_REQUIRED_INCLUDES ${DBUS_TQT_INCLUDE_DIRS} ${TQT_INCLUDE_DIRS} ${QT_INCLUDE_DIRS})
set( CMAKE_REQUIRED_LIBRARIES ${DBUS_TQT_LDFLAGS} ${TQT_LDFLAGS} ${QT_LDFLAGS} )
check_cxx_source_compiles("
#include <tqt.h>
#include <dbus/connection.h>
int main(int, char**) { return 0; } "
HAVE_DBUS_QT3_07 )
tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
if( NOT HAVE_DBUS_QT3_07 )
tde_message_fatal( "dbus-tqt is required, but was not found on your system" )
endif( )
# tqt-dbus (tdm, ksmserver)
if( BUILD_TDM OR BUILD_KSMSERVER )
if( BUILD_KSMSERVER AND WITH_UPOWER )
pkg_check_modules( DBUS_1_TQT dbus-1-tqt )
if( NOT DBUS_1_TQT_FOUND )
tde_message_fatal( "dbus-tqt-1 is required, but was not found on your system" )
endif( )
else( )
# check for dbus-tqt
# dbus-tqt need Qt flags
pkg_check_modules( DBUS_TQT REQUIRED dbus-tqt )
tde_save( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
set( CMAKE_REQUIRED_INCLUDES ${DBUS_TQT_INCLUDE_DIRS} ${TQT_INCLUDE_DIRS} ${QT_INCLUDE_DIRS})
set( CMAKE_REQUIRED_LIBRARIES ${DBUS_TQT_LDFLAGS} ${TQT_LDFLAGS} ${QT_LDFLAGS} )
check_cxx_source_compiles("
#include <tqt.h>
#include <dbus/connection.h>
int main(int, char**) { return 0; } "
HAVE_DBUS_QT3_07 )
tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
if( NOT HAVE_DBUS_QT3_07 )
tde_message_fatal( "dbus-tqt is required, but was not found on your system" )
endif( )
endif( )
endif( )

@ -13,18 +13,24 @@ if( NOT DBUS_SYSTEM_BUS )
set( DBUS_SYSTEM_BUS "unix:path=/var/run/dbus/system_bus_socket" CACHE INTERNAL "" FORCE )
endif()
if( WITH_UPOWER )
add_definitions( -DWITH_UPOWER )
endif( )
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/tdmlib
${TDE_INCLUDE_DIR}
${TQT_INCLUDE_DIRS}
${DBUS_1_TQT_INCLUDE_DIRS}
${DBUS_TQT_INCLUDE_DIRS}
${HAL_INCLUDE_DIRS}
)
link_directories(
${TQT_LIBRARY_DIRS}
${DBUS_1_TQT_LIBRARY_DIRS}
${DBUS_TQT_LIBRARY_DIRS}
)
@ -43,5 +49,5 @@ tde_add_tdeinit_executable( ksmserver AUTOMOC
main.cpp server.cpp shutdowndlg.cpp startupdlg.cpp
legacy.cpp startup.cpp shutdown.cpp client.cpp
KSMServerInterface.skel server.skel timed.ui
LINK dmctl-static tdeui-shared krsync-shared ${HAL_LIBRARIES} ${DBUS_TQT_LIBRARIES}
LINK dmctl-static tdeui-shared krsync-shared ${HAL_LIBRARIES} ${DBUS_1_TQT_LIBRARIES} ${DBUS_TQT_LIBRARIES}
)

File diff suppressed because it is too large Load Diff

@ -1,6 +1,7 @@
/*****************************************************************
ksmserver - the KDE session management server
Copyright (C) 2012 Serghei Amelian <serghei.amelian@gmail.com>
Copyright (C) 2000 Matthias Ettrich <ettrich@kde.org>
******************************************************************/
@ -32,129 +33,138 @@ class KAction;
#include <config.h>
#ifndef NO_QT3_DBUS_SUPPORT
/* We acknowledge the the dbus API is unstable */
#define DBUS_API_SUBJECT_TO_CHANGE
#include <dbus/connection.h>
#endif // NO_QT3_DBUS_SUPPORT
#ifdef COMPILE_HALBACKEND
#include <hal/libhal.h>
#endif
#ifdef WITH_UPOWER
#include <tqdbusconnection.h>
#else
#warning test
#ifndef NO_QT3_DBUS_SUPPORT
/* We acknowledge the the dbus API is unstable */
#define DBUS_API_SUBJECT_TO_CHANGE
#include <dbus/connection.h>
#endif // NO_QT3_DBUS_SUPPORT
#ifdef COMPILE_HALBACKEND
#include <hal/libhal.h>
#endif
#endif // WITH_UPOWER
// The (singleton) widget that makes/fades the desktop gray.
class KSMShutdownFeedback : public TQWidget
{
Q_OBJECT
Q_OBJECT
public:
static void start() { s_pSelf = new KSMShutdownFeedback(); }
static void stop() { if ( s_pSelf != 0L ) s_pSelf->fadeBack(); delete s_pSelf; s_pSelf = 0L; }
static KSMShutdownFeedback * self() { return s_pSelf; }
static void start() { s_pSelf = new KSMShutdownFeedback(); }
static void stop() { if ( s_pSelf != 0L ) s_pSelf->fadeBack(); delete s_pSelf; s_pSelf = 0L; }
static KSMShutdownFeedback * self() { return s_pSelf; }
protected:
~KSMShutdownFeedback() {}
~KSMShutdownFeedback() {}
private slots:
void slotPaintEffect();
void slotPaintEffect();
private:
static KSMShutdownFeedback * s_pSelf;
KSMShutdownFeedback();
int m_currentY;
TQPixmap m_root;
void fadeBack( void );
float m_grayOpacity;
float m_compensation;
bool m_fadeBackwards;
bool m_readDelayComplete;
TQImage m_unfadedImage;
TQImage m_grayImage;
TQTime m_fadeTime;
int m_rowsDone;
KPixmapIO m_pmio;
bool m_greyImageCreated;
static KSMShutdownFeedback * s_pSelf;
KSMShutdownFeedback();
int m_currentY;
TQPixmap m_root;
void fadeBack( void );
float m_grayOpacity;
float m_compensation;
bool m_fadeBackwards;
bool m_readDelayComplete;
TQImage m_unfadedImage;
TQImage m_grayImage;
TQTime m_fadeTime;
int m_rowsDone;
KPixmapIO m_pmio;
bool m_greyImageCreated;
};
// The (singleton) widget that shows either pretty pictures or a black screen during logout
class KSMShutdownIPFeedback : public TQWidget
{
Q_OBJECT
Q_OBJECT
public:
static void start() { s_pSelf = new KSMShutdownIPFeedback(); }
static void showit() { if ( s_pSelf != 0L ) s_pSelf->showNow(); }
static void stop() { if ( s_pSelf != 0L ) s_pSelf->fadeBack(); delete s_pSelf; s_pSelf = 0L; }
static KSMShutdownIPFeedback * self() { return s_pSelf; }
static bool ispainted() { if ( s_pSelf != 0L ) return s_pSelf->m_isPainted; else return false; }
static void start() { s_pSelf = new KSMShutdownIPFeedback(); }
static void showit() { if ( s_pSelf != 0L ) s_pSelf->showNow(); }
static void stop() { if ( s_pSelf != 0L ) s_pSelf->fadeBack(); delete s_pSelf; s_pSelf = 0L; }
static KSMShutdownIPFeedback * self() { return s_pSelf; }
static bool ispainted() { if ( s_pSelf != 0L ) return s_pSelf->m_isPainted; else return false; }
protected:
~KSMShutdownIPFeedback();
~KSMShutdownIPFeedback();
public slots:
void slotPaintEffect();
void slotSetBackgroundPixmap(const TQPixmap &);
void slotPaintEffect();
void slotSetBackgroundPixmap(const TQPixmap &);
private:
static KSMShutdownIPFeedback * s_pSelf;
KSMShutdownIPFeedback();
int m_currentY;
TQPixmap m_root;
void fadeBack( void );
void showNow( void );
int m_timeout;
bool m_isPainted;
KRootPixmap* m_sharedRootPixmap;
TQPixmap m_rootPixmap;
int mPixmapTimeout;
static KSMShutdownIPFeedback * s_pSelf;
KSMShutdownIPFeedback();
int m_currentY;
TQPixmap m_root;
void fadeBack( void );
void showNow( void );
int m_timeout;
bool m_isPainted;
KRootPixmap* m_sharedRootPixmap;
TQPixmap m_rootPixmap;
int mPixmapTimeout;
};
// The confirmation dialog
class KSMShutdownDlg : public TQDialog
{
Q_OBJECT
Q_OBJECT
public:
static bool confirmShutdown( bool maysd, KApplication::ShutdownType& sdtype, TQString& bopt );
static bool confirmShutdown( bool maysd, KApplication::ShutdownType& sdtype, TQString& bopt );
public slots:
void slotLogout();
void slotHalt();
void slotReboot();
void slotReboot(int);
void slotSuspend();
void slotHibernate();
void slotLogout();
void slotHalt();
void slotReboot();
void slotReboot(int);
void slotSuspend();
void slotHibernate();
protected:
~KSMShutdownDlg();
~KSMShutdownDlg();
private:
KSMShutdownDlg( TQWidget* parent, bool maysd, KApplication::ShutdownType sdtype );
KApplication::ShutdownType m_shutdownType;
TQString m_bootOption;
TQPopupMenu *targets;
TQStringList rebootOptions;
KSMShutdownDlg( TQWidget* parent, bool maysd, KApplication::ShutdownType sdtype );
KApplication::ShutdownType m_shutdownType;
TQString m_bootOption;
TQPopupMenu *targets;
TQStringList rebootOptions;
#ifdef WITH_UPOWER
TQT_DBusConnection m_dbusConn;
#else
#ifdef COMPILE_HALBACKEND
LibHalContext* m_halCtx;
DBusConnection *m_dbusConn;
LibHalContext* m_halCtx;
DBusConnection *m_dbusConn;
#endif
bool m_lockOnResume;
#endif // WITH_UPOWER
bool m_lockOnResume;
};
// The shutdown-in-progress dialog
class KSMShutdownIPDlg : public KSMModalDialog
{
Q_OBJECT
Q_OBJECT
public:
static TQWidget* showShutdownIP();
static TQWidget* showShutdownIP();
protected:
~KSMShutdownIPDlg();
~KSMShutdownIPDlg();
private:
KSMShutdownIPDlg( TQWidget* parent );
KSMShutdownIPDlg( TQWidget* parent );
};
class KSMDelayedPushButton : public KPushButton
@ -210,14 +220,14 @@ class FlatButton : public TQToolButton
virtual void keyReleaseEvent(TQKeyEvent*e);
private slots:
private:
void init();
bool m_pressed;
TQString m_text;
TQPixmap m_pixmap;
};
@ -227,18 +237,18 @@ class TQLabel;
class KSMDelayedMessageBox : public TimedLogoutDlg
{
Q_OBJECT
Q_OBJECT
public:
KSMDelayedMessageBox( KApplication::ShutdownType sdtype, const TQString &bootOption, int confirmDelay );
static bool showTicker( KApplication::ShutdownType sdtype, const TQString &bootOption, int confirmDelay );
KSMDelayedMessageBox( KApplication::ShutdownType sdtype, const TQString &bootOption, int confirmDelay );
static bool showTicker( KApplication::ShutdownType sdtype, const TQString &bootOption, int confirmDelay );
protected slots:
void updateText();
void updateText();
private:
TQString m_template;
int m_remaining;
TQString m_template;
int m_remaining;
};
#endif

@ -30,31 +30,20 @@ class KAction;
#include <kapplication.h>
#include <kpixmapio.h>
#include <config.h>
#ifndef NO_QT3_DBUS_SUPPORT
/* We acknowledge the the dbus API is unstable */
#define DBUS_API_SUBJECT_TO_CHANGE
#include <dbus/connection.h>
#endif // NO_QT3_DBUS_SUPPORT
#ifdef COMPILE_HALBACKEND
#include <hal/libhal.h>
#endif
// The startup-in-progress dialog
class KSMStartupIPDlg : public KSMModalDialog
{
Q_OBJECT
Q_OBJECT
public:
static TQWidget* showStartupIP();
static TQWidget* showStartupIP();
protected:
~KSMStartupIPDlg();
~KSMStartupIPDlg();
private:
KSMStartupIPDlg( TQWidget* parent );
KSMStartupIPDlg( TQWidget* parent );
};
#endif

Loading…
Cancel
Save