00001 /* 00002 * Copyright (C) 2009, Edmundo Albuquerque de Souza e Silva. 00003 * 00004 * This file may be distributed under the terms of the Q Public License 00005 * as defined by Trolltech AS of Norway and appearing in the file 00006 * LICENSE.QPL included in the packaging of this file. 00007 * 00008 * THIS FILE IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING 00009 * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00010 * PURPOSE. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, 00011 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING 00012 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 00013 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 00014 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 00015 * 00016 */ 00017 00018 #ifndef __RIOMMSYNC_H__ 00019 #define __RIOMMSYNC_H__ 00020 00021 #include <qdialog.h> 00022 #include <qwidget.h> 00023 #include <qlineedit.h> 00024 #include <qtextedit.h> 00025 #include <qfile.h> 00026 #include <qtextstream.h> 00027 #include <qfileinfo.h> 00028 00029 #define SYNC_NONE 0 00030 #define SYNC_BROWSER 1 00031 #define SYNC_TGIF 2 00032 00033 class RioMMSync : public QDialog 00034 { 00035 Q_OBJECT 00036 00037 private: 00038 QLineEdit *leNewLine; 00039 00040 QTextEdit *teFileContent; 00041 00042 QFile fSyncFile; 00043 00044 QTextStream *tsSyncFile; 00045 00046 int syncType; 00047 int blockNumber; 00048 00049 /******************************************************************************/ 00050 /* Try to read the sync file contents */ 00051 /* if the file does not exists, it will be created */ 00052 /* */ 00053 /* Return values */ 00054 /* false: if the file could not be read or created */ 00055 /******************************************************************************/ 00056 bool readSyncFile( QFileInfo fiSyncFile ); 00057 00058 /******************************************************************************/ 00059 /* Try to write sync file contents */ 00060 /* */ 00061 /* Return values */ 00062 /* false: if the contents could not be written */ 00063 /******************************************************************************/ 00064 bool writeSyncFile( ); 00065 00066 public: 00067 RioMMSync( QWidget *parent = 0 , const char *name = 0 , WFlags f = 0 ); 00068 00069 /******************************************************************************/ 00070 /* Initializes class variables and create interface layout */ 00071 /******************************************************************************/ 00072 bool Initialize( QFileInfo fiSyncFile, int type, int position ); 00073 00074 private slots: 00075 /******************************************************************************/ 00076 /* Add the content of leNewLine to teFileContent */ 00077 /******************************************************************************/ 00078 void addNewLine(); 00079 00080 /******************************************************************************/ 00081 /* If everything is OK close this window */ 00082 /******************************************************************************/ 00083 void processInput(); 00084 }; 00085 #endif