diff options
-rw-r--r-- | vcl/unx/kde/UnxCommandThread.cxx | 35 | ||||
-rw-r--r-- | vcl/unx/kde/UnxCommandThread.hxx | 1 | ||||
-rw-r--r-- | vcl/unx/kde/fpicker/kdecommandthread.cxx | 1 | ||||
-rw-r--r-- | vcl/unx/kde/fpicker/kdecommandthread.hxx | 1 | ||||
-rw-r--r-- | vcl/unx/kde/fpicker/kdefilepicker.cxx | 31 |
5 files changed, 49 insertions, 20 deletions
diff --git a/vcl/unx/kde/UnxCommandThread.cxx b/vcl/unx/kde/UnxCommandThread.cxx index b7c4a868289d..df3a01499b42 100644 --- a/vcl/unx/kde/UnxCommandThread.cxx +++ b/vcl/unx/kde/UnxCommandThread.cxx @@ -100,34 +100,29 @@ OUString SAL_CALL UnxFilePickerCommandThread::getDirectory() return m_aGetDirectory; } -uno::Sequence< OUString > SAL_CALL UnxFilePickerCommandThread::getFiles() +uno::Sequence< OUString > SAL_CALL UnxFilePickerCommandThread::getSelectedFiles() { ::osl::MutexGuard aGuard( m_aMutex ); sal_Int32 nSize = m_aGetFiles.size(); - uno::Sequence< OUString > aFiles( ( nSize > 1 )? nSize + 1: nSize ); + uno::Sequence< OUString > aFiles( nSize ); - if ( nSize == 1 ) - aFiles[0] = m_aGetFiles.front(); - else if ( nSize > 1 ) + size_t nIdx = 0; + for ( ::std::list< OUString >::const_iterator it = m_aGetFiles.begin(); + it != m_aGetFiles.end(); ++it, ++nIdx ) { - // First entry in the sequence must be the dirname, the others are the - // filenames, so we have to rearrange the list... - - OUString aFront = m_aGetFiles.front(); - sal_Int32 nLastSlash = aFront.lastIndexOf( '/' ); + aFiles[nIdx] = *it; + } - aFiles[0] = ( nLastSlash >= 0 )? aFront.copy( 0, nLastSlash ): OUString(); - ++nLastSlash; + return aFiles; +} +uno::Sequence< OUString > SAL_CALL UnxFilePickerCommandThread::getFiles() +{ + ::osl::MutexGuard aGuard( m_aMutex ); - sal_Int32 nIdx = 1; - for ( ::std::list< OUString >::const_iterator it = m_aGetFiles.begin(); - it != m_aGetFiles.end(); ++it, ++nIdx ) - { - sal_Int32 nLength = (*it).getLength() - nLastSlash; - aFiles[nIdx] = ( nLength >= 0 )? (*it).copy( nLastSlash, nLength ): OUString(); - } - } + uno::Sequence< OUString > aFiles = getSelectedFiles(); + if (aFiles.getLength() > 1) + aFiles.realloc(1); // we just want the first entry here return aFiles; } diff --git a/vcl/unx/kde/UnxCommandThread.hxx b/vcl/unx/kde/UnxCommandThread.hxx index c2571c588a21..da17b60001c3 100644 --- a/vcl/unx/kde/UnxCommandThread.hxx +++ b/vcl/unx/kde/UnxCommandThread.hxx @@ -109,6 +109,7 @@ public: OUString SAL_CALL getDirectory(); ::osl::Condition& SAL_CALL getFilesCondition() { return m_aGetFilesCondition; } + ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSelectedFiles(); ::com::sun::star::uno::Sequence< OUString > SAL_CALL getFiles(); ::osl::Condition& SAL_CALL getValueCondition() { return m_aGetValueCondition; } diff --git a/vcl/unx/kde/fpicker/kdecommandthread.cxx b/vcl/unx/kde/fpicker/kdecommandthread.cxx index 6f4411791a96..b30f3e72e314 100644 --- a/vcl/unx/kde/fpicker/kdecommandthread.cxx +++ b/vcl/unx/kde/fpicker/kdecommandthread.cxx @@ -57,6 +57,7 @@ KDECommandEvent::KDECommandEvent( const QString &qCommand, QStringList *pStringL { "getDirectory", GetDirectory }, { "setDirectory", SetDirectory }, { "getFiles", GetFiles }, + { "getSelectedFiles", GetSelectedFiles }, { "setTitle", SetTitle }, { "setType", SetType }, { "setDefaultName", SetDefaultName }, diff --git a/vcl/unx/kde/fpicker/kdecommandthread.hxx b/vcl/unx/kde/fpicker/kdecommandthread.hxx index b795b1828186..a0f10236b344 100644 --- a/vcl/unx/kde/fpicker/kdecommandthread.hxx +++ b/vcl/unx/kde/fpicker/kdecommandthread.hxx @@ -60,6 +60,7 @@ public: SetDirectory, GetFiles, + GetSelectedFiles, SetTitle, SetType, diff --git a/vcl/unx/kde/fpicker/kdefilepicker.cxx b/vcl/unx/kde/fpicker/kdefilepicker.cxx index e2baaae6a5cd..766bd38e9893 100644 --- a/vcl/unx/kde/fpicker/kdefilepicker.cxx +++ b/vcl/unx/kde/fpicker/kdefilepicker.cxx @@ -330,6 +330,37 @@ void KDEFileDialog::customEvent( QCustomEvent *pEvent ) { KURL::List qList( selectedURLs() ); for ( KURL::List::const_iterator it = qList.begin(); it != qList.end(); ++it ) + { + appendURL( qString, (*it) ); + break; // we just want the first element + } + } + else + { + // we have to return the selected files anyway + const KFileItemList *pItems = ops->selectedItems(); + for ( KFileItemListIterator it( *pItems ); it.current(); ++it ) + { + appendURL( qString, (*it)->url() ); + break; // we just want the first element + } + } + + sendCommand( qString ); + setCanNotifySelection( true ); + } + break; + case KDECommandEvent::GetSelectedFiles: + { + QString qString; + qString.reserve( 1024 ); + + qString.append( "files" ); + + if ( result() == QDialog::Accepted ) + { + KURL::List qList( selectedURLs() ); + for ( KURL::List::const_iterator it = qList.begin(); it != qList.end(); ++it ) appendURL( qString, (*it) ); } else |