Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Examples  

filedialog.h

Go to the documentation of this file.
00001 
00002 //
00003 // YASA application action declarations
00004 //
00005 // Project: Yasa 2
00006 // Author : Jan Blumenthal
00007 // Start  : 2002/02/28
00008 // $Header: /sources/yasa/yasagui/filedialog.h,v 1.5 2003/01/24 15:47:41 bj Exp $
00009 //
00011 //
00012 // This program is free software; you can redistribute it and/or modify
00013 // it under the terms of the GNU General Public License as published by
00014 // the Free Software Foundation; either version 2 of the License, or
00015 // (at your option) any later version.
00016 //
00017 // This program is distributed in the hope that it will be useful,
00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 // GNU General Public License for more details.
00021 //
00022 // You should have received a copy of the GNU General Public License
00023 // along with this program (See the included file COPYING);
00024 // if not, write to the Free Software Foundation, Inc.,
00025 // 675 Mass Ave, Cambridge, MA 02139, USA.
00026 //
00028 // This file contains all information about the actions occured by user interactions
00030 #ifndef YASAGUI_FILEDIALOG_INCLUDE
00031 #define YASAGUI_FILEDIALOG_INCLUDE
00032 
00033 #include <qfiledialog.h>
00034 #include "yasagui/yasagui.h"
00035 #include "translations.h"
00036 #include "config.h"
00037 
00038 
00040 class YListEntry;
00041 
00042 
00044 class YFileDialog : public QFileDialog
00045 {   Q_OBJECT
00046 public:             YFileDialog(const QString &dir, const QString &title, const QString &filter, QFileDialog::Mode mode=QFileDialog::ExistingFile);
00047     int             Request(const QFileInfo &fileinfo=QFileInfo(), QFileDialog::Mode mode=QFileDialog::ExistingFile );
00048 };
00049 
00050 
00052 class YFileOperations
00053 {
00054 public:
00055     static int      AddSubDirectory(QString &path, const QString &subdir);
00056     static QString  AddDirectory(const QString &path, const QString &subdir);
00057     static int      MakeRelative(QString &filename, const QString &dir=QDir::currentDirPath(), bool mode=true );
00058     static int      CreateDirectory(const QString &directory);
00059     static int      CopyFile(const QString &src, const QString &dest, bool overwrite=false);
00060     static int      RenameFile(const QString &src, const QString &dest, bool overwrite=false);
00061     static int      CopyDirectory(const QString &src, const QString &dest, bool subdir=true);
00062     static QString  CorrectFileName(const QString &name);
00063     static QString  GetFileName(const QString &path);
00064     static QString  CutExtension(const QString &path);
00065     static int      AddToFileName(QString &path, const QString &addi);
00066     static int      AddExtension(QString &path, const QString &addi);
00067     static void     RemoveDirectory(const QString &name, bool subdir=true, bool force=true);
00068     static int      RunCommand(const QString &name, bool showcommand=true);
00069     static int      RunBashCommand(const QString &name, bool showcommand=true);
00070     static int      RunBashScript(const QString &name, bool showcommand=true);
00071     static QString  ConvertToUnixPath(const QString &srcpath);
00072 
00073 };
00074 
00075 
00076 
00078 class YFile : public QFile
00079 {
00080 public:             YFile(const QString &f) :
00081                     QFile(f)
00082                     {}
00083     int             GetModifiedTime(QDateTime &dateedit) const;
00084     int             SetModifiedTime(const QDateTime &dt);
00085 };
00086 
00087 
00094 class YSourceFile : public YFile
00095 {
00099     bool            contentchanged;
00100     QDateTime       lastmodified;
00101     QStringList     oldcontents;
00102 public:             YSourceFile(const QString &f) :
00103                     YFile(f),
00104                     contentchanged(true)
00105                     {}
00106                     ~YSourceFile()
00107                     {
00108                         FinalizeFile();
00109                     }
00110 
00112     void            FinalizeFile()
00113                     {
00114                         if ( isOpen() )
00115                         {
00116                             close();
00117                             if (!contentchanged)
00118                                 SetModifiedTime(lastmodified);
00119                         }
00120                         contentchanged=true;
00121                         oldcontents.clear();
00122                     }
00124     bool            CheckImportant(const QString &string) const
00125                     {
00126                         return string.length()>1 && (string.left(2) != "//" );
00127                     }
00129     int             OpenFile();
00130     int             WriteLine(const QString &line);
00131     int             WriteImportant(const QString &line)
00132                     {
00133                         return WriteLine(line);
00134                     }
00136     int             WriteUnimportant(const QString &line=QString::null )
00137                     {
00138                         return WriteLine(line);
00139                     }
00140 /*  int             WriteImportant(const QString &line);
00142     int             WriteUnimportant(const QString &line=QString::null )
00143                     {
00144                         if ( writeBlock( line.latin1(), line.length() ) == -1 )
00145                             return YASAE_WRITE_FILE;
00146                         if ( writeBlock( SG_NEW_LINE, 1) == -1 )
00147                             return YASAE_WRITE_FILE;
00148                         return 0;
00149                     }
00150 */
00151 };
00152 
00153 
00155 #endif                                                                          // ifndef YASAGUI_FILEDIALOG_INCLUDE

Generated on Thu Feb 13 23:43:53 2003 for Yasa by doxygen1.3-rc3