diff options
author | Darrell Anderson <humanreadable@yahoo.com> | 2012-05-08 16:52:56 -0500 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2012-06-03 03:27:24 +0200 |
commit | 90130c99a48800dcef5a5508b99198633452b86c (patch) | |
tree | 67c94b1fa9786d3399640f0df7a7ce4d3b31f516 /kioslave | |
parent | aaffef4117fb9103c5b60f467f49aaa97a4d9635 (diff) | |
download | tdebase-90130c99a48800dcef5a5508b99198633452b86c.tar.gz tdebase-90130c99a48800dcef5a5508b99198633452b86c.zip |
Fix TDE to honor HAL options
Thanks to Francois Andriot.
This partially resolves bug report 986.
(cherry picked from commit 8ecd10805a655acc958f241942b00826f71454cc)
Diffstat (limited to 'kioslave')
-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 df0ff4dd4..4652a7049 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: /** |