00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef FOLDER_H
00030 #define FOLDER_H
00031
00032 #include <QObject>
00033 #include <QEvent>
00034 #include <q3listview.h>
00035 #include <q3iconview.h>
00036
00037 #include "MdiSubWindow.h"
00038
00039 class FolderListItem;
00040 class Table;
00041 class Matrix;
00042 class MultiLayer;
00043 class Note;
00044
00045 class QDragEnterEvent;
00046 class QDragMoveEvent;
00047 class QDragLeaveEvent;
00048 class QDropEvent;
00049 class Q3DragObject;
00050
00052 class Folder : public QObject
00053 {
00054 Q_OBJECT
00055
00056 public:
00057 Folder( Folder *parent, const QString &name );
00058
00059 QList<MdiSubWindow *> windowsList(){return lstWindows;};
00060
00061 void addWindow( MdiSubWindow *w );
00062 void removeWindow( MdiSubWindow *w );
00063
00065 QStringList subfolders();
00066
00068 QList<Folder*> folders();
00069
00071 Folder* findSubfolder(const QString& s, bool caseSensitive = true, bool partialMatch = false);
00072
00074 MdiSubWindow* findWindow(const QString& s, bool windowNames, bool labels,
00075 bool caseSensitive, bool partialMatch);
00076
00078
00083 MdiSubWindow *window(const QString &name, const char *cls="MdiSubWindow", bool recursive=false);
00085 Table *table(const QString &name, bool recursive=false) { return (Table*) window(name, "Table", recursive); }
00087 Matrix *matrix(const QString &name, bool recursive=false) { return (Matrix*) window(name, "Matrix", recursive); }
00089 MultiLayer *graph(const QString &name, bool recursive=false) { return (MultiLayer*) window(name, "MultiLayer", recursive); }
00091 Note *note(const QString &name, bool recursive=false) { return (Note*) window(name, "Note", recursive); }
00092
00094 QString path();
00095
00097 int depth();
00098
00099 Folder *folderBelow();
00100
00102 Folder* rootFolder();
00103
00105 QString sizeToString();
00106
00107 QString birthDate(){return birthdate;};
00108 void setBirthDate(const QString& s){birthdate = s;};
00109
00110 QString modificationDate(){return modifDate;};
00111 void setModificationDate(const QString& s){modifDate = s;};
00112
00114 FolderListItem * folderListItem(){return myFolderListItem;};
00115 void setFolderListItem(FolderListItem *it){myFolderListItem = it;};
00116
00117 MdiSubWindow *activeWindow(){return d_active_window;};
00118 void setActiveWindow(MdiSubWindow *w){d_active_window = w;};
00119
00120 QString logInfo(){return d_log_info;};
00121 void appendLogInfo(const QString& text){d_log_info += text;};
00122 void clearLogInfo(){d_log_info = QString();};
00123
00124 protected:
00125 QString birthdate, modifDate;
00126 QString d_log_info;
00127 QList<MdiSubWindow *> lstWindows;
00128 FolderListItem *myFolderListItem;
00129
00131 MdiSubWindow *d_active_window;
00132 };
00133
00134
00135
00136
00137
00138
00140 class WindowListItem : public Q3ListViewItem
00141 {
00142 public:
00143 WindowListItem( Q3ListView *parent, MdiSubWindow *w );
00144
00145 MdiSubWindow *window() { return myWindow; };
00146
00147 protected:
00148 MdiSubWindow *myWindow;
00149 };
00150
00151
00152
00153
00154
00155
00157 class FolderListItem : public Q3ListViewItem
00158 {
00159 public:
00160 FolderListItem( Q3ListView *parent, Folder *f );
00161 FolderListItem( FolderListItem *parent, Folder *f );
00162
00163 enum {RTTI = 1001};
00164
00165 void setActive( bool o );
00166 void cancelRename(int){return;};
00167
00168 virtual int rtti() const {return (int)RTTI;};
00169
00170 Folder *folder() { return myFolder; };
00171
00173
00176 bool isChildOf(FolderListItem *src);
00177
00178 protected:
00179 Folder *myFolder;
00180 };
00181
00182
00183
00184
00185
00186
00188 class FolderListView : public Q3ListView
00189 {
00190 Q_OBJECT
00191
00192 public:
00193 FolderListView( QWidget *parent = 0, const char *name = 0 );
00194
00195 public slots:
00196 void adjustColumns();
00197
00198 protected slots:
00199 void expandedItem(Q3ListViewItem *item);
00200
00201 protected:
00202 void startDrag();
00203
00204 void contentsDropEvent( QDropEvent *e );
00205 void contentsMouseMoveEvent( QMouseEvent *e );
00206 void contentsMousePressEvent( QMouseEvent *e );
00207 void contentsMouseDoubleClickEvent( QMouseEvent* e );
00208 void keyPressEvent ( QKeyEvent * e );
00209 void contentsMouseReleaseEvent( QMouseEvent *){mousePressed = false;};
00210 void enterEvent(QEvent *){mousePressed = false;};
00211
00212 signals:
00213 void dragItems(QList<Q3ListViewItem *> items);
00214 void dropItems(Q3ListViewItem *dest);
00215 void renameItem(Q3ListViewItem *item);
00216 void addFolderItem();
00217 void deleteSelection();
00218
00219 private:
00220 bool mousePressed;
00221 QPoint presspos;
00222 };
00223
00224 #endif