[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
klfpathchooser.h
Go to the documentation of this file.
1 /***************************************************************************
2  * file klfpathchooser.h
3  * This file is part of the KLatexFormula Project.
4  * Copyright (C) 2011 by Philippe Faist
5  * philippe.faist at bluewin.ch
6  * *
7  * This program is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program; if not, write to the *
19  * Free Software Foundation, Inc., *
20  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  ***************************************************************************/
22 /* $Id$ */
23 
24 
25 #ifndef KLFPATHCHOOSER_H
26 #define KLFPATHCHOOSER_H
27 
28 #include <QFrame>
29 #include <QPushButton>
30 #include <QLineEdit>
31 
32 #include <klfdefs.h>
33 
38 class KLF_EXPORT KLFPathChooser : public QFrame
39 {
40  Q_OBJECT
41 
42  // mode: 0=open, 1=save, 2=choose dir
43  Q_PROPERTY(int mode READ mode WRITE setMode)
44  Q_PROPERTY(bool dialogConfirmOverwrite READ dialogConfirmOverwrite WRITE setDialogConfirmOverwrite)
45  Q_PROPERTY(QString caption READ caption WRITE setCaption)
46  Q_PROPERTY(QString filter READ filter WRITE setFilter)
47  Q_PROPERTY(QString path READ path WRITE setPath USER true)
48 
49  Q_PROPERTY(bool possibleOverwriteWasConfirmed READ possibleOverwriteWasConfirmed)
50 
51 public:
52  KLFPathChooser(QWidget *parent);
53  virtual ~KLFPathChooser();
54 
60  virtual int mode() const { return _mode; }
61  virtual QString caption() const { return _caption; }
62  virtual QString filter() const { return _filter; }
63  virtual QString path() const;
64 
66  virtual bool dialogConfirmOverwrite() const { return _dlgconfirmoverwrite; }
67 
82  virtual bool possibleOverwriteWasConfirmed() const { return _pathFromDialog; }
83 
84 signals:
85  void fileDialogPathChosen(const QString& fname);
86 
87 public slots:
89  virtual void setMode(int mode);
90  virtual void setCaption(const QString& caption);
91  virtual void setFilter(const QString& filter);
92 
98  virtual void setPath(const QString& path);
99 
109  virtual void setDialogConfirmOverwrite(bool confirm) { _dlgconfirmoverwrite = confirm; }
110 
111  virtual void requestBrowse();
112 
113 private slots:
114  void slotTextChanged();
115 
116 private:
117  int _mode;
118  QString _caption;
119  QString _filter;
120  bool _dlgconfirmoverwrite;
121 
122  bool _pathFromDialog;
123 
124  QLineEdit *txtPath;
125  QPushButton *btnBrowse;
126 
127  QString _selectedfilter;
128 };
129 
130 #endif
A widget comprising of a line edit and a "browse" button.
void fileDialogPathChosen(const QString &fname)
virtual int mode() const
virtual QString filter() const
virtual bool possibleOverwriteWasConfirmed() const
virtual QString caption() const
virtual bool dialogConfirmOverwrite() const
virtual void setDialogConfirmOverwrite(bool confirm)
Base declarations for klatexformula and some utilities.
#define KLF_EXPORT
Definition: klfdefs.h:41

Generated by doxygen 1.9.1