1 /*************************************************************************
9 * The Contents of this file are made available subject to the terms of
10 * either of the following licenses
12 * - GNU Lesser General Public License Version 2.1
13 * - Sun Industry Standards Source License Version 1.1
15 * Sun Microsystems Inc., October, 2000
17 * GNU Lesser General Public License Version 2.1
18 * =============================================
19 * Copyright 2000 by Sun Microsystems, Inc.
20 * 901 San Antonio Road, Palo Alto, CA 94303, USA
22 * This library is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU Lesser General Public
24 * License version 2.1, as published by the Free Software Foundation.
26 * This library is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 * Lesser General Public License for more details.
31 * You should have received a copy of the GNU Lesser General Public
32 * License along with this library; if not, write to the Free Software
33 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
37 * Sun Industry Standards Source License Version 1.1
38 * =================================================
39 * The contents of this file are subject to the Sun Industry Standards
40 * Source License Version 1.1 (the "License"); You may not use this file
41 * except in compliance with the License. You may obtain a copy of the
42 * License at http://www.openoffice.org/license.html.
44 * Software provided under this License is provided on an "AS IS" basis,
45 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
46 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
47 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
48 * See the License for the specific provisions governing your rights and
49 * obligations concerning the Software.
51 * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
53 * Copyright: 2000 by Sun Microsystems, Inc.
55 * All Rights Reserved.
57 * Contributor(s): Jan Holesovsky <kendy@openoffice.org>
60 ************************************************************************/
62 #ifndef _KDEFILEPICKER_HXX_
63 #define _KDEFILEPICKER_HXX_
65 #include <kfiledialog.h>
66 #include <kfilefiltercombo.h>
72 class FileDialog
: public KFileDialog
77 typedef QPair
< QString
, QString
> FilterEntry
;
78 typedef QValueList
< FilterEntry
> FilterList
;
80 QVBox
*m_pCustomWidget
;
81 QHBox
*m_pCombosAndButtons
;
85 QVBox
*m_pPushButtons
;
89 FilterList m_aFilters
;
91 /** Are we a "Save As" dialog?
93 * We cannot use KFileDialog::setOperationMode() here, because then
94 * it automatically adds an "Automatically select filename extension"
95 * check box, and completely destroys the dialog's layout
96 * (custom list boxes are under this check box, which looks ugly).
101 bool m_bCanNotifySelection
;
104 FileDialog( const QString
&startDir
, const QString
&filter
,
105 QWidget
*parent
, const char *name
);
106 virtual ~FileDialog();
109 virtual void resizeEvent( QResizeEvent
*pEvent
);
110 virtual void showEvent( QShowEvent
*pEvent
);
111 void updateCustomWidgetLayout();
113 virtual void customEvent( QCustomEvent
*pEvent
);
116 void appendControl( const QString
&rId
, const QString
&rType
, const QString
&rTitle
);
117 QWidget
* findControl( const QString
&rId
) const;
118 void enableControl( const QString
&rId
, const QString
&rValue
);
119 void getValue( const QString
&rId
, const QString
&rAction
);
120 void setValue( const QString
&rId
, const QString
&rAction
, const QStringList
&rValue
);
122 void appendFilter( const QString
&rTitle
, const QString
&rFilter
);
123 QString
filters() const;
124 QString
addExtension( const QString
&rFileName
) const;
126 void setIsSave( bool bIsSave
) { m_bIsSave
= bIsSave
; }
127 bool isSave( void ) const { return m_bIsSave
; }
129 void setIsExecuting( bool bIsExecuting
) { m_bIsExecuting
= bIsExecuting
; }
130 bool isExecuting( void ) const { return m_bIsExecuting
; }
132 bool isSupportedProtocol( const QString
&rProtocol
) const;
133 KURL
mostLocalURL( const KURL
&rURL
) const;
134 QString
localCopy( const QString
&rFileName
) const;
136 void setCanNotifySelection( bool bCanNotifySelection
) { m_bCanNotifySelection
= bCanNotifySelection
; }
137 bool canNotifySelection( void ) const { return m_bCanNotifySelection
; }
140 void fileHighlightedCommand( const QString
& );
141 void selectionChangedCommand();
144 void sendCommand( const QString
&rCommand
);
145 void appendURL( QString
&rBuffer
, const KURL
&rURL
);
146 void appendEscaped( QString
&rBuffer
, const QString
&rString
);
147 QString
escapeString( const QString
&rString
);
150 class FileFilterComboHack
: public KFileFilterCombo
153 void setCurrentFilter( const QString
& filter
);
156 #endif // _KDEFILEPICKER_HXX_