diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-08-08 14:36:50 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-08-08 14:36:50 -0500 |
commit | 960cc8392da291eaf6c90d2101b721f6c20488f3 (patch) | |
tree | 63ecdf7a203cd721c0652bad2023a3e9f53f995c /tdeioslave/media | |
parent | 3a84ecae5ded7370a7dfee43f25dd21269d65a7c (diff) | |
download | tdebase-960cc8392da291eaf6c90d2101b721f6c20488f3.tar.gz tdebase-960cc8392da291eaf6c90d2101b721f6c20488f3.zip |
Update tdehw-based media manager for new mount API
Allow active VT to be queried from tdm
Only display media notification messages on active VT
Hide logout action buttons if logout process unstalls
Diffstat (limited to 'tdeioslave/media')
-rw-r--r-- | tdeioslave/media/mediamanager/tdehardwarebackend.cpp | 28 | ||||
-rw-r--r-- | tdeioslave/media/medianotifier/CMakeLists.txt | 3 | ||||
-rw-r--r-- | tdeioslave/media/medianotifier/medianotifier.cpp | 26 |
3 files changed, 25 insertions, 32 deletions
diff --git a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp index 3171d8f3c..369f87c3a 100644 --- a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp +++ b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp @@ -969,39 +969,15 @@ TQString TDEBackend::mount(const Medium *medium) return i18n("Internal error"); } - TQString optionString; TQString diskLabel; TQMap<TQString,TQString> valids = MediaManagerUtils::splitOptions(mountoptions(medium->id())); - if (valids["ro"] == "true") { - optionString.append(" -r"); - } - - if (valids["atime"] != "true") { - optionString.append(" -A"); - } - - if (valids["utf8"] == "true") { - optionString.append(" -c utf8"); - } - - if (valids["sync"] == "true") { - optionString.append(" -s"); - } TQString mount_point = valids["mountpoint"]; if (mount_point.startsWith("/media/")) { diskLabel = mount_point.mid(7); } - if (valids.contains("filesystem")) { - optionString.append(TQString(" -t %1").arg(valids["filesystem"])); - } - - if (valids.contains("locale")) { - optionString.append(TQString(" -c %1").arg(valids["locale"])); - } - if (diskLabel == "") { // Try to use a pretty mount point if possible TQStringList pieces = TQStringList::split("/", sdevice->deviceNode(), FALSE); @@ -1015,7 +991,7 @@ TQString TDEBackend::mount(const Medium *medium) if (!medium->isEncrypted()) { // normal volume TQString mountMessages; - TQString mountedPath = sdevice->mountDevice(diskLabel, optionString, &mountMessages); + TQString mountedPath = sdevice->mountDevice(diskLabel, valids, &mountMessages); if (mountedPath.isNull()) { qerror = i18n("<qt>Unable to mount this device.<p>Potential reasons include:<br>Improper device and/or user privilege level<br>Corrupt data on storage device"); if (!mountMessages.isNull()) { @@ -1068,7 +1044,7 @@ TQString TDEBackend::mount(const Medium *medium) // mount encrypted volume with password int mountRetcode; TQString mountMessages; - TQString mountedPath = sdevice->mountEncryptedDevice(m_decryptionPassword, diskLabel, optionString, &mountMessages, &mountRetcode); + TQString mountedPath = sdevice->mountEncryptedDevice(m_decryptionPassword, diskLabel, valids, &mountMessages, &mountRetcode); if (mountedPath.isNull()) { if (mountRetcode == 0) { // Mounting was successful diff --git a/tdeioslave/media/medianotifier/CMakeLists.txt b/tdeioslave/media/medianotifier/CMakeLists.txt index 9618f79ab..35d639d1b 100644 --- a/tdeioslave/media/medianotifier/CMakeLists.txt +++ b/tdeioslave/media/medianotifier/CMakeLists.txt @@ -13,6 +13,7 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR}/tdeioslave/media/libmediacommon ${CMAKE_SOURCE_DIR}/tdeioslave/media/libmediacommon + ${CMAKE_SOURCE_DIR}/tdmlib ${TDE_INCLUDE_DIR} ${TQT_INCLUDE_DIRS} ) @@ -38,6 +39,6 @@ set( ${target}_SRCS tde_add_kpart( ${target} AUTOMOC SOURCES ${${target}_SRCS} - LINK mediacommon-static tdeinit_kded-shared + LINK mediacommon-static tdeinit_kded-shared dmctl-static DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/tdeioslave/media/medianotifier/medianotifier.cpp b/tdeioslave/media/medianotifier/medianotifier.cpp index e500731a2..9b4c0e17e 100644 --- a/tdeioslave/media/medianotifier/medianotifier.cpp +++ b/tdeioslave/media/medianotifier/medianotifier.cpp @@ -41,6 +41,8 @@ #include "notifieraction.h" #include "mediamanagersettings.h" +#include "dmctl.h" + MediaNotifier::MediaNotifier(const TQCString &name) : KDEDModule(name) { connectDCOPSignal( "kded", "mediamanager", "mediumAdded(TQString, bool)", @@ -69,13 +71,14 @@ void MediaNotifier::onMediumChange( const TQString &name, bool allowNotification kdDebug() << "MediaNotifier::onMediumChange( " << name << ", " << allowNotification << ")" << endl; - if ( !allowNotification ) + if ( !allowNotification ) { return; + } -// Update user activity timestamp, otherwise the notification dialog will be shown -// in the background due to focus stealing prevention. Entering a new media can -// be seen as a kind of user activity after all. It'd be better to update the timestamp -// as soon as the media is entered, but it apparently takes some time to get here. + // Update user activity timestamp, otherwise the notification dialog will be shown + // in the background due to focus stealing prevention. Entering a new media can + // be seen as a kind of user activity after all. It'd be better to update the timestamp + // as soon as the media is entered, but it apparently takes some time to get here. kapp->updateUserTimestamp(); KURL url( "system:/media/"+name ); @@ -285,6 +288,19 @@ void MediaNotifier::notify( KFileItem &medium ) { kdDebug() << "Notification triggered." << endl; + DM dm; + int currentActiveVT = dm.activeVT(); + int currentX11VT = TDEApplication::currentX11VT(); + + if (currentX11VT < 0) { + // Do not notify if user is not local + return; + } + if ((currentActiveVT >= 0) && (currentX11VT != currentActiveVT)) { + // Do not notify if VT is not active! + return; + } + NotifierSettings *settings = new NotifierSettings(); if ( settings->autoActionForMimetype( medium.mimetype() )==0L ) |