summaryrefslogtreecommitdiffstats
path: root/tdeioslave/media/mediamanager
diff options
context:
space:
mode:
Diffstat (limited to 'tdeioslave/media/mediamanager')
-rw-r--r--tdeioslave/media/mediamanager/mediamanager.cpp73
-rw-r--r--tdeioslave/media/mediamanager/mediamanager.h3
2 files changed, 50 insertions, 26 deletions
diff --git a/tdeioslave/media/mediamanager/mediamanager.cpp b/tdeioslave/media/mediamanager/mediamanager.cpp
index a74a887be..325609baf 100644
--- a/tdeioslave/media/mediamanager/mediamanager.cpp
+++ b/tdeioslave/media/mediamanager/mediamanager.cpp
@@ -136,39 +136,22 @@ void MediaManager::loadBackends()
m_mediaList.blockSignals(false);
}
-
-TQStringList MediaManager::fullList()
-{
- TQPtrList<Medium> list = m_mediaList.list();
-
- TQStringList result;
-
- TQPtrList<Medium>::const_iterator it = list.begin();
- TQPtrList<Medium>::const_iterator end = list.end();
- for (; it!=end; ++it)
- {
- result+= (*it)->properties();
- result+= Medium::SEPARATOR;
- }
-
- return result;
-}
-
-TQStringList MediaManager::properties(const TQString &name)
+const Medium* MediaManager::getMediumByName(const TQString &name)
{
const Medium *m = m_mediaList.findByName(name);
-
if (!m)
{
KURL u(name);
- kdDebug() << "Media::prop " << name << " " << u.isValid() << endl;
+ kdDebug() << "Media::getMediumByName " << name << " " << u.isValid() << endl;
if (u.isValid())
{
if (u.protocol() == "system")
{
TQString path = u.path();
if (path.startsWith("/media/"))
+ {
path = path.mid(strlen("/media/"));
+ }
m = m_mediaList.findByName(path);
kdDebug() << "findByName " << path << m << endl;
}
@@ -189,19 +172,44 @@ TQStringList MediaManager::properties(const TQString &name)
{
path = TDEStandardDirs::realFilePath(u.path());
kdDebug() << "comparing " << (*it)->mountPoint() << " " << path << " " << (*it)->deviceNode() << endl;
- if ((*it)->mountPoint() == path || (*it)->deviceNode() == path) {
- m = *it;
- break;
+ if ((*it)->mountPoint() == path || (*it)->deviceNode() == path)
+ {
+ m = *it;
+ break;
}
}
}
}
}
+ return m;
+}
- if (m) {
+TQStringList MediaManager::fullList()
+{
+ TQPtrList<Medium> list = m_mediaList.list();
+
+ TQStringList result;
+
+ TQPtrList<Medium>::const_iterator it = list.begin();
+ TQPtrList<Medium>::const_iterator end = list.end();
+ for (; it!=end; ++it)
+ {
+ result+= (*it)->properties();
+ result+= Medium::SEPARATOR;
+ }
+
+ return result;
+}
+
+TQStringList MediaManager::properties(const TQString &name)
+{
+ const Medium *m = getMediumByName(name);
+ if (m)
+ {
return m->properties();
}
- else {
+ else
+ {
return TQStringList();
}
}
@@ -396,6 +404,19 @@ TQStringVariantMap MediaManager::lockByNode(const TQString &deviceNode)
return lock(medium->id());
}
+TQString MediaManager::mimeType(const TQString &name)
+{
+ const Medium *m = getMediumByName(name);
+ if (m)
+ {
+ return m->mimeType();
+ }
+ else
+ {
+ return TQString::null;
+ }
+}
+
TQString MediaManager::nameForLabel(const TQString &label)
{
const TQPtrList<Medium> media = m_mediaList.list();
diff --git a/tdeioslave/media/mediamanager/mediamanager.h b/tdeioslave/media/mediamanager/mediamanager.h
index d8a31d8e1..3c49109f3 100644
--- a/tdeioslave/media/mediamanager/mediamanager.h
+++ b/tdeioslave/media/mediamanager/mediamanager.h
@@ -41,6 +41,8 @@ public:
MediaManager(const TQCString &obj);
~MediaManager();
+ const Medium* getMediumByName(const TQString &name);
+
k_dcop:
TQStringList fullList();
TQStringList properties(const TQString &name);
@@ -57,6 +59,7 @@ k_dcop:
TQStringVariantMap unlockByNode(const TQString &deviceNode, const TQString &password);
TQStringVariantMap lockByNode(const TQString &deviceNode);
+ TQString mimeType(const TQString &name);
TQString nameForLabel(const TQString &label);
ASYNC setUserLabel(const TQString &name, const TQString &label);