Removed HAL dependant code.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/256/head
Michele Calgaro 2 years ago
parent f1df18afb5
commit f9f7aee79e

@ -117,7 +117,6 @@ option( WITH_XINERAMA "Enable xinerama extension support" ${WITH_ALL_OPTIONS} )
option( WITH_ARTS "Enable aRts 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_I8K "Enable Dell laptop support (ksysguard)" ${WITH_ALL_OPTIONS} )
option( WITH_SENSORS "Enable lm_sensors support (ksysguard)" ${WITH_ALL_OPTIONS} ) option( WITH_SENSORS "Enable lm_sensors support (ksysguard)" ${WITH_ALL_OPTIONS} )
option( WITH_HAL "Enable HAL support" OFF )
option( WITH_TDEHWLIB "Enable TDE hardware library support" ${WITH_ALL_OPTIONS} ) option( WITH_TDEHWLIB "Enable TDE hardware library support" ${WITH_ALL_OPTIONS} )
option( WITH_UPOWER "Enable UPOWER support" ${WITH_ALL_OPTIONS} ) option( WITH_UPOWER "Enable UPOWER support" ${WITH_ALL_OPTIONS} )
option( WITH_ELFICON "Enable ELF embedded metadata support" ${WITH_ALL_OPTIONS} ) option( WITH_ELFICON "Enable ELF embedded metadata support" ${WITH_ALL_OPTIONS} )
@ -148,8 +147,7 @@ option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden"
# WITH_ARTS affects libkonq khotkeys # WITH_ARTS affects libkonq khotkeys
# WITH_I8K affects ksysguard # WITH_I8K affects ksysguard
# WITH_SENSORS affects ksysguard # WITH_SENSORS affects ksysguard
# WITH_HAL affects tdeioslaves(media) ksmserver kicker # WITH_TDEHWLIB affects tdeioslaves(media)
# WITH_TDEHWLIB affects tdeioslaves(media), replaces WITH_HAL on systems without HAL
# WITH_LIBRAW1394 affects kcontrol(view1394) # WITH_LIBRAW1394 affects kcontrol(view1394)
# WITH_PAM affects tdm kdesktop kcheckpass # WITH_PAM affects tdm kdesktop kcheckpass
# WITH_SHADOW affects tdm kcheckpass # WITH_SHADOW affects tdm kcheckpass

@ -121,15 +121,6 @@ if( NOT HAVE_CRYPT )
endif( NOT HAVE_CRYPT ) endif( NOT HAVE_CRYPT )
# hal (ksmserver, tdeioslaves)
if( WITH_HAL )
pkg_search_module( HAL hal )
if( NOT HAL_FOUND )
tde_message_fatal( "hal is required, but was not found on your system" )
endif( )
endif( )
# tdehwlib (drkonqi, kcontrol, kicker, ksmserver, tdeioslaves, tdm) # tdehwlib (drkonqi, kcontrol, kicker, ksmserver, tdeioslaves, tdm)
if( WITH_TDEHWLIB ) if( WITH_TDEHWLIB )
tde_save_and_set( CMAKE_REQUIRED_INCLUDES "${TDE_INCLUDE_DIR}" ) tde_save_and_set( CMAKE_REQUIRED_INCLUDES "${TDE_INCLUDE_DIR}" )
@ -458,27 +449,6 @@ if( BUILD_KDESKTOP )
endif( ) endif( )
# dbus-tqt (ksmserver, kicker, tdeioslaves(media))
if( WITH_HAL AND (BUILD_KSMSERVER OR BUILD_KICKER OR BUILD_TDEIOSLAVES) )
# 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} ${TQT_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( )
# check for krb5 # check for krb5
if( WITH_KRB5 ) if( WITH_KRB5 )
pkg_search_module( KRB5 krb5 ) pkg_search_module( KRB5 krb5 )

@ -64,18 +64,9 @@
// drkonqi, tdeioslave // drkonqi, tdeioslave
#cmakedefine HAVE_SYS_TYPES_H 1 #cmakedefine HAVE_SYS_TYPES_H 1
// tdeioslave/media
#cmakedefine WITH_HAL 1
#ifdef WITH_HAL
#define COMPILE_HALBACKEND
#define COMPILE_LINUXCDPOLLING
#endif
// tdeioslave/media // tdeioslave/media
#cmakedefine WITH_TDEHWLIB 1 #cmakedefine WITH_TDEHWLIB 1
#ifdef WITH_TDEHWLIB #ifdef WITH_TDEHWLIB
// forcibly deactivate HAL support and substitute TDE hardware library support
#undef COMPILE_HALBACKEND
#define COMPILE_TDEHARDWAREBACKEND #define COMPILE_TDEHARDWAREBACKEND
#endif #endif

@ -228,16 +228,5 @@ if you want to read without subscribing.</para>
</answer> </answer>
</qandaentry> </qandaentry>
<qandaentry>
<question>
<para>How do the developers propose to transition away from HAL (hardware abstraction layer)?</para>
</question>
<answer>
<para>The Trinity team developed a new native hardware support layer that is under testing.
That new system will be enabled by default in a future release, but is available now
in the development sources.</para>
</answer>
</qandaentry>
</qandaset> </qandaset>
</chapter> </chapter>

@ -19,10 +19,7 @@ it, and much more.</para>
<para>The use of a device is controlled by the operating <para>The use of a device is controlled by the operating
system and it is important your operating system has tools for managing system and it is important your operating system has tools for managing
these devices. &tde; can also auto mount devices, working with these devices. &tde; can also auto mount devices.</para>
<acronym>HAL</acronym> (Hardware Abstraction Layer). Your distribution
should have set up <acronym>HAL</acronym> automatically; if not,
consult the documentation provided by your distribution.</para>
<para>There are several ways to find the list of media devices: use <para>There are several ways to find the list of media devices: use
whichever one suits you best:</para> whichever one suits you best:</para>
@ -89,14 +86,6 @@ configured. To find out if they are running on your system check the
<command>udevd</command>. &tde; does not provide any of these <command>udevd</command>. &tde; does not provide any of these
components. You must check with you distribution.</para> components. You must check with you distribution.</para>
<itemizedlist>
<title>Related Information</title>
<listitem><para><ulink url="http://wiki.kde.org/tiki-index.php?page=DBUS">HOWTO: setting up D-BUS and HAL with TDE's media ioslave
edit</ulink> (A community maintained HOWTO on the &tde; wiki)</para></listitem>
<listitem><para><ulink url="http://www.freedesktop.org/wiki/Software/dbus">The DBus page</ulink></para></listitem>
<listitem><para><ulink url="http://www.freedesktop.org/wiki/Software/hal"></ulink>HAL - Hardware Abstraction Layer</para></listitem>
</itemizedlist>
</sect2> </sect2>
<sect2 id="mounting-removable-disks"> <sect2 id="mounting-removable-disks">

@ -2458,13 +2458,7 @@ static int run_vkbd = -1;
void LockProcess::showVkbd() void LockProcess::showVkbd()
{ {
if( run_vkbd == - 1 ) { if( run_vkbd == - 1 ) {
#ifdef WITH_HAL
int status = system( "hal-find-by-property --key system.formfactor.subtype --string tabletpc" );
// status = 0; // enable for testing
run_vkbd = ( WIFEXITED( status ) && WEXITSTATUS( status ) == 0 && !TDEStandardDirs::findExe( "xvkbd" ).isEmpty()) ? 1 : 0;
#else // WITH_HAL
run_vkbd = (!TDEStandardDirs::findExe( "xvkbd" ).isEmpty()); run_vkbd = (!TDEStandardDirs::findExe( "xvkbd" ).isEmpty());
#endif // WITH_HAL
} }
if( run_vkbd ) { if( run_vkbd ) {
mVkbdWindows.clear(); mVkbdWindows.clear();

@ -20,7 +20,6 @@ include_directories(
${CMAKE_SOURCE_DIR}/kicker/kicker/buttons ${CMAKE_SOURCE_DIR}/kicker/kicker/buttons
${CMAKE_SOURCE_DIR}/tdmlib ${CMAKE_SOURCE_DIR}/tdmlib
${CMAKE_SOURCE_DIR}/libkonq ${CMAKE_SOURCE_DIR}/libkonq
${DBUS_TQT_INCLUDE_DIRS}
${TDE_INCLUDE_DIR} ${TDE_INCLUDE_DIR}
${TQT_INCLUDE_DIRS} ${TQT_INCLUDE_DIRS}
) )
@ -56,5 +55,5 @@ set( ${target}_SRCS
tde_add_library( ${target} STATIC_PIC AUTOMOC tde_add_library( ${target} STATIC_PIC AUTOMOC
SOURCES ${${target}_SRCS} SOURCES ${${target}_SRCS}
DEPENDENCIES kicker_core-static DEPENDENCIES kicker_core-static
LINK dmctl-static kickoffsearch_interfaces-shared ${TDEHW_LIBRARIES} ${DBUS_TQT_LIBRARIES} ${HAL_LIBRARIES} LINK dmctl-static kickoffsearch_interfaces-shared ${TDEHW_LIBRARIES}
) )

@ -116,16 +116,6 @@
#include "config.h" #include "config.h"
#ifdef COMPILE_HALBACKEND
#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
#include <hal/libhal.h>
#endif // COMPILE_HALBACKEND
#ifdef __NetBSD__ #ifdef __NetBSD__
#define statfs statvfs #define statfs statvfs
#endif #endif
@ -447,38 +437,6 @@ KMenu::KMenu()
search_tab_top_left.load( locate("data", "kicker/pics/search-tab-top-left.png" ) ); search_tab_top_left.load( locate("data", "kicker/pics/search-tab-top-left.png" ) );
search_tab_top_right.load( locate("data", "kicker/pics/search-tab-top-right.png" ) ); search_tab_top_right.load( locate("data", "kicker/pics/search-tab-top-right.png" ) );
search_tab_top_center.load( locate("data", "kicker/pics/search-tab-top-center.png" ) ); search_tab_top_center.load( locate("data", "kicker/pics/search-tab-top-center.png" ) );
#ifdef COMPILE_HALBACKEND
m_halCtx = NULL;
m_halCtx = libhal_ctx_new();
DBusError error;
dbus_error_init(&error);
m_dbusConn = dbus_connection_open_private(DBUS_SYSTEM_BUS, &error);
if (!m_dbusConn) {
dbus_error_free(&error);
libhal_ctx_free(m_halCtx);
m_halCtx = NULL;
} else {
dbus_bus_register(m_dbusConn, &error);
if (dbus_error_is_set(&error)) {
dbus_error_free(&error);
libhal_ctx_free(m_halCtx);
m_dbusConn = NULL;
m_halCtx = NULL;
} else {
libhal_ctx_set_dbus_connection(m_halCtx, m_dbusConn);
if (!libhal_ctx_init(m_halCtx, &error)) {
if (dbus_error_is_set(&error)) {
dbus_error_free(&error);
}
libhal_ctx_free(m_halCtx);
m_dbusConn = NULL;
m_halCtx = NULL;
}
}
}
#endif
} }
void KMenu::setupUi() void KMenu::setupUi()
@ -501,15 +459,6 @@ KMenu::~KMenu()
clearSubmenus(); clearSubmenus();
delete m_filterData; delete m_filterData;
#ifdef COMPILE_HALBACKEND
if (m_halCtx) {
DBusError error;
dbus_error_init(&error);
libhal_ctx_shutdown(m_halCtx, &error);
libhal_ctx_free(m_halCtx);
}
#endif
} }
bool KMenu::eventFilter ( TQObject * receiver, TQEvent* e) bool KMenu::eventFilter ( TQObject * receiver, TQEvent* e)
@ -1378,10 +1327,7 @@ void KMenu::insertStaticExitItems()
} }
bool maysd = false; bool maysd = false;
#if defined(COMPILE_HALBACKEND) #if defined(WITH_TDEHWLIB)
if (ksmserver.readBoolEntry( "offerShutdown", true ) && DM().canShutdown())
maysd = true;
#elif defined(WITH_TDEHWLIB)
TDERootSystemDevice* rootDevice = TDEGlobal::hardwareDevices()->rootSystemDevice(); TDERootSystemDevice* rootDevice = TDEGlobal::hardwareDevices()->rootSystemDevice();
if( rootDevice ) { if( rootDevice ) {
maysd = rootDevice->canPowerOff(); maysd = rootDevice->canPowerOff();
@ -3794,27 +3740,7 @@ void KMenu::insertSuspendOption( int &nId, int &index )
bool standby = false; bool standby = false;
bool suspend_disk = false; bool suspend_disk = false;
bool hybrid_suspend = false; bool hybrid_suspend = false;
#if defined(COMPILE_HALBACKEND) #if defined(WITH_TDEHWLIB)
suspend_ram = libhal_device_get_property_bool(m_halCtx,
"/org/freedesktop/Hal/devices/computer",
"power_management.can_suspend",
NULL);
standby = libhal_device_get_property_bool(m_halCtx,
"/org/freedesktop/Hal/devices/computer",
"power_management.can_standby",
NULL);
suspend_disk = libhal_device_get_property_bool(m_halCtx,
"/org/freedesktop/Hal/devices/computer",
"power_management.can_hibernate",
NULL);
hybrid_suspend = libhal_device_get_property_bool(m_halCtx,
"/org/freedesktop/Hal/devices/computer",
"power_management.can_suspend_hybrid",
NULL);
#elif defined(WITH_TDEHWLIB) // COMPILE_HALBACKEND
TDERootSystemDevice* rootDevice = TDEGlobal::hardwareDevices()->rootSystemDevice(); TDERootSystemDevice* rootDevice = TDEGlobal::hardwareDevices()->rootSystemDevice();
if (rootDevice) { if (rootDevice) {
suspend_ram = rootDevice->canSuspend(); suspend_ram = rootDevice->canSuspend();
@ -3886,49 +3812,7 @@ void KMenu::slotSuspend(int id)
DCOPRef("kdesktop", "KScreensaverIface").call("lock()"); DCOPRef("kdesktop", "KScreensaverIface").call("lock()");
} }
#if defined(COMPILE_HALBACKEND) #if defined(WITH_TDEHWLIB)
DBusMessage* msg = NULL;
if (m_dbusConn) {
// No Freeze support in HAL
if (id == SuspendType::Standby) {
msg = dbus_message_new_method_call(
"org.freedesktop.Hal",
"/org/freedesktop/Hal/devices/computer",
"org.freedesktop.Hal.Device.SystemPowerManagement",
"Standby");
} else if (id == SuspendType::Suspend) {
msg = dbus_message_new_method_call(
"org.freedesktop.Hal",
"/org/freedesktop/Hal/devices/computer",
"org.freedesktop.Hal.Device.SystemPowerManagement",
"Suspend");
int wakeup=0;
dbus_message_append_args(msg, DBUS_TYPE_INT32, &wakeup, DBUS_TYPE_INVALID);
} else if (id == SuspendType::Hibernate) {
msg = dbus_message_new_method_call(
"org.freedesktop.Hal",
"/org/freedesktop/Hal/devices/computer",
"org.freedesktop.Hal.Device.SystemPowerManagement",
"Hibernate");
} else if (id == SuspendType::HybridSuspend) {
msg = dbus_message_new_method_call(
"org.freedesktop.Hal",
"/org/freedesktop/Hal/devices/computer",
"org.freedesktop.Hal.Device.SystemPowerManagement",
"SuspendHybrid");
int wakeup=0;
dbus_message_append_args(msg, DBUS_TYPE_INT32, &wakeup, DBUS_TYPE_INVALID);
} else {
return;
}
if(dbus_connection_send(m_dbusConn, msg, NULL)) {
error = false;
}
dbus_message_unref(msg);
}
#elif defined(WITH_TDEHWLIB) // COMPILE_HALBACKEND
TDERootSystemDevice* rootDevice = TDEGlobal::hardwareDevices()->rootSystemDevice(); TDERootSystemDevice* rootDevice = TDEGlobal::hardwareDevices()->rootSystemDevice();
if (rootDevice) { if (rootDevice) {
if (id == SuspendType::Freeze) { if (id == SuspendType::Freeze) {

@ -45,16 +45,6 @@
#include <config.h> #include <config.h>
#ifdef COMPILE_HALBACKEND
#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
#include <hal/libhal.h>
#endif // COMPILE_HALBACKEND
class KickerClientMenu; class KickerClientMenu;
class KickoffTabBar; class KickoffTabBar;
class KBookmarkMenu; class KBookmarkMenu;
@ -347,11 +337,6 @@ private:
void fillOverflowCategory(); void fillOverflowCategory();
TQString insertBreaks(const TQString& text, TQFontMetrics fm, int width, TQString leadInsert = TQString::null); TQString insertBreaks(const TQString& text, TQFontMetrics fm, int width, TQString leadInsert = TQString::null);
#ifdef COMPILE_HALBACKEND
LibHalContext* m_halCtx;
DBusConnection *m_dbusConn;
#endif
}; };
#endif #endif

@ -25,13 +25,10 @@ include_directories(
${CMAKE_SOURCE_DIR}/tdmlib ${CMAKE_SOURCE_DIR}/tdmlib
${TDE_INCLUDE_DIR} ${TDE_INCLUDE_DIR}
${TQT_INCLUDE_DIRS} ${TQT_INCLUDE_DIRS}
${DBUS_TQT_INCLUDE_DIRS}
${HAL_INCLUDE_DIRS}
) )
link_directories( link_directories(
${TQT_LIBRARY_DIRS} ${TQT_LIBRARY_DIRS}
${DBUS_TQT_LIBRARY_DIRS}
) )
@ -50,5 +47,5 @@ tde_add_tdeinit_executable( ksmserver AUTOMOC
main.cpp server.cpp shutdowndlg.cpp startupdlg.cpp main.cpp server.cpp shutdowndlg.cpp startupdlg.cpp
legacy.cpp startup.cpp shutdown.cpp client.cpp legacy.cpp startup.cpp shutdown.cpp client.cpp
KSMServerInterface.skel server.skel timed.ui KSMServerInterface.skel server.skel timed.ui
LINK dmctl-static tdeui-shared tdersync-shared ${TDEHW_LIBRARIES} ${HAL_LIBRARIES} ${DBUS_TQT_LIBRARIES} LINK dmctl-static tdeui-shared tdersync-shared ${TDEHW_LIBRARIES}
) )

@ -17,7 +17,7 @@
SUBDIRS = . SUBDIRS = .
INCLUDES= -I$(top_srcdir)/tdmlib $(all_includes) $(HAL_INCS) $(DBUS_INCS) INCLUDES= -I$(top_srcdir)/tdmlib $(all_includes)
bin_PROGRAMS = bin_PROGRAMS =
lib_LTLIBRARIES = lib_LTLIBRARIES =
@ -31,7 +31,7 @@ ksmserver_la_SOURCES = main.cpp server.cpp shutdowndlg.cpp \
KSMServerInterface.skel server.skel timed.ui KSMServerInterface.skel server.skel timed.ui
ksmserver_la_LDFLAGS = $(all_libraries) -avoid-version -module ksmserver_la_LDFLAGS = $(all_libraries) -avoid-version -module
ksmserver_la_LIBADD = ../tdmlib/libdmctl.la $(LIB_TDEUI) $(HAL_LIBS) $(DBUS_LIBS) ksmserver_la_LIBADD = ../tdmlib/libdmctl.la $(LIB_TDEUI)
picsdir = $(kde_datadir)/ksmserver/pics picsdir = $(kde_datadir)/ksmserver/pics
pics_DATA = shutdownkonq.png pics_DATA = shutdownkonq.png
@ -44,7 +44,7 @@ updatedir = $(kde_datadir)/tdeconf_update
EXTRA_PROGRAMS = testsh EXTRA_PROGRAMS = testsh
testsh_SOURCES = test.cpp timed.ui testsh_SOURCES = test.cpp timed.ui
testsh_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_TQT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor testsh_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_TQT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor
testsh_LDADD = $(LIB_TDEUI) shutdowndlg.lo ../tdmlib/libdmctl.la $(HAL_LIBS) $(DBUS_LIBS) testsh_LDADD = $(LIB_TDEUI) shutdowndlg.lo ../tdmlib/libdmctl.la
messages: messages:
$(XGETTEXT) *.cpp -o $(podir)/ksmserver.pot $(XGETTEXT) *.cpp -o $(podir)/ksmserver.pot

@ -797,10 +797,6 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent,
connect(btnLogout, TQT_SIGNAL(clicked()), TQT_SLOT(slotLogout())); connect(btnLogout, TQT_SIGNAL(clicked()), TQT_SLOT(slotLogout()));
} }
#ifdef COMPILE_HALBACKEND
m_halCtx = NULL;
#endif
if ((maysd) || (mayrb)) { if ((maysd) || (mayrb)) {
// respect lock on resume & disable suspend/hibernate settings // respect lock on resume & disable suspend/hibernate settings
@ -815,70 +811,7 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent,
bool canHibernate = false; bool canHibernate = false;
bool canHybridSuspend = false; bool canHybridSuspend = false;
#if defined(COMPILE_HALBACKEND) #if defined(WITH_TDEHWLIB)
// Query HAL for suspend/resume support
m_halCtx = libhal_ctx_new();
DBusError error;
dbus_error_init(&error);
m_dbusConn = dbus_connection_open_private(DBUS_SYSTEM_BUS, &error);
if (!m_dbusConn)
{
dbus_error_free(&error);
libhal_ctx_free(m_halCtx);
m_halCtx = NULL;
}
else
{
dbus_bus_register(m_dbusConn, &error);
if (dbus_error_is_set(&error))
{
dbus_error_free(&error);
libhal_ctx_free(m_halCtx);
m_dbusConn = NULL;
m_halCtx = NULL;
}
else
{
libhal_ctx_set_dbus_connection(m_halCtx, m_dbusConn);
if (!libhal_ctx_init(m_halCtx, &error))
{
if (dbus_error_is_set(&error))
dbus_error_free(&error);
libhal_ctx_free(m_halCtx);
m_dbusConn = NULL;
m_halCtx = NULL;
}
}
}
if (m_halCtx)
{
if (libhal_device_get_property_bool(m_halCtx,
"/org/freedesktop/Hal/devices/computer",
"power_management.can_suspend",
NULL))
{
canSuspend = true;
}
if (libhal_device_get_property_bool(m_halCtx,
"/org/freedesktop/Hal/devices/computer",
"power_management.can_hibernate",
NULL))
{
canHibernate = true;
}
if (libhal_device_get_property_bool(m_halCtx,
"/org/freedesktop/Hal/devices/computer",
"power_management.can_suspend_hybrid",
NULL))
{
canHybridSuspend = true;
}
}
#elif defined(WITH_TDEHWLIB) // COMPILE_HALBACKEND
TDERootSystemDevice* rootDevice = TDEGlobal::hardwareDevices()->rootSystemDevice(); TDERootSystemDevice* rootDevice = TDEGlobal::hardwareDevices()->rootSystemDevice();
if (rootDevice) { if (rootDevice) {
canFreeze = rootDevice->canFreeze(); canFreeze = rootDevice->canFreeze();
@ -892,7 +825,7 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent,
canHibernate = false; canHibernate = false;
canHybridSuspend = false; canHybridSuspend = false;
} }
#endif // COMPILE_HALBACKEND #endif
if(doUbuntuLogout) { if(doUbuntuLogout) {
// Ubuntu style logout window // Ubuntu style logout window
@ -1175,15 +1108,6 @@ KSMShutdownDlg::KSMShutdownDlg( TQWidget* parent,
KSMShutdownDlg::~KSMShutdownDlg() KSMShutdownDlg::~KSMShutdownDlg()
{ {
#ifdef COMPILE_HALBACKEND
if (m_halCtx)
{
DBusError error;
dbus_error_init(&error);
libhal_ctx_shutdown(m_halCtx, &error);
libhal_ctx_free(m_halCtx);
}
#endif
} }
@ -1220,46 +1144,13 @@ void KSMShutdownDlg::slotHalt()
void KSMShutdownDlg::slotSuspend() void KSMShutdownDlg::slotSuspend()
{ {
#ifndef COMPILE_HALBACKEND
*m_selection = SuspendType::Suspend; *m_selection = SuspendType::Suspend;
#else
if (m_dbusConn)
{
DBusMessage *msg = dbus_message_new_method_call(
"org.freedesktop.Hal",
"/org/freedesktop/Hal/devices/computer",
"org.freedesktop.Hal.Device.SystemPowerManagement",
"Suspend");
int wakeup=0;
dbus_message_append_args(msg, DBUS_TYPE_INT32, &wakeup, DBUS_TYPE_INVALID);
dbus_connection_send(m_dbusConn, msg, NULL);
dbus_message_unref(msg);
}
#endif
reject(); // continue on resume reject(); // continue on resume
} }
void KSMShutdownDlg::slotHibernate() void KSMShutdownDlg::slotHibernate()
{ {
#ifndef COMPILE_HALBACKEND
*m_selection = SuspendType::Hibernate; *m_selection = SuspendType::Hibernate;
#else
if (m_dbusConn)
{
DBusMessage *msg = dbus_message_new_method_call(
"org.freedesktop.Hal",
"/org/freedesktop/Hal/devices/computer",
"org.freedesktop.Hal.Device.SystemPowerManagement",
"Hibernate");
dbus_connection_send(m_dbusConn, msg, NULL);
dbus_message_unref(msg);
}
#endif
reject(); // continue on resume reject(); // continue on resume
} }
@ -1271,22 +1162,7 @@ void KSMShutdownDlg::slotFreeze()
void KSMShutdownDlg::slotHybridSuspend() void KSMShutdownDlg::slotHybridSuspend()
{ {
#ifndef COMPILE_HALBACKEND
*m_selection = SuspendType::HybridSuspend; *m_selection = SuspendType::HybridSuspend;
#else
if (m_dbusConn)
{
DBusMessage *msg = dbus_message_new_method_call(
"org.freedesktop.Hal",
"/org/freedesktop/Hal/devices/computer",
"org.freedesktop.Hal.Device.SystemPowerManagement",
"SuspendHybrid");
dbus_connection_send(m_dbusConn, msg, NULL);
dbus_message_unref(msg);
}
#endif
reject(); // continue on resume reject(); // continue on resume
} }

@ -34,16 +34,6 @@ class TDEAction;
#include <config.h> #include <config.h>
#ifdef COMPILE_HALBACKEND
#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
#include <hal/libhal.h>
#endif // COMPILE_HALBACKEND
namespace SuspendType { namespace SuspendType {
enum SuspendType { enum SuspendType {
NotSpecified = 0, NotSpecified = 0,
@ -159,10 +149,6 @@ private:
TQString m_bootOption; TQString m_bootOption;
TQPopupMenu *targets; TQPopupMenu *targets;
TQStringList rebootOptions; TQStringList rebootOptions;
#ifdef COMPILE_HALBACKEND
LibHalContext* m_halCtx;
DBusConnection *m_dbusConn;
#endif
bool m_lockOnResume; bool m_lockOnResume;
int* m_selection; int* m_selection;
}; };

@ -3,7 +3,7 @@
# A script to perform R14.0.0 XDG compliance updates. # A script to perform R14.0.0 XDG compliance updates.
SCRIPT_NAME="$(basename -- "$0")" SCRIPT_NAME="$(basename -- "$0")"
SCRIPT_VERSION=202103280 SCRIPT_VERSION=202202130
# This script should be needed to run only once, but corner cases # This script should be needed to run only once, but corner cases
# and file/directory permissions could cause incomplete updates. # and file/directory permissions could cause incomplete updates.
@ -824,15 +824,14 @@ if [ "$R14_VERSION" -lt "201401070" ]; then
mv $PROFILE_DIR/share/apps/kstyle $PROFILE_DIR/share/apps/tdestyle 2>/dev/null mv $PROFILE_DIR/share/apps/kstyle $PROFILE_DIR/share/apps/tdestyle 2>/dev/null
fi fi
fi fi
if [ "$R14_VERSION" -lt "201309150" ]; then if [ "$R14_VERSION" -lt "202202130" ]; then
# Copy the following two rc files rather than move because the older versions are needed for HAL systems.
if [ ! -f $PROFILE_DIR/share/config/tdenetworkmanagerrc ] && [ -f $PROFILE_DIR/share/config/knetworkmanagerrc ]; then if [ ! -f $PROFILE_DIR/share/config/tdenetworkmanagerrc ] && [ -f $PROFILE_DIR/share/config/knetworkmanagerrc ]; then
Log " knetworkmanager->tdenetworkmanager" Log " knetworkmanager->tdenetworkmanager"
cp -a $PROFILE_DIR/share/config/knetworkmanagerrc $PROFILE_DIR/share/config/tdenetworkmanagerrc 2>/dev/null mv $PROFILE_DIR/share/config/knetworkmanagerrc $PROFILE_DIR/share/config/tdenetworkmanagerrc 2>/dev/null
fi fi
if [ ! -f $PROFILE_DIR/share/config/tdepowersaverc ] && [ -f $PROFILE_DIR/share/config/kpowersaverc ]; then if [ ! -f $PROFILE_DIR/share/config/tdepowersaverc ] && [ -f $PROFILE_DIR/share/config/kpowersaverc ]; then
Log " kpowersave->tdepowersave" Log " kpowersave->tdepowersave"
cp -a $PROFILE_DIR/share/config/kpowersaverc $PROFILE_DIR/share/config/tdepowersaverc 2>/dev/null mv $PROFILE_DIR/share/config/kpowersaverc $PROFILE_DIR/share/config/tdepowersaverc 2>/dev/null
fi fi
fi fi
if [ "$R14_VERSION" -lt "201401050" ]; then if [ "$R14_VERSION" -lt "201401050" ]; then

@ -1,7 +1,3 @@
if include_media_halbackend
PROPSDLGPLUGINDIR = propsdlgplugin
endif
SUBDIRS = libmediacommon . mediamanager medianotifier mounthelper \ SUBDIRS = libmediacommon . mediamanager medianotifier mounthelper \
tdefile-plugin tdecmodule mimetypes services $(PROPSDLGPLUGINDIR) tdefile-plugin tdecmodule mimetypes services $(PROPSDLGPLUGINDIR)

@ -6,179 +6,3 @@ AC_CHECK_HEADER(linux/cdrom.h,
LINUXCDPOLLING=yes LINUXCDPOLLING=yes
AC_SUBST(LINUXCDPOLLING) AC_SUBST(LINUXCDPOLLING)
]) ])
AC_ARG_WITH(hal,AC_HELP_STRING([--with-hal],[Enable HAL support [default=check]]),[hal_test="$withval"],[hal_test="yes"])
if test "x$hal_test" = "xyes" ; then
########### Check for the HAL
AC_MSG_CHECKING(for the HAL)
hal_inc=NOTFOUND
hal_lib=NOTFOUND
hal=NOTFOUND
search_incs="$kde_includes $kde_extra_includes /usr/include /usr/include/hal /usr/local/include /usr/local/include/hal"
AC_FIND_FILE(libhal.h libhal-storage.h, $search_incs, hal_incdir)
if test -r $hal_incdir/libhal.h && test -r $hal_incdir/libhal-storage.h && grep LibHalVolume $hal_incdir/libhal-storage.h > /dev/null 2>&1; then
HAL_INCS="-I$hal_incdir"
hal_inc=FOUND
fi
search_libs="$kde_libraries $kde_extra_libs /usr/lib$tdelibsuff /usr/local/lib$tdelibsuff"
AC_FIND_FILE(libhal.so libhal-storage.so, $search_libs, hal_libdir)
if test -r $hal_libdir/libhal.so && test -r $hal_libdir/libhal-storage.so ; then
HAL_LIBS="-L$hal_libdir -lhal -lhal-storage"
hal_lib=FOUND
fi
if test "$hal_inc" != FOUND || test "$hal_lib" != FOUND; then
KDE_PKG_CHECK_MODULES( HAL, hal > 0.5, [ HAL_INCS=$HAL_CFLAGS; hal_inc=FOUND; hal_lib=FOUND; ] , AC_MSG_RESULT(Nothing found on PKG_CONFIG_PATH) )
fi
if test "$hal_inc" = FOUND && test "$hal_lib" = FOUND ; then
AC_MSG_RESULT(headers $HAL_INCS libraries $HAL_LIBS)
hal=FOUND
else
AC_MSG_RESULT(searched but not found)
fi
AC_SUBST(HAL_INCS)
AC_SUBST(HAL_LIBS)
########### Check for DBus
AC_MSG_CHECKING(for DBus)
dbus_inc=NOTFOUND
dbus_lib=NOTFOUND
dbus=NOTFOUND
search_incs="$kde_includes $kde_extra_includes /usr/include /usr/include/dbus-1.0 /usr/local/include /usr/local/include/dbus-1.0"
AC_FIND_FILE(dbus/dbus.h, $search_incs, dbus_incdir)
search_incs_arch_deps="$kde_includes $kde_extra_includes /usr/lib$tdelibsuff/dbus-1.0/include /usr/local/lib$tdelibsuff/dbus-1.0/include"
AC_FIND_FILE(dbus/dbus-arch-deps.h, $search_incs_arch_deps, dbus_incdir_arch_deps)
if test -r $dbus_incdir/dbus/dbus.h && test -r $dbus_incdir_arch_deps/dbus/dbus-arch-deps.h ; then
DBUS_INCS="-I$dbus_incdir -I$dbus_incdir_arch_deps"
dbus_inc=FOUND
fi
search_libs="$kde_libraries $kde_extra_libs /usr/lib$tdelibsuff /usr/local/lib$tdelibsuff"
AC_FIND_FILE(libdbus-1.so, $search_libs, dbus_libdir)
if test -r $dbus_libdir/libdbus-1.so ; then
DBUS_LIBS="-L$dbus_libdir -ldbus-1"
dbus_lib=FOUND
fi
if test $dbus_inc != FOUND || test $dbus_lib != FOUND ; then
KDE_PKG_CHECK_MODULES( DBUS, "dbus-1", [ DBUS_INCS=$DBUS_CFLAGS; dbus_inc=FOUND; dbus_lib=FOUND; ] , AC_MSG_RESULT( Nothing found on PKG_CONFIG_PATH ) )
fi
dbus_bus_var=`pkg-config --variable=system_bus_default_address dbus-1 2>/dev/null`
if test -z "$dbus_bus_var"; then
dbus_bus_var="unix:path=/var/run/dbus/system_bus_socket"
fi
AC_DEFINE_UNQUOTED(DBUS_SYSTEM_BUS, "$dbus_bus_var", [Define the unix domain path for dbus system bus])
if test $dbus_inc = FOUND && test $dbus_lib = FOUND ; then
AC_MSG_RESULT(headers $DBUS_INCS libraries $DBUS_LIBS)
dbus=FOUND
else
AC_MSG_RESULT(searched but not found)
fi
AC_SUBST(DBUS_INCS)
AC_SUBST(DBUS_LIBS)
########### Check for DBus-Qt3 bindings
AC_MSG_CHECKING(for DBus-Qt3 bindings)
dbusqt_inc=NOTFOUND
dbusqt_lib=NOTFOUND
dbusqt=NOTFOUND
search_incs="$kde_includes $kde_extra_includes /usr/include /usr/include/dbus-1.0 /usr/local/include /usr/local/include/dbus-1.0"
AC_FIND_FILE(dbus/connection.h, $search_incs, dbusqt_incdir)
if test -r $dbusqt_incdir/dbus/connection.h ; then
have_qt_patch=0
grep dbus_connection_setup_with_qt_main $dbusqt_incdir/dbus/connection.h \
> /dev/null 2>&1 && have_qt_patch=1
if test $have_qt_patch = 1 ; then
DBUSTQT_INCS="-I$dbusqt_incdir"
dbusqt_inc=FOUND
fi
fi
search_libs="$kde_libraries $kde_extra_libs /usr/lib$tdelibsuff /usr/local/lib$tdelibsuff"
AC_FIND_FILE(libdbus-qt-1.so, $search_libs, dbusqt_libdir)
if test -r $dbusqt_libdir/libdbus-qt-1.so ; then
DBUSTQT_LIBS="-L$dbusqt_libdir -ldbus-qt-1"
dbusqt_lib=FOUND
fi
if test $dbusqt_inc != FOUND || test $dbusqt_lib != FOUND ; then
search_incs="`pkg-config --cflags dbus-1 |sed 's/-I//g'`"
AC_FIND_FILE(dbus/connection.h, $search_incs, dbusqt_incdir)
if test -r $dbusqt_incdir/dbus/connection.h ; then
have_qt_patch=0
grep dbus_connection_setup_with_qt_main $dbusqt_incdir/dbus/connection.h \
> /dev/null 2>&1 && have_qt_patch=1
if test $have_qt_patch = 1 ; then
DBUSTQT_INCS="-I$dbusqt_incdir"
dbusqt_inc=FOUND
fi
fi
search_libs="`pkg-config --libs dbus-1 --libs-only-L | sed 's/-L//g'`"
AC_FIND_FILE(libdbus-qt-1.so, $search_libs, dbusqt_libdir)
if test -r $dbusqt_libdir/libdbus-qt-1.so ; then
DBUSTQT_LIBS="-L$dbusqt_libdir -ldbus-qt-1"
dbusqt_lib=FOUND
fi
fi
if test $dbusqt_inc = FOUND && test $dbusqt_lib = FOUND ; then
AC_MSG_RESULT(headers $dbusqt_incdir libraries $dbusqt_libdir)
dbusqt=FOUND
else
AC_MSG_RESULT(searched but not found)
fi
AC_SUBST(DBUSTQT_INCS)
AC_SUBST(DBUSTQT_LIBS)
fi
########### Check if media HAL backend sould be compiled
AC_MSG_CHECKING(if the HAL backend for media:/ should be compiled)
HALBACKEND=no
if test "x$hal" = "xFOUND" && test "x$dbus" = "xFOUND" && test "x$dbusqt" = "xFOUND" ; then
AC_DEFINE_UNQUOTED([COMPILE_HALBACKEND],1, [media HAL backend compilation])
HALBACKEND=yes
AC_SUBST(HALBACKEND)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(include_media_linuxcdpolling, test "$LINUXCDPOLLING" = "yes")
AM_CONDITIONAL(include_media_halbackend, test "$HALBACKEND" = yes)
AC_CHECK_FUNCS(statvfs)

@ -1,11 +1,5 @@
Those scripts are an example on how to allow media:/ to use Those scripts are an example on how to allow media:/ to use
hotplugging events if you don't use HAL. They're targeting hotplugging events.
"Linux 2.6 + hotplug + udev" platforms, but we can surely make
something equivalent for Linux 2.4, FreeBSD...
They are just examples, the packagers will surely develop their
own version (I'm currently using them on Debian Sid, Linux 2.6.9
though).
1) mediamanager_usbstorage.dev 1) mediamanager_usbstorage.dev
This file only needs to be copied to /etc/dev.d/default This file only needs to be copied to /etc/dev.d/default

@ -4,11 +4,6 @@
<kcfg> <kcfg>
<kcfgfile name="mediamanagerrc"/> <kcfgfile name="mediamanagerrc"/>
<group name="Global"> <group name="Global">
<entry name="HalBackendEnabled" type="Bool">
<label>Enable HAL backend</label>
<whatsthis>When HAL (Hardware Abstraction Layer) support is enabled, TDE will use it to gather information on the storage media available in your system.</whatsthis>
<default>true</default>
</entry>
<entry name="TdeHardwareBackendEnabled" type="Bool"> <entry name="TdeHardwareBackendEnabled" type="Bool">
<label>Enable TDE hardware library backend</label> <label>Enable TDE hardware library backend</label>
<whatsthis>When TDE hardware library support is enabled, TDE will use it to gather information on the storage media available in your system.</whatsthis> <whatsthis>When TDE hardware library support is enabled, TDE will use it to gather information on the storage media available in your system.</whatsthis>

@ -230,15 +230,6 @@ bool MediaImpl::ensureMediumMounted(Medium &medium)
return false; return false;
} }
#ifdef COMPILE_HALBACKEND
if ( medium.isEncrypted() && medium.clearDeviceUdi().isEmpty() )
{
m_lastErrorCode = TDEIO::ERR_COULD_NOT_MOUNT;
m_lastErrorMessage = i18n("The drive is encrypted.");
return false;
}
#endif // COMPILE_HALBACKEND
if ( medium.needMounting() ) if ( medium.needMounting() )
{ {
m_lastErrorCode = 0; m_lastErrorCode = 0;

@ -16,13 +16,10 @@ include_directories(
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
${TDE_INCLUDE_DIR} ${TDE_INCLUDE_DIR}
${TQT_INCLUDE_DIRS} ${TQT_INCLUDE_DIRS}
${HAL_INCLUDE_DIRS}
${DBUS_TQT_INCLUDE_DIRS}
) )
link_directories( link_directories(
${TQT_LIBRARY_DIRS} ${TQT_LIBRARY_DIRS}
${DBUS_TQT_LIBRARY_DIRS}
) )
@ -45,11 +42,6 @@ tde_create_translated_desktop(
set( target kded_mediamanager ) set( target kded_mediamanager )
if( WITH_HAL )
set( HAL_MEDIA_BACKEND halbackend.cpp linuxcdpolling.cpp )
set( HAL_MEDIA_LIBRARIES ${HAL_LIBRARIES} -lhal-storage ${DBUS_TQT_LIBRARIES} )
endif( )
if( WITH_TDEHWLIB ) if( WITH_TDEHWLIB )
set( TDEHWBACKEND tdehardwarebackend.cpp ) set( TDEHWBACKEND tdehardwarebackend.cpp )
endif( WITH_TDEHWLIB ) endif( WITH_TDEHWLIB )
@ -60,7 +52,7 @@ tde_add_kpart( ${target} AUTOMOC
backendbase.cpp fstabbackend.cpp removablebackend.cpp backendbase.cpp fstabbackend.cpp removablebackend.cpp
unlockdialog.ui dialog.cpp unlockdialog.ui dialog.cpp
mediadirnotify.cpp mediadirnotify.skel mediadirnotify.cpp mediadirnotify.skel
${HAL_MEDIA_BACKEND} ${TDEHWBACKEND} ${TDEHWBACKEND}
LINK mediacommon-static tdeinit_kded-shared ${TDEHW_LIBRARIES} ${HAL_MEDIA_LIBRARIES} LINK mediacommon-static tdeinit_kded-shared ${TDEHW_LIBRARIES}
DESTINATION ${PLUGIN_INSTALL_DIR} DESTINATION ${PLUGIN_INSTALL_DIR}
) )

@ -1,18 +1,7 @@
kde_module_LTLIBRARIES = kded_mediamanager.la kde_module_LTLIBRARIES = kded_mediamanager.la
if include_media_halbackend
HALBACKEND_INCS = $(HAL_INCS) $(DBUS_INCS) $(DBUSTQT_INCS)
endif
METASOURCES = AUTO METASOURCES = AUTO
INCLUDES = -I$(srcdir)/../libmediacommon -I../libmediacommon $(HALBACKEND_INCS) $(all_includes) INCLUDES = -I$(srcdir)/../libmediacommon -I../libmediacommon $(all_includes)
if include_media_halbackend
HALBACKEND_LIB = libhalbackend.la
libhalbackend_la_SOURCES = halbackend.cpp
libhalbackend_la_LDFLAGS = -avoid-version $(all_libraries) -no-undefined
libhalbackend_la_LIBADD = $(HAL_LIBS) $(DBUS_LIBS) $(DBUSTQT_LIBS)
endif
if include_media_linuxcdpolling if include_media_linuxcdpolling
LINUXCDPOLLING_LIB = liblinuxcdpolling.la LINUXCDPOLLING_LIB = liblinuxcdpolling.la
@ -20,11 +9,11 @@ liblinuxcdpolling_la_SOURCES = linuxcdpolling.cpp
liblinuxcdpolling_la_LDFLAGS = -avoid-version $(all_libraries) -no-undefined liblinuxcdpolling_la_LDFLAGS = -avoid-version $(all_libraries) -no-undefined
endif endif
noinst_LTLIBRARIES = $(LINUXCDPOLLING_LIB) $(HALBACKEND_LIB) noinst_LTLIBRARIES = $(LINUXCDPOLLING_LIB)
kded_mediamanager_la_SOURCES = mediamanager.cpp mediamanager.skel medialist.cpp backendbase.cpp fstabbackend.cpp removablebackend.cpp mediadirnotify.cpp mediadirnotify.skel kded_mediamanager_la_SOURCES = mediamanager.cpp mediamanager.skel medialist.cpp backendbase.cpp fstabbackend.cpp removablebackend.cpp mediadirnotify.cpp mediadirnotify.skel
kded_mediamanager_la_LDFLAGS = $(all_libraries) -module -avoid-version kded_mediamanager_la_LDFLAGS = $(all_libraries) -module -avoid-version
kded_mediamanager_la_LIBADD = $(LIB_TDESYCOCA) ../libmediacommon/libmediacommon.la $(HALBACKEND_LIB) $(LINUXCDPOLLING_LIB) kded_mediamanager_la_LIBADD = $(LIB_TDESYCOCA) ../libmediacommon/libmediacommon.la $(LINUXCDPOLLING_LIB)
servicesdir = $(kde_servicesdir)/kded servicesdir = $(kde_servicesdir)/kded

@ -160,7 +160,6 @@ bool inExclusionPattern(KMountPoint *mount, bool networkSharesOnly)
|| mount->mountPoint().find("/sys") == 0 || mount->mountPoint().find("/sys") == 0
// We might want to display only network shares // We might want to display only network shares
// since HAL doesn't handle them
|| ( networkSharesOnly || ( networkSharesOnly
&& mount->mountType().find( "smb" ) == -1 && mount->mountType().find( "smb" ) == -1
&& mount->mountType().find( "cifs" ) == -1 && mount->mountType().find( "cifs" ) == -1

File diff suppressed because it is too large Load Diff

@ -1,233 +0,0 @@
/* This file is part of the KDE Project
Copyright (c) 2004-2005 Jérôme Lodewyck <jerome dot lodewyck at normalesup dot org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
/**
* This is a media:/ backend for the freedesktop Hardware Abstraction Layer
* Usage : create an instance of HALBackend, then call InitHal(). A false
* result from the later function means that something went wrong and that
* the backend shall not be used.
*
* @author Jérôme Lodewyck <jerome dot lodewyck at normalesup dot org>
* @short media:/ backend for the HAL
*/
#ifndef _HALBACKEND_H_
#define _HALBACKEND_H_
#include "backendbase.h"
#include <tqobject.h>
#include <tqstringlist.h>
#include <tqstring.h>
#include <tqregexp.h>
#include <config.h>
/* We acknowledge the the dbus API is unstable */
#define DBUS_API_SUBJECT_TO_CHANGE
/* DBus-Qt bindings */
#include <dbus/connection.h>
/* HAL libraries */
#include <libhal.h>
#include <libhal-storage.h>
namespace TDEIO {
class Job;
}
class HALBackend : public TQObject, public BackendBase
{
Q_OBJECT
public:
/**
* Constructor
*/
HALBackend(MediaList &list, TQObject* parent);
/**
* Destructor
*/
~HALBackend();
/**
* Perform HAL initialization.
*
* @return true if succeded. If not, rely on some other backend
*/
bool InitHal();
/**
* List all devices and append them to the media device list (called only once, at startup).
*
* @return true if succeded, false otherwise
*/
bool ListDevices();
TQStringList mountoptions(const TQString &id);
bool setMountoptions(const TQString &id, const TQStringList &options);
TQStringVariantMap mount(const TQString &id);
TQStringVariantMap mount(const Medium *medium);
TQStringVariantMap unmount(const TQString &id);
TQStringVariantMap unlock(const TQString &id, const TQString &password);
TQStringVariantMap lock(const TQString &id);
private:
/**
* Append a device in the media list. This function will check if the device
* is worth listing.
*
* @param udi Universal Device Id
* @param allowNotification Indicates if this event will be notified to the user
*/
void AddDevice(const char* udi, bool allowNotification=true);
/**
* Remove a device from the device list
*
* @param udi Universal Device Id
*/
void RemoveDevice(const char* udi);
/**
* A device has changed, update it
*
* @param udi Universal Device Id
*/
void ModifyDevice(const char *udi, const char* key);
/**
* HAL informed that a special action has occured
* (e.g. device unplugged without unmounting)
*
* @param udi Universal Device Id
*/
void DeviceCondition(const char *udi, const char *condition);
/**
* Integrate the DBus connection within qt main loop
*/
void MainLoopIntegration(DBusConnection *dbusConnection);
/* Set media properties */
private:
/**
* Reset properties for the given medium
*/
void ResetProperties(const char* MediumUdi, bool allowNotification=false);
/**
* Find the medium that is concerned with device udi
*/
const char* findMediumUdiFromUdi(const char* udi);
void setVolumeProperties(Medium* medium);
bool setFloppyProperties(Medium* medium);
void setFloppyMountState( Medium* medium );
bool setFstabProperties(Medium* medium);
void setCameraProperties(Medium* medium);
TQString generateName(const TQString &devNode);
static TQString isInFstab(const Medium *medium);
static TQString listUsingProcesses(const Medium *medium);
static TQString killUsingProcesses(const Medium *medium);
private slots:
void slotResult(TDEIO::Job *job);
/* Hal call-backs -- from gvm*/
public:
/** Invoked when a device is added to the Global Device List.
*
* @param ctx LibHal context
* @param udi Universal Device Id
*/
static void hal_device_added(LibHalContext *ctx, const char *udi);
/** Invoked when a device is removed from the Global Device List.
*
* @param ctx LibHal context
* @param udi Universal Device Id
*/
static void hal_device_removed(LibHalContext *ctx, const char *udi);
/** Invoked when a property of a device in the Global Device List is
* changed, and we have we have subscribed to changes for that device.
*
* @param ctx LibHal context
* @param udi Univerisal Device Id
* @param key Key of property
*/
static void hal_device_property_modified(LibHalContext *ctx, const char *udi, const char *key,
dbus_bool_t is_removed, dbus_bool_t is_added);
/** Type for callback when a non-continuos condition occurs on a device
*
* @param udi Univerisal Device Id
* @param condition_name Name of the condition
* @param message D-BUS message with variable parameters depending on condition
*/
static void hal_device_condition(LibHalContext *ctx, const char *udi,
const char *condition_name,
const char* message
);
TQStringList getHALmountoptions(TQString udi);
/* HAL and DBus structures */
private:
/**
* The HAL context connecting the whole application to the HAL
*/
LibHalContext* m_halContext;
/**
* libhal-storage HAL policy, e.g. for icon names
*/
LibHalStoragePolicy* m_halStoragePolicy;
/**
* The DBus-Qt bindings connection for mainloop integration
*/
DBusQt::Connection* m_dBusQtConnection;
/**
* Object for the kded module
*/
TQObject* m_parent;
DBusConnection *dbus_connection;
/**
* Data structure for fstab mount/unmount jobs
*/
struct mount_job_data {
// [in] Medium, which is being mounted/unmounted by the job
const Medium* medium;
// [in,out] Should be set to true when the job completes
bool completed;
// [out] TDEIO::Error if an error occured during operation. Otherwise, 0
int error;
// [out] Error message to be displayed to the user
TQString errorMessage;
};
TQMap<TDEIO::Job *, struct mount_job_data*> mount_jobs;
};
#endif /* _HALBACKEND_H_ */

@ -36,10 +36,6 @@
#include "tdehardwarebackend.h" #include "tdehardwarebackend.h"
#endif // COMPILE_TDEHARDWAREBACKEND #endif // COMPILE_TDEHARDWAREBACKEND
#ifdef COMPILE_HALBACKEND
#include "halbackend.h"
#endif //COMPILE_HALBACKEND
#ifdef COMPILE_LINUXCDPOLLING #ifdef COMPILE_LINUXCDPOLLING
#include "linuxcdpolling.h" #include "linuxcdpolling.h"
#endif //COMPILE_LINUXCDPOLLING #endif //COMPILE_LINUXCDPOLLING
@ -80,33 +76,9 @@ void MediaManager::loadBackends()
} }
mp_removableBackend = 0L; mp_removableBackend = 0L;
m_halbackend = 0L;
m_tdebackend = 0L; m_tdebackend = 0L;
m_fstabbackend = 0L; m_fstabbackend = 0L;
#ifdef COMPILE_HALBACKEND
if ( MediaManagerSettings::self()->halBackendEnabled() )
{
m_mediaList.blockSignals(false);
m_halbackend = new HALBackend(m_mediaList, this);
if (m_halbackend->InitHal())
{
m_backends.append( m_halbackend );
m_fstabbackend = new FstabBackend(m_mediaList, true);
m_backends.append( m_fstabbackend );
// No need to load something else...
m_mediaList.blockSignals(false);
return;
}
else
{
delete m_halbackend;
m_halbackend = 0;
m_mediaList.blockSignals(true);
}
}
#endif // COMPILE_HALBACKEND
#ifdef COMPILE_TDEHARDWAREBACKEND #ifdef COMPILE_TDEHARDWAREBACKEND
if ( MediaManagerSettings::self()->tdeHardwareBackendEnabled() ) if ( MediaManagerSettings::self()->tdeHardwareBackendEnabled() )
{ {
@ -216,36 +188,24 @@ TQStringList MediaManager::properties(const TQString &name)
TQStringList MediaManager::mountoptions(const TQString &name) TQStringList MediaManager::mountoptions(const TQString &name)
{ {
#ifdef COMPILE_HALBACKEND #ifdef COMPILE_TDEHARDWAREBACKEND
if (!m_halbackend) if (!m_tdebackend)
return TQStringList();
return m_halbackend->mountoptions(name);
#else // COMPILE_HALBACKEND
#ifdef COMPILE_TDEHARDWAREBACKEND
if (!m_tdebackend)
return TQStringList();
return m_tdebackend->mountoptions(name);
#else // COMPILE_TDEHARDWAREBACKEND
return TQStringList(); return TQStringList();
#endif // COMPILE_TDEHARDWAREBACKEND return m_tdebackend->mountoptions(name);
#endif // COMPILE_HALBACKEND #else
return TQStringList();
#endif
} }
bool MediaManager::setMountoptions(const TQString &name, const TQStringList &options) bool MediaManager::setMountoptions(const TQString &name, const TQStringList &options)
{ {
#ifdef COMPILE_HALBACKEND #ifdef COMPILE_TDEHARDWAREBACKEND
if (!m_halbackend) if (!m_tdebackend)
return false;
return m_halbackend->setMountoptions(name, options);
#else // COMPILE_HALBACKEND
#ifdef COMPILE_TDEHARDWAREBACKEND
if (!m_tdebackend)
return false;
return m_tdebackend->setMountoptions(name, options);
#else // COMPILE_TDEHARDWAREBACKEND
return false; return false;
#endif // COMPILE_TDEHARDWAREBACKEND return m_tdebackend->setMountoptions(name, options);
#endif // COMPILE_HALBACKEND #else
return false;
#endif
} }
TQStringVariantMap MediaManager::mount(const TQString &uid) TQStringVariantMap MediaManager::mount(const TQString &uid)
@ -258,16 +218,9 @@ TQStringVariantMap MediaManager::mount(const TQString &uid)
return result; return result;
} }
return m_tdebackend->mount(uid); return m_tdebackend->mount(uid);
#elif defined COMPILE_HALBACKEND
if (!m_halbackend) {
result["errStr"] = i18n("Feature only available with HAL");
result["result"] = false;
return result;
}
return m_halbackend->mount(uid);
#else #else
if (!m_fstabbackend) { if (!m_fstabbackend) {
result["errStr"] = i18n("Feature only available with HAL or TDE hardware backend"); result["errStr"] = i18n("Feature only available with the TDE hardware backend");
result["result"] = false; result["result"] = false;
return result; return result;
} }
@ -285,16 +238,9 @@ TQStringVariantMap MediaManager::unmount(const TQString &uid)
return result; return result;
} }
return m_tdebackend->unmount(uid); return m_tdebackend->unmount(uid);
#elif defined COMPILE_HALBACKEND
if (!m_halbackend) {
result["errStr"] = i18n("Feature only available with HAL");
result["result"] = false;
return result;
}
return m_halbackend->unmount(uid);
#else #else
if (!m_fstabbackend) { if (!m_fstabbackend) {
result["errStr"] = i18n("Feature only available with HAL or TDE hardware backend"); result["errStr"] = i18n("Feature only available with the TDE hardware backend");
result["result"] = false; result["result"] = false;
return result; return result;
} }
@ -312,16 +258,9 @@ TQStringVariantMap MediaManager::unlock(const TQString &uid, const TQString &pas
return result; return result;
} }
return m_tdebackend->unlock(uid, password); return m_tdebackend->unlock(uid, password);
#elif defined COMPILE_HALBACKEND
if (!m_halbackend) {
result["errStr"] = i18n("Feature only available with HAL");
result["result"] = false;
return result;
}
return m_halbackend->unlock(uid, password);
#else #else
// if (!m_fstabbackend) { // if (!m_fstabbackend) {
result["errStr"] = i18n("Feature only available with HAL or TDE hardware backend"); result["errStr"] = i18n("Feature only available with the TDE hardware backend");
result["result"] = false; result["result"] = false;
return result; return result;
// } // }
@ -339,16 +278,9 @@ TQStringVariantMap MediaManager::lock(const TQString &uid)
return result; return result;
} }
return m_tdebackend->lock(uid); return m_tdebackend->lock(uid);
#elif defined COMPILE_HALBACKEND
if (!m_halbackend) {
result["errStr"] = i18n("Feature only available with HAL");
result["result"] = false;
return result;
}
return m_halbackend->lock(uid);
#else #else
// if (!m_fstabbackend) { // if (!m_fstabbackend) {
result["errStr"] = i18n("Feature only available with HAL or TDE hardware backend"); result["errStr"] = i18n("Feature only available with the TDE hardware backend");
result["result"] = false; result["result"] = false;
return result; return result;
// } // }

