author | zecke <zecke> | 2002-04-27 22:20:11 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-04-27 22:20:11 (UTC) |
commit | 2dc8c64cfa30a199e4ebd45618e726e9ffc6f7dc (patch) (unidiff) | |
tree | 60d42174dc3898dae0c95a339b49997a8591a86b | |
parent | 7d741c93b423a3ab721071971b2c345d2d8548e2 (diff) | |
download | opie-2dc8c64cfa30a199e4ebd45618e726e9ffc6f7dc.zip opie-2dc8c64cfa30a199e4ebd45618e726e9ffc6f7dc.tar.gz opie-2dc8c64cfa30a199e4ebd45618e726e9ffc6f7dc.tar.bz2 |
Move FileItem class from the header into an anonymous namespace
-rw-r--r-- | libopie/ofileselector.cc | 49 | ||||
-rw-r--r-- | libopie/ofileselector.h | 49 |
2 files changed, 49 insertions, 49 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc index 3a11032..0a6e595 100644 --- a/libopie/ofileselector.cc +++ b/libopie/ofileselector.cc | |||
@@ -1,172 +1,219 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 3 | .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This library is free software; you can | 5 | _;:, .> :=|. This library is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <qnamespace.h> | 29 | #include <qnamespace.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
31 | #include <qcombobox.h> | 31 | #include <qcombobox.h> |
32 | #include <qhbox.h> | 32 | #include <qhbox.h> |
33 | #include <qvbox.h> | 33 | #include <qvbox.h> |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qwidgetstack.h> | 35 | #include <qwidgetstack.h> |
36 | #include <qlineedit.h> | 36 | #include <qlineedit.h> |
37 | #include <qcheckbox.h> | 37 | #include <qcheckbox.h> |
38 | #include <qlabel.h> | 38 | #include <qlabel.h> |
39 | #include <qheader.h> | 39 | #include <qheader.h> |
40 | #include <qdir.h> | 40 | #include <qdir.h> |
41 | #include <qpainter.h> | 41 | #include <qpainter.h> |
42 | #include <qaction.h> | 42 | #include <qaction.h> |
43 | #include <qpopupmenu.h> | 43 | #include <qpopupmenu.h> |
44 | #include <qcursor.h> | 44 | #include <qcursor.h> |
45 | #include <qstringlist.h> | 45 | #include <qstringlist.h> |
46 | #include <qmessagebox.h> | 46 | #include <qmessagebox.h> |
47 | 47 | ||
48 | #include <qpe/qpeapplication.h> | 48 | #include <qpe/qpeapplication.h> |
49 | #include <qpe/fileselector.h> | 49 | #include <qpe/fileselector.h> |
50 | #include <qpe/applnk.h> | 50 | #include <qpe/applnk.h> |
51 | #include <qpe/global.h> | 51 | #include <qpe/global.h> |
52 | #include <qpe/mimetype.h> | 52 | #include <qpe/mimetype.h> |
53 | #include <qpe/resource.h> | 53 | #include <qpe/resource.h> |
54 | #include <qpe/storage.h> | 54 | #include <qpe/storage.h> |
55 | 55 | ||
56 | #include <unistd.h> | 56 | #include <unistd.h> |
57 | #include <stdlib.h> | 57 | #include <stdlib.h> |
58 | #include <sys/stat.h> | 58 | #include <sys/stat.h> |
59 | 59 | ||
60 | #include "ofileselector.h" | 60 | #include "ofileselector.h" |
61 | 61 | ||
62 | QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; | 62 | QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; |
63 | 63 | ||
64 | namespace { | 64 | namespace { |
65 | 65 | ||
66 | int indexByString( const QComboBox *box, const QString &str ){ | 66 | int indexByString( const QComboBox *box, const QString &str ){ |
67 | int index= -1; | 67 | int index= -1; |
68 | for(int i= 0; i < box->count(); i++ ){ | 68 | for(int i= 0; i < box->count(); i++ ){ |
69 | if( str == box->text(i ) ){ | 69 | if( str == box->text(i ) ){ |
70 | index= i; | 70 | index= i; |
71 | break; | 71 | break; |
72 | } | 72 | } |
73 | } | 73 | } |
74 | return index; | 74 | return index; |
75 | } | 75 | } |
76 | 76 | class OFileSelectorItem : public QListViewItem { | |
77 | public: | ||
78 | OFileSelectorItem(QListView *view, const QPixmap &pixmap, const QString &path, | ||
79 | const QString &date, const QString &size, const QString &mDir, | ||
80 | bool isLocked=false, bool isDir=false ): QListViewItem(view) { | ||
81 | setPixmap(0, pixmap ); | ||
82 | setText(1, path ); | ||
83 | setText(2, size ); | ||
84 | setText(3, date ); | ||
85 | //setText(4, mDir ); | ||
86 | m_dir = mDir; | ||
87 | dir = isDir; | ||
88 | mLocked = isLocked; | ||
89 | } | ||
90 | bool isLocked() const{ | ||
91 | return mLocked; | ||
92 | } | ||
93 | QString directory()const{ | ||
94 | return m_dir; | ||
95 | } | ||
96 | bool isDir()const{ | ||
97 | return dir; | ||
98 | } | ||
99 | QString path()const{ | ||
100 | return text(1 ); | ||
101 | } | ||
102 | QString key(int id, bool )const { | ||
103 | QString ke; | ||
104 | if( id == 0 || id == 1 ){ // name | ||
105 | if( dir ){ | ||
106 | ke.append("0" ); | ||
107 | ke.append( text(1) ); | ||
108 | }else{ | ||
109 | ke.append("1" ); | ||
110 | ke.append( text(1) ); | ||
111 | } | ||
112 | }else if( id == 2 ){ // size | ||
113 | return text(2); | ||
114 | }else if( id == 3 ){ // date | ||
115 | return text(3); | ||
116 | } | ||
117 | return ke; | ||
118 | }; | ||
119 | private: | ||
120 | bool mLocked:1; | ||
121 | bool dir:1; | ||
122 | QString m_dir; | ||
123 | }; | ||
77 | }; | 124 | }; |
78 | 125 | ||
79 | 126 | ||
80 | OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, | 127 | OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, |
81 | const QString &fileName, const QStringList &mimetypes ) : QWidget( wid ) | 128 | const QString &fileName, const QStringList &mimetypes ) : QWidget( wid ) |
82 | { | 129 | { |
83 | if(wid!=0) | 130 | if(wid!=0) |
84 | resize(wid->width(),wid->height()); | 131 | resize(wid->width(),wid->height()); |
85 | m_selector = selector; | 132 | m_selector = selector; |
86 | m_currentDir = dirName; | 133 | m_currentDir = dirName; |
87 | m_name = fileName; | 134 | m_name = fileName; |
88 | m_mimetypes = mimetypes; | 135 | m_mimetypes = mimetypes; |
89 | 136 | ||
90 | if( mimetypes.isEmpty() ) | 137 | if( mimetypes.isEmpty() ) |
91 | m_autoMime = true; | 138 | m_autoMime = true; |
92 | 139 | ||
93 | qWarning("OFileSelector mimetypes %s", mimetypes.join(" ").latin1() ); | 140 | qWarning("OFileSelector mimetypes %s", mimetypes.join(" ").latin1() ); |
94 | m_mode = mode; | 141 | m_mode = mode; |
95 | m_shTool = true; | 142 | m_shTool = true; |
96 | m_shPerm = true; | 143 | m_shPerm = true; |
97 | m_shLne = true; | 144 | m_shLne = true; |
98 | m_shChooser = true; | 145 | m_shChooser = true; |
99 | m_shYesNo = true; | 146 | m_shYesNo = true; |
100 | 147 | ||
101 | // for FILESELECTOR only view is interesting | 148 | // for FILESELECTOR only view is interesting |
102 | m_location = 0; | 149 | m_location = 0; |
103 | m_homeButton = 0; | 150 | m_homeButton = 0; |
104 | m_docButton = 0; | 151 | m_docButton = 0; |
105 | m_hideButton = 0; | 152 | m_hideButton = 0; |
106 | m_ok = 0; | 153 | m_ok = 0; |
107 | m_cancel = 0; | 154 | m_cancel = 0; |
108 | m_reread = 0; | 155 | m_reread = 0; |
109 | m_up = 0; | 156 | m_up = 0; |
110 | m_View = 0; | 157 | m_View = 0; |
111 | m_select = 0; | 158 | m_select = 0; |
112 | m_stack = 0; | 159 | m_stack = 0; |
113 | 160 | ||
114 | m_select = 0; | 161 | m_select = 0; |
115 | m_stack = 0; | 162 | m_stack = 0; |
116 | m_lay = 0; | 163 | m_lay = 0; |
117 | m_boxToolbar = 0; | 164 | m_boxToolbar = 0; |
118 | m_boxOk = 0; | 165 | m_boxOk = 0; |
119 | m_edit = 0; | 166 | m_edit = 0; |
120 | 167 | ||
121 | m_fnLabel = 0; | 168 | m_fnLabel = 0; |
122 | m_checkPerm = 0; | 169 | m_checkPerm = 0; |
123 | m_mimeCheck = 0; | 170 | m_mimeCheck = 0; |
124 | m_viewCheck = 0; | 171 | m_viewCheck = 0; |
125 | 172 | ||
126 | m_pseudo = 0; | 173 | m_pseudo = 0; |
127 | m_pseudoLayout = 0; | 174 | m_pseudoLayout = 0; |
128 | 175 | ||
129 | m_dir = true; | 176 | m_dir = true; |
130 | m_files = true; | 177 | m_files = true; |
131 | m_custom = 0; | 178 | m_custom = 0; |
132 | m_showPopup = true; | 179 | m_showPopup = true; |
133 | 180 | ||
134 | if(m_pixmaps == 0 ) // init the pixmaps | 181 | if(m_pixmaps == 0 ) // init the pixmaps |
135 | initPics(); | 182 | initPics(); |
136 | 183 | ||
137 | m_lay = new QVBoxLayout(this); | 184 | m_lay = new QVBoxLayout(this); |
138 | init(); | 185 | init(); |
139 | m_edit->setText( fileName ); | 186 | m_edit->setText( fileName ); |
140 | } | 187 | } |
141 | 188 | ||
142 | void OFileSelector::initPics() | 189 | void OFileSelector::initPics() |
143 | { | 190 | { |
144 | qWarning("init pics" ); | 191 | qWarning("init pics" ); |
145 | m_pixmaps = new QMap<QString,QPixmap>; | 192 | m_pixmaps = new QMap<QString,QPixmap>; |
146 | QPixmap pm = Resource::loadPixmap( "folder" ); | 193 | QPixmap pm = Resource::loadPixmap( "folder" ); |
147 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 194 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
148 | QPainter painter( &pm ); | 195 | QPainter painter( &pm ); |
149 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 196 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
150 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 197 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
151 | m_pixmaps->insert("dirsymlink", pm ); | 198 | m_pixmaps->insert("dirsymlink", pm ); |
152 | 199 | ||
153 | QPixmap pm2 = Resource::loadPixmap( "lockedfolder" ); | 200 | QPixmap pm2 = Resource::loadPixmap( "lockedfolder" ); |
154 | QPainter pen(&pm2 ); | 201 | QPainter pen(&pm2 ); |
155 | pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk ); | 202 | pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk ); |
156 | pm2.setMask( pm2.createHeuristicMask( FALSE ) ); | 203 | pm2.setMask( pm2.createHeuristicMask( FALSE ) ); |
157 | m_pixmaps->insert("symlinkedlocked", pm2 ); | 204 | m_pixmaps->insert("symlinkedlocked", pm2 ); |
158 | 205 | ||
159 | } | 206 | } |
160 | 207 | ||
161 | // let's initialize the gui | 208 | // let's initialize the gui |
162 | /** | 209 | /** |
163 | -------------------- | 210 | -------------------- |
164 | | cmbBox Button | | 211 | | cmbBox Button | |
165 | -------------------- | 212 | -------------------- |
166 | | FileSlector | | 213 | | FileSlector | |
167 | | or | | 214 | | or | |
168 | | OSelector | | 215 | | OSelector | |
169 | | | | 216 | | | |
170 | | | | 217 | | | |
171 | ____________________ | 218 | ____________________ |
172 | | LineEdit | | 219 | | LineEdit | |
diff --git a/libopie/ofileselector.h b/libopie/ofileselector.h index babe09f..8173d76 100644 --- a/libopie/ofileselector.h +++ b/libopie/ofileselector.h | |||
@@ -1,210 +1,163 @@ | |||
1 | /* | 1 | /* |
2 | This is based on code and idea of | 2 | This is based on code and idea of |
3 | L. J. Potter ljp@llornkcor.com | 3 | L. J. Potter ljp@llornkcor.com |
4 | Thanks a lot | 4 | Thanks a lot |
5 | 5 | ||
6 | 6 | ||
7 | =. This file is part of the OPIE Project | 7 | =. This file is part of the OPIE Project |
8 | .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 8 | .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This library is free software; you can | 10 | _;:, .> :=|. This library is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This library is distributed in the hope that | 17 | .i_,=:_. -<s. This library is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef opiefileselector_h | 34 | #ifndef opiefileselector_h |
35 | #define opiefileselector_h | 35 | #define opiefileselector_h |
36 | 36 | ||
37 | #include <qwidget.h> | 37 | #include <qwidget.h> |
38 | #include <qstring.h> | 38 | #include <qstring.h> |
39 | #include <qpixmap.h> | 39 | #include <qpixmap.h> |
40 | #include <qstringlist.h> | 40 | #include <qstringlist.h> |
41 | #include <qmap.h> | 41 | #include <qmap.h> |
42 | #include <qvaluelist.h> | 42 | #include <qvaluelist.h> |
43 | 43 | ||
44 | #include <qpe/applnk.h> | 44 | #include <qpe/applnk.h> |
45 | #include <qlistview.h> | 45 | #include <qlistview.h> |
46 | /** This is OPIEs FileDialog Widget. You can use it | 46 | /** This is OPIEs FileDialog Widget. You can use it |
47 | * as a dropin replacement of the fileselector and | 47 | * as a dropin replacement of the fileselector and |
48 | * or use any of the new features. | 48 | * or use any of the new features. |
49 | * This is also a complete FileSave and FileLoad widget | 49 | * This is also a complete FileSave and FileLoad widget |
50 | * If you look for a Dialog check OFileDialog | 50 | * If you look for a Dialog check OFileDialog |
51 | * | 51 | * |
52 | */ | 52 | */ |
53 | class DocLnk; | 53 | class DocLnk; |
54 | class QCheckBox; | 54 | class QCheckBox; |
55 | class QComboBox; | 55 | class QComboBox; |
56 | class QPushButton; | 56 | class QPushButton; |
57 | class FileSelector; | 57 | class FileSelector; |
58 | class QGridLayout; | 58 | class QGridLayout; |
59 | class QLineEdit; | 59 | class QLineEdit; |
60 | class QLabel; | 60 | class QLabel; |
61 | class QWidgetStack; | 61 | class QWidgetStack; |
62 | class QHBoxLayout; | 62 | class QHBoxLayout; |
63 | class QVBoxLayout; | 63 | class QVBoxLayout; |
64 | class QPopupMenu; | 64 | class QPopupMenu; |
65 | class QFileInfo; | 65 | class QFileInfo; |
66 | // | 66 | // |
67 | class OFileSelectorItem : public QListViewItem { | 67 | |
68 | public: | ||
69 | OFileSelectorItem(QListView *view, const QPixmap &pixmap, const QString &path, | ||
70 | const QString &date, const QString &size, const QString &mDir, | ||
71 | bool isLocked=false, bool isDir=false ): QListViewItem(view) { | ||
72 | setPixmap(0, pixmap ); | ||
73 | setText(1, path ); | ||
74 | setText(2, size ); | ||
75 | setText(3, date ); | ||
76 | //setText(4, mDir ); | ||
77 | m_dir = mDir; | ||
78 | dir = isDir; | ||
79 | mLocked = isLocked; | ||
80 | } | ||
81 | bool isLocked() const{ | ||
82 | return mLocked; | ||
83 | } | ||
84 | QString directory()const{ | ||
85 | return m_dir; | ||
86 | } | ||
87 | bool isDir()const{ | ||
88 | return dir; | ||
89 | } | ||
90 | QString path()const{ | ||
91 | return text(1 ); | ||
92 | } | ||
93 | QString key(int id, bool )const { | ||
94 | QString ke; | ||
95 | if( id == 0 || id == 1 ){ // name | ||
96 | if( dir ){ | ||
97 | ke.append("0" ); | ||
98 | ke.append( text(1) ); | ||
99 | }else{ | ||
100 | ke.append("1" ); | ||
101 | ke.append( text(1) ); | ||
102 | } | ||
103 | }else if( id == 2 ){ // size | ||
104 | return text(2); | ||
105 | }else if( id == 3 ){ // date | ||
106 | return text(3); | ||
107 | } | ||
108 | return ke; | ||
109 | }; | ||
110 | private: | ||
111 | bool mLocked:1; | ||
112 | bool dir:1; | ||
113 | QString m_dir; | ||
114 | }; | ||
115 | 68 | ||
116 | class OFileSelector : public QWidget { | 69 | class OFileSelector : public QWidget { |
117 | Q_OBJECT | 70 | Q_OBJECT |
118 | public: | 71 | public: |
119 | enum Mode {OPEN=1, SAVE=2, FILESELECTOR=4, DIR=8 }; | 72 | enum Mode {OPEN=1, SAVE=2, FILESELECTOR=4, DIR=8 }; |
120 | enum Selector{NORMAL=1, EXTENDED = 2, EXTENDED_ALL =4 }; | 73 | enum Selector{NORMAL=1, EXTENDED = 2, EXTENDED_ALL =4 }; |
121 | enum View { DIRS = 1, FILES = 2, TREE = 4, ICON = 8 }; | 74 | enum View { DIRS = 1, FILES = 2, TREE = 4, ICON = 8 }; |
122 | OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, const QString &fileName = QString::null, const QStringList &mimetypes = QStringList() ); | 75 | OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, const QString &fileName = QString::null, const QStringList &mimetypes = QStringList() ); |
123 | ~OFileSelector() {}; | 76 | ~OFileSelector() {}; |
124 | bool isToolbarVisible() const { return m_shTool; }; | 77 | bool isToolbarVisible() const { return m_shTool; }; |
125 | bool isPermissionBarVisible() const { return m_shPerm; }; | 78 | bool isPermissionBarVisible() const { return m_shPerm; }; |
126 | bool isLineEditVisible()const { return m_shLne; }; | 79 | bool isLineEditVisible()const { return m_shLne; }; |
127 | bool isChooserVisible( )const { return m_shChooser; }; | 80 | bool isChooserVisible( )const { return m_shChooser; }; |
128 | bool isYesCancelVisible()const { return m_shYesNo; }; | 81 | bool isYesCancelVisible()const { return m_shYesNo; }; |
129 | void setYesCancelVisible( bool show ); | 82 | void setYesCancelVisible( bool show ); |
130 | void setToolbarVisible( bool show ); | 83 | void setToolbarVisible( bool show ); |
131 | void setPermissionBarVisible( bool show ); | 84 | void setPermissionBarVisible( bool show ); |
132 | void setLineEditVisible(bool show) ; | 85 | void setLineEditVisible(bool show) ; |
133 | void setChooserVisible( bool chooser ); | 86 | void setChooserVisible( bool chooser ); |
134 | 87 | ||
135 | QCheckBox* permissionCheckbox(); | 88 | QCheckBox* permissionCheckbox(); |
136 | bool setPermission() const; | 89 | bool setPermission() const; |
137 | void setPermissionChecked( bool check ); | 90 | void setPermissionChecked( bool check ); |
138 | 91 | ||
139 | void setMode( int ); | 92 | void setMode( int ); |
140 | 93 | ||
141 | bool showDirs()const { return m_dir; } | 94 | bool showDirs()const { return m_dir; } |
142 | void setShowDirs(bool ); | 95 | void setShowDirs(bool ); |
143 | 96 | ||
144 | const QListView* listView() { return m_View; }; | 97 | const QListView* listView() { return m_View; }; |
145 | 98 | ||
146 | bool isCaseSensetive()const { return m_case; } | 99 | bool isCaseSensetive()const { return m_case; } |
147 | void setCaseSensetive(bool caSe ); | 100 | void setCaseSensetive(bool caSe ); |
148 | 101 | ||
149 | bool showFiles()const { return m_files; }; | 102 | bool showFiles()const { return m_files; }; |
150 | void setShowFiles(bool ); | 103 | void setShowFiles(bool ); |
151 | bool cd(const QString &path ); | 104 | bool cd(const QString &path ); |
152 | 105 | ||
153 | 106 | ||
154 | int mode()const { return m_mode; }; | 107 | int mode()const { return m_mode; }; |
155 | int selector()const { return m_selector; }; | 108 | int selector()const { return m_selector; }; |
156 | void setSelector( int ); | 109 | void setSelector( int ); |
157 | 110 | ||
158 | bool showPopup()const { return m_showPopup; }; | 111 | bool showPopup()const { return m_showPopup; }; |
159 | void setShowPopup( bool pop ) { m_showPopup = pop; }; | 112 | void setShowPopup( bool pop ) { m_showPopup = pop; }; |
160 | void setPopupMenu( QPopupMenu * ); | 113 | void setPopupMenu( QPopupMenu * ); |
161 | 114 | ||
162 | void updateLay(); | 115 | void updateLay(); |
163 | 116 | ||
164 | void reparse(); // re reads the dir | 117 | void reparse(); // re reads the dir |
165 | 118 | ||
166 | QString selectedName( )const; | 119 | QString selectedName( )const; |
167 | QStringList selectedNames()const; | 120 | QStringList selectedNames()const; |
168 | 121 | ||
169 | QString selectedPath() const; | 122 | QString selectedPath() const; |
170 | QStringList selectedPaths() const; | 123 | QStringList selectedPaths() const; |
171 | 124 | ||
172 | QString directory()const; | 125 | QString directory()const; |
173 | int fileCount(); | 126 | int fileCount(); |
174 | 127 | ||
175 | /* the user needs to delete it */ | 128 | /* the user needs to delete it */ |
176 | DocLnk selectedDocument()const; | 129 | DocLnk selectedDocument()const; |
177 | /* the user needs to delete it */ | 130 | /* the user needs to delete it */ |
178 | QValueList<DocLnk> selectedDocuments()const; | 131 | QValueList<DocLnk> selectedDocuments()const; |
179 | 132 | ||
180 | signals: | 133 | signals: |
181 | void fileSelected( const DocLnk & ); | 134 | void fileSelected( const DocLnk & ); |
182 | void fileSelected( const QString & ); | 135 | void fileSelected( const QString & ); |
183 | void dirSelected(const QString &dir ); | 136 | void dirSelected(const QString &dir ); |
184 | void closeMe(); | 137 | void closeMe(); |
185 | void ok(); | 138 | void ok(); |
186 | void cancel(); | 139 | void cancel(); |
187 | 140 | ||
188 | protected slots: | 141 | protected slots: |
189 | void slotOk(); | 142 | void slotOk(); |
190 | void slotCancel(); | 143 | void slotCancel(); |
191 | void slotViewCheck(const QString & ); | 144 | void slotViewCheck(const QString & ); |
192 | void slotMimeCheck(const QString & ); | 145 | void slotMimeCheck(const QString & ); |
193 | void locationComboActivated(const QString & ); | 146 | void locationComboActivated(const QString & ); |
194 | void insertLocationPath(const QString &, int); | 147 | void insertLocationPath(const QString &, int); |
195 | void locationComboChanged(); | 148 | void locationComboChanged(); |
196 | protected: | 149 | protected: |
197 | void init(); | 150 | void init(); |
198 | void updateMimes(); | 151 | void updateMimes(); |
199 | 152 | ||
200 | protected: | 153 | protected: |
201 | 154 | ||
202 | private: | 155 | private: |
203 | int m_mode, m_selector; | 156 | int m_mode, m_selector; |
204 | QComboBox *m_location, *m_mimeCheck, *m_viewCheck; | 157 | QComboBox *m_location, *m_mimeCheck, *m_viewCheck; |
205 | QPushButton *m_homeButton, *m_docButton, *m_hideButton, *m_ok, *m_cancel; | 158 | QPushButton *m_homeButton, *m_docButton, *m_hideButton, *m_ok, *m_cancel; |
206 | QPushButton *m_reread, *m_up; | 159 | QPushButton *m_reread, *m_up; |
207 | QListView *m_View; | 160 | QListView *m_View; |
208 | QCheckBox *m_checkPerm; | 161 | QCheckBox *m_checkPerm; |
209 | QWidget *m_pseudo; | 162 | QWidget *m_pseudo; |
210 | QVBoxLayout *m_pseudoLayout; | 163 | QVBoxLayout *m_pseudoLayout; |