File kaffeine-media.diff of Package kde3-kaffeine

Index: kaffeine/kaffeineapp.cpp
===================================================================
--- kaffeine/src/kaffeineapp.cpp.orig
+++ kaffeine/src/kaffeineapp.cpp
@@ -61,19 +62,42 @@ int KaffeineApp::newInstance()
   if (args->count())
      for (int i = 0; i < args->count(); i++ )
      {
-       url = QFile::decodeName(args->arg(i));
-       // relative file names
-       if ((url.left(1) != "/") && (!url.contains(":/")) && (url.lower() != "dvd") && (url.lower() != "vcd")
-           && (url.lower() != "audiocd") && (url.lower() != "cdda"))
-          url = path.absFilePath(url);
+       KURL u = KIO::NetAccess::mostLocalURL(args->url(i), 0);
+       if (u.isLocalFile())
+          url = path.absFilePath(u.path());
+       else
+	  url = u.url();
        urls.append(url);
      }
 
+  QString device = args->getOption("device");
+  if (device == "default")
+    device = QString::null;
+  else if (device.startsWith("media:/") || device.startsWith("system:/media/"))
+  {
+    if (device.startsWith("system:/media/"))
+    {
+      device = device.mid(14);
+      device = device.prepend("media:/");
+    }
+    KURL devicePath(device);
+    DCOPRef mediamanager("kded","mediamanager");
+    DCOPReply reply = mediamanager.call("properties(QString)",devicePath.path(-1).mid(1));
+    if (reply.isValid())
+    {
+      QStringList properties = reply;
+      device = properties[5];
+    }
+    else
+      device = QString::null;
+  }
+
   if (m_kaffeine)  /* still running */
   {
     kdDebug() << "KaffeineApp: Kaffeine is still running..." << endl;
     if (urls.count() > 0)  /* send urls to running instance */
     {
+       m_kaffeine->setDevice(device);
        m_kaffeine->loadTMP(urls);
        QTimer::singleShot(300, m_kaffeine, SLOT(slotSwitchToPlayerWindow())); // delay for feeling only
     }
@@ -92,23 +116,6 @@ int KaffeineApp::newInstance()
   if (args->isSet("verbose"))
     engineParameters.append("verbose=\"True\"");
 
-  QString device = args->getOption("device");
-  if (device == "default")
-    device = QString::null;
-  else if (device.startsWith("media:/"))
-  {
-    KURL devicePath(device);
-    DCOPRef mediamanager("kded","mediamanager");
-    DCOPReply reply = mediamanager.call("properties(QString)",devicePath.path(-1).mid(1));
-    if (reply.isValid())
-    {
-      QStringList properties = reply;
-      device = properties[5];
-    }
-    else
-      device = QString::null;
-  }
-
   m_kaffeine = new Kaffeine(urls, engineParameters, device, args->isSet("play"), args->isSet("fullscreen"),
                             args->isSet("wizard"), 0, "kaffeine_mainview");
   m_kaffeine->show();
openSUSE Build Service is sponsored by