Folder.h
Go to the documentation of this file.00001 #ifndef FOLDER_H
00002 #define FOLDER_H
00003
00004 #include <iostream.h>
00005 #include <qdatetime.h>
00006 #include <qlist.h>
00007 #include <qstring.h>
00008 #include <qstringlist.h>
00009 #include "Base.h"
00010 #include "Vocabulary.h"
00011
00012 class Folder : public Base {
00013
00014 public:
00015
00016 static const Q_UINT32 magicNumber( Q_UINT32( 0x77446688 ) );
00017
00018 Folder( int id = -1, const QString& title = QString::null );
00019 Folder( const Folder& folder );
00020 virtual ~Folder();
00021
00022 const char* className() const { return "Folder"; }
00023
00024 int getId() const;
00025 int getMaxId();
00026 int getMaxVocabId();
00027 const QString getTitle() const;
00028 void setTitle( const QString& title );
00029 const QString getDescription() const;
00030 void setDescription( const QString& desc );
00031 const QString getAuthor() const;
00032 void setAuthor( const QString& author );
00033 const QDateTime getCreationDate() const;
00034 void setCreationDate( const QDateTime& date );
00035 const QDateTime getModificationDate() const;
00036 void setModificationDate( const QDateTime& date );
00037
00038 bool isDirty() const;
00039 void setDirty( bool isDirty, bool recursive = false );
00040
00041 bool isMarkedForStudy() const;
00042 void setMarkedForStudy( bool isMarkedForStudy );
00043 bool isMarkedForDeletion() const;
00044 void setMarkedForDeletion( bool isMarkedForDeletion );
00045 bool containsTermWithTranslations( const QString& lang1, const QString& lang2 );
00046 bool isReachableFromRoot() const;
00047
00048 QStringList getTranslationLanguages();
00049 void removeTranslations( const QStringList& languages );
00050
00051 void add( Vocabulary* child );
00052 void add( Folder* child );
00053 void remove( Vocabulary* child );
00054 void remove( Folder* child );
00055 bool isEmpty() const;
00056 int getChildrenCount() const;
00057 Folder* getFolder( int id );
00058 Vocabulary* getVocabulary( int id );
00059 Folder* getRoot() const;
00060 Folder* getParent() const;
00061 QString getPath() const;
00062 QString getHumanReadablePath() const;
00063 void setParent( Folder* parent );
00064
00065
00066
00067 void getItemsCount( uint* termCount, uint* vocabCount, uint* folderCount,
00068 uint* checkedTermCount, uint* checkedVocabCount, uint* checkedFolderCount,
00069 uint* selectedTermCount, uint* selectedVocabCount, uint* selectedFolderCount,
00070 bool isReachableFromRoot,
00071 const QString& firstLang = QString::null, const QString& testLang = QString::null );
00072
00073 Base* first();
00074 Base* next();
00075
00076 bool load( const QString& filename );
00077 bool loadMetadata( const QString& filename );
00078 bool saveMetadata( const QString& filename ) const;
00079
00080 void buildVocabCopiesMap( QMap<int,Vocabulary>& vocabularies ) const;
00081
00082 friend QDataStream& operator<<( QDataStream& out, const Folder& folder );
00083 friend QDataStream& operator>>( QDataStream& in, Folder& folder );
00084
00085 private:
00086
00087 Vocabulary* getVocabularyRec( int id );
00088
00089 int id;
00090 QString title;
00091 QString description;
00092 QString author;
00093 QDateTime creationDate;
00094 QDateTime modificationDate;
00095 bool markedForStudy;
00096 bool markedForDeletion;
00097
00098 bool dirty;
00099
00100 Folder* parent;
00101 QList<Base> children;
00102
00103 };
00104
00105 QDataStream& operator<<( QDataStream& out, const Folder& folder );
00106 QDataStream& operator>>( QDataStream& in, Folder& folder );
00107
00108 #endif