KexiStartupFileDialog.h
1/* This file is part of the KDE project
2 Copyright (C) 2003-2005 Jaroslaw Staniek <js@iidea.pl>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef _KexiStartupFileDialog_h_
21#define _KexiStartupFileDialog_h_
22
23#include <tdefiledialog.h>
24
25#ifdef TQ_WS_WIN
26# include "KexiStartupFileDialogBase_win.h"
27#else
28 typedef KFileDialog KexiStartupFileDialogBase;
29#endif
30
31
34{
35 TQ_OBJECT
36
37
38public:
45 enum Mode {
46 Opening = 1,
47 SavingFileBasedDB = 2,
48 SavingServerBasedDB = 4,
49 Custom = 256
50 };
51
53 const TQString& startDirOrVariable, int mode, TQWidget *parent=0, const char *name=0);
54
55 virtual ~KexiStartupFileDialog();
56
61 static bool askForOverwriting(const TQString& filePath, TQWidget *parent = 0);
62
63 void setMode(int mode);
64
65 TQStringList additionalFilters() const;
66
68 void setAdditionalFilters(const TQStringList &mimeTypes);
69
70 TQStringList excludedFilters() const;
71
73 void setExcludedFilters(const TQStringList &mimeTypes);
74
75// KURL currentURL();
76 TQString currentFileName();
77
78//#ifndef TQ_WS_WIN
79// KURLComboBox *locationWidget() const;
80//#endif
83 void setLocationText(const TQString& fn);
84
89 void setDefaultExtension(const TQString& ext) { m_defaultExtension = ext; }
90
94 bool checkFileName();
95// bool checkURL();
96
99 void setConfirmOverwrites(bool set) { m_confirmOverwrites = set; }
100
101 virtual bool eventFilter ( TQObject * watched, TQEvent * e );
102
103public slots:
104 virtual void show();
105
106 virtual void setFocus();
107
108 // Typing a file that doesn't exist closes the file dialog, we have to
109 // handle this case better here.
110 virtual void accept();
111
112signals:
113 //entered file name is accepted
114 void accepted();
115 void rejected();
116
117protected slots:
118 virtual void reject();
119
120private:
121 void updateFilters();
122
123// KURL m_lastUrl;
124 TQString m_lastFileName;
125 int m_mode;
126 TQStringList m_additionalMimeTypes, m_excludedMimeTypes;
127 TQString m_defaultExtension;
128 bool m_confirmOverwrites : 1;
129 bool m_filtersUpdated : 1;
130};
131
132#endif
133
Widget for opening/saving files supported by Kexi.
void setConfirmOverwrites(bool set)
void setDefaultExtension(const TQString &ext)
Sets default extension which will be added after accepting if user didn't provided one.