@ -29,7 +29,6 @@
#include "removablebackend.h" #include "removablebackend.h"
#include "mediadirnotify.h" #include "mediadirnotify.h"
class HALBackend;
class TDEBackend; class TDEBackend;
class FstabBackend; class FstabBackend;
@ -65,7 +64,6 @@ k_dcop:
ASYNC reloadBackends(); ASYNC reloadBackends();
// Removable media handling (for people not having HAL)
bool removablePlug(const TQString &devNode, const TQString &label); bool removablePlug(const TQString &devNode, const TQString &label);
bool removableUnplug(const TQString &devNode); bool removableUnplug(const TQString &devNode);
bool removableCamera(const TQString &devNode); bool removableCamera(const TQString &devNode);
@ -94,7 +92,6 @@ private:
MediaList m_mediaList; MediaList m_mediaList;
TQValueList<BackendBase*> m_backends; TQValueList<BackendBase*> m_backends;
RemovableBackend *mp_removableBackend; RemovableBackend *mp_removableBackend;
HALBackend *m_halbackend;
TDEBackend *m_tdebackend; TDEBackend *m_tdebackend;
MediaDirNotify m_dirNotify; MediaDirNotify m_dirNotify;
FstabBackend *m_fstabbackend; FstabBackend *m_fstabbackend;

