--- fpicker/source/unx/kde/kdefilepicker.cxx	2007-01-11 13:55:36.000000000 +0100
+++ fpicker/source/unx/kde/kdefilepicker.cxx	2007-02-02 15:07:58.000000000 +0100
@@ -345,11 +345,8 @@ void FileDialog::customEvent( QCustomEve
                         setCanNotifySelection( true );
                         exec();
 
-#if KDE_IS_VERSION(3,5,0)
-                        KURL qLocalSelectedURL = KIO::NetAccess::mostLocalURL( selectedURL(), this );
-#else
-                        KURL qLocalSelectedURL( selectedURL() );
-#endif
+                        KURL qLocalSelectedURL = mostLocalURL( selectedURL() );
+
                         qSelectedURL = addExtension( qLocalSelectedURL.url() );
                         QString qProtocol( qLocalSelectedURL.protocol() );
 
@@ -641,13 +638,33 @@ bool FileDialog::isSupportedProtocol( co
     return false;
 }
 
-QString FileDialog::localCopy( const QString &rFileName ) const
+KURL FileDialog::mostLocalURL( const KURL &rURL ) const
 {
 #if KDE_IS_VERSION(3,5,0)
-    KURL qLocalURL = KIO::NetAccess::mostLocalURL( KURL( rFileName ), const_cast<FileDialog*>( this ) );
+    KURL qMostLocalURL( KIO::NetAccess::mostLocalURL( rURL, const_cast<FileDialog*>( this ) ) );
+    if ( qMostLocalURL.isLocalFile() )
+        return qMostLocalURL;
+    else
+    {
+        // Terrible hack to get even non-existing media:// files right
+        qMostLocalURL.cd( ".." );
+        KURL qMostLocalPath( KIO::NetAccess::mostLocalURL( qMostLocalURL, const_cast<FileDialog*>( this ) ) );
+        if ( qMostLocalPath.isLocalFile() )
+        {
+            qMostLocalPath.addPath( rURL.fileName() );
+            return qMostLocalPath;
+        }
+    }
+#endif
+
+    return rURL;
+}
+
+QString FileDialog::localCopy( const QString &rFileName ) const
+{
+    KURL qLocalURL = mostLocalURL( KURL( rFileName ) );
     if ( qLocalURL.isLocalFile() )
         return qLocalURL.url();
-#endif
 
     int nExtensionPos = rFileName.findRev( '/' );
     if ( nExtensionPos >= 0 )
--- fpicker/source/unx/kde/kdefilepicker.hxx	2007-01-11 13:55:36.000000000 +0100
+++ fpicker/source/unx/kde/kdefilepicker.hxx	2007-02-02 14:57:27.000000000 +0100
@@ -130,6 +130,7 @@ protected:
     bool                        isExecuting( void ) const { return m_bIsExecuting; }
 
     bool                        isSupportedProtocol( const QString &rProtocol ) const;
+    KURL                        mostLocalURL( const KURL &rURL ) const;
     QString                     localCopy( const QString &rFileName ) const;
 
     void                        setCanNotifySelection( bool bCanNotifySelection ) { m_bCanNotifySelection = bCanNotifySelection; }
