update dev300-m58
[ooovba.git] / applied_patches / 0283-fpicker-kde-dialog.diff
blob181d0bb7dac3db220a7ba7f092a6613be26d9c2a
1 --- /dev/null 2004-04-06 15:27:52.000000000 +0200
2 +++ fpicker/source/unx/kde/kdecommandthread.cxx 2004-06-21 17:38:20.886719904 +0200
3 @@ -0,0 +1,208 @@
4 +/*************************************************************************
5 + *
6 + *
7 + *
8 + *
9 + *
10 + *
11 + *
12 + * The Contents of this file are made available subject to the terms of
13 + * either of the following licenses
14 + *
15 + * - GNU Lesser General Public License Version 2.1
16 + * - Sun Industry Standards Source License Version 1.1
17 + *
18 + * Sun Microsystems Inc., October, 2000
19 + *
20 + * GNU Lesser General Public License Version 2.1
21 + * =============================================
22 + * Copyright 2000 by Sun Microsystems, Inc.
23 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
24 + *
25 + * This library is free software; you can redistribute it and/or
26 + * modify it under the terms of the GNU Lesser General Public
27 + * License version 2.1, as published by the Free Software Foundation.
28 + *
29 + * This library is distributed in the hope that it will be useful,
30 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
32 + * Lesser General Public License for more details.
33 + *
34 + * You should have received a copy of the GNU Lesser General Public
35 + * License along with this library; if not, write to the Free Software
36 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
37 + * MA 02111-1307 USA
38 + *
39 + *
40 + * Sun Industry Standards Source License Version 1.1
41 + * =================================================
42 + * The contents of this file are subject to the Sun Industry Standards
43 + * Source License Version 1.1 (the "License"); You may not use this file
44 + * except in compliance with the License. You may obtain a copy of the
45 + * License at http://www.openoffice.org/license.html.
46 + *
47 + * Software provided under this License is provided on an "AS IS" basis,
48 + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
49 + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
50 + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
51 + * See the License for the specific provisions governing your rights and
52 + * obligations concerning the Software.
53 + *
54 + * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
55 + *
56 + * Copyright: 2000 by Sun Microsystems, Inc.
57 + *
58 + * All Rights Reserved.
59 + *
60 + * Contributor(s): Jan Holesovsky <kendy@openoffice.org>
61 + *
62 + *
63 + ************************************************************************/
65 +#include <kdecommandthread.hxx>
67 +#include <qstringlist.h>
69 +#include <kapplication.h>
71 +#include <iostream>
73 +//////////////////////////////////////////////////////////////////////////
74 +// CommandEvent
75 +//////////////////////////////////////////////////////////////////////////
77 +CommandEvent::CommandEvent( const QString &qCommand, QStringList *pStringList )
78 + : QCustomEvent( TypeId, pStringList ),
79 + m_eCommand( Unknown )
81 + struct {
82 + const char *pName;
83 + CommandEventType eType;
84 + } *pIdx, pMapping[] =
85 + {
86 + { "appendControl", AppendControl },
87 + { "enableControl", EnableControl },
88 + { "getValue", GetValue },
89 + { "setValue", SetValue },
90 + { "appendFilter", AppendFilter },
91 + { "appendFilterGroup", AppendFilterGroup },
92 + { "getCurrentFilter", GetCurrentFilter },
93 + { "setCurrentFilter", SetCurrentFilter },
94 + { "getDirectory", GetDirectory },
95 + { "setDirectory", SetDirectory },
96 + { "getFiles", GetFiles },
97 + { "setTitle", SetTitle },
98 + { "setType", SetType },
99 + { "setDefaultName", SetDefaultName },
100 + { "setMultiSelection", SetMultiSelection },
101 + { "exec", Exec },
102 + { 0, Unknown }
103 + };
105 + for ( pIdx = pMapping; pIdx->pName && qCommand != pIdx->pName; ++pIdx )
108 + m_eCommand = pIdx->eType;
111 +//////////////////////////////////////////////////////////////////////////
112 +// CommandThread
113 +//////////////////////////////////////////////////////////////////////////
115 +CommandThread::CommandThread( QWidget *pObject )
116 + : m_pObject( pObject )
120 +CommandThread::~CommandThread()
124 +void CommandThread::run()
126 + QTextIStream qStream( stdin );
127 + qStream.setEncoding( QTextStream::UnicodeUTF8 );
129 + QString qLine;
130 + bool bQuit = false;
131 + while ( !bQuit && !qStream.atEnd() )
133 + qLine = qStream.readLine();
134 + handleCommand( qLine, bQuit );
138 +void CommandThread::handleCommand( const QString &rString, bool &bQuit )
140 + QMutexLocker qMutexLocker( &m_aMutex );
142 +#if OSL_DEBUG_LEVEL > 0
143 + ::std::cerr << "kdefilepicker received: " << rString.latin1() << ::std::endl;
144 +#endif
146 + bQuit = false;
147 + QStringList *pTokens = tokenize( rString );
149 + if ( !pTokens )
150 + return;
151 + if ( pTokens->empty() )
153 + delete pTokens, pTokens = NULL;
154 + return;
157 + QString qCommand = pTokens->front();
158 + pTokens->pop_front();
160 + if ( qCommand == "exit" )
162 + bQuit = true;
163 + kapp->exit();
164 + kapp->wakeUpGuiThread();
166 + else
167 + kapp->postEvent( m_pObject, new CommandEvent( qCommand, pTokens ) );
170 +QStringList* CommandThread::tokenize( const QString &rString )
172 + // Commands look like:
173 + // command arg1 arg2 arg3 ...
174 + // Args may be enclosed in '"', if they contain spaces.
176 + QStringList *pList = new QStringList();
178 + QString qBuffer;
179 + qBuffer.reserve( 1024 );
181 + const QChar *pUnicode = rString.unicode();
182 + const QChar *pEnd = pUnicode + rString.length();
183 + bool bQuoted = false;
185 + for ( ; pUnicode != pEnd; ++pUnicode )
187 + if ( *pUnicode == '\\' )
189 + ++pUnicode;
190 + if ( pUnicode != pEnd )
192 + if ( *pUnicode == 'n' )
193 + qBuffer.append( '\n' );
194 + else
195 + qBuffer.append( *pUnicode );
198 + else if ( *pUnicode == '"' )
199 + bQuoted = !bQuoted;
200 + else if ( *pUnicode == ' ' && !bQuoted )
202 + pList->push_back( qBuffer );
203 + qBuffer.setLength( 0 );
205 + else
206 + qBuffer.append( *pUnicode );
208 + pList->push_back( qBuffer );
210 + return pList;
212 --- /dev/null 2004-04-06 15:27:52.000000000 +0200
213 +++ fpicker/source/unx/kde/kdecommandthread.hxx 2004-06-14 14:37:20.597310272 +0200
214 @@ -0,0 +1,128 @@
215 +/*************************************************************************
223 + * The Contents of this file are made available subject to the terms of
224 + * either of the following licenses
226 + * - GNU Lesser General Public License Version 2.1
227 + * - Sun Industry Standards Source License Version 1.1
229 + * Sun Microsystems Inc., October, 2000
231 + * GNU Lesser General Public License Version 2.1
232 + * =============================================
233 + * Copyright 2000 by Sun Microsystems, Inc.
234 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
236 + * This library is free software; you can redistribute it and/or
237 + * modify it under the terms of the GNU Lesser General Public
238 + * License version 2.1, as published by the Free Software Foundation.
240 + * This library is distributed in the hope that it will be useful,
241 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
242 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
243 + * Lesser General Public License for more details.
245 + * You should have received a copy of the GNU Lesser General Public
246 + * License along with this library; if not, write to the Free Software
247 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
248 + * MA 02111-1307 USA
251 + * Sun Industry Standards Source License Version 1.1
252 + * =================================================
253 + * The contents of this file are subject to the Sun Industry Standards
254 + * Source License Version 1.1 (the "License"); You may not use this file
255 + * except in compliance with the License. You may obtain a copy of the
256 + * License at http://www.openoffice.org/license.html.
258 + * Software provided under this License is provided on an "AS IS" basis,
259 + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
260 + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
261 + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
262 + * See the License for the specific provisions governing your rights and
263 + * obligations concerning the Software.
265 + * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
267 + * Copyright: 2000 by Sun Microsystems, Inc.
269 + * All Rights Reserved.
271 + * Contributor(s): Jan Holesovsky <kendy@openoffice.org>
274 + ************************************************************************/
276 +#ifndef _KDECOMMANDTHREAD_HXX_
277 +#define _KDECOMMANDTHREAD_HXX_
279 +#include <qevent.h>
280 +#include <qmutex.h>
281 +#include <qthread.h>
283 +class CommandEvent : public QCustomEvent
285 +public:
286 + enum CommandEventType {
287 + Unknown = 0,
289 + AppendControl,
290 + EnableControl,
291 + GetValue,
292 + SetValue,
294 + AppendFilter,
295 + AppendFilterGroup,
296 + UpdateFilters,
297 + GetCurrentFilter,
298 + SetCurrentFilter,
300 + GetDirectory,
301 + SetDirectory,
303 + GetFiles,
305 + SetTitle,
306 + SetType,
307 + SetDefaultName,
308 + SetMultiSelection,
310 + Exec
311 + };
312 + static const QEvent::Type TypeId = (QEvent::Type) ( (int) QEvent::User + 42 /*random magic value*/ );
314 +protected:
315 + CommandEventType m_eCommand;
317 +public:
318 + CommandEvent( const QString &qCommand, QStringList *pStringList );
320 + CommandEventType command() const { return m_eCommand; }
321 + QStringList* stringList() { return static_cast< QStringList* >( data() ); }
324 +class CommandThread : public QThread
326 +protected:
327 + QObject *m_pObject;
329 + QMutex m_aMutex;
331 +public:
332 + CommandThread( QWidget *pObject );
333 + virtual ~CommandThread();
335 + virtual void run();
337 +protected:
338 + void handleCommand( const QString &rString, bool &bQuit );
339 + QStringList* tokenize( const QString &rString );
342 +#endif // _KDECOMMANDTHREAD_HXX_
343 --- /dev/null 2004-04-06 15:27:52.000000000 +0200
344 +++ fpicker/source/unx/kde/kdefilepicker.cxx 2004-09-08 17:01:55.270345192 +0200
345 @@ -0,0 +1,630 @@
346 +/*************************************************************************
354 + * The Contents of this file are made available subject to the terms of
355 + * either of the following licenses
357 + * - GNU Lesser General Public License Version 2.1
358 + * - Sun Industry Standards Source License Version 1.1
360 + * Sun Microsystems Inc., October, 2000
362 + * GNU Lesser General Public License Version 2.1
363 + * =============================================
364 + * Copyright 2000 by Sun Microsystems, Inc.
365 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
367 + * This library is free software; you can redistribute it and/or
368 + * modify it under the terms of the GNU Lesser General Public
369 + * License version 2.1, as published by the Free Software Foundation.
371 + * This library is distributed in the hope that it will be useful,
372 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
373 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
374 + * Lesser General Public License for more details.
376 + * You should have received a copy of the GNU Lesser General Public
377 + * License along with this library; if not, write to the Free Software
378 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
379 + * MA 02111-1307 USA
382 + * Sun Industry Standards Source License Version 1.1
383 + * =================================================
384 + * The contents of this file are subject to the Sun Industry Standards
385 + * Source License Version 1.1 (the "License"); You may not use this file
386 + * except in compliance with the License. You may obtain a copy of the
387 + * License at http://www.openoffice.org/license.html.
389 + * Software provided under this License is provided on an "AS IS" basis,
390 + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
391 + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
392 + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
393 + * See the License for the specific provisions governing your rights and
394 + * obligations concerning the Software.
396 + * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
398 + * Copyright: 2000 by Sun Microsystems, Inc.
400 + * All Rights Reserved.
402 + * Contributor(s): Jan Holesovsky <kendy@openoffice.org>
405 + ************************************************************************/
407 +#include <kdecommandthread.hxx>
408 +#include <kdefilepicker.hxx>
410 +#include <qcheckbox.h>
411 +#include <qcombobox.h>
412 +#include <qgrid.h>
413 +#include <qhbox.h>
414 +#include <qlabel.h>
415 +#include <qlayout.h>
416 +#include <qobjectlist.h>
417 +#include <qpushbutton.h>
418 +#include <qvbox.h>
420 +#ifdef QT_NO_EMIT
421 +#define emit
422 +#endif
424 +#include <kdiroperator.h>
425 +#include <kfiledialog.h>
426 +#include <kfilefiltercombo.h>
427 +#include <klocale.h>
428 +#include <kmessagebox.h>
430 +#include <algorithm>
431 +#include <iostream>
433 +//////////////////////////////////////////////////////////////////////////
434 +// FileDialog
435 +//////////////////////////////////////////////////////////////////////////
437 +FileDialog::FileDialog( const QString &startDir, const QString &filter,
438 + QWidget *parent, const char *name )
439 + : KFileDialog( startDir, filter, parent, name, true, m_pCustomWidget = new QVBox() ),
440 + m_pCombosAndButtons( new QHBox( m_pCustomWidget ) ),
441 + m_pLabels( new QVBox( m_pCombosAndButtons ) ),
442 + m_pComboBoxes( new QVBox( m_pCombosAndButtons ) ),
443 + m_pPushButtons( new QVBox( m_pCombosAndButtons ) ),
444 + m_pCheckBoxes( new QGrid( 2, m_pCustomWidget ) ),
445 + m_bIsSave( false ),
446 + m_bCanNotifySelection( true )
448 + connect( this, SIGNAL( fileHighlighted( const QString & ) ),
449 + this, SLOT( fileHighlightedCommand( const QString & ) ) );
451 + connect( this, SIGNAL( selectionChanged() ),
452 + this, SLOT( selectionChangedCommand() ) );
454 + m_pCustomWidget->setSpacing( KDialog::spacingHint() );
455 + m_pCombosAndButtons->setSpacing( KDialog::spacingHint() );
457 + updateCustomWidgetLayout();
460 +FileDialog::~FileDialog()
464 +void FileDialog::resizeEvent( QResizeEvent *pEvent )
466 + KFileDialog::resizeEvent( pEvent );
468 + updateCustomWidgetLayout();
471 +void FileDialog::showEvent( QShowEvent *pEvent )
473 + KFileDialog::showEvent( pEvent );
475 + updateCustomWidgetLayout();
478 +void FileDialog::updateCustomWidgetLayout()
480 + QPoint qReferencePoint = filterWidget->mapTo( this, QPoint( 0, 0 ) );
481 + QPoint qCustomPoint = m_pCustomWidget->mapTo( this, QPoint( 0, 0 ) );
483 + int nLeft = qReferencePoint.x() - qCustomPoint.x();
484 + int nRight = m_pCustomWidget->width() - filterWidget->width() - nLeft;
486 + nLeft -= KDialog::spacingHint();
487 + nRight -= KDialog::spacingHint();
488 + m_pLabels->setFixedWidth( ( nLeft > 0 )? nLeft: 80 );
489 + // FIXME The following call sets the width of m_pPushButtons all right,
490 + // but it also increases the width of m_pComboBoxes rapidly. Can we do
491 + // anything about it?
492 + m_pPushButtons->setFixedWidth( ( nRight > 0 )? nRight: 100 );
495 +void FileDialog::customEvent( QCustomEvent *pEvent )
497 + if ( pEvent && pEvent->type() == CommandEvent::TypeId )
499 + CommandEvent *pCommandEvent = static_cast< CommandEvent* >( pEvent );
500 + QStringList *pStringList = pCommandEvent->stringList();
502 + int nListSize = -1;
503 + if ( pStringList )
504 + nListSize = pStringList->size();
506 + switch ( pCommandEvent->command() )
508 + case CommandEvent::AppendControl:
509 + if ( nListSize >= 3 )
511 + appendControl( (*pStringList)[0], (*pStringList)[1], (*pStringList)[2] );
513 + break;
514 + case CommandEvent::EnableControl:
515 + if ( nListSize >= 2 )
517 + enableControl( (*pStringList)[0], (*pStringList)[1] );
519 + break;
520 + case CommandEvent::GetValue:
521 + if ( nListSize >= 2 )
523 + getValue( (*pStringList)[0], (*pStringList)[1] );
525 + break;
526 + case CommandEvent::SetValue:
527 + if ( nListSize >= 2 )
529 + QStringList qStringList = (*pStringList);
530 + qStringList.pop_front();
531 + qStringList.pop_front();
533 + setValue( (*pStringList)[0], (*pStringList)[1], qStringList );
535 + break;
536 + case CommandEvent::AppendFilter:
537 + if ( nListSize >= 2 )
539 + appendFilter( (*pStringList)[0], (*pStringList)[1] );
541 + // update the filters widget
542 + setFilter( filters() );
544 + break;
545 + case CommandEvent::AppendFilterGroup:
546 + if ( nListSize >= 1 )
548 + QStringList::const_iterator it = pStringList->begin();
549 + ++it; // We ignore the filter group name
551 + while ( it != pStringList->end() )
553 + QString qTitle = *it;
554 + ++it;
555 + if ( it != pStringList->end() )
557 + appendFilter( qTitle, (*it) );
558 + ++it;
562 + // update the filters widget
563 + setFilter( filters() );
565 + break;
566 + case CommandEvent::GetCurrentFilter:
568 + QString qCurrentFilter = filterWidget->currentText();
569 + sendCommand( "currentFilter " + escapeString( qCurrentFilter ) );
571 + break;
572 + case CommandEvent::SetCurrentFilter:
573 + if ( nListSize >= 1 )
575 + static_cast< FileFilterComboHack* >( filterWidget )->setCurrentFilter( pStringList->front() );
577 + break;
578 + case CommandEvent::GetDirectory:
580 + QString qDirectory = baseURL().url();
581 + if ( qDirectory.startsWith( "file:/" ) && qDirectory.mid( 6, 1 ) != "/" )
582 + qDirectory.replace( "file:/", "file:///" );
583 + sendCommand( "currentDirectory " + escapeString( qDirectory ) );
585 + break;
586 + case CommandEvent::SetDirectory:
587 + if ( nListSize >= 1 )
589 + setURL( pStringList->front() );
591 + break;
592 + case CommandEvent::GetFiles:
594 + QString qString;
595 + qString.reserve( 1024 );
597 + qString.append( "files" );
599 + if ( result() == QDialog::Accepted )
601 + KURL::List qList( selectedURLs() );
602 + for ( KURL::List::const_iterator it = qList.begin(); it != qList.end(); ++it )
604 + qString.append( " " );
605 + QString qUrlStr = (*it).url();
606 + if ( qUrlStr.startsWith( "file:/" ) && qUrlStr.mid( 6, 1 ) != "/" )
607 + qUrlStr.replace( "file:/", "file:///" );
608 + appendEscaped( qString, addExtension( qUrlStr ) );
611 + else
613 + // we have to return the selected files anyway
614 + const KFileItemList *pItems = ops->selectedItems();
615 + for ( KFileItemListIterator it( *pItems ); it.current(); ++it )
617 + qString.append( " " );
618 + QString qUrlStr = (*it)->url().url();
619 + if ( qUrlStr.startsWith( "file:/" ) && qUrlStr.mid( 6, 1 ) != "/" )
620 + qUrlStr.replace( "file:/", "file:///" );
621 + appendEscaped( qString, addExtension( qUrlStr ) );
625 + sendCommand( qString );
626 + setCanNotifySelection( true );
628 + break;
629 + case CommandEvent::SetTitle:
630 + if ( nListSize >= 1 )
632 + setCaption( pStringList->front() );
634 + break;
635 + case CommandEvent::SetType:
636 + if ( nListSize >= 1 )
638 + QString qType( pStringList->front() );
639 + if ( qType == "open" )
641 + setIsSave( false );
642 + setCaption( i18n( "Open" ) );
644 + else if ( qType == "save" )
646 + setIsSave( true );
647 + setCaption( i18n( "Save As" ) );
650 + break;
651 + case CommandEvent::SetDefaultName:
652 + if ( nListSize >= 1 )
654 + setKeepLocation( true );
655 + setSelection( pStringList->front() );
657 + break;
658 + case CommandEvent::SetMultiSelection:
659 + if ( nListSize >= 1 )
661 + if ( pStringList->front() == "true" )
662 + setMode( KFile::Files );
663 + else
664 + setMode( KFile::File );
665 + }
666 + break;
667 + case CommandEvent::Exec:
669 + filterWidget->setEditable( false );
670 + QString qSelectedURL;
671 + do {
672 + setCanNotifySelection( true );
673 + exec();
674 + qSelectedURL = addExtension( selectedURL().url() );
675 + } while ( isSave() &&
676 + result() == QDialog::Accepted &&
677 + ( qSelectedURL.startsWith( "file:" ) && QFile::exists( qSelectedURL.mid( 5 ) ) ) &&
678 + KMessageBox::warningYesNo( 0,
679 + i18n( "A file named \"%1\" already exists. "
680 + "Are you sure you want to overwrite it?" ).arg( qSelectedURL ),
681 + i18n( "Overwrite File?" ),
682 + i18n( "Overwrite" ), KStdGuiItem::cancel() ) != KMessageBox::Yes );
684 + if ( result() == QDialog::Accepted )
685 + sendCommand( "accept" );
686 + else
687 + sendCommand( "reject" );
689 + break;
690 + default:
691 + break;
694 + // FIXME Some cleanup of pEvent? delete something, etc.?
698 +void FileDialog::appendControl( const QString &rId, const QString &rType, const QString &rTitle )
700 + QString qLabel( rTitle );
701 + qLabel.replace( '~', '&' );
703 + if ( rType == "checkbox" )
705 + QCheckBox *pCheckBox = new QCheckBox( qLabel, m_pCheckBoxes, rId.utf8() );
707 + pCheckBox->setEnabled( true );
708 + pCheckBox->setChecked( false );
710 + else if ( rType == "listbox" )
712 + QLabel *pComboLabel = new QLabel( qLabel, m_pLabels );
713 + QComboBox *pComboBox = new QComboBox( m_pComboBoxes, rId.utf8() );
715 + pComboLabel->setBuddy( pComboBox );
716 + pComboBox->setEnabled( true );
718 + else if ( rType == "pushbutton" )
720 + QPushButton *pPushButton = new QPushButton( qLabel, m_pPushButtons, rId.utf8() );
721 + pPushButton->setEnabled( true );
725 +QWidget* FileDialog::findControl( const QString &rId ) const
727 + QObjectList *pList = m_pCustomWidget->queryList();
728 + QCString qName( rId.utf8() );
729 + QObjectList::const_iterator it = pList->begin();
731 + for ( ; it != pList->end() && qName != (*it)->name(); ++it )
734 + QWidget *pWidget = NULL;
735 + if ( it != pList->end() )
736 + pWidget = static_cast< QWidget* >( *it );
738 + delete pList;
740 + return pWidget;
743 +void FileDialog::enableControl( const QString &rId, const QString &rValue )
745 + QWidget *pWidget = findControl( rId );
747 + if ( pWidget )
748 + pWidget->setEnabled( rValue.lower() == "true" );
751 +void FileDialog::getValue( const QString &rId, const QString &rAction )
753 + QWidget *pWidget = findControl( rId );
754 + QString qString;
755 + qString.reserve( 1024 );
756 + qString.append( "value" );
758 + if ( pWidget )
760 + QCString qClassName = pWidget->className();
761 + if ( qClassName == "QCheckBox" )
763 + QCheckBox *pCheckBox = static_cast< QCheckBox* >( pWidget );
765 + if ( pCheckBox->isChecked() )
766 + qString.append( " bool true" );
767 + else
768 + qString.append( " bool false" );
770 + else if ( qClassName == "QComboBox" )
772 + QComboBox *pComboBox = static_cast< QComboBox* >( pWidget );
773 + if ( rAction == "getItems" )
775 + qString.append( " stringList" );
776 + for ( int nIdx = 0; nIdx < pComboBox->count(); ++nIdx )
778 + qString.append( ' ' );
779 + appendEscaped( qString, pComboBox->text( nIdx ) );
782 + else if ( rAction == "getSelectedItem" )
784 + qString.append( " string " );
785 + appendEscaped( qString, pComboBox->currentText() );
787 + else if ( rAction == "getSelectedItemIndex" )
789 + qString.append( " int " );
790 + qString.append( QString().setNum( pComboBox->currentItem() ) );
792 + // TODO getHelpURL
794 + // TODO push button
797 + sendCommand( qString );
800 +void FileDialog::setValue( const QString &rId, const QString &rAction, const QStringList &rValue )
802 + QWidget *pWidget = findControl( rId );
804 + if ( pWidget )
806 + QCString qClassName = pWidget->className();
807 + if ( qClassName == "QCheckBox" )
809 + QCheckBox *pCheckBox = static_cast< QCheckBox* >( pWidget );
811 + bool bValue = ( !rValue.isEmpty() ) && ( rValue.front().lower() == "true" );
812 + pCheckBox->setChecked( bValue );
814 + else if ( qClassName == "QComboBox" )
816 + QComboBox *pComboBox = static_cast< QComboBox* >( pWidget );
817 + if ( rAction == "addItem" )
819 + if ( !rValue.isEmpty() )
820 + pComboBox->insertItem( rValue.front() );
822 + else if ( rAction == "addItems" )
824 + pComboBox->insertStringList( rValue );
826 + else if ( rAction == "deleteItem" )
828 + if ( !rValue.isEmpty() )
829 + pComboBox->removeItem( rValue.front().toInt() );
831 + else if ( rAction == "deleteItems" )
833 + pComboBox->clear();
835 + else if ( rAction == "setSelectedItem" )
837 + if ( !rValue.isEmpty() )
838 + pComboBox->setCurrentItem( rValue.front().toInt() );
840 + // FIXME setHelpURL is ignored
842 + // TODO push button
846 +void FileDialog::appendFilter( const QString &rTitle, const QString &rFilter )
848 + // Filters are separated by ';'
849 + QString qFilter( rFilter );
850 + qFilter.replace( QChar( ';' ), QChar( ' ' ) ).replace( "*.*", "*" );
852 + m_aFilters.push_back( qMakePair( rTitle, qFilter ) );
855 +QString FileDialog::filters() const
857 + QString qString, qTmp;
858 + bool bFirstFilter = true;
860 + for ( FilterList::const_iterator it = m_aFilters.begin(); it != m_aFilters.end(); ++it )
862 + if ( bFirstFilter )
863 + bFirstFilter = false;
864 + else
865 + qString.append( '\n' );
867 + qString.append( (*it).second );
868 + qString.append( '|' );
870 + qTmp = (*it).first;
871 + qString.append( qTmp.replace( '/', "\\/" ) );
874 + return qString;
877 +QString FileDialog::addExtension( const QString &rFileName ) const
879 + if ( !isSave() )
880 + return rFileName;
882 + QString qExtension;
884 + QWidget *pExtensionWidget = findControl( "100" ); // CHECKBOX_AUTOEXTENSION
885 + QCheckBox *pExtensionCB = pExtensionWidget? static_cast< QCheckBox* >( pExtensionWidget->qt_cast( "QCheckBox" ) ): NULL;
886 + if ( pExtensionCB && pExtensionCB->isChecked() )
888 + // FIXME: qFilter can be a MIME; we ignore it now...
889 + QStringList qFilterList = QStringList::split( " ", currentFilter() );
890 + for ( QStringList::const_iterator it = qFilterList.begin();
891 + qExtension.isEmpty() && it != qFilterList.end();
892 + ++it )
894 + int nUnwanted = (*it).findRev( '*' );
895 + if ( nUnwanted < 0 )
896 + nUnwanted = (*it).findRev( '?' );
897 + else
898 + nUnwanted = ::std::max( nUnwanted, (*it).find( '?', nUnwanted ) );
900 + int nIdx = (*it).find( '.', ::std::max( nUnwanted, 0 ) );
901 + if ( nIdx >= 0 )
902 + qExtension = (*it).mid( nIdx ).lower();
906 + if ( qExtension.isEmpty() || qExtension == "." || rFileName.endsWith( qExtension ) )
907 + return rFileName;
908 + else
909 + return rFileName + qExtension;
912 +void FileDialog::fileHighlightedCommand( const QString & )
914 + if ( canNotifySelection() )
916 + sendCommand( "fileSelectionChanged" );
917 + setCanNotifySelection( false );
921 +void FileDialog::selectionChangedCommand()
923 + if ( canNotifySelection() )
925 + sendCommand( "fileSelectionChanged" );
926 + setCanNotifySelection( false );
930 +void FileDialog::sendCommand( const QString &rCommand )
932 +#if OSL_DEBUG_LEVEL > 0
933 + ::std::cerr << "kdefilepicker sent: " << rCommand.latin1() << ::std::endl;
934 +#endif
936 + //m_aOutputStream << rCommand << endl;
937 + ::std::cout << rCommand.utf8() << ::std::endl;
940 +void FileDialog::appendEscaped( QString &rBuffer, const QString &rString )
942 + const QChar *pUnicode = rString.unicode();
943 + const QChar *pEnd = pUnicode + rString.length();
945 + rBuffer.append( '"' );
946 + for ( ; pUnicode != pEnd; ++pUnicode )
948 + if ( *pUnicode == '\\' )
949 + rBuffer.append( "\\\\" );
950 + else if ( *pUnicode == '"' )
951 + rBuffer.append( "\\\"" );
952 + else if ( *pUnicode == '\n' )
953 + rBuffer.append( "\\\n" );
954 + else
955 + rBuffer.append( *pUnicode );
957 + rBuffer.append( '"' );
960 +QString FileDialog::escapeString( const QString &rString )
962 + QString qString;
963 + qString.reserve( 2*rString.length() + 2 ); // every char escaped + quotes
965 + appendEscaped( qString, rString );
967 + return qString;
971 +void FileFilterComboHack::setCurrentFilter( const QString& filter )
973 + setCurrentText( filter );
974 + filterChanged();
976 --- /dev/null 2004-04-06 15:27:52.000000000 +0200
977 +++ fpicker/source/unx/kde/kdefilepicker.hxx 2004-06-11 14:03:03.937359576 +0200
978 @@ -0,0 +1,147 @@
979 +/*************************************************************************
987 + * The Contents of this file are made available subject to the terms of
988 + * either of the following licenses
990 + * - GNU Lesser General Public License Version 2.1
991 + * - Sun Industry Standards Source License Version 1.1
993 + * Sun Microsystems Inc., October, 2000
995 + * GNU Lesser General Public License Version 2.1
996 + * =============================================
997 + * Copyright 2000 by Sun Microsystems, Inc.
998 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
1000 + * This library is free software; you can redistribute it and/or
1001 + * modify it under the terms of the GNU Lesser General Public
1002 + * License version 2.1, as published by the Free Software Foundation.
1004 + * This library is distributed in the hope that it will be useful,
1005 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1006 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1007 + * Lesser General Public License for more details.
1009 + * You should have received a copy of the GNU Lesser General Public
1010 + * License along with this library; if not, write to the Free Software
1011 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1012 + * MA 02111-1307 USA
1015 + * Sun Industry Standards Source License Version 1.1
1016 + * =================================================
1017 + * The contents of this file are subject to the Sun Industry Standards
1018 + * Source License Version 1.1 (the "License"); You may not use this file
1019 + * except in compliance with the License. You may obtain a copy of the
1020 + * License at http://www.openoffice.org/license.html.
1022 + * Software provided under this License is provided on an "AS IS" basis,
1023 + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
1024 + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
1025 + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
1026 + * See the License for the specific provisions governing your rights and
1027 + * obligations concerning the Software.
1029 + * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
1031 + * Copyright: 2000 by Sun Microsystems, Inc.
1033 + * All Rights Reserved.
1035 + * Contributor(s): Jan Holesovsky <kendy@openoffice.org>
1038 + ************************************************************************/
1040 +#ifndef _KDEFILEPICKER_HXX_
1041 +#define _KDEFILEPICKER_HXX_
1043 +#include <kfiledialog.h>
1044 +#include <kfilefiltercombo.h>
1046 +class QGrid;
1047 +class QHBox;
1048 +class QVBox;
1050 +class FileDialog : public KFileDialog
1052 + Q_OBJECT
1054 +protected:
1055 + typedef QPair< QString, QString > FilterEntry;
1056 + typedef QValueList< FilterEntry > FilterList;
1058 + QVBox *m_pCustomWidget;
1059 + QHBox *m_pCombosAndButtons;
1061 + QVBox *m_pLabels;
1062 + QVBox *m_pComboBoxes;
1063 + QVBox *m_pPushButtons;
1065 + QGrid *m_pCheckBoxes;
1067 + FilterList m_aFilters;
1069 + /** Are we a "Save As" dialog?
1070 + *
1071 + * We cannot use KFileDialog::setOperationMode() here, because then
1072 + * it automatically adds an "Automatically select filename extension"
1073 + * check box, and completely destroys the dialog's layout
1074 + * (custom list boxes are under this check box, which looks ugly).
1075 + */
1076 + bool m_bIsSave;
1078 + bool m_bCanNotifySelection;
1080 +public:
1081 + FileDialog( const QString &startDir, const QString &filter,
1082 + QWidget *parent, const char *name );
1083 + virtual ~FileDialog();
1085 +protected:
1086 + virtual void resizeEvent( QResizeEvent *pEvent );
1087 + virtual void showEvent( QShowEvent *pEvent );
1088 + void updateCustomWidgetLayout();
1090 + virtual void customEvent( QCustomEvent *pEvent );
1092 +protected:
1093 + void appendControl( const QString &rId, const QString &rType, const QString &rTitle );
1094 + QWidget* findControl( const QString &rId ) const;
1095 + void enableControl( const QString &rId, const QString &rValue );
1096 + void getValue( const QString &rId, const QString &rAction );
1097 + void setValue( const QString &rId, const QString &rAction, const QStringList &rValue );
1099 + void appendFilter( const QString &rTitle, const QString &rFilter );
1100 + QString filters() const;
1101 + QString addExtension( const QString &rFileName ) const;
1103 + void setIsSave( bool bIsSave ) { m_bIsSave = bIsSave; }
1104 + bool isSave( void ) const { return m_bIsSave; }
1106 + void setCanNotifySelection( bool bCanNotifySelection ) { m_bCanNotifySelection = bCanNotifySelection; }
1107 + bool canNotifySelection( void ) const { return m_bCanNotifySelection; }
1109 +protected slots:
1110 + void fileHighlightedCommand( const QString & );
1111 + void selectionChangedCommand();
1113 +protected:
1114 + void sendCommand( const QString &rCommand );
1115 + void appendEscaped( QString &rBuffer, const QString &rString );
1116 + QString escapeString( const QString &rString );
1119 +class FileFilterComboHack : public KFileFilterCombo
1121 +public:
1122 + void setCurrentFilter( const QString& filter );
1125 +#endif // _KDEFILEPICKER_HXX_
1126 --- /dev/null 2004-04-06 15:27:52.000000000 +0200
1127 +++ fpicker/source/unx/kde/kdefpmain.cxx 2004-06-21 17:40:44.786843760 +0200
1128 @@ -0,0 +1,110 @@
1129 +/*************************************************************************
1137 + * The Contents of this file are made available subject to the terms of
1138 + * either of the following licenses
1140 + * - GNU Lesser General Public License Version 2.1
1141 + * - Sun Industry Standards Source License Version 1.1
1143 + * Sun Microsystems Inc., October, 2000
1145 + * GNU Lesser General Public License Version 2.1
1146 + * =============================================
1147 + * Copyright 2000 by Sun Microsystems, Inc.
1148 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
1150 + * This library is free software; you can redistribute it and/or
1151 + * modify it under the terms of the GNU Lesser General Public
1152 + * License version 2.1, as published by the Free Software Foundation.
1154 + * This library is distributed in the hope that it will be useful,
1155 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1156 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1157 + * Lesser General Public License for more details.
1159 + * You should have received a copy of the GNU Lesser General Public
1160 + * License along with this library; if not, write to the Free Software
1161 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1162 + * MA 02111-1307 USA
1165 + * Sun Industry Standards Source License Version 1.1
1166 + * =================================================
1167 + * The contents of this file are subject to the Sun Industry Standards
1168 + * Source License Version 1.1 (the "License"); You may not use this file
1169 + * except in compliance with the License. You may obtain a copy of the
1170 + * License at http://www.openoffice.org/license.html.
1172 + * Software provided under this License is provided on an "AS IS" basis,
1173 + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
1174 + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
1175 + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
1176 + * See the License for the specific provisions governing your rights and
1177 + * obligations concerning the Software.
1179 + * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
1181 + * Copyright: 2000 by Sun Microsystems, Inc.
1183 + * All Rights Reserved.
1185 + * Contributor(s): Jan Holesovsky <kendy@openoffice.org>
1188 + ************************************************************************/
1190 +#include <kdemodalityfilter.hxx>
1191 +#include <kdefilepicker.hxx>
1192 +#include <kdecommandthread.hxx>
1194 +#include <kaboutdata.h>
1195 +#include <kapplication.h>
1196 +#include <kcmdlineargs.h>
1198 +#include <iostream>
1199 +#include <stdlib.h>
1201 +//////////////////////////////////////////////////////////////////////////
1202 +// Main
1203 +//////////////////////////////////////////////////////////////////////////
1205 +int main( int argc, char* argv[] )
1207 + // we fake the name of the application to have "OpenOffice.org" in the
1208 + // title
1209 + KAboutData qAboutData( "kdefilepicker", I18N_NOOP( "OpenOffice.org" ),
1210 + "0.1", I18N_NOOP( "kdefilepicker is an implementation of the KDE file dialog for OpenOffice.org." ),
1211 + KAboutData::License_LGPL,
1212 + "(c) 2004, Jan Holesovsky" );
1213 + qAboutData.addAuthor( "Jan Holesovsky", I18N_NOOP("Original author and current maintainer"), "kendy@openoffice.org" );
1215 + // Let the user see that this does something...
1216 + ::std::cerr << "kdefilepicker, an implementation of KDE file dialog for OOo." << ::std::endl
1217 + << "Type 'exit' and press Enter to finish." << ::std::endl;
1219 + KCmdLineArgs::init( argc, argv, &qAboutData );
1221 + KLocale::setMainCatalogue( "kdialog" );
1223 + KApplication kApplication;
1224 + //ModalityFilter qFilter( /*winid*/ 79691780 );
1226 + FileDialog aFileDialog( NULL, QString(), NULL, "kdefiledialog" );
1228 + CommandThread qCommandThread( &aFileDialog );
1229 + qCommandThread.start();
1231 + kApplication.exec();
1233 + qCommandThread.wait();
1235 + ::std::cout << "exited" << ::std::endl;
1237 + return 0;
1239 --- /dev/null 2004-04-06 15:27:52.000000000 +0200
1240 +++ fpicker/source/unx/kde/kdemodalityfilter.cxx 2004-06-11 14:18:36.003663960 +0200
1241 @@ -0,0 +1,100 @@
1242 +/*************************************************************************
1250 + * The Contents of this file are made available subject to the terms of
1251 + * either of the following licenses
1253 + * - GNU Lesser General Public License Version 2.1
1254 + * - Sun Industry Standards Source License Version 1.1
1256 + * Sun Microsystems Inc., October, 2000
1258 + * GNU Lesser General Public License Version 2.1
1259 + * =============================================
1260 + * Copyright 2000 by Sun Microsystems, Inc.
1261 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
1263 + * This library is free software; you can redistribute it and/or
1264 + * modify it under the terms of the GNU Lesser General Public
1265 + * License version 2.1, as published by the Free Software Foundation.
1267 + * This library is distributed in the hope that it will be useful,
1268 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1269 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1270 + * Lesser General Public License for more details.
1272 + * You should have received a copy of the GNU Lesser General Public
1273 + * License along with this library; if not, write to the Free Software
1274 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1275 + * MA 02111-1307 USA
1278 + * Sun Industry Standards Source License Version 1.1
1279 + * =================================================
1280 + * The contents of this file are subject to the Sun Industry Standards
1281 + * Source License Version 1.1 (the "License"); You may not use this file
1282 + * except in compliance with the License. You may obtain a copy of the
1283 + * License at http://www.openoffice.org/license.html.
1285 + * Software provided under this License is provided on an "AS IS" basis,
1286 + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
1287 + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
1288 + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
1289 + * See the License for the specific provisions governing your rights and
1290 + * obligations concerning the Software.
1292 + * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
1294 + * Copyright: 2000 by Sun Microsystems, Inc.
1296 + * All Rights Reserved.
1298 + * Contributor(s): Jan Holesovsky <kendy@openoffice.org>
1301 + ************************************************************************/
1303 +#include <kdemodalityfilter.hxx>
1305 +#include <kapplication.h>
1306 +#include <kdialogbase.h>
1308 +#include <netwm.h>
1309 +#include <X11/Xlib.h>
1310 +#include <X11/Xutil.h>
1312 +//////////////////////////////////////////////////////////////////////////
1313 +// Modality filter
1314 +//////////////////////////////////////////////////////////////////////////
1316 +ModalityFilter::ModalityFilter( WId nWinId )
1317 + : m_nWinId( nWinId )
1319 + kapp->installEventFilter( this );
1322 +ModalityFilter::~ModalityFilter()
1324 + kapp->removeEventFilter( this );
1327 +bool ModalityFilter::eventFilter( QObject *pObject, QEvent *pEvent )
1329 + if ( pObject->isWidgetType() && pEvent->type() == QEvent::Show )
1331 + KDialogBase* pDlg = ::qt_cast< KDialogBase* >( pObject );
1332 + if ( pDlg != NULL && m_nWinId != 0 )
1334 + XSetTransientForHint( qt_xdisplay(), pDlg->winId(), m_nWinId );
1335 + NETWinInfo aInfo( qt_xdisplay(), pDlg->winId(), qt_xrootwin(), NET::WMState );
1336 + aInfo.setState( NET::Modal, NET::Modal );
1337 + m_nWinId = 0;
1340 + return false;
1342 --- /dev/null 2004-04-06 15:27:52.000000000 +0200
1343 +++ fpicker/source/unx/kde/kdemodalityfilter.hxx 2004-06-11 13:50:46.856412912 +0200
1344 @@ -0,0 +1,79 @@
1345 +/*************************************************************************
1353 + * The Contents of this file are made available subject to the terms of
1354 + * either of the following licenses
1356 + * - GNU Lesser General Public License Version 2.1
1357 + * - Sun Industry Standards Source License Version 1.1
1359 + * Sun Microsystems Inc., October, 2000
1361 + * GNU Lesser General Public License Version 2.1
1362 + * =============================================
1363 + * Copyright 2000 by Sun Microsystems, Inc.
1364 + * 901 San Antonio Road, Palo Alto, CA 94303, USA
1366 + * This library is free software; you can redistribute it and/or
1367 + * modify it under the terms of the GNU Lesser General Public
1368 + * License version 2.1, as published by the Free Software Foundation.
1370 + * This library is distributed in the hope that it will be useful,
1371 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1372 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1373 + * Lesser General Public License for more details.
1375 + * You should have received a copy of the GNU Lesser General Public
1376 + * License along with this library; if not, write to the Free Software
1377 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1378 + * MA 02111-1307 USA
1381 + * Sun Industry Standards Source License Version 1.1
1382 + * =================================================
1383 + * The contents of this file are subject to the Sun Industry Standards
1384 + * Source License Version 1.1 (the "License"); You may not use this file
1385 + * except in compliance with the License. You may obtain a copy of the
1386 + * License at http://www.openoffice.org/license.html.
1388 + * Software provided under this License is provided on an "AS IS" basis,
1389 + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
1390 + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
1391 + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
1392 + * See the License for the specific provisions governing your rights and
1393 + * obligations concerning the Software.
1395 + * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
1397 + * Copyright: 2000 by Sun Microsystems, Inc.
1399 + * All Rights Reserved.
1401 + * Contributor(s): Jan Holesovsky <kendy@openoffice.org>
1404 + ************************************************************************/
1406 +#ifndef _KDEMODALITYFILTER_HXX_
1407 +#define _KDEMODALITYFILTER_HXX_
1409 +#include <qobject.h>
1411 +class ModalityFilter : public QObject
1413 +private:
1414 + WId m_nWinId;
1416 +public:
1417 + ModalityFilter( WId nWinId );
1418 + virtual ~ModalityFilter();
1420 + virtual bool eventFilter( QObject *pObject, QEvent *pEvent );
1423 +#endif // _KDEMODALITYFILTER_HXX_
1424 --- /dev/null 2004-04-06 15:27:52.000000000 +0200
1425 +++ fpicker/source/unx/kde/makefile.mk 2004-06-15 10:53:54.282583408 +0200
1426 @@ -0,0 +1,110 @@
1427 +#*************************************************************************
1435 +# The Contents of this file are made available subject to the terms of
1436 +# either of the following licenses
1438 +# - GNU Lesser General Public License Version 2.1
1439 +# - Sun Industry Standards Source License Version 1.1
1441 +# Sun Microsystems Inc., October, 2000
1443 +# GNU Lesser General Public License Version 2.1
1444 +# =============================================
1445 +# Copyright 2000 by Sun Microsystems, Inc.
1446 +# 901 San Antonio Road, Palo Alto, CA 94303, USA
1448 +# This library is free software; you can redistribute it and/or
1449 +# modify it under the terms of the GNU Lesser General Public
1450 +# License version 2.1, as published by the Free Software Foundation.
1452 +# This library is distributed in the hope that it will be useful,
1453 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
1454 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1455 +# Lesser General Public License for more details.
1457 +# You should have received a copy of the GNU Lesser General Public
1458 +# License along with this library; if not, write to the Free Software
1459 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
1460 +# MA 02111-1307 USA
1463 +# Sun Industry Standards Source License Version 1.1
1464 +# =================================================
1465 +# The contents of this file are subject to the Sun Industry Standards
1466 +# Source License Version 1.1 (the "License"); You may not use this file
1467 +# except in compliance with the License. You may obtain a copy of the
1468 +# License at http://www.openoffice.org/license.html.
1470 +# Software provided under this License is provided on an "AS IS" basis,
1471 +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
1472 +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
1473 +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
1474 +# See the License for the specific provisions governing your rights and
1475 +# obligations concerning the Software.
1477 +# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
1479 +# Copyright: 2000 by Sun Microsystems, Inc.
1481 +# All Rights Reserved.
1483 +# Contributor(s): _______________________________________
1487 +#*************************************************************************
1489 +PRJ=..$/..$/..
1491 +PRJNAME=fpicker
1492 +TARGET=kdefilepicker
1493 +LIBTARGET=NO
1494 +ENABLE_EXCEPTIONS=TRUE
1495 +#COMP1TYPELIST=$(TARGET)
1496 +#COMPRDB=$(SOLARBINDIR)$/types.rdb
1498 +# --- Settings -----------------------------------------------------
1500 +.INCLUDE : settings.mk
1502 +# ------------------------------------------------------------------
1504 +.IF "$(GUIBASE)" != "unx" || "$(ENABLE_KDE)" != "TRUE"
1506 +dummy:
1507 + @echo "Nothing to build. GUIBASE == $(GUIBASE), ENABLE_KDE is not set"
1509 +.ELSE # we build for KDE
1511 +CFLAGS+= $(KDE_CFLAGS)
1513 +# --- Files --------------------------------------------------------
1515 +SLOFILES =\
1516 + $(SLO)$/kdecommandthread.obj \
1517 + $(SLO)$/kdefilepicker.obj \
1518 + $(SLO)$/kdefilepicker.moc.obj \
1519 + $(SLO)$/kdefpmain.obj \
1520 + $(SLO)$/kdemodalityfilter.obj
1522 +APP1TARGET=$(TARGET)
1523 +APP1OBJS=$(SLOFILES)
1524 +APP1STDLIBS=\
1525 + $(SALLIB) \
1526 + $(KDE_LIBS) -lkio
1529 +.ENDIF # "$(GUIBASE)" != "unx" || "$(ENABLE_KDE)" != "TRUE"
1531 +# --- Targets ------------------------------------------------------
1533 +.INCLUDE : target.mk
1535 +$(MISC)$/kdefilepicker.moc.cxx : kdefilepicker.hxx
1536 + $(MOC) $< -o $@