@ -44,13 +44,6 @@ ManagerModule::ManagerModule( TQWidget* parent, const char* name )
addConfig( MediaManagerSettings::self(), view ); addConfig( MediaManagerSettings::self(), view );
#ifndef COMPILE_HALBACKEND
TQString hal_text = view->kcfg_HalBackendEnabled->text();
hal_text += " ("+i18n("No support for HAL on this system")+")";
view->kcfg_HalBackendEnabled->setText( hal_text );
#endif
view->kcfg_HalBackendEnabled->setEnabled( false );
#ifndef COMPILE_LINUXCDPOLLING #ifndef COMPILE_LINUXCDPOLLING
TQString poll_text = view->kcfg_CdPollingEnabled->text(); TQString poll_text = view->kcfg_CdPollingEnabled->text();
poll_text += " ("+i18n("No support for CD polling on this system")+")"; poll_text += " ("+i18n("No support for CD polling on this system")+")";
@ -140,13 +133,12 @@ void ManagerModule::save()
rememberSettings(); rememberSettings();
//Well... reloadBackends is buggy with HAL, it seems to be linked
//to a bug in the unmaintained Qt3 DBUS binding ;-/
//DCOPRef mediamanager( "kded", "mediamanager" );
//DCOPReply reply = mediamanager.call( "reloadBackends" );
// So we use this hack instead...
DCOPRef kded( "kded", "kded" ); DCOPRef kded( "kded", "kded" );
// DCOPReply reply = mediamanager.call( "reloadBackends" );
// Well... reloadBackends had issues with HAL, it seems it was linked
// to a bug in the unmaintained Qt3 DBUS binding, but it is not quite clear.
// It may be ok now that HAL is no longer supported but needs to be tested.
// So we use this hack instead...
kded.call( "unloadModule", "mediamanager" ); kded.call( "unloadModule", "mediamanager" );
kded.call( "loadModule", "mediamanager" ); kded.call( "loadModule", "mediamanager" );

