directorylist.*: Reimplemented mounting process.

What remains is to figure out a way to pass ClamAV the mountpoint
instead of the block device name.

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
pull/24/head
Mavridis Philippe 4 years ago
parent cb9983144b
commit b487b5bb8b
No known key found for this signature in database
GPG Key ID: F8D2D7E2F989A494

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

@ -113,6 +113,7 @@ class DeviceItem : public TQObject, public TQCheckListItem
void completed() { if( childCount() == 0 ) { setExpandable( false ); repaint(); } }
private:
void mountDevice(const TQString & device);
TQString getMountPoint(const TQString & device);
KDirLister m_lister;
KURL m_url;
bool m_listed;

Loading…
Cancel
Save