Source: scqtfiledialog.h


Annotated List
Files
Globals
Hierarchy
Index
/**************************************************************************
                          scqtfiledialog.h  -  description
                             -------------------
    begin                : Mon Sep 3 2001
    copyright            : (C) 2001 by Werner Schulte
    email                : sc@schulte-ac.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

/***************************************************************************
 0.2.1 - 16.09.2002 : Bugfixes and method parameter and names
                      QT compatible now.
 0.2.2 . 26.09.2002 : Bugfixes, mkDir erneuert, aus Edit wird Dialog
                      QT-kompatibel, Classe mkDir geloescht
 ***************************************************************************/

#ifndef SCQTFILEDIALOG_H
#define SCQTFILEDIALOG_H

#include 
#include 
#include 
#include 
#include 
#include 
#include 

#include 
#include 

#define MAXDIRCOMBOCOUNT  8
#define MAXTYPECOMBOCOUNT 8

/**
  * This Class provides a FileDialogView
It is a subclass of ScQtFileDialog. ScQtFileDialog creates and destroys the instances. Dont use it directly. @author Werner Schulte (email : werner@schulte-ac.de, homepage : www.uv-ac.de) @version 0.2.2 - sc - 26.09.2002 The dialog is separated into three input fields, some buttons and a listview. The listview shows the actual directory (starting with the ".." dir, followed by all dirs, followed by files. The type ComboBox (field is writable) contains the filter (e.g. "*.txt"). If a new filter is entered, the old one is stored in the combobox list (max size is 8) and recallable by ComboBox selection. The path ComboBox (field is writable) contains the path string. If a new path is entered, the old one is stored in the combobox list (max size is 8) and recallable by ComboBox selection. example call (mkDir):
    fd = new ScQtFileEditDlg( parent, name, path, filter );
    fd->setAutoExtension( true );
    fd->allowMkDir( true );
    fd->setNFilter( false );
    fd->setFSorting( true );
    fd->readIt();
    fd->exec();

    if ( fd->result() == QDialog::Accepted )
      fname = fd->getResult();
    else
      fname = "";

    delete fd;
  
*/ class ScQtFileEditDlg : public ScQtFileDlg, QDir { Q_OBJECT public: /** returns the actual selected file/dir name extended with the type extension if AutoExtension is set. @return : the filename (with the path preset) **/ QString getResult( ); /** returns the actual selected file/dir name extended with the type extension if AutoExtension is set. The path is included. @return : the filename (without the path) **/ QString getFileName( ); /** reads the selected directory using the preset parameters. **/ void readIt( ); /** set or unsets AutoExtension. If AutoExtension is on and a file type is used, the program checks, whether a matching extension builds the end of the selected filename . If yes, the filename is untouched, if no, the filename is concated by the extension of the type string. **/ void setAutoExtension( bool ex=false ); /** allows or denies mkdir feature. If allowed, the MkDir button is switched on. **/ void allowMkDir( bool mkdir=false ); /** sets the ListView to show dirs only or not **/ void setDirOnly( bool donly=false ); /** set or unsets the name filter. **/ void setNFilter( bool ff=false ); /** set or unsets the filenames sorting. **/ void setFSorting( bool ff=false ); /** set the QDir mode **/ void setMode( int mode=QDir::All ); /** constructor **/ ScQtFileEditDlg( QWidget *parent=0, const char *name=0, const QString &path="/", const QString &filter="*" ); /** destructor **/ ~ScQtFileEditDlg(); private slots: void slotOK( ); void slotCancel( ); void slotDoubleClicked( QListViewItem *item=0 ); void slotSelectionChanged( QListViewItem *item=0 ); void slotDirComboBoxChanged( int item ); void slotTypeComboBoxChanged( int item ); void slotFileTextChanged( const QString &txt="" ); void slotShowDir(); void slotMkDir(); private: mkDirEdit *mkd; bool dirOnly; QListViewItem *srcLastItem; QTimer showTimer; bool mkdirflag, fsorting, fnfilter; int fmode; const QFileInfoList *qfil; bool rFlag, exflag; // recursionFlag,extensionflag QString bpath, bfilter, filename; QString dirstr,linkstr, filestr; QPixmap *fileIcon, *dirIcon, *linkIcon, *cdToParentIcon; const QFileInfoList *readDir( const QString &path="/", const QString &filter="*" ); int checkComboEntryExists( QComboBox *com=0, const QString &str="" ); void insDirCombo( const QString &str="" ); void insTypeCombo( const QString &str="" ); void initDirCombo( const QString &str="" ); void initTypeCombo( const QString &str="" ); void loadSrcDirDir( ); void autoExtension( ); }; /** * This Class provides a FileDialog usable also under Qtopia and Opie
As Qtopia/Opie does not ship any FileDialogClass, this class can be used instead. It is more or less parameter compatible to the X11 QT standard filedialog, but comes with some extensions. @author Werner Schulte (email : werner@schulte-ac.de, homepage : www.uv-ac.de) @version 0.2.2 - sc - 26.09.2002 This class uses the Class ScQtFileEditDlg for presentation and selection. This class is created, wehn needed and destroyed, when the dialog is closed. */ class ScQtFileDialog : public QObject { Q_OBJECT public: /** resizes the dialog to width/height. @p width : the width in pixels @p height : the height in pixels **/ // static void resize( int width, int height ); /** presents the selected directory and returns the selected filename. The filename can either be selected using the list to select a file, or by entering the name manually into the filename field. @p path : the path to start the dialog with @p filter : the filter for the filename list @p parent : the Widgets parent (as know from QT) @p name : the Dialogs name (as know from QT) @return : the selected filename. If none was selected, an empty QString is returned. **/ static QString getOpenFileName( const QString &path, const QString &filter, QWidget *parent=0, const char *name=0 ); /** presents the selected directory and returns the entered filename. The filename can either be selected using the list to select a file, or by entering the name manually into the filename field. @p path : the path to start the dialog with @p filter : the filter for the filename list @p parent : the Widgets parent (as know from QT) @p name : the Dialogs name (as know from QT) @p caption : the Dialogs caption @return : the selected filename. If none was selected, an empty QString is returned. **/ static QString getSaveFileName( const QString &path="/", const QString &filter="*", QWidget *parent=0, const char *name=0 ); /** presents the selected directory and returns the selected dirname. The dirname can either be selected using the list to select a file, or by entering the name manually into the filename field. @p name : the Dialogs name (as know from QT) @p path : the path to start the dialog with @p parent : the Widgets parent (as know from QT) @return : the selected dirname. If none was selected, an empty QString is returned. **/ static QString getExistingDirectory( const QString &path="/", QWidget *parent=0, const char *name=0 ); /** constructor **/ ScQtFileDialog( QWidget *parent=0, const char *name=0 ); /** destructor **/ ~ScQtFileDialog(); }; #endif

Generated by: sc on schomep4 on Sun Nov 23 16:54:25 2003, using kdoc 2.0a54.