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 
00060     static bool askForOverwriting(const QString& filePath, QWidget *parent = 0);
00061 
00062     void setMode(int mode);
00063 
00064     QStringList additionalFilters() const;
00065 
00067     void setAdditionalFilters(const QStringList &mimeTypes);
00068 
00069     QStringList excludedFilters() const;
00070 
00072     void setExcludedFilters(const QStringList &mimeTypes);
00073 
00074 //  KURL currentURL();
00075     QString currentFileName();
00076 
00077 //#ifndef Q_WS_WIN
00078 //  KURLComboBox *locationWidget() const;
00079 //#endif
00082     void setLocationText(const QString& fn);
00083 
00088     void setDefaultExtension(const QString& ext) { m_defaultExtension = ext; }
00089     
00093     bool checkFileName();
00094 //  bool checkURL();
00095 
00098     void setConfirmOverwrites(bool set) { m_confirmOverwrites = set; }
00099 
00100     virtual bool eventFilter ( QObject * watched, QEvent * e );
00101 
00102 public slots:
00103     virtual void show();
00104 
00105     virtual void setFocus();
00106 
00107     // Typing a file that doesn't exist closes the file dialog, we have to
00108     // handle this case better here.
00109     virtual void accept();
00110 
00111 signals:
00112     //entered file name is accepted
00113     void accepted();
00114     void rejected();
00115     
00116 protected slots:
00117     virtual void reject();
00118 
00119 private:
00120     void updateFilters();
00121 
00122 //  KURL m_lastUrl;
00123     QString m_lastFileName;
00124     int m_mode;
00125     QStringList m_additionalMimeTypes, m_excludedMimeTypes;
00126     QString m_defaultExtension;
00127     bool m_confirmOverwrites : 1;
00128     bool m_filtersUpdated : 1;
00129 };
00130 
00131 #endif
00132 
KDE Home | KDE Accessibility Home | Description of Access Keys