@ -20,6 +20,7 @@
# include <tqtooltip.h>
# include <tqdir.h>
# include <tdemessagebox.h>
# include <tdefileitem.h>
# include <tdelocale.h>
# include <kdebug.h>
@ -29,7 +30,6 @@
# include <tdeapplication.h>
# include <dcopref.h>
# include <dcopclient.h>
# include <kautomount.h>
# include "directorylist.h"
@ -432,6 +432,20 @@ DeviceItem::paintCell( TQPainter * p, const TQColorGroup & cg, int column, int w
TQCheckListItem : : paintCell ( p , isDisabled ( ) ? listView ( ) - > palette ( ) . disabled ( ) : _cg , column , width , align ) ;
}
TQString DeviceItem : : getMountPoint ( const TQString & device )
{
DCOPRef mediamanager ( " kded " , " mediamanager " ) ;
DCOPReply reply = mediamanager . call ( " properties " , device ) ;
TQStringList properties ;
reply . get ( properties , " TQStringList " ) ;
TQString mountpoint = * ( properties . at ( 7 ) ) ;
return mountpoint ;
}
void
DeviceItem : : mountDevice ( const TQString & device )
{
@ -439,34 +453,23 @@ DeviceItem::mountDevice( const TQString & device)
if ( ! kapp - > dcopClient ( ) - > isAttached ( ) )
kapp - > dcopClient ( ) - > attach ( ) ;
TQString mountpoint ;
mountpoint = getMountPoint ( device ) ;
//Set Up our DCOP Calls
if ( mountpoint ! = TQString : : null ) // already mounted
return ;
TQStringList retVal ;
TQCString mediacall = " mediamanager " ;
TQCString devicecall = " properties " ;
if ( KDE : : versionMajor ( ) = = 3 & & KDE : : versionMinor ( ) < 4 )
{
mediacall = " mountwatcher " ;
devicecall = " basicDeviceInfo " ;
}
//Mount any devices that are not already mounted
DCOPRef mediamanager ( " kded " , " mediamanager " ) ;
DCOPReply reply = mediamanager . call ( " mountByNode " , device ) ;
DCOPRef mediamanager ( " kded " , mediacall ) ;
DCOPReply reply = mediamanager . call ( devicecall , device ) ;
bool success ;
reply . get ( success , " bool " ) ;
mountpoint = getMountPoint ( device ) ;
if ( ! reply . isValid ( ) )
{
////kdDebug() << "not valid" << endl;
if ( ! success | | mountpoint = = TQString : : null ) {
KMessageBox : : sorry ( 0 , i18n ( " Cannot mount %1. Please check that you have the permissions needed to mount the device, as well as the needed kernel modules loaded. " ) ) ;
}
retVal = reply ;
////kdDebug() << retVal << endl;
////kdDebug() << retVal[1] << endl;
////kdDebug() << retVal[10] << endl;
if ( ! ( retVal [ 10 ] . contains ( " _mounted " ) ) )
new KAutoMount ( true , " " , retVal [ 5 ] , " " , " " , false ) ;
}