diff options
author | Michele Calgaro <[email protected]> | 2019-08-24 18:25:55 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2020-10-17 10:48:28 +0800 |
commit | d34f23f403e82f352e4c5d4e20966bcba2bec8c6 (patch) | |
tree | a1c02a3f85d2cf018f279bca095d5012702701e5 /tdeioslave/media/mediamanager/medialist.cpp | |
parent | ebc4784c4fddeb307f4bc2ab83b4189312f24f3b (diff) | |
download | tdebase-d34f23f403e82f352e4c5d4e20966bcba2bec8c6.tar.gz tdebase-d34f23f403e82f352e4c5d4e20966bcba2bec8c6.zip |
tdeioslave media: clean up code related to medium mountable state in preparation for further work.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'tdeioslave/media/mediamanager/medialist.cpp')
-rw-r--r-- | tdeioslave/media/mediamanager/medialist.cpp | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/tdeioslave/media/mediamanager/medialist.cpp b/tdeioslave/media/mediamanager/medialist.cpp index b06824d0c..dc0a108d6 100644 --- a/tdeioslave/media/mediamanager/medialist.cpp +++ b/tdeioslave/media/mediamanager/medialist.cpp @@ -128,42 +128,42 @@ bool MediaList::changeMediumState(const Medium &medium, bool allowNotification) { kdDebug(1219) << "MediaList::changeMediumState(const Medium &) for id " << medium.id() << endl; - if ( !m_idMap.contains(medium.id()) ) return false; + if (!m_idMap.contains(medium.id())) return false; Medium *m = m_idMap[medium.id()]; - if ( medium.isMountable() ) + m->setMountable(medium.isMountable()); + if (medium.isMountable()) { - TQString device_node = medium.deviceNode(); - TQString clear_device_udi = medium.clearDeviceUdi(); - TQString mount_point = medium.mountPoint(); - TQString fs_type = medium.fsType(); - bool mounted = medium.isMounted(); - - m->mountableState( device_node, clear_device_udi, mount_point, fs_type, mounted ); + m->setMountable(true); + m->setDeviceNode(medium.deviceNode()); + m->setClearDeviceUdi(medium.clearDeviceUdi()); + m->setMountPoint(medium.mountPoint()); + m->setFsType(medium.fsType()); + m->setMounted(medium.isMounted()); } else { - m->unmountableState( medium.baseURL() ); + m->setBaseURL(medium.baseURL()); } - if (!medium.mimeType().isEmpty()) { - m->setMimeType( medium.mimeType() ); + m->setMimeType(medium.mimeType()); } if (!medium.iconName().isEmpty()) { - m->setIconName( medium.iconName() ); + m->setIconName(medium.iconName()); } if (!medium.label().isEmpty()) { - m->setLabel( medium.label() ); + m->setLabel(medium.label()); } m->setHidden(medium.hidden()); + m->setSoftHidden(medium.softHidden()); emit mediumStateChanged(m->id(), m->name(), !m->needMounting(), allowNotification); return true; @@ -184,7 +184,8 @@ bool MediaList::changeMediumState(const TQString &id, Medium *medium = m_idMap[id]; - medium->unmountableState( baseURL ); + medium->setMountable(false); + medium->setBaseURL(baseURL); if (!mimeType.isEmpty()) { @@ -225,7 +226,11 @@ bool MediaList::changeMediumState(const TQString &id, Medium *medium = m_idMap[id]; - medium->mountableState( deviceNode, mountPoint, fsType, mounted ); + medium->setMountable(true); + medium->setDeviceNode(deviceNode); + medium->setMountPoint(mountPoint); + medium->setFsType(fsType); + medium->setMounted(mounted); if (!mimeType.isEmpty()) { @@ -262,7 +267,12 @@ bool MediaList::changeMediumState(const TQString &id, bool mounted, Medium *medium = m_idMap[id]; - if ( !medium->mountableState( mounted ) ) return false; + medium->setMountable(true); + medium->setMounted(mounted); + if (medium->deviceNode().isEmpty() || !medium->isMountable()) + { + return false; + } if (!mimeType.isEmpty()) { |