diff options
author | Mavridis Philippe <[email protected]> | 2021-01-15 17:28:25 +0200 |
---|---|---|
committer | Mavridis Philippe <[email protected]> | 2021-01-15 17:28:25 +0200 |
commit | b487b5bb8b314d381b6d13dcf4f49898f24b6f4a (patch) | |
tree | adc5b56ca38d84ec99da7ab631ef95ba93311168 /src | |
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 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/directorylist.cpp | 51 | ||||
-rw-r--r-- | src/directorylist.h | 1 |
2 files changed, 28 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 ); } diff --git a/src/directorylist.h b/src/directorylist.h index 343c3fa..4e4c058 100644 --- a/src/directorylist.h +++ b/src/directorylist.h @@ -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; |