-rw-r--r-- | noncore/unsupported/filebrowser/filebrowser.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/unsupported/filebrowser/filebrowser.h b/noncore/unsupported/filebrowser/filebrowser.h index 549d463..2ce28ba 100644 --- a/noncore/unsupported/filebrowser/filebrowser.h +++ b/noncore/unsupported/filebrowser/filebrowser.h | |||
@@ -1,162 +1,163 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef FILEBROWSER_H | 20 | #ifndef FILEBROWSER_H |
21 | #define FILEBROWSER_H | 21 | #define FILEBROWSER_H |
22 | 22 | ||
23 | |||
23 | #include <qlistview.h> | 24 | #include <qlistview.h> |
24 | #include <qmainwindow.h> | 25 | #include <qmainwindow.h> |
25 | #include <qfileinfo.h> | 26 | #include <qfileinfo.h> |
26 | #include <qaction.h> | 27 | #include <qaction.h> |
27 | #include <qtimer.h> | 28 | #include <qtimer.h> |
28 | #include <qstringlist.h> | 29 | #include <qstringlist.h> |
29 | class QLabel; | 30 | class QLabel; |
30 | class InlineEdit; | 31 | class InlineEdit; |
31 | 32 | ||
32 | class FileItem : public QListViewItem | 33 | class FileItem : public QListViewItem |
33 | { | 34 | { |
34 | public: | 35 | public: |
35 | FileItem( QListView * parent, const QFileInfo & fi ); | 36 | FileItem( QListView * parent, const QFileInfo & fi ); |
36 | 37 | ||
37 | QString key( int column, bool ascending = TRUE ) const; | 38 | QString key( int column, bool ascending = TRUE ) const; |
38 | QString getFilePath(){ return fileInfo.filePath(); } | 39 | QString getFilePath(){ return fileInfo.filePath(); } |
39 | QString getFileName(){ return fileInfo.fileName(); } | 40 | QString getFileName(){ return fileInfo.fileName(); } |
40 | bool isDir(){ return fileInfo.isDir(); } | 41 | bool isDir(){ return fileInfo.isDir(); } |
41 | bool isExecutable(){ return fileInfo.isExecutable(); } | 42 | bool isExecutable(){ return fileInfo.isExecutable(); } |
42 | bool isLib(); | 43 | bool isLib(); |
43 | int launch(); | 44 | int launch(); |
44 | bool rename( const QString & name ); | 45 | bool rename( const QString & name ); |
45 | private: | 46 | private: |
46 | QString sizeString( unsigned int size ); | 47 | QString sizeString( unsigned int size ); |
47 | QFileInfo fileInfo; | 48 | QFileInfo fileInfo; |
48 | QPixmap FileItem::drawThumbnail(const QFileInfo &file); | 49 | QPixmap FileItem::drawThumbnail(const QFileInfo &file); |
49 | }; | 50 | }; |
50 | 51 | ||
51 | 52 | ||
52 | class FileView : public QListView | 53 | class FileView : public QListView |
53 | { | 54 | { |
54 | Q_OBJECT | 55 | Q_OBJECT |
55 | 56 | ||
56 | public: | 57 | public: |
57 | FileView( const QString & dir, QWidget * parent = 0, | 58 | FileView( const QString & dir, QWidget * parent = 0, |
58 | const char * name = 0, | 59 | const char * name = 0, |
59 | bool hidden = FALSE, | 60 | bool hidden = FALSE, |
60 | bool symlinks = FALSE, | 61 | bool symlinks = FALSE, |
61 | bool thumbnails = FALSE ); | 62 | bool thumbnails = FALSE ); |
62 | 63 | ||
63 | void setDir( const QString & dir ); | 64 | void setDir( const QString & dir ); |
64 | QString cd(){ return currentDir; } | 65 | QString cd(){ return currentDir; } |
65 | QStringList history() const { return dirHistory; } | 66 | QStringList history() const { return dirHistory; } |
66 | bool showingHidden; | 67 | bool showingHidden; |
67 | 68 | ||
68 | void setShowHidden(bool hidden); | 69 | void setShowHidden(bool hidden); |
69 | void setShowSymlinks(bool symlinks); | 70 | void setShowSymlinks(bool symlinks); |
70 | void setShowThumbnails(bool thumbnails); | 71 | void setShowThumbnails(bool thumbnails); |
71 | bool getShowThumbnails () const { return showThumbnails; } | 72 | bool getShowThumbnails () const { return showThumbnails; } |
72 | void setMenuKeepsOpen(bool keepOpen); | 73 | void setMenuKeepsOpen(bool keepOpen); |
73 | 74 | ||
74 | public slots: | 75 | public slots: |
75 | void updateDir(); | 76 | void updateDir(); |
76 | void parentDir(); | 77 | void parentDir(); |
77 | void lastDir(); | 78 | void lastDir(); |
78 | 79 | ||
79 | void rename(); | 80 | void rename(); |
80 | void copy(); | 81 | void copy(); |
81 | void paste(); | 82 | void paste(); |
82 | void del(); | 83 | void del(); |
83 | void cut(); | 84 | void cut(); |
84 | void newFolder(); | 85 | void newFolder(); |
85 | void viewAsText(); | 86 | void viewAsText(); |
86 | void chPerm(); | 87 | void chPerm(); |
87 | protected: | 88 | protected: |
88 | void generateDir( const QString & dir ); | 89 | void generateDir( const QString & dir ); |
89 | void resizeEvent( QResizeEvent* ); | 90 | void resizeEvent( QResizeEvent* ); |
90 | void contentsMousePressEvent( QMouseEvent * e ); | 91 | void contentsMousePressEvent( QMouseEvent * e ); |
91 | void contentsMouseReleaseEvent( QMouseEvent * e ); | 92 | void contentsMouseReleaseEvent( QMouseEvent * e ); |
92 | 93 | ||
93 | protected slots: | 94 | protected slots: |
94 | void itemClicked( QListViewItem * i ); | 95 | void itemClicked( QListViewItem * i ); |
95 | void itemDblClicked( QListViewItem * i ); | 96 | void itemDblClicked( QListViewItem * i ); |
96 | void showFileMenu(); | 97 | void showFileMenu(); |
97 | void cancelMenuTimer(); | 98 | void cancelMenuTimer(); |
98 | void selectAll(){ QListView::selectAll( TRUE ); } | 99 | void selectAll(){ QListView::selectAll( TRUE ); } |
99 | void deselectAll(){ QListView::selectAll( FALSE ); } | 100 | void deselectAll(){ QListView::selectAll( FALSE ); } |
100 | void addToDocuments(); | 101 | void addToDocuments(); |
101 | void run(); | 102 | void run(); |
102 | void endRenaming(); | 103 | void endRenaming(); |
103 | private: | 104 | private: |
104 | QString currentDir; | 105 | QString currentDir; |
105 | QStringList dirHistory, flist; | 106 | QStringList dirHistory, flist; |
106 | QTimer menuTimer; | 107 | QTimer menuTimer; |
107 | InlineEdit * le; | 108 | InlineEdit * le; |
108 | FileItem * itemToRename; | 109 | FileItem * itemToRename; |
109 | bool selected; | 110 | bool selected; |
110 | bool showHidden; | 111 | bool showHidden; |
111 | bool showSymlinks; | 112 | bool showSymlinks; |
112 | bool showThumbnails; | 113 | bool showThumbnails; |
113 | bool menuKeepsOpen; | 114 | bool menuKeepsOpen; |
114 | 115 | ||
115 | bool copyFile( const QString & dest, const QString & src ); | 116 | bool copyFile( const QString & dest, const QString & src ); |
116 | 117 | ||
117 | signals: | 118 | signals: |
118 | void dirChanged(); | 119 | void dirChanged(); |
119 | void textViewActivated( QWidget * w ); | 120 | void textViewActivated( QWidget * w ); |
120 | void textViewDeactivated(); | 121 | void textViewDeactivated(); |
121 | }; | 122 | }; |
122 | 123 | ||
123 | class FileBrowser : public QMainWindow | 124 | class FileBrowser : public QMainWindow |
124 | { | 125 | { |
125 | Q_OBJECT | 126 | Q_OBJECT |
126 | 127 | ||
127 | public: | 128 | public: |
128 | FileBrowser( QWidget * parent = 0, | 129 | FileBrowser( QWidget * parent = 0, |
129 | const char * name = 0, WFlags f = 0 ); | 130 | const char * name = 0, WFlags f = 0 ); |
130 | FileBrowser( const QString & dir, QWidget * parent = 0, | 131 | FileBrowser( const QString & dir, QWidget * parent = 0, |
131 | const char * name = 0, WFlags f = 0 ); | 132 | const char * name = 0, WFlags f = 0 ); |
132 | public slots: | 133 | public slots: |
133 | void changeCaption(const QString &); | 134 | void changeCaption(const QString &); |
134 | private: | 135 | private: |
135 | void init(const QString & dir); | 136 | void init(const QString & dir); |
136 | QString fileToCopy; | 137 | QString fileToCopy; |
137 | QPopupMenu * dirMenu, * sortMenu, *viewMenu; | 138 | QPopupMenu * dirMenu, * sortMenu, *viewMenu; |
138 | FileView * fileView; | 139 | FileView * fileView; |
139 | QAction * pasteAction; | 140 | QAction * pasteAction; |
140 | QAction *lastAction; | 141 | QAction *lastAction; |
141 | QAction *upAction; | 142 | QAction *upAction; |
142 | 143 | ||
143 | bool copyFile( const QString & dest, const QString & src ); | 144 | bool copyFile( const QString & dest, const QString & src ); |
144 | 145 | ||
145 | private slots: | 146 | private slots: |
146 | void pcmciaMessage( const QCString &msg, const QByteArray &); | 147 | void pcmciaMessage( const QCString &msg, const QByteArray &); |
147 | 148 | ||
148 | void sortName(); | 149 | void sortName(); |
149 | void sortDate(); | 150 | void sortDate(); |
150 | void sortSize(); | 151 | void sortSize(); |
151 | void sortType(); | 152 | void sortType(); |
152 | void updateSorting(); | 153 | void updateSorting(); |
153 | void updateShowHidden(); | 154 | void updateShowHidden(); |
154 | void updateShowSymlinks(); | 155 | void updateShowSymlinks(); |
155 | void updateShowThumbnails(); | 156 | void updateShowThumbnails(); |
156 | void updateDirMenu(); | 157 | void updateDirMenu(); |
157 | void dirSelected( int id ); | 158 | void dirSelected( int id ); |
158 | void cleanUp(); | 159 | void cleanUp(); |
159 | 160 | ||
160 | }; | 161 | }; |
161 | 162 | ||
162 | #endif | 163 | #endif |