merge the formfield patch from ooo-build
[ooovba.git] / applied_patches / 0287-fpicker-kde-local-media2.diff
blob24aa208d59d031830db5e2d0968e533c028c7ac6
1 --- fpicker/source/unx/kde/kdefilepicker.cxx 2007-01-11 13:55:36.000000000 +0100
2 +++ fpicker/source/unx/kde/kdefilepicker.cxx 2007-02-02 15:07:58.000000000 +0100
3 @@ -345,11 +345,8 @@ void FileDialog::customEvent( QCustomEve
4 setCanNotifySelection( true );
5 exec();
7 -#if KDE_IS_VERSION(3,5,0)
8 - KURL qLocalSelectedURL = KIO::NetAccess::mostLocalURL( selectedURL(), this );
9 -#else
10 - KURL qLocalSelectedURL( selectedURL() );
11 -#endif
12 + KURL qLocalSelectedURL = mostLocalURL( selectedURL() );
14 qSelectedURL = addExtension( qLocalSelectedURL.url() );
15 QString qProtocol( qLocalSelectedURL.protocol() );
17 @@ -641,13 +638,33 @@ bool FileDialog::isSupportedProtocol( co
18 return false;
21 -QString FileDialog::localCopy( const QString &rFileName ) const
22 +KURL FileDialog::mostLocalURL( const KURL &rURL ) const
24 #if KDE_IS_VERSION(3,5,0)
25 - KURL qLocalURL = KIO::NetAccess::mostLocalURL( KURL( rFileName ), const_cast<FileDialog*>( this ) );
26 + KURL qMostLocalURL( KIO::NetAccess::mostLocalURL( rURL, const_cast<FileDialog*>( this ) ) );
27 + if ( qMostLocalURL.isLocalFile() )
28 + return qMostLocalURL;
29 + else
30 + {
31 + // Terrible hack to get even non-existing media:// files right
32 + qMostLocalURL.cd( ".." );
33 + KURL qMostLocalPath( KIO::NetAccess::mostLocalURL( qMostLocalURL, const_cast<FileDialog*>( this ) ) );
34 + if ( qMostLocalPath.isLocalFile() )
35 + {
36 + qMostLocalPath.addPath( rURL.fileName() );
37 + return qMostLocalPath;
38 + }
39 + }
40 +#endif
42 + return rURL;
45 +QString FileDialog::localCopy( const QString &rFileName ) const
47 + KURL qLocalURL = mostLocalURL( KURL( rFileName ) );
48 if ( qLocalURL.isLocalFile() )
49 return qLocalURL.url();
50 -#endif
52 int nExtensionPos = rFileName.findRev( '/' );
53 if ( nExtensionPos >= 0 )
54 --- fpicker/source/unx/kde/kdefilepicker.hxx 2007-01-11 13:55:36.000000000 +0100
55 +++ fpicker/source/unx/kde/kdefilepicker.hxx 2007-02-02 14:57:27.000000000 +0100
56 @@ -130,6 +130,7 @@ protected:
57 bool isExecuting( void ) const { return m_bIsExecuting; }
59 bool isSupportedProtocol( const QString &rProtocol ) const;
60 + KURL mostLocalURL( const KURL &rURL ) const;
61 QString localCopy( const QString &rFileName ) const;
63 void setCanNotifySelection( bool bCanNotifySelection ) { m_bCanNotifySelection = bCanNotifySelection; }