@ -19,17 +19,6 @@
<property name="name"> <property name="name">
<cstring>unnamed</cstring> <cstring>unnamed</cstring>
</property> </property>
<widget class="TQCheckBox">
<property name="name">
<cstring>kcfg_HalBackendEnabled</cstring>
</property>
<property name="text">
<string>Enable HAL backend</string>
</property>
<property name="whatsThis" stdset="0">
<string>Select this if you want to enable the Hardware Abstraction Layer (http://hal.freedesktop.org/wiki/Software/hal) support.</string>
</property>
</widget>
<widget class="TQCheckBox"> <widget class="TQCheckBox">
<property name="name"> <property name="name">
<cstring>kcfg_CdPollingEnabled</cstring> <cstring>kcfg_CdPollingEnabled</cstring>
@ -348,16 +337,7 @@ Display the short name as is; store a long name when the short name is not all u
</spacer> </spacer>
</vbox> </vbox>
</widget> </widget>
<connections>
<connection>
<sender>kcfg_HalBackendEnabled</sender>
<signal>toggled(bool)</signal>
<receiver>groupbox_mount</receiver>
<slot>setEnabled(bool)</slot>
</connection>
</connections>
<tabstops> <tabstops>
<tabstop>kcfg_HalBackendEnabled</tabstop>
<tabstop>kcfg_CdPollingEnabled</tabstop> <tabstop>kcfg_CdPollingEnabled</tabstop>
<tabstop>kcfg_AutostartEnabled</tabstop> <tabstop>kcfg_AutostartEnabled</tabstop>
<tabstop>kcfg_NotificationPopupsEnabled</tabstop> <tabstop>kcfg_NotificationPopupsEnabled</tabstop>

Loading…
Cancel
Save