summaryrefslogtreecommitdiffstats
path: root/tdeioslave/media/libmediacommon
diff options
context:
space:
mode:
Diffstat (limited to 'tdeioslave/media/libmediacommon')
-rw-r--r--tdeioslave/media/libmediacommon/medium.cpp23
-rw-r--r--tdeioslave/media/libmediacommon/medium.h19
2 files changed, 28 insertions, 14 deletions
diff --git a/tdeioslave/media/libmediacommon/medium.cpp b/tdeioslave/media/libmediacommon/medium.cpp
index c185a8c9f..cb06a5eb8 100644
--- a/tdeioslave/media/libmediacommon/medium.cpp
+++ b/tdeioslave/media/libmediacommon/medium.cpp
@@ -43,6 +43,7 @@ void Medium::initMedium()
m_properties += TQString::null; // CLEAR_DEVICE_UDI
m_properties += "false"; // HIDDEN
m_properties += "false"; // SOFT_HIDDEN
+ m_properties += "false"; // LOCKED
}
Medium::Medium(const TQString id, TQString uuid, const TQString name)
@@ -86,6 +87,7 @@ const Medium Medium::create(const TQStringList &properties)
m.m_properties[CLEAR_DEVICE_UDI] = properties[CLEAR_DEVICE_UDI];
m.m_properties[HIDDEN] = properties[HIDDEN];
m.m_properties[SOFT_HIDDEN] = properties[SOFT_HIDDEN];
+ m.m_properties[LOCKED] = properties[LOCKED];
}
return m;
@@ -221,9 +223,13 @@ void Medium::setIconName(const TQString &iconName)
m_properties[ICON_NAME] = iconName;
}
-void Medium::setEncrypted(bool state)
+void Medium::setEncrypted(bool encrypted)
{
- m_properties[ENCRYPTED] = ( state ? "true" : "false" );
+ m_properties[ENCRYPTED] = encrypted ? "true" : "false";
+ if (!encrypted)
+ {
+ setLocked(false);
+ }
}
void Medium::setClearDeviceUdi(const TQString &clearDeviceUdi)
@@ -233,12 +239,17 @@ void Medium::setClearDeviceUdi(const TQString &clearDeviceUdi)
void Medium::setHidden(bool state)
{
- m_properties[HIDDEN] = ( state ? "true" : "false" );
+ m_properties[HIDDEN] = state ? "true" : "false";
}
void Medium::setSoftHidden(bool state)
{
- m_properties[SOFT_HIDDEN] = ( state ? "true" : "false" );
+ m_properties[SOFT_HIDDEN] = state ? "true" : "false";
+}
+
+void Medium::setLocked(bool locked)
+{
+ m_properties[LOCKED] = locked ? "true" : "false";
}
bool Medium::needMounting() const
@@ -246,9 +257,9 @@ bool Medium::needMounting() const
return isMountable() && !isMounted();
}
-bool Medium::needDecryption() const
+bool Medium::needUnlocking() const
{
- return isEncrypted() && clearDeviceUdi().isEmpty();
+ return isEncrypted() && isLocked();
}
KURL Medium::prettyBaseURL() const
diff --git a/tdeioslave/media/libmediacommon/medium.h b/tdeioslave/media/libmediacommon/medium.h
index 7e7f2b04a..49a7fb980 100644
--- a/tdeioslave/media/libmediacommon/medium.h
+++ b/tdeioslave/media/libmediacommon/medium.h
@@ -46,7 +46,8 @@ public:
static const uint CLEAR_DEVICE_UDI = 14;
static const uint HIDDEN = 15;
static const uint SOFT_HIDDEN = 16;
- static const uint PROPERTIES_COUNT = 17;
+ static const uint LOCKED = 17;
+ static const uint PROPERTIES_COUNT = 18;
static const TQString SEPARATOR;
Medium(const TQString id, TQString uuid, const TQString name);
@@ -60,21 +61,22 @@ public:
TQString name() const { return m_properties[NAME]; }
TQString label() const { return m_properties[LABEL]; }
TQString userLabel() const { return m_properties[USER_LABEL]; }
- bool isMountable() const { return m_properties[MOUNTABLE]=="true"; }
+ bool isMountable() const { return m_properties[MOUNTABLE] == "true"; }
TQString deviceNode() const { return m_properties[DEVICE_NODE]; }
TQString mountPoint() const { return m_properties[MOUNT_POINT]; }
TQString fsType() const { return m_properties[FS_TYPE]; }
- bool isMounted() const { return m_properties[MOUNTED]=="true"; }
+ bool isMounted() const { return m_properties[MOUNTED] == "true"; }
TQString baseURL() const { return m_properties[BASE_URL]; }
TQString mimeType() const { return m_properties[MIME_TYPE]; }
TQString iconName() const { return m_properties[ICON_NAME]; }
- bool isEncrypted() const { return m_properties[ENCRYPTED]=="true"; };
+ bool isEncrypted() const { return m_properties[ENCRYPTED] == "true"; };
TQString clearDeviceUdi() const { return m_properties[CLEAR_DEVICE_UDI]; };
- bool hidden() const { return m_properties[HIDDEN]=="true"; };
- bool softHidden() const { return m_properties[SOFT_HIDDEN]=="true"; };
+ bool hidden() const { return m_properties[HIDDEN] == "true"; };
+ bool softHidden() const { return m_properties[SOFT_HIDDEN] == "true"; };
+ bool isLocked() const { return m_properties[LOCKED] == "true"; };
bool needMounting() const;
- bool needDecryption() const;
+ bool needUnlocking() const;
KURL prettyBaseURL() const;
TQString prettyLabel() const;
@@ -89,10 +91,11 @@ public:
void setBaseURL(const TQString &baseURL);
void setMimeType(const TQString &mimeType);
void setIconName(const TQString &iconName);
- void setEncrypted(bool state);
+ void setEncrypted(bool encrypted);
void setClearDeviceUdi(const TQString &clearDeviceUdi);
void setHidden(bool state);
void setSoftHidden(bool state);
+ void setLocked(bool locked);
Medium();