Version 4.2.0.1, tag libreoffice-4.2.0.1
[LibreOffice.git] / vcl / unx / kde / fpicker / kdefilepicker.hxx
blob173e242f5cf10295aec10cba9b46efb0eff4e10a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_UNX_KDE_FPICKER_KDEFILEPICKER_HXX
21 #define INCLUDED_VCL_UNX_KDE_FPICKER_KDEFILEPICKER_HXX
23 #include <config_vclplug.h>
25 #if ENABLE_TDE
26 #include <shell/tde_defines.h>
27 #endif // ENABLE_TDE
29 #include <cstddef>
31 #if ENABLE_TDE
32 #include <tdefiledialog.h>
33 #include <tdefilefiltercombo.h>
34 #else // ENABLE_TDE
35 #include <kfiledialog.h>
36 #include <kfilefiltercombo.h>
37 #endif // ENABLE_TDE
39 class QGrid;
40 class QHBox;
41 class QVBox;
43 class KDEFileDialog : public KFileDialog
45 #if ENABLE_TDE
46 TQ_OBJECT
47 #else // ENABLE_TDE
48 Q_OBJECT
49 #endif // ENABLE_TDE
51 protected:
52 typedef QPair< QString, QString > FilterEntry;
53 typedef QValueList< FilterEntry > FilterList;
55 QVBox *m_pCustomWidget;
56 QHBox *m_pCombosAndButtons;
58 QVBox *m_pLabels;
59 QVBox *m_pComboBoxes;
60 QVBox *m_pPushButtons;
62 QGrid *m_pCheckBoxes;
64 FilterList m_aFilters;
66 /** Are we a "Save As" dialog?
68 * We cannot use KFileDialog::setOperationMode() here, because then
69 * it automatically adds an "Automatically select filename extension"
70 * check box, and completely destroys the dialog's layout
71 * (custom list boxes are under this check box, which looks ugly).
73 bool m_bIsSave;
74 bool m_bIsExecuting;
76 bool m_bCanNotifySelection;
78 public:
79 KDEFileDialog( const QString &startDir, const QString &filter,
80 QWidget *parent, const char *name );
81 virtual ~KDEFileDialog();
83 protected:
84 virtual void resizeEvent( QResizeEvent *pEvent );
85 virtual void showEvent( QShowEvent *pEvent );
86 void updateCustomWidgetLayout();
88 virtual void customEvent( QCustomEvent *pEvent );
90 protected:
91 void appendControl( const QString &rId, const QString &rType, const QString &rTitle );
92 QWidget* findControl( const QString &rId ) const;
93 void enableControl( const QString &rId, const QString &rValue );
94 void getValue( const QString &rId, const QString &rAction );
95 void setValue( const QString &rId, const QString &rAction, const QStringList &rValue );
97 void appendFilter( const QString &rTitle, const QString &rFilter );
98 QString filters() const;
99 QString addExtension( const QString &rFileName ) const;
101 void setIsSave( bool bIsSave ) { m_bIsSave = bIsSave; }
102 bool isSave( void ) const { return m_bIsSave; }
104 void setIsExecuting( bool bIsExecuting ) { m_bIsExecuting = bIsExecuting; }
105 bool isExecuting( void ) const { return m_bIsExecuting; }
107 bool isSupportedProtocol( const QString &rProtocol ) const;
108 KURL mostLocalURL( const KURL &rURL ) const;
109 QString localCopy( const QString &rFileName ) const;
111 void setCanNotifySelection( bool bCanNotifySelection ) { m_bCanNotifySelection = bCanNotifySelection; }
112 bool canNotifySelection( void ) const { return m_bCanNotifySelection; }
114 protected slots:
115 // Qt3 moc does not really understand #ifdef and would process both slots,
116 // so the FILTER_OUT_FOO tags are used to remove some slots before moc sees them.
117 #if ENABLE_TDE
118 void fileHighlightedCommand( const TQString & ); // FILTER_OUT_TDE
119 #else // ENABLE_TDE
120 void fileHighlightedCommand( const QString & ); // FILTER_OUT_KDE
121 #endif // ENABLE_TDE
122 void selectionChangedCommand();
124 protected:
125 void sendCommand( const QString &rCommand );
126 void appendURL( QString &rBuffer, const KURL &rURL );
127 void appendEscaped( QString &rBuffer, const QString &rString );
128 QString escapeString( const QString &rString );
131 class KDEFileFilterComboHack : public KFileFilterCombo
133 public:
134 void setCurrentFilter( const QString& filter );
137 #endif // INCLUDED_VCL_UNX_KDE_FPICKER_KDEFILEPICKER_HXX
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */