Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / vcl / unx / kde / fpicker / kdefilepicker.hxx
blobb586ae9a448921907ba12a4dd71eaa074f28ca3c
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 <sal/config.h>
25 #include <config_vclplug.h>
26 #include <sal/types.h>
28 #if ENABLE_TDE
29 #include <shell/tde_defines.h>
30 #endif // ENABLE_TDE
32 #include <cstddef>
34 #if ENABLE_TDE
35 #include <tdefiledialog.h>
36 #include <tdefilefiltercombo.h>
37 #else // ENABLE_TDE
38 #include <kfiledialog.h>
39 #include <kfilefiltercombo.h>
40 #endif // ENABLE_TDE
42 class QGrid;
43 class QHBox;
44 class QVBox;
46 class KDEFileDialog : public KFileDialog
48 #if ENABLE_TDE
49 TQ_OBJECT
50 #else // ENABLE_TDE
51 Q_OBJECT
52 #endif // ENABLE_TDE
54 protected:
55 typedef QPair< QString, QString > FilterEntry;
56 typedef QValueList< FilterEntry > FilterList;
58 QVBox *m_pCustomWidget;
59 QHBox *m_pCombosAndButtons;
61 QVBox *m_pLabels;
62 QVBox *m_pComboBoxes;
63 QVBox *m_pPushButtons;
65 QGrid *m_pCheckBoxes;
67 FilterList m_aFilters;
69 /** Are we a "Save As" dialog?
71 * We cannot use KFileDialog::setOperationMode() here, because then
72 * it automatically adds an "Automatically select filename extension"
73 * check box, and completely destroys the dialog's layout
74 * (custom list boxes are under this check box, which looks ugly).
76 bool m_bIsSave;
77 bool m_bIsExecuting;
79 bool m_bCanNotifySelection;
81 public:
82 KDEFileDialog( const QString &startDir, const QString &filter,
83 QWidget *parent, const char *name );
84 virtual ~KDEFileDialog();
86 protected:
87 virtual void resizeEvent( QResizeEvent *pEvent ) SAL_OVERRIDE;
88 virtual void showEvent( QShowEvent *pEvent ) SAL_OVERRIDE;
89 void updateCustomWidgetLayout();
91 virtual void customEvent( QCustomEvent *pEvent ) SAL_OVERRIDE;
93 protected:
94 void appendControl( const QString &rId, const QString &rType, const QString &rTitle );
95 QWidget* findControl( const QString &rId ) const;
96 void enableControl( const QString &rId, const QString &rValue );
97 void getValue( const QString &rId, const QString &rAction );
98 void setValue( const QString &rId, const QString &rAction, const QStringList &rValue );
100 void appendFilter( const QString &rTitle, const QString &rFilter );
101 QString filters() const;
102 QString addExtension( const QString &rFileName ) const;
104 void setIsSave( bool bIsSave ) { m_bIsSave = bIsSave; }
105 bool isSave( void ) const { return m_bIsSave; }
107 void setIsExecuting( bool bIsExecuting ) { m_bIsExecuting = bIsExecuting; }
108 bool isExecuting( void ) const { return m_bIsExecuting; }
110 bool isSupportedProtocol( const QString &rProtocol ) const;
111 KURL mostLocalURL( const KURL &rURL ) const;
112 QString localCopy( const QString &rFileName ) const;
114 void setCanNotifySelection( bool bCanNotifySelection ) { m_bCanNotifySelection = bCanNotifySelection; }
115 bool canNotifySelection( void ) const { return m_bCanNotifySelection; }
117 protected slots:
118 // Qt3 moc does not really understand #ifdef and would process both slots,
119 // so the FILTER_OUT_FOO tags are used to remove some slots before moc sees them.
120 #if ENABLE_TDE
121 void fileHighlightedCommand( const TQString & ); // FILTER_OUT_TDE
122 #else // ENABLE_TDE
123 void fileHighlightedCommand( const QString & ); // FILTER_OUT_KDE
124 #endif // ENABLE_TDE
125 void selectionChangedCommand();
127 protected:
128 void sendCommand( const QString &rCommand );
129 void appendURL( QString &rBuffer, const KURL &rURL );
130 void appendEscaped( QString &rBuffer, const QString &rString );
131 QString escapeString( const QString &rString );
134 class KDEFileFilterComboHack : public KFileFilterCombo
136 public:
137 void setCurrentFilter( const QString& filter );
140 #endif // INCLUDED_VCL_UNX_KDE_FPICKER_KDEFILEPICKER_HXX
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */