diff options
author | Mavridis Philippe <mavridisf@gmail.com> | 2021-01-15 17:28:25 +0200 |
---|---|---|
committer | Mavridis Philippe <mavridisf@gmail.com> | 2021-01-15 17:28:25 +0200 |
commit | b487b5bb8b314d381b6d13dcf4f49898f24b6f4a (patch) | |
tree | adc5b56ca38d84ec99da7ab631ef95ba93311168 /src/directorylist.cpp | |
parent | cb9983144be814ee0ec28d9fed7399f98aab202c (diff) | |
download | klamav-b487b5bb8b314d381b6d13dcf4f49898f24b6f4a.tar.gz klamav-b487b5bb8b314d381b6d13dcf4f49898f24b6f4a.zip |
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>
Diffstat (limited to 'src/directorylist.cpp')
-rw-r--r-- | src/directorylist.cpp | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/src/directorylist.cpp b/src/directorylist.cpp index 80571ab..e62e532 100644 --- a/src/directorylist.cpp +++ b/src/directorylist.cpp @@ -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 ); } |