kexi

KexiStartupFileDialog.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2003-2005 Jaroslaw Staniek <js@iidea.pl>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef _KexiStartupFileDialog_h_
00021 #define _KexiStartupFileDialog_h_
00022 
00023 #include <kfiledialog.h>
00024 
00025 #ifdef Q_WS_WIN
00026 # include "KexiStartupFileDialogBase_win.h"
00027 #else
00028   typedef KFileDialog KexiStartupFileDialogBase;
00029 #endif
00030 
00031 
00033 class KEXIMAIN_EXPORT KexiStartupFileDialog : public KexiStartupFileDialogBase
00034 {
00035     Q_OBJECT
00036     
00037 public:
00044     typedef enum Mode { 
00045         Opening = 1,
00046         SavingFileBasedDB = 2,
00047         SavingServerBasedDB = 4,
00048         Custom = 256
00049     };
00050     
00051     KexiStartupFileDialog(
00052         const QString& startDirOrVariable, int mode, QWidget *parent=0, const char *name=0);
00053 
00054     virtual ~KexiStartupFileDialog();
00055 
00056     void setMode(int mode);
00057 
00058     QStringList additionalFilters() const;
00059 
00061     void setAdditionalFilters(const QStringList &mimeTypes);
00062 
00063     QStringList excludedFilters() const;
00064 
00066     void setExcludedFilters(const QStringList &mimeTypes);
00067 
00068 //  KURL currentURL();
00069     QString currentFileName();
00070 
00071 //#ifndef Q_WS_WIN
00072 //  KURLComboBox *locationWidget() const;
00073 //#endif
00076     void setLocationText(const QString& fn);
00077 
00082     void setDefaultExtension(const QString& ext) { m_defaultExtension = ext; }
00083     
00087     bool checkFileName();
00088 //  bool checkURL();
00089 
00092     void setConfirmOverwrites(bool set) { m_confirmOverwrites = set; }
00093 
00094     virtual bool eventFilter ( QObject * watched, QEvent * e );
00095 
00096 public slots:
00097     virtual void show();
00098 
00099     virtual void setFocus();
00100 
00101     // Typing a file that doesn't exist closes the file dialog, we have to
00102     // handle this case better here.
00103     virtual void accept();
00104 
00105 signals:
00106     //entered file name is accepted
00107     void accepted();
00108     void rejected();
00109     
00110 protected slots:
00111     virtual void reject();
00112 
00113 private:
00114     void updateFilters();
00115 
00116 //  KURL m_lastUrl;
00117     QString m_lastFileName;
00118     int m_mode;
00119     QStringList m_additionalMimeTypes, m_excludedMimeTypes;
00120     QString m_defaultExtension;
00121     bool m_confirmOverwrites : 1;
00122     bool m_filtersUpdated : 1;
00123 };
00124 
00125 #endif
00126 
KDE Home | KDE Accessibility Home | Description of Access Keys