diff options
author | Darrell Anderson <humanreadable@yahoo.com> | 2012-05-08 16:52:56 -0500 |
---|---|---|
committer | Darrell Anderson <humanreadable@yahoo.com> | 2012-05-08 16:55:37 -0500 |
commit | 8ecd10805a655acc958f241942b00826f71454cc (patch) | |
tree | dffcbc72ba4d8b2ce1c7356973dddccb9b4075c6 /kioslave/media | |
parent | 68be838d5bd7da8ffa99da3e9ed521f66e2ce6ec (diff) | |
download | tdebase-8ecd10805a655acc958f241942b00826f71454cc.tar.gz tdebase-8ecd10805a655acc958f241942b00826f71454cc.zip |
Fix TDE to honor HAL options
Thanks to Francois Andriot.
This partially resolves bug report 986.
Diffstat (limited to 'kioslave/media')
-rw-r--r-- | kioslave/media/mediamanager/halbackend.cpp | 43 | ||||
-rw-r--r-- | kioslave/media/mediamanager/halbackend.h | 1 |
2 files changed, 44 insertions, 0 deletions
diff --git a/kioslave/media/mediamanager/halbackend.cpp b/kioslave/media/mediamanager/halbackend.cpp index a4571fa46..a6726c8eb 100644 --- a/kioslave/media/mediamanager/halbackend.cpp +++ b/kioslave/media/mediamanager/halbackend.cpp @@ -873,6 +873,33 @@ void HALBackend::hal_device_condition(LibHalContext *ctx, const char *udi, s_HALBackend->DeviceCondition(udi, condition_name); } +TQStringList HALBackend::getHALmountoptions(TQString udi) +{ + const char* _ppt_string; + LibHalVolume* volume; + LibHalDrive* drive; + + TQString _ppt_TQString; + + volume = libhal_volume_from_udi( m_halContext, udi.latin1() ); + if( volume ) + drive = libhal_drive_from_udi( m_halContext, libhal_volume_get_storage_device_udi( volume ) ); + else + drive = libhal_drive_from_udi( m_halContext, udi.latin1() ); + + if( !drive ) + return TQString::null; + + if( volume ) + _ppt_string = libhal_volume_policy_get_mount_options ( drive, volume, NULL ); + else + _ppt_string = libhal_drive_policy_get_mount_options ( drive, NULL ); + + _ppt_TQString = TQString(_ppt_string ? _ppt_string : ""); + + return TQStringList::split(",",_ppt_TQString); +} + TQStringList HALBackend::mountoptions(const TQString &name) { const Medium* medium = m_mediaList.findById(name); @@ -1472,10 +1499,26 @@ TQString HALBackend::mount(const Medium *medium) soptions << TQString("data=ordered"); } + TQStringList hal_mount_options = getHALmountoptions(medium->id()); + for (TQValueListIterator<TQString> it=hal_mount_options.begin();it!=hal_mount_options.end();it++) + { + soptions << *it; + kdDebug()<<"HALOption: "<<*it<<endl; + if ((*it).startsWith("iocharset=")) + { + soptions.remove("utf8"); + kdDebug()<<"\"iocharset=\" found. Removing \"utf8\" from options."<<endl; + } + } + + const char **options = new const char*[soptions.size() + 1]; uint noptions = 0; for (TQStringList::ConstIterator it = soptions.begin(); it != soptions.end(); ++it, ++noptions) + { options[noptions] = (*it).latin1(); + kdDebug()<<"Option: "<<*it<<endl; + } options[noptions] = NULL; TQString qerror = i18n("Cannot mount encrypted drives!"); diff --git a/kioslave/media/mediamanager/halbackend.h b/kioslave/media/mediamanager/halbackend.h index 59c7aa366..18de7ea3c 100644 --- a/kioslave/media/mediamanager/halbackend.h +++ b/kioslave/media/mediamanager/halbackend.h @@ -187,6 +187,7 @@ public: const char* message ); + TQStringList getHALmountoptions(TQString udi); /* HAL and DBus structures */ private: /** |