update dev300-m58
[ooovba.git] / applied_patches / 0291-fpicker-kde-non-utf8.diff
blob85015387fee8b18de541324287068e99e2a0438a
1 --- fpicker/source/unx/kde/kdefilepicker.cxx 2007-07-03 17:16:36.000000000 +0200
2 +++ fpicker/source/unx/kde/kdefilepicker.cxx 2007-07-03 19:32:57.000000000 +0200
3 @@ -260,38 +260,14 @@ void FileDialog::customEvent( QCustomEve
5 KURL::List qList( selectedURLs() );
6 for ( KURL::List::const_iterator it = qList.begin(); it != qList.end(); ++it )
7 - {
8 - qString.append( " " );
9 - QString qUrlStr = addExtension( (*it).url() );
11 - if ( !isExecuting() && !isSupportedProtocol( KURL( qUrlStr ).protocol() ) )
12 - qUrlStr = localCopy( qUrlStr );
14 - if ( qUrlStr.startsWith( "file:/" ) && qUrlStr.mid( 6, 1 ) != "/" )
15 - qUrlStr.replace( "file:/", "file:///" );
17 - if ( !qUrlStr.isEmpty() )
18 - appendEscaped( qString, qUrlStr );
19 - }
20 + appendURL( qString, (*it) );
22 else
24 // we have to return the selected files anyway
25 const KFileItemList *pItems = ops->selectedItems();
26 for ( KFileItemListIterator it( *pItems ); it.current(); ++it )
27 - {
28 - qString.append( " " );
29 - QString qUrlStr = addExtension( (*it)->url().url() );
31 - if ( !isExecuting() && !isSupportedProtocol( KURL( qUrlStr ).protocol() ) )
32 - qUrlStr = localCopy( qUrlStr );
34 - if ( qUrlStr.startsWith( "file:/" ) && qUrlStr.mid( 6, 1 ) != "/" )
35 - qUrlStr.replace( "file:/", "file:///" );
37 - if ( !qUrlStr.isEmpty() )
38 - appendEscaped( qString, qUrlStr );
39 - }
40 + appendURL( qString, (*it)->url() );
43 sendCommand( qString );
44 @@ -662,7 +639,8 @@ KURL FileDialog::mostLocalURL( const KUR
46 QString FileDialog::localCopy( const QString &rFileName ) const
48 - KURL qLocalURL = mostLocalURL( KURL( rFileName ) );
49 + // 106 == MIB enum for UTF-8
50 + KURL qLocalURL = mostLocalURL( KURL( rFileName, 106 ) );
51 if ( qLocalURL.isLocalFile() )
52 return qLocalURL.url();
54 @@ -713,6 +691,28 @@ void FileDialog::sendCommand( const QStr
55 ::std::cout << rCommand.utf8() << ::std::endl;
58 +void FileDialog::appendURL( QString &rBuffer, const KURL &rURL )
60 + // From Martin Kretzschmar:
61 + // file:///path/to/test%E0.odt is not a valid URL from OOo's point of
62 + // view. (?Most modern parts of?) OOo assume(s) that the URL contains only
63 + // ASCII characters (which test%E0.odt does) and is UTF-8 after unescaping
64 + // (which file:///path/test%E0.odt is not).
65 + // Cf. the comment in sal/inc/osl/file.h.
66 + // 106 == MIB enum for UTF-8
67 + QString qUrlStr = addExtension( rURL.url( 0, 106 ) );
69 + if ( !isExecuting() && !isSupportedProtocol( rURL.protocol() ) )
70 + qUrlStr = localCopy( qUrlStr );
72 + if ( qUrlStr.startsWith( "file:/" ) && qUrlStr.mid( 6, 1 ) != "/" )
73 + qUrlStr.replace( "file:/", "file:///" );
75 + rBuffer.append( " " );
76 + if ( !qUrlStr.isEmpty() )
77 + appendEscaped( rBuffer, qUrlStr );
80 void FileDialog::appendEscaped( QString &rBuffer, const QString &rString )
82 const QChar *pUnicode = rString.unicode();
83 --- fpicker/source/unx/kde/kdefilepicker.hxx 2007-07-03 11:35:37.000000000 +0200
84 +++ fpicker/source/unx/kde/kdefilepicker.hxx 2007-07-03 19:10:58.000000000 +0200
85 @@ -142,6 +142,7 @@ protected slots:
87 protected:
88 void sendCommand( const QString &rCommand );
89 + void appendURL( QString &rBuffer, const KURL &rURL );
90 void appendEscaped( QString &rBuffer, const QString &rString );
91 QString escapeString( const QString &rString );