[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
src/klftools/klfpathchooser.h
Go to the documentation of this file.
00001 /***************************************************************************
00002  *   file klfpathchooser.h
00003  *   This file is part of the KLatexFormula Project.
00004  *   Copyright (C) 2011 by Philippe Faist
00005  *   philippe.faist at bluewin.ch
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  *   This program is distributed in the hope that it will be useful,       *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU General Public License for more details.                          *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU General Public License     *
00018  *   along with this program; if not, write to the                         *
00019  *   Free Software Foundation, Inc.,                                       *
00020  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00021  ***************************************************************************/
00022 /* $Id$ */
00023 
00024 
00025 #ifndef KLFPATHCHOOSER_H
00026 #define KLFPATHCHOOSER_H
00027 
00028 #include <QFrame>
00029 #include <QPushButton>
00030 #include <QLineEdit>
00031 
00032 #include <klfdefs.h>
00033 
00038 class KLF_EXPORT KLFPathChooser : public QFrame
00039 {
00040   Q_OBJECT
00041 
00042   // mode: 0=open, 1=save, 2=choose dir
00043   Q_PROPERTY(int mode READ mode WRITE setMode)
00044   Q_PROPERTY(bool dialogConfirmOverwrite READ dialogConfirmOverwrite WRITE setDialogConfirmOverwrite)
00045   Q_PROPERTY(QString caption READ caption WRITE setCaption)
00046   Q_PROPERTY(QString filter READ filter WRITE setFilter)
00047   Q_PROPERTY(QString path READ path WRITE setPath USER true)
00048   
00049   Q_PROPERTY(bool possibleOverwriteWasConfirmed READ possibleOverwriteWasConfirmed)
00050 
00051 public:
00052   KLFPathChooser(QWidget *parent);
00053   virtual ~KLFPathChooser();
00054 
00060   virtual int mode() const { return _mode; }
00061   virtual QString caption() const { return _caption; }
00062   virtual QString filter() const { return _filter; }
00063   virtual QString path() const;
00064 
00066   virtual bool dialogConfirmOverwrite() const { return _dlgconfirmoverwrite; }
00067   
00082   virtual bool possibleOverwriteWasConfirmed() const { return _pathFromDialog; }
00083 
00084 signals:
00085   void fileDialogPathChosen(const QString& fname);
00086 
00087 public slots:
00089   virtual void setMode(int mode);
00090   virtual void setCaption(const QString& caption);
00091   virtual void setFilter(const QString& filter);
00092 
00098   virtual void setPath(const QString& path);
00099 
00109   virtual void setDialogConfirmOverwrite(bool confirm) { _dlgconfirmoverwrite = confirm; }
00110 
00111   virtual void requestBrowse();
00112 
00113 private slots:
00114   void slotTextChanged();
00115   
00116 private:
00117   int _mode;
00118   QString _caption;
00119   QString _filter;
00120   bool _dlgconfirmoverwrite;
00121   
00122   bool _pathFromDialog;
00123 
00124   QLineEdit *txtPath;
00125   QPushButton *btnBrowse;
00126 
00127   QString _selectedfilter;
00128 };
00129 
00130 #endif

Generated by doxygen 1.7.6.1. The KLatexFormula website is hosted on sourceforge.net