kwave  18.07.70
FileDialog.h
Go to the documentation of this file.
1 /*************************************************************************
2  FileDialog.h - enhanced KFileDialog
3  -------------------
4  begin : Thu May 30 2002
5  copyright : (C) 2002 by Thomas Eschenbacher
6  email : Thomas.Eschenbacher@gmx.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef FILE_DIALOG_H
19 #define FILE_DIALOG_H
20 
21 #include "config.h"
22 
23 #include <QtGlobal>
24 #include <QDialog>
25 #include <QObject>
26 #include <QString>
27 #include <QUrl>
28 #include <QVBoxLayout>
29 
30 #include <KFileWidget>
31 
32 class QWidget;
33 class KUrlComboBox;
34 
35 namespace Kwave
36 {
41  class Q_DECL_EXPORT FileDialog: public QDialog
42  {
43  Q_OBJECT
44  public:
45  typedef enum {
46  SaveFile = 0,
48  SelectDir
49  } OperationMode;
50 
67  FileDialog(const QString& startDir,
68  OperationMode mode,
69  const QString& filter,
70  QWidget *parent,
71  const QUrl last_url = QUrl(),
72  const QString last_ext = QString());
73 
75  virtual ~FileDialog() Q_DECL_OVERRIDE
76  {
77  }
78 
82  QString selectedExtension();
83 
87  QUrl selectedUrl() const;
88 
92  QUrl baseUrl() const;
93 
98  void setDirectory(const QString &directory);
99 
104  void selectUrl(const QUrl &url);
105 
110  void setCustomWidget(QWidget *widget);
111 
117  KUrlComboBox *locationEdit() const;
118 
119  protected:
120 
122  void loadConfig(const QString &section);
123 
124  signals:
125 
126  void filterChanged(const QString &filter);
127 
128  protected slots:
129 
131  virtual void accept() Q_DECL_OVERRIDE;
132 
134  void saveConfig();
135 
136  private:
137 
145  QString guessFilterFromFileExt(const QString &pattern,
146  OperationMode mode);
147 
148  private:
149 
151  QVBoxLayout m_layout;
152 
154  KFileWidget m_file_widget;
155 
157  QString m_config_group;
158 
161 
163  QString m_last_ext;
164 
165  };
166 }
167 
168 #endif /* FILE_DIALOG_H */
169 
170 //***************************************************************************
171 //***************************************************************************
virtual ~FileDialog() Q_DECL_OVERRIDE
Definition: FileDialog.h:75
Definition: App.h:33
KFileWidget m_file_widget
Definition: FileDialog.h:154
QVBoxLayout m_layout
Definition: FileDialog.h:151
QString m_config_group
Definition: FileDialog.h:157
QString m_last_ext
Definition: FileDialog.h:163