author | zecke <zecke> | 2004-11-14 17:40:57 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-11-14 17:40:57 (UTC) |
commit | 61dc3dd61685a1bfc6aba33ad81f8348bb992a11 (patch) (unidiff) | |
tree | 74994977ad38557c91a2f16975a9d8798c3365ec | |
parent | 9507723db1df320547a0cb660b9b923d41438fdf (diff) | |
download | opie-61dc3dd61685a1bfc6aba33ad81f8348bb992a11.zip opie-61dc3dd61685a1bfc6aba33ad81f8348bb992a11.tar.gz opie-61dc3dd61685a1bfc6aba33ad81f8348bb992a11.tar.bz2 |
-Fix bug in OFileSelector ListView spotted by hrw
to sort the 'size' column according their 'Number'-Halbordnung
and not by string comparsion
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 15 | ||||
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector_p.h | 4 |
2 files changed, 11 insertions, 8 deletions
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp index 01a51a2..718f743 100644 --- a/libopie2/opieui/fileselector/ofileselector.cpp +++ b/libopie2/opieui/fileselector/ofileselector.cpp | |||
@@ -1,1224 +1,1227 @@ | |||
1 | 1 | ||
2 | /* | 2 | /* |
3 | =. This file is part of the OPIE Project | 3 | =. This file is part of the OPIE Project |
4 | .=l. Copyright (C) 2002,2003 Holger Freyther <zecke@handhelds.org> | 4 | .=l. Copyright (C) 2002,2003 Holger Freyther <zecke@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This library is free software; you can | 6 | _;:, .> :=|. This library is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This library is distributed in the hope that | 13 | .i_,=:_. -<s. This library is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ..}^=.= = ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
19 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
20 | : = ...= . :.=- | 20 | : = ...= . :.=- |
21 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
22 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
23 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
24 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
25 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | /* hacky but we need to get FileSelector::filter */ | 30 | /* hacky but we need to get FileSelector::filter */ |
31 | #define private public | 31 | #define private public |
32 | #include <qpe/fileselector.h> | 32 | #include <qpe/fileselector.h> |
33 | #undef private | 33 | #undef private |
34 | 34 | ||
35 | #include "ofileselector_p.h" | 35 | #include "ofileselector_p.h" |
36 | 36 | ||
37 | /* OPIE */ | 37 | /* OPIE */ |
38 | #include <opie2/ofileselector.h> | 38 | #include <opie2/ofileselector.h> |
39 | #include <opie2/odebug.h> | 39 | #include <opie2/odebug.h> |
40 | 40 | ||
41 | #include <qpe/qpeapplication.h> | 41 | #include <qpe/qpeapplication.h> |
42 | #include <qpe/mimetype.h> | 42 | #include <qpe/mimetype.h> |
43 | #include <qpe/resource.h> | 43 | #include <qpe/resource.h> |
44 | #include <qpe/storage.h> | 44 | #include <qpe/storage.h> |
45 | 45 | ||
46 | /* QT */ | 46 | /* QT */ |
47 | #include <qcombobox.h> | 47 | #include <qcombobox.h> |
48 | #include <qdir.h> | 48 | #include <qdir.h> |
49 | #include <qhbox.h> | 49 | #include <qhbox.h> |
50 | #include <qheader.h> | 50 | #include <qheader.h> |
51 | #include <qlabel.h> | 51 | #include <qlabel.h> |
52 | #include <qlayout.h> | 52 | #include <qlayout.h> |
53 | #include <qlineedit.h> | 53 | #include <qlineedit.h> |
54 | #include <qlistview.h> | 54 | #include <qlistview.h> |
55 | #include <qpopupmenu.h> | 55 | #include <qpopupmenu.h> |
56 | #include <qwidgetstack.h> | 56 | #include <qwidgetstack.h> |
57 | #include <qregexp.h> | 57 | #include <qregexp.h> |
58 | #include <qobjectlist.h> | 58 | #include <qobjectlist.h> |
59 | 59 | ||
60 | using namespace Opie::Ui::Internal; | 60 | using namespace Opie::Ui::Internal; |
61 | 61 | ||
62 | namespace Opie { | 62 | namespace Opie { |
63 | namespace Ui { | 63 | namespace Ui { |
64 | namespace Internal { | 64 | namespace Internal { |
65 | OFileViewInterface::OFileViewInterface( OFileSelector* _selector ) | 65 | OFileViewInterface::OFileViewInterface( OFileSelector* _selector ) |
66 | : m_selector( _selector ) | 66 | : m_selector( _selector ) |
67 | { | 67 | { |
68 | selector()->registerView( this ); | 68 | selector()->registerView( this ); |
69 | } | 69 | } |
70 | 70 | ||
71 | OFileViewInterface::~OFileViewInterface() | 71 | OFileViewInterface::~OFileViewInterface() |
72 | {} | 72 | {} |
73 | 73 | ||
74 | QString OFileViewInterface::name()const | 74 | QString OFileViewInterface::name()const |
75 | { | 75 | { |
76 | return m_name; | 76 | return m_name; |
77 | } | 77 | } |
78 | 78 | ||
79 | void OFileViewInterface::setName( const QString& name ) | 79 | void OFileViewInterface::setName( const QString& name ) |
80 | { | 80 | { |
81 | m_name = name; | 81 | m_name = name; |
82 | } | 82 | } |
83 | 83 | ||
84 | OFileSelector* OFileViewInterface::selector()const | 84 | OFileSelector* OFileViewInterface::selector()const |
85 | { | 85 | { |
86 | return m_selector; | 86 | return m_selector; |
87 | } | 87 | } |
88 | 88 | ||
89 | DocLnk OFileViewInterface::selectedDocument()const | 89 | DocLnk OFileViewInterface::selectedDocument()const |
90 | { | 90 | { |
91 | return DocLnk( selectedName() ); | 91 | return DocLnk( selectedName() ); |
92 | } | 92 | } |
93 | 93 | ||
94 | bool OFileViewInterface::showNew()const | 94 | bool OFileViewInterface::showNew()const |
95 | { | 95 | { |
96 | return selector()->showNew(); | 96 | return selector()->showNew(); |
97 | } | 97 | } |
98 | 98 | ||
99 | bool OFileViewInterface::showClose()const | 99 | bool OFileViewInterface::showClose()const |
100 | { | 100 | { |
101 | return selector()->showClose(); | 101 | return selector()->showClose(); |
102 | } | 102 | } |
103 | 103 | ||
104 | MimeTypes OFileViewInterface::mimeTypes()const | 104 | MimeTypes OFileViewInterface::mimeTypes()const |
105 | { | 105 | { |
106 | return selector()->mimeTypes(); | 106 | return selector()->mimeTypes(); |
107 | } | 107 | } |
108 | 108 | ||
109 | QStringList OFileViewInterface::currentMimeType()const | 109 | QStringList OFileViewInterface::currentMimeType()const |
110 | { | 110 | { |
111 | return selector()->currentMimeType(); | 111 | return selector()->currentMimeType(); |
112 | } | 112 | } |
113 | 113 | ||
114 | void OFileViewInterface::activate( const QString& ) | 114 | void OFileViewInterface::activate( const QString& ) |
115 | { | 115 | { |
116 | // not implemented here | 116 | // not implemented here |
117 | } | 117 | } |
118 | 118 | ||
119 | void OFileViewInterface::ok() | 119 | void OFileViewInterface::ok() |
120 | { | 120 | { |
121 | emit selector()->ok(); | 121 | emit selector()->ok(); |
122 | } | 122 | } |
123 | 123 | ||
124 | void OFileViewInterface::cancel() | 124 | void OFileViewInterface::cancel() |
125 | { | 125 | { |
126 | emit selector()->cancel(); | 126 | emit selector()->cancel(); |
127 | } | 127 | } |
128 | 128 | ||
129 | void OFileViewInterface::closeMe() | 129 | void OFileViewInterface::closeMe() |
130 | { | 130 | { |
131 | emit selector()->closeMe(); | 131 | emit selector()->closeMe(); |
132 | } | 132 | } |
133 | 133 | ||
134 | void OFileViewInterface::fileSelected( const QString& str) | 134 | void OFileViewInterface::fileSelected( const QString& str) |
135 | { | 135 | { |
136 | emit selector()->fileSelected( str); | 136 | emit selector()->fileSelected( str); |
137 | } | 137 | } |
138 | 138 | ||
139 | void OFileViewInterface::fileSelected( const DocLnk& lnk) | 139 | void OFileViewInterface::fileSelected( const DocLnk& lnk) |
140 | { | 140 | { |
141 | emit selector()->fileSelected( lnk ); | 141 | emit selector()->fileSelected( lnk ); |
142 | } | 142 | } |
143 | 143 | ||
144 | void OFileViewInterface::setCurrentFileName( const QString& str ) | 144 | void OFileViewInterface::setCurrentFileName( const QString& str ) |
145 | { | 145 | { |
146 | selector()->m_lneEdit->setText( str ); | 146 | selector()->m_lneEdit->setText( str ); |
147 | } | 147 | } |
148 | 148 | ||
149 | QString OFileViewInterface::currentFileName()const | 149 | QString OFileViewInterface::currentFileName()const |
150 | { | 150 | { |
151 | return selector()->m_lneEdit->text(); | 151 | return selector()->m_lneEdit->text(); |
152 | } | 152 | } |
153 | 153 | ||
154 | QString OFileViewInterface::startDirectory()const | 154 | QString OFileViewInterface::startDirectory()const |
155 | { | 155 | { |
156 | return selector()->m_startDir; | 156 | return selector()->m_startDir; |
157 | } | 157 | } |
158 | 158 | ||
159 | bool OFileViewInterface::allItem( const QString& item )const | 159 | bool OFileViewInterface::allItem( const QString& item )const |
160 | { | 160 | { |
161 | return selector()->m_allList.contains( item ); | 161 | return selector()->m_allList.contains( item ); |
162 | } | 162 | } |
163 | 163 | ||
164 | 164 | ||
165 | ODocumentFileView::ODocumentFileView( OFileSelector* selector ) | 165 | ODocumentFileView::ODocumentFileView( OFileSelector* selector ) |
166 | :OFileViewInterface( selector ) | 166 | :OFileViewInterface( selector ) |
167 | { | 167 | { |
168 | m_selector = 0; | 168 | m_selector = 0; |
169 | setName( QObject::tr("Documents") ); | 169 | setName( QObject::tr("Documents") ); |
170 | } | 170 | } |
171 | 171 | ||
172 | ODocumentFileView::~ODocumentFileView() | 172 | ODocumentFileView::~ODocumentFileView() |
173 | { | 173 | { |
174 | } | 174 | } |
175 | 175 | ||
176 | QString ODocumentFileView::selectedName()const | 176 | QString ODocumentFileView::selectedName()const |
177 | { | 177 | { |
178 | if (!m_selector) | 178 | if (!m_selector) |
179 | return QString::null; | 179 | return QString::null; |
180 | 180 | ||
181 | return m_selector->selectedDocument().file(); | 181 | return m_selector->selectedDocument().file(); |
182 | } | 182 | } |
183 | 183 | ||
184 | QString ODocumentFileView::selectedPath()const | 184 | QString ODocumentFileView::selectedPath()const |
185 | { | 185 | { |
186 | return QPEApplication::documentDir(); | 186 | return QPEApplication::documentDir(); |
187 | } | 187 | } |
188 | 188 | ||
189 | QString ODocumentFileView::directory()const | 189 | QString ODocumentFileView::directory()const |
190 | { | 190 | { |
191 | return selectedPath(); | 191 | return selectedPath(); |
192 | } | 192 | } |
193 | 193 | ||
194 | void ODocumentFileView::reread() | 194 | void ODocumentFileView::reread() |
195 | { | 195 | { |
196 | if (!m_selector) | 196 | if (!m_selector) |
197 | return; | 197 | return; |
198 | 198 | ||
199 | m_selector->setNewVisible( showNew() ); | 199 | m_selector->setNewVisible( showNew() ); |
200 | m_selector->setCloseVisible( showClose() ); | 200 | m_selector->setCloseVisible( showClose() ); |
201 | m_selector->filter = currentMimeType().join(";"); | 201 | m_selector->filter = currentMimeType().join(";"); |
202 | m_selector->reread(); | 202 | m_selector->reread(); |
203 | } | 203 | } |
204 | 204 | ||
205 | int ODocumentFileView::fileCount()const | 205 | int ODocumentFileView::fileCount()const |
206 | { | 206 | { |
207 | if (!m_selector) | 207 | if (!m_selector) |
208 | return -1; | 208 | return -1; |
209 | 209 | ||
210 | return m_selector->fileCount(); | 210 | return m_selector->fileCount(); |
211 | } | 211 | } |
212 | 212 | ||
213 | DocLnk ODocumentFileView::selectedDocument()const | 213 | DocLnk ODocumentFileView::selectedDocument()const |
214 | { | 214 | { |
215 | if (!m_selector) | 215 | if (!m_selector) |
216 | return DocLnk(); | 216 | return DocLnk(); |
217 | 217 | ||
218 | return m_selector->selectedDocument(); | 218 | return m_selector->selectedDocument(); |
219 | } | 219 | } |
220 | 220 | ||
221 | QWidget* ODocumentFileView::widget( QWidget* parent ) | 221 | QWidget* ODocumentFileView::widget( QWidget* parent ) |
222 | { | 222 | { |
223 | if (!m_selector ) | 223 | if (!m_selector ) |
224 | { | 224 | { |
225 | m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() ); | 225 | m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() ); |
226 | QObject::connect(m_selector, SIGNAL(fileSelected(const DocLnk&) ), | 226 | QObject::connect(m_selector, SIGNAL(fileSelected(const DocLnk&) ), |
227 | selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) ); | 227 | selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) ); |
228 | QObject::connect(m_selector, SIGNAL(closeMe() ), | 228 | QObject::connect(m_selector, SIGNAL(closeMe() ), |
229 | selector(), SIGNAL(closeMe() ) ); | 229 | selector(), SIGNAL(closeMe() ) ); |
230 | QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk&) ), | 230 | QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk&) ), |
231 | selector(), SIGNAL(newSelected(const DocLnk&) ) ); | 231 | selector(), SIGNAL(newSelected(const DocLnk&) ) ); |
232 | } | 232 | } |
233 | 233 | ||
234 | return m_selector; | 234 | return m_selector; |
235 | } | 235 | } |
236 | 236 | ||
237 | /* | 237 | /* |
238 | * This is the file system view used | 238 | * This is the file system view used |
239 | * we use a QListView + QListViewItems for it | 239 | * we use a QListView + QListViewItems for it |
240 | */ | 240 | */ |
241 | 241 | ||
242 | OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, | 242 | OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, |
243 | const QString& path, const QString& date, | 243 | const QString& path, const QString& date, |
244 | const QString& size, const QString& dir, | 244 | const QString& size, const QString& dir, |
245 | bool isLocked, bool isDir ) | 245 | bool isLocked, bool isDir ) |
246 | : QListViewItem( view ) | 246 | : QListViewItem( view ), m_dir(dir), m_isDir(isDir), m_locked(isLocked) |
247 | { | 247 | { |
248 | setPixmap(0, pixmap ); | 248 | setPixmap(0, pixmap ); |
249 | setText(1, path ); | 249 | setText(1, path ); |
250 | setText(2, size ); | 250 | setText(2, size ); |
251 | setText(3, date ); | 251 | setText(3, date ); |
252 | m_isDir = isDir; | ||
253 | m_dir = dir; | ||
254 | m_locked = isLocked; | ||
255 | } | 252 | } |
256 | 253 | ||
257 | OFileSelectorItem::~OFileSelectorItem() | 254 | OFileSelectorItem::~OFileSelectorItem() |
258 | { | 255 | { |
259 | } | 256 | } |
260 | 257 | ||
261 | bool OFileSelectorItem::isLocked()const | 258 | bool OFileSelectorItem::isLocked()const |
262 | { | 259 | { |
263 | return m_locked; | 260 | return m_locked; |
264 | } | 261 | } |
265 | 262 | ||
266 | QString OFileSelectorItem::directory()const | 263 | QString OFileSelectorItem::directory()const |
267 | { | 264 | { |
268 | return m_dir; | 265 | return m_dir; |
269 | } | 266 | } |
270 | 267 | ||
271 | bool OFileSelectorItem::isDir()const | 268 | bool OFileSelectorItem::isDir()const |
272 | { | 269 | { |
273 | return m_isDir; | 270 | return m_isDir; |
274 | } | 271 | } |
275 | 272 | ||
276 | QString OFileSelectorItem::path()const | 273 | QString OFileSelectorItem::path()const |
277 | { | 274 | { |
278 | return text( 1 ); | 275 | return text( 1 ); |
279 | } | 276 | } |
280 | 277 | ||
281 | QString OFileSelectorItem::key( int id, bool )const | 278 | QString OFileSelectorItem::key( int id, bool )const |
282 | { | 279 | { |
283 | QString ke; | 280 | QString ke; |
281 | |||
282 | /* | ||
283 | * id = 0 ||id == 1 : Sort By Name but Directories at Top | ||
284 | * id = 2 : Sort By Size: Prepend '0' to the key | ||
285 | */ | ||
284 | if( id == 0 || id == 1 ) | 286 | if( id == 0 || id == 1 ) |
285 | { // name | 287 | { // name |
286 | if( m_isDir ) | 288 | if( m_isDir ) |
287 | { | 289 | { |
288 | ke.append("0" ); | 290 | ke.append("0" ); |
289 | ke.append( text(1) ); | 291 | ke.append( text(1) ); |
290 | } | 292 | } |
291 | else | 293 | else |
292 | { | 294 | { |
293 | ke.append("1" ); | 295 | ke.append("1" ); |
294 | ke.append( text(1) ); | 296 | ke.append( text(1) ); |
295 | } | 297 | } |
296 | return ke; | 298 | return ke; |
297 | } | 299 | }else if(id == 2) { |
298 | else | 300 | return text(2).rightJustify(20, '0'); |
301 | }else | ||
299 | return text( id ); | 302 | return text( id ); |
300 | 303 | ||
301 | } | 304 | } |
302 | 305 | ||
303 | OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, OFileSelector* sel) | 306 | OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, OFileSelector* sel) |
304 | :QWidget( parent ), m_sel( sel ) | 307 | :QWidget( parent ), m_sel( sel ) |
305 | { | 308 | { |
306 | m_all = false; | 309 | m_all = false; |
307 | QVBoxLayout* lay = new QVBoxLayout( this ); | 310 | QVBoxLayout* lay = new QVBoxLayout( this ); |
308 | m_currentDir = startDir; | 311 | m_currentDir = startDir; |
309 | 312 | ||
310 | /* | 313 | /* |
311 | * now we add a special bar | 314 | * now we add a special bar |
312 | * One Button For Up | 315 | * One Button For Up |
313 | * Home | 316 | * Home |
314 | * Doc | 317 | * Doc |
315 | * And a dropdown menu with FileSystems | 318 | * And a dropdown menu with FileSystems |
316 | * FUTURE: one to change dir with lineedit | 319 | * FUTURE: one to change dir with lineedit |
317 | * Bookmarks | 320 | * Bookmarks |
318 | * Create Dir | 321 | * Create Dir |
319 | */ | 322 | */ |
320 | QHBox* box = new QHBox(this ); | 323 | QHBox* box = new QHBox(this ); |
321 | box->setBackgroundMode( PaletteButton ); | 324 | box->setBackgroundMode( PaletteButton ); |
322 | box->setSpacing( 0 ); | 325 | box->setSpacing( 0 ); |
323 | 326 | ||
324 | QToolButton *btn = new QToolButton( box ); | 327 | QToolButton *btn = new QToolButton( box ); |
325 | btn->setIconSet( Resource::loadIconSet("up") ); | 328 | btn->setIconSet( Resource::loadIconSet("up") ); |
326 | connect(btn, SIGNAL(clicked() ), | 329 | connect(btn, SIGNAL(clicked() ), |
327 | this, SLOT( cdUP() ) ); | 330 | this, SLOT( cdUP() ) ); |
328 | 331 | ||
329 | btn = new QToolButton( box ); | 332 | btn = new QToolButton( box ); |
330 | btn->setIconSet( Resource::loadIconSet("home") ); | 333 | btn->setIconSet( Resource::loadIconSet("home") ); |
331 | connect(btn, SIGNAL(clicked() ), | 334 | connect(btn, SIGNAL(clicked() ), |
332 | this, SLOT( cdHome() ) ); | 335 | this, SLOT( cdHome() ) ); |
333 | 336 | ||
334 | btn = new QToolButton( box ); | 337 | btn = new QToolButton( box ); |
335 | btn->setIconSet( Resource::loadIconSet("DocsIcon") ); | 338 | btn->setIconSet( Resource::loadIconSet("DocsIcon") ); |
336 | connect(btn, SIGNAL(clicked() ), | 339 | connect(btn, SIGNAL(clicked() ), |
337 | this, SLOT(cdDoc() ) ); | 340 | this, SLOT(cdDoc() ) ); |
338 | 341 | ||
339 | m_btnNew = new QToolButton( box ); | 342 | m_btnNew = new QToolButton( box ); |
340 | m_btnNew->setIconSet( Resource::loadIconSet("new") ); | 343 | m_btnNew->setIconSet( Resource::loadIconSet("new") ); |
341 | connect(m_btnNew, SIGNAL(clicked() ), | 344 | connect(m_btnNew, SIGNAL(clicked() ), |
342 | this, SLOT(slotNew() ) ); | 345 | this, SLOT(slotNew() ) ); |
343 | 346 | ||
344 | 347 | ||
345 | m_btnClose = new QToolButton( box ); | 348 | m_btnClose = new QToolButton( box ); |
346 | m_btnClose->setIconSet( Resource::loadIconSet("close") ); | 349 | m_btnClose->setIconSet( Resource::loadIconSet("close") ); |
347 | connect(m_btnClose, SIGNAL(clicked() ), | 350 | connect(m_btnClose, SIGNAL(clicked() ), |
348 | selector(), SIGNAL(closeMe() ) ); | 351 | selector(), SIGNAL(closeMe() ) ); |
349 | 352 | ||
350 | btn = new QToolButton( box ); | 353 | btn = new QToolButton( box ); |
351 | btn->setIconSet( Resource::loadIconSet("cardmon/pcmcia") ); | 354 | btn->setIconSet( Resource::loadIconSet("cardmon/pcmcia") ); |
352 | 355 | ||
353 | /* let's fill device parts */ | 356 | /* let's fill device parts */ |
354 | QPopupMenu* pop = new QPopupMenu(this); | 357 | QPopupMenu* pop = new QPopupMenu(this); |
355 | connect(pop, SIGNAL( activated(int) ), | 358 | connect(pop, SIGNAL( activated(int) ), |
356 | this, SLOT(slotFSActivated(int) ) ); | 359 | this, SLOT(slotFSActivated(int) ) ); |
357 | 360 | ||
358 | StorageInfo storage; | 361 | StorageInfo storage; |
359 | const QList<FileSystem> &fs = storage.fileSystems(); | 362 | const QList<FileSystem> &fs = storage.fileSystems(); |
360 | QListIterator<FileSystem> it(fs); | 363 | QListIterator<FileSystem> it(fs); |
361 | for ( ; it.current(); ++it ) | 364 | for ( ; it.current(); ++it ) |
362 | { | 365 | { |
363 | const QString disk = (*it)->name(); | 366 | const QString disk = (*it)->name(); |
364 | const QString path = (*it)->path(); | 367 | const QString path = (*it)->path(); |
365 | m_dev.insert( disk, path ); | 368 | m_dev.insert( disk, path ); |
366 | pop->insertItem( disk ); | 369 | pop->insertItem( disk ); |
367 | } | 370 | } |
368 | m_fsPop = pop; | 371 | m_fsPop = pop; |
369 | 372 | ||
370 | 373 | ||
371 | btn->setPopup( pop ); | 374 | btn->setPopup( pop ); |
372 | 375 | ||
373 | lay->addWidget( box ); | 376 | lay->addWidget( box ); |
374 | 377 | ||
375 | m_view = new QListView( this ); | 378 | m_view = new QListView( this ); |
376 | 379 | ||
377 | m_view->installEventFilter(this); | 380 | m_view->installEventFilter(this); |
378 | 381 | ||
379 | QPEApplication::setStylusOperation( m_view->viewport(), | 382 | QPEApplication::setStylusOperation( m_view->viewport(), |
380 | QPEApplication::RightOnHold); | 383 | QPEApplication::RightOnHold); |
381 | m_view->addColumn(" " ); | 384 | m_view->addColumn(" " ); |
382 | m_view->addColumn(tr("Name"), 135 ); | 385 | m_view->addColumn(tr("Name"), 135 ); |
383 | m_view->addColumn(tr("Size"), -1 ); | 386 | m_view->addColumn(tr("Size"), -1 ); |
384 | m_view->addColumn(tr("Date"), 60 ); | 387 | m_view->addColumn(tr("Date"), 60 ); |
385 | m_view->addColumn(tr("Mime Type"), -1 ); | 388 | m_view->addColumn(tr("Mime Type"), -1 ); |
386 | 389 | ||
387 | 390 | ||
388 | m_view->setSorting( 1 ); | 391 | m_view->setSorting( 1 ); |
389 | m_view->setAllColumnsShowFocus( TRUE ); | 392 | m_view->setAllColumnsShowFocus( TRUE ); |
390 | 393 | ||
391 | lay->addWidget( m_view, 1000 ); | 394 | lay->addWidget( m_view, 1000 ); |
392 | connectSlots(); | 395 | connectSlots(); |
393 | } | 396 | } |
394 | 397 | ||
395 | OFileViewFileListView::~OFileViewFileListView() | 398 | OFileViewFileListView::~OFileViewFileListView() |
396 | { | 399 | { |
397 | } | 400 | } |
398 | 401 | ||
399 | void OFileViewFileListView::slotNew() | 402 | void OFileViewFileListView::slotNew() |
400 | { | 403 | { |
401 | DocLnk lnk; | 404 | DocLnk lnk; |
402 | emit selector()->newSelected( lnk ); | 405 | emit selector()->newSelected( lnk ); |
403 | } | 406 | } |
404 | 407 | ||
405 | OFileSelectorItem* OFileViewFileListView::currentItem()const | 408 | OFileSelectorItem* OFileViewFileListView::currentItem()const |
406 | { | 409 | { |
407 | QListViewItem* item = m_view->currentItem(); | 410 | QListViewItem* item = m_view->currentItem(); |
408 | if (!item ) | 411 | if (!item ) |
409 | return 0l; | 412 | return 0l; |
410 | 413 | ||
411 | return static_cast<OFileSelectorItem*>(item); | 414 | return static_cast<OFileSelectorItem*>(item); |
412 | } | 415 | } |
413 | 416 | ||
414 | void OFileViewFileListView::reread( bool all ) | 417 | void OFileViewFileListView::reread( bool all ) |
415 | { | 418 | { |
416 | m_view->clear(); | 419 | m_view->clear(); |
417 | 420 | ||
418 | if (selector()->showClose() ) | 421 | if (selector()->showClose() ) |
419 | m_btnClose->show(); | 422 | m_btnClose->show(); |
420 | else | 423 | else |
421 | m_btnClose->hide(); | 424 | m_btnClose->hide(); |
422 | 425 | ||
423 | if (selector()->showNew() ) | 426 | if (selector()->showNew() ) |
424 | m_btnNew->show(); | 427 | m_btnNew->show(); |
425 | else | 428 | else |
426 | m_btnNew->hide(); | 429 | m_btnNew->hide(); |
427 | 430 | ||
428 | m_mimes = selector()->currentMimeType(); | 431 | m_mimes = selector()->currentMimeType(); |
429 | m_all = all; | 432 | m_all = all; |
430 | 433 | ||
431 | QDir dir( m_currentDir ); | 434 | QDir dir( m_currentDir ); |
432 | if (!dir.exists() ) | 435 | if (!dir.exists() ) |
433 | return; | 436 | return; |
434 | 437 | ||
435 | dir.setSorting( QDir::Name | QDir::DirsFirst | QDir::Reversed ); | 438 | dir.setSorting( QDir::Name | QDir::DirsFirst | QDir::Reversed ); |
436 | int filter; | 439 | int filter; |
437 | filter = QDir::Dirs; | 440 | filter = QDir::Dirs; |
438 | if ( selector()->mode() != OFileSelector::DIRECTORYSELECTOR ) | 441 | if ( selector()->mode() != OFileSelector::DIRECTORYSELECTOR ) |
439 | filter = filter | QDir::Files | QDir::All; | 442 | filter = filter | QDir::Files | QDir::All; |
440 | 443 | ||
441 | if ( m_all ) | 444 | if ( m_all ) |
442 | filter = filter | QDir::Hidden; | 445 | filter = filter | QDir::Hidden; |
443 | 446 | ||
444 | dir.setFilter( filter ); | 447 | dir.setFilter( filter ); |
445 | 448 | ||
446 | // now go through all files | 449 | // now go through all files |
447 | const QFileInfoList *list = dir.entryInfoList(); | 450 | const QFileInfoList *list = dir.entryInfoList(); |
448 | if (!list) | 451 | if (!list) |
449 | { | 452 | { |
450 | cdUP(); | 453 | cdUP(); |
451 | return; | 454 | return; |
452 | } | 455 | } |
453 | 456 | ||
454 | QFileInfoListIterator it( *list ); | 457 | QFileInfoListIterator it( *list ); |
455 | QFileInfo *fi; | 458 | QFileInfo *fi; |
456 | while( (fi=it.current() ) ) | 459 | while( (fi=it.current() ) ) |
457 | { | 460 | { |
458 | if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ) | 461 | if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ) |
459 | { | 462 | { |
460 | ++it; | 463 | ++it; |
461 | continue; | 464 | continue; |
462 | } | 465 | } |
463 | 466 | ||
464 | /* | 467 | /* |
465 | * It is a symlink we try to resolve it now but don't let us attack by DOS | 468 | * It is a symlink we try to resolve it now but don't let us attack by DOS |
466 | * | 469 | * |
467 | */ | 470 | */ |
468 | if( fi->isSymLink() ) | 471 | if( fi->isSymLink() ) |
469 | { | 472 | { |
470 | QString file = fi->dirPath( true ) + "/" + fi->readLink(); | 473 | QString file = fi->dirPath( true ) + "/" + fi->readLink(); |
471 | for( int i = 0; i<=4; i++) | 474 | for( int i = 0; i<=4; i++) |
472 | { // 5 tries to prevent dos | 475 | { // 5 tries to prevent dos |
473 | QFileInfo info( file ); | 476 | QFileInfo info( file ); |
474 | if( !info.exists() ) | 477 | if( !info.exists() ) |
475 | { | 478 | { |
476 | addSymlink( fi, TRUE ); | 479 | addSymlink( fi, TRUE ); |
477 | break; | 480 | break; |
478 | } | 481 | } |
479 | else if( info.isDir() ) | 482 | else if( info.isDir() ) |
480 | { | 483 | { |
481 | addDir( fi, TRUE ); | 484 | addDir( fi, TRUE ); |
482 | break; | 485 | break; |
483 | } | 486 | } |
484 | else if( info.isFile() ) | 487 | else if( info.isFile() ) |
485 | { | 488 | { |
486 | addFile( fi, TRUE ); | 489 | addFile( fi, TRUE ); |
487 | break; | 490 | break; |
488 | } | 491 | } |
489 | else if( info.isSymLink() ) | 492 | else if( info.isSymLink() ) |
490 | { | 493 | { |
491 | file = info.dirPath(true ) + "/" + info.readLink() ; | 494 | file = info.dirPath(true ) + "/" + info.readLink() ; |
492 | break; | 495 | break; |
493 | } | 496 | } |
494 | else if( i == 4) | 497 | else if( i == 4) |
495 | { // couldn't resolve symlink add it as symlink | 498 | { // couldn't resolve symlink add it as symlink |
496 | addSymlink( fi ); | 499 | addSymlink( fi ); |
497 | } | 500 | } |
498 | } // off for loop for symlink resolving | 501 | } // off for loop for symlink resolving |
499 | } | 502 | } |
500 | else if( fi->isDir() ) | 503 | else if( fi->isDir() ) |
501 | addDir( fi ); | 504 | addDir( fi ); |
502 | else if( fi->isFile() ) | 505 | else if( fi->isFile() ) |
503 | addFile( fi ); | 506 | addFile( fi ); |
504 | 507 | ||
505 | ++it; | 508 | ++it; |
506 | } // of while loop | 509 | } // of while loop |
507 | m_view->sort(); | 510 | m_view->sort(); |
508 | 511 | ||
509 | } | 512 | } |
510 | int OFileViewFileListView::fileCount()const | 513 | int OFileViewFileListView::fileCount()const |
511 | { | 514 | { |
512 | return m_view->childCount(); | 515 | return m_view->childCount(); |
513 | } | 516 | } |
514 | 517 | ||
515 | QString OFileViewFileListView::currentDir()const | 518 | QString OFileViewFileListView::currentDir()const |
516 | { | 519 | { |
517 | return m_currentDir; | 520 | return m_currentDir; |
518 | } | 521 | } |
519 | 522 | ||
520 | OFileSelector* OFileViewFileListView::selector() | 523 | OFileSelector* OFileViewFileListView::selector() |
521 | { | 524 | { |
522 | return m_sel; | 525 | return m_sel; |
523 | } | 526 | } |
524 | 527 | ||
525 | bool OFileViewFileListView::eventFilter (QObject *, QEvent *e) | 528 | bool OFileViewFileListView::eventFilter (QObject *, QEvent *e) |
526 | { | 529 | { |
527 | if ( e->type() == QEvent::KeyPress ) | 530 | if ( e->type() == QEvent::KeyPress ) |
528 | { | 531 | { |
529 | QKeyEvent *k = (QKeyEvent *)e; | 532 | QKeyEvent *k = (QKeyEvent *)e; |
530 | if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) | 533 | if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) |
531 | { | 534 | { |
532 | slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); | 535 | slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); |
533 | return true; | 536 | return true; |
534 | } | 537 | } |
535 | } | 538 | } |
536 | return false; | 539 | return false; |
537 | } | 540 | } |
538 | 541 | ||
539 | void OFileViewFileListView::connectSlots() | 542 | void OFileViewFileListView::connectSlots() |
540 | { | 543 | { |
541 | connect(m_view, SIGNAL(clicked(QListViewItem*) ), | 544 | connect(m_view, SIGNAL(clicked(QListViewItem*) ), |
542 | this, SLOT(slotCurrentChanged(QListViewItem*) ) ); | 545 | this, SLOT(slotCurrentChanged(QListViewItem*) ) ); |
543 | connect(m_view, SIGNAL(mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ), | 546 | connect(m_view, SIGNAL(mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ), |
544 | this, SLOT(slotClicked(int,QListViewItem*,const QPoint&,int) ) ); | 547 | this, SLOT(slotClicked(int,QListViewItem*,const QPoint&,int) ) ); |
545 | } | 548 | } |
546 | 549 | ||
547 | void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) | 550 | void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) |
548 | { | 551 | { |
549 | if (!item) | 552 | if (!item) |
550 | return; | 553 | return; |
551 | #if 0 | 554 | #if 0 |
552 | 555 | ||
553 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); | 556 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); |
554 | 557 | ||
555 | if (!sel->isDir() ) | 558 | if (!sel->isDir() ) |
556 | { | 559 | { |
557 | selector()->m_lneEdit->setText( sel->text(1) ); | 560 | selector()->m_lneEdit->setText( sel->text(1) ); |
558 | // if in fileselector mode we will emit selected | 561 | // if in fileselector mode we will emit selected |
559 | if ( selector()->mode() == OFileSelector::FileSelector ) | 562 | if ( selector()->mode() == OFileSelector::FileSelector ) |
560 | { | 563 | { |
561 | odebug << "slot Current Changed" << oendl; | 564 | odebug << "slot Current Changed" << oendl; |
562 | QStringList str = QStringList::split("->", sel->text(1) ); | 565 | QStringList str = QStringList::split("->", sel->text(1) ); |
563 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); | 566 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); |
564 | emit selector()->fileSelected( path ); | 567 | emit selector()->fileSelected( path ); |
565 | DocLnk lnk( path ); | 568 | DocLnk lnk( path ); |
566 | emit selector()->fileSelected( lnk ); | 569 | emit selector()->fileSelected( lnk ); |
567 | } | 570 | } |
568 | } | 571 | } |
569 | #endif | 572 | #endif |
570 | } | 573 | } |
571 | 574 | ||
572 | void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) | 575 | void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) |
573 | { | 576 | { |
574 | if (!item || ( button != Qt::LeftButton) ) | 577 | if (!item || ( button != Qt::LeftButton) ) |
575 | return; | 578 | return; |
576 | 579 | ||
577 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); | 580 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); |
578 | if (!sel->isLocked() ) | 581 | if (!sel->isLocked() ) |
579 | { | 582 | { |
580 | QStringList str = QStringList::split("->", sel->text(1) ); | 583 | QStringList str = QStringList::split("->", sel->text(1) ); |
581 | if (sel->isDir() ) | 584 | if (sel->isDir() ) |
582 | { | 585 | { |
583 | m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); | 586 | m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); |
584 | emit selector()->dirSelected( m_currentDir ); | 587 | emit selector()->dirSelected( m_currentDir ); |
585 | reread( m_all ); | 588 | reread( m_all ); |
586 | } | 589 | } |
587 | else | 590 | else |
588 | { // file | 591 | { // file |
589 | odebug << "slot Clicked" << oendl; | 592 | odebug << "slot Clicked" << oendl; |
590 | selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); | 593 | selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); |
591 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); | 594 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); |
592 | emit selector()->fileSelected( path ); | 595 | emit selector()->fileSelected( path ); |
593 | DocLnk lnk( path ); | 596 | DocLnk lnk( path ); |
594 | emit selector()->fileSelected( lnk ); | 597 | emit selector()->fileSelected( lnk ); |
595 | } | 598 | } |
596 | } // not locked | 599 | } // not locked |
597 | } | 600 | } |
598 | 601 | ||
599 | void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) | 602 | void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) |
600 | { | 603 | { |
601 | MimeType type( info->absFilePath() ); | 604 | MimeType type( info->absFilePath() ); |
602 | if (!compliesMime( type.id() ) ) | 605 | if (!compliesMime( type.id() ) ) |
603 | return; | 606 | return; |
604 | 607 | ||
605 | QPixmap pix = type.pixmap(); | 608 | QPixmap pix = type.pixmap(); |
606 | QString dir, name; bool locked; | 609 | QString dir, name; bool locked; |
607 | if ( pix.isNull() ) | 610 | if ( pix.isNull() ) |
608 | { | 611 | { |
609 | QWMatrix matrix; | 612 | QWMatrix matrix; |
610 | QPixmap pixer(Resource::loadPixmap("UnknownDocument") ); | 613 | QPixmap pixer(Resource::loadPixmap("UnknownDocument") ); |
611 | matrix.scale( .4, .4 ); | 614 | matrix.scale( .4, .4 ); |
612 | pix = pixer.xForm( matrix ); | 615 | pix = pixer.xForm( matrix ); |
613 | } | 616 | } |
614 | dir = info->dirPath( true ); | 617 | dir = info->dirPath( true ); |
615 | locked = false; | 618 | locked = false; |
616 | if ( symlink ) | 619 | if ( symlink ) |
617 | name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink(); | 620 | name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink(); |
618 | else | 621 | else |
619 | { | 622 | { |
620 | name = info->fileName(); | 623 | name = info->fileName(); |
621 | if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) || | 624 | if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) || |
622 | ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) | 625 | ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) |
623 | { | 626 | { |
624 | locked = true; pix = Resource::loadPixmap("locked"); | 627 | locked = true; pix = Resource::loadPixmap("locked"); |
625 | } | 628 | } |
626 | } | 629 | } |
627 | (void)new OFileSelectorItem( m_view, pix, name, | 630 | (void)new OFileSelectorItem( m_view, pix, name, |
628 | info->lastModified().toString(), QString::number( info->size() ), | 631 | info->lastModified().toString(), QString::number( info->size() ), |
629 | dir, locked ); | 632 | dir, locked ); |
630 | } | 633 | } |
631 | 634 | ||
632 | void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) | 635 | void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) |
633 | { | 636 | { |
634 | bool locked = false; QString name; QPixmap pix; | 637 | bool locked = false; QString name; QPixmap pix; |
635 | 638 | ||
636 | if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) || | 639 | if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) || |
637 | ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) ) | 640 | ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) ) |
638 | { | 641 | { |
639 | locked = true; | 642 | locked = true; |
640 | if ( symlink ) | 643 | if ( symlink ) |
641 | pix = Resource::loadPixmap( "opie/symlink" ); | 644 | pix = Resource::loadPixmap( "opie/symlink" ); |
642 | else | 645 | else |
643 | pix = Resource::loadPixmap( "lockedfolder" ); | 646 | pix = Resource::loadPixmap( "lockedfolder" ); |
644 | } | 647 | } |
645 | else | 648 | else |
646 | pix = symlink ? Resource::loadPixmap( "opie/symlink") : Resource::loadPixmap("folder"); | 649 | pix = symlink ? Resource::loadPixmap( "opie/symlink") : Resource::loadPixmap("folder"); |
647 | 650 | ||
648 | name = symlink ? info->fileName() + " -> " + info->dirPath(true) + "/" + info->readLink() : | 651 | name = symlink ? info->fileName() + " -> " + info->dirPath(true) + "/" + info->readLink() : |
649 | info->fileName(); | 652 | info->fileName(); |
650 | 653 | ||
651 | (void)new OFileSelectorItem( m_view, pix, name, | 654 | (void)new OFileSelectorItem( m_view, pix, name, |
652 | info->lastModified().toString(), | 655 | info->lastModified().toString(), |
653 | QString::number( info->size() ), | 656 | QString::number( info->size() ), |
654 | info->dirPath( true ), locked, true ); | 657 | info->dirPath( true ), locked, true ); |
655 | 658 | ||
656 | 659 | ||
657 | } | 660 | } |
658 | 661 | ||
659 | void OFileViewFileListView::addSymlink( QFileInfo* , bool ) | 662 | void OFileViewFileListView::addSymlink( QFileInfo* , bool ) |
660 | { | 663 | { |
661 | } | 664 | } |
662 | 665 | ||
663 | void OFileViewFileListView::cdUP() | 666 | void OFileViewFileListView::cdUP() |
664 | { | 667 | { |
665 | QDir dir( m_currentDir ); | 668 | QDir dir( m_currentDir ); |
666 | dir.cdUp(); | 669 | dir.cdUp(); |
667 | 670 | ||
668 | if (!dir.exists() ) | 671 | if (!dir.exists() ) |
669 | m_currentDir = "/"; | 672 | m_currentDir = "/"; |
670 | else | 673 | else |
671 | m_currentDir = dir.absPath(); | 674 | m_currentDir = dir.absPath(); |
672 | 675 | ||
673 | emit selector()->dirSelected( m_currentDir ); | 676 | emit selector()->dirSelected( m_currentDir ); |
674 | reread( m_all ); | 677 | reread( m_all ); |
675 | } | 678 | } |
676 | 679 | ||
677 | void OFileViewFileListView::cdHome() | 680 | void OFileViewFileListView::cdHome() |
678 | { | 681 | { |
679 | m_currentDir = QDir::homeDirPath(); | 682 | m_currentDir = QDir::homeDirPath(); |
680 | emit selector()->dirSelected( m_currentDir ); | 683 | emit selector()->dirSelected( m_currentDir ); |
681 | reread( m_all ); | 684 | reread( m_all ); |
682 | } | 685 | } |
683 | 686 | ||
684 | void OFileViewFileListView::cdDoc() | 687 | void OFileViewFileListView::cdDoc() |
685 | { | 688 | { |
686 | m_currentDir = QPEApplication::documentDir(); | 689 | m_currentDir = QPEApplication::documentDir(); |
687 | emit selector()->dirSelected( m_currentDir ); | 690 | emit selector()->dirSelected( m_currentDir ); |
688 | reread( m_all ); | 691 | reread( m_all ); |
689 | } | 692 | } |
690 | 693 | ||
691 | void OFileViewFileListView::changeDir( const QString& dir ) | 694 | void OFileViewFileListView::changeDir( const QString& dir ) |
692 | { | 695 | { |
693 | m_currentDir = dir; | 696 | m_currentDir = dir; |
694 | emit selector()->dirSelected( m_currentDir ); | 697 | emit selector()->dirSelected( m_currentDir ); |
695 | reread( m_all ); | 698 | reread( m_all ); |
696 | } | 699 | } |
697 | 700 | ||
698 | void OFileViewFileListView::slotFSActivated( int id ) | 701 | void OFileViewFileListView::slotFSActivated( int id ) |
699 | { | 702 | { |
700 | changeDir ( m_dev[m_fsPop->text(id)] ); | 703 | changeDir ( m_dev[m_fsPop->text(id)] ); |
701 | } | 704 | } |
702 | 705 | ||
703 | /* check if the mimetype in mime | 706 | /* check if the mimetype in mime |
704 | * complies with the one which is current | 707 | * complies with the one which is current |
705 | */ | 708 | */ |
706 | /* | 709 | /* |
707 | * We've the mimetype of the file | 710 | * We've the mimetype of the file |
708 | * We need to get the stringlist of the current mimetype | 711 | * We need to get the stringlist of the current mimetype |
709 | * | 712 | * |
710 | * mime = image@slashjpeg | 713 | * mime = image@slashjpeg |
711 | * QStringList = 'image@slash*' | 714 | * QStringList = 'image@slash*' |
712 | * or QStringList = image/jpeg;image/png;application/x-ogg | 715 | * or QStringList = image/jpeg;image/png;application/x-ogg |
713 | * or QStringList = application/x-ogg;image@slash*; | 716 | * or QStringList = application/x-ogg;image@slash*; |
714 | * with all these mime filters it should get acceptes | 717 | * with all these mime filters it should get acceptes |
715 | * to do so we need to look if mime is contained inside | 718 | * to do so we need to look if mime is contained inside |
716 | * the stringlist | 719 | * the stringlist |
717 | * if it's contained return true | 720 | * if it's contained return true |
718 | * if not ( I'm no RegExp expert at all ) we'll look if a '@slash*' | 721 | * if not ( I'm no RegExp expert at all ) we'll look if a '@slash*' |
719 | * is contained in the mimefilter and then we will | 722 | * is contained in the mimefilter and then we will |
720 | * look if both are equal until the '/' | 723 | * look if both are equal until the '/' |
721 | */ | 724 | */ |
722 | 725 | ||
723 | bool OFileViewFileListView::compliesMime( const QString& str) | 726 | bool OFileViewFileListView::compliesMime( const QString& str) |
724 | { | 727 | { |
725 | if (str.isEmpty() || m_mimes.isEmpty() || str.stripWhiteSpace().isEmpty() ) | 728 | if (str.isEmpty() || m_mimes.isEmpty() || str.stripWhiteSpace().isEmpty() ) |
726 | return true; | 729 | return true; |
727 | 730 | ||
728 | for (QStringList::Iterator it = m_mimes.begin(); it != m_mimes.end(); ++it ) | 731 | for (QStringList::Iterator it = m_mimes.begin(); it != m_mimes.end(); ++it ) |
729 | { | 732 | { |
730 | QRegExp reg( (*it) ); | 733 | QRegExp reg( (*it) ); |
731 | reg.setWildcard( true ); | 734 | reg.setWildcard( true ); |
732 | if ( str.find( reg ) != -1 ) | 735 | if ( str.find( reg ) != -1 ) |
733 | return true; | 736 | return true; |
734 | 737 | ||
735 | } | 738 | } |
736 | return false; | 739 | return false; |
737 | } | 740 | } |
738 | /* | 741 | /* |
739 | * The listView giving access to the file system! | 742 | * The listView giving access to the file system! |
740 | */ | 743 | */ |
741 | 744 | ||
742 | class OFileViewFileSystem : public OFileViewInterface | 745 | class OFileViewFileSystem : public OFileViewInterface |
743 | { | 746 | { |
744 | public: | 747 | public: |
745 | OFileViewFileSystem( OFileSelector* ); | 748 | OFileViewFileSystem( OFileSelector* ); |
746 | ~OFileViewFileSystem(); | 749 | ~OFileViewFileSystem(); |
747 | 750 | ||
748 | QString selectedName() const; | 751 | QString selectedName() const; |
749 | QString selectedPath() const; | 752 | QString selectedPath() const; |
750 | 753 | ||
751 | QString directory()const; | 754 | QString directory()const; |
752 | void reread(); | 755 | void reread(); |
753 | int fileCount()const; | 756 | int fileCount()const; |
754 | 757 | ||
755 | QWidget* widget( QWidget* parent ); | 758 | QWidget* widget( QWidget* parent ); |
756 | void activate( const QString& ); | 759 | void activate( const QString& ); |
757 | private: | 760 | private: |
758 | OFileViewFileListView* m_view; | 761 | OFileViewFileListView* m_view; |
759 | bool m_all : 1; | 762 | bool m_all : 1; |
760 | }; | 763 | }; |
761 | 764 | ||
762 | OFileViewFileSystem::OFileViewFileSystem( OFileSelector* sel) | 765 | OFileViewFileSystem::OFileViewFileSystem( OFileSelector* sel) |
763 | : OFileViewInterface( sel ) | 766 | : OFileViewInterface( sel ) |
764 | { | 767 | { |
765 | m_view = 0; | 768 | m_view = 0; |
766 | m_all = false; | 769 | m_all = false; |
767 | } | 770 | } |
768 | 771 | ||
769 | OFileViewFileSystem::~OFileViewFileSystem() | 772 | OFileViewFileSystem::~OFileViewFileSystem() |
770 | { | 773 | { |
771 | } | 774 | } |
772 | 775 | ||
773 | QString OFileViewFileSystem::selectedName()const | 776 | QString OFileViewFileSystem::selectedName()const |
774 | { | 777 | { |
775 | if (!m_view ) | 778 | if (!m_view ) |
776 | return QString::null; | 779 | return QString::null; |
777 | 780 | ||
778 | QString cFN=currentFileName(); | 781 | QString cFN=currentFileName(); |
779 | if (cFN.startsWith("/")) return cFN; | 782 | if (cFN.startsWith("/")) return cFN; |
780 | return m_view->currentDir() + "/" + cFN; | 783 | return m_view->currentDir() + "/" + cFN; |
781 | } | 784 | } |
782 | 785 | ||
783 | QString OFileViewFileSystem::selectedPath()const | 786 | QString OFileViewFileSystem::selectedPath()const |
784 | { | 787 | { |
785 | return QString::null; | 788 | return QString::null; |
786 | } | 789 | } |
787 | 790 | ||
788 | QString OFileViewFileSystem::directory()const | 791 | QString OFileViewFileSystem::directory()const |
789 | { | 792 | { |
790 | if (!m_view) | 793 | if (!m_view) |
791 | return QString::null; | 794 | return QString::null; |
792 | 795 | ||
793 | OFileSelectorItem* item = m_view->currentItem(); | 796 | OFileSelectorItem* item = m_view->currentItem(); |
794 | if (!item ) | 797 | if (!item ) |
795 | return QString::null; | 798 | return QString::null; |
796 | 799 | ||
797 | return QDir(item->directory() ).absPath(); | 800 | return QDir(item->directory() ).absPath(); |
798 | } | 801 | } |
799 | 802 | ||
800 | void OFileViewFileSystem::reread() | 803 | void OFileViewFileSystem::reread() |
801 | { | 804 | { |
802 | if (!m_view) | 805 | if (!m_view) |
803 | return; | 806 | return; |
804 | 807 | ||
805 | m_view->reread( m_all ); | 808 | m_view->reread( m_all ); |
806 | } | 809 | } |
807 | 810 | ||
808 | int OFileViewFileSystem::fileCount()const | 811 | int OFileViewFileSystem::fileCount()const |
809 | { | 812 | { |
810 | if (!m_view ) | 813 | if (!m_view ) |
811 | return -1; | 814 | return -1; |
812 | return m_view->fileCount(); | 815 | return m_view->fileCount(); |
813 | } | 816 | } |
814 | 817 | ||
815 | QWidget* OFileViewFileSystem::widget( QWidget* parent ) | 818 | QWidget* OFileViewFileSystem::widget( QWidget* parent ) |
816 | { | 819 | { |
817 | if (!m_view ) | 820 | if (!m_view ) |
818 | { | 821 | { |
819 | m_view = new OFileViewFileListView( parent, startDirectory(), selector() ); | 822 | m_view = new OFileViewFileListView( parent, startDirectory(), selector() ); |
820 | } | 823 | } |
821 | return m_view; | 824 | return m_view; |
822 | } | 825 | } |
823 | 826 | ||
824 | void OFileViewFileSystem::activate( const QString& str ) | 827 | void OFileViewFileSystem::activate( const QString& str ) |
825 | { | 828 | { |
826 | m_all = allItem( str ); | 829 | m_all = allItem( str ); |
827 | } | 830 | } |
828 | 831 | ||
829 | 832 | ||
830 | } | 833 | } |
831 | /* Selector */ | 834 | /* Selector */ |
832 | /** | 835 | /** |
833 | * @short new and complete c'tor | 836 | * @short new and complete c'tor |
834 | * | 837 | * |
835 | * Create a OFileSelector to let the user select a file. It can | 838 | * Create a OFileSelector to let the user select a file. It can |
836 | * either be used to open a file, select a save name in a dir or | 839 | * either be used to open a file, select a save name in a dir or |
837 | * as a dropin for the FileSelector. | 840 | * as a dropin for the FileSelector. |
838 | * | 841 | * |
839 | * <pre> | 842 | * <pre> |
840 | * QMap<QString, QStringList> mimeTypes; | 843 | * QMap<QString, QStringList> mimeTypes; |
841 | * QStringList types; | 844 | * QStringList types; |
842 | * types << "text@slash* "; | 845 | * types << "text@slash* "; |
843 | * types << "audio@slash*"; | 846 | * types << "audio@slash*"; |
844 | * mimeTypes.insert( tr("Audio and Text"), types ); | 847 | * mimeTypes.insert( tr("Audio and Text"), types ); |
845 | * mimeTypes.insert( tr("All"), "*@slash*); | 848 | * mimeTypes.insert( tr("All"), "*@slash*); |
846 | * | 849 | * |
847 | * now you could create your fileselector | 850 | * now you could create your fileselector |
848 | * </pre> | 851 | * </pre> |
849 | * | 852 | * |
850 | * | 853 | * |
851 | * @param parent the parent of this widget | 854 | * @param parent the parent of this widget |
852 | * @param mode The mode from the enum Mode (Open,Save,FILESELECTOR) | 855 | * @param mode The mode from the enum Mode (Open,Save,FILESELECTOR) |
853 | * @param sel The selector to be used | 856 | * @param sel The selector to be used |
854 | * @param dirName The name of the dir to start int | 857 | * @param dirName The name of the dir to start int |
855 | * @param fileName The fileName placed in the fileselector lineedit | 858 | * @param fileName The fileName placed in the fileselector lineedit |
856 | * @param mimetypes The MimeType map of used mimetypes | 859 | * @param mimetypes The MimeType map of used mimetypes |
857 | * @param showNew Show a New Button. Most likely to be used in the FileSelector view. | 860 | * @param showNew Show a New Button. Most likely to be used in the FileSelector view. |
858 | * @param showClose Show a Close Button. Most likely to be used in FileSelector view. | 861 | * @param showClose Show a Close Button. Most likely to be used in FileSelector view. |
859 | * | 862 | * |
860 | */ | 863 | */ |
861 | OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, | 864 | OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, |
862 | const QString& dirName, const QString& fileName, | 865 | const QString& dirName, const QString& fileName, |
863 | const MimeTypes& mimetypes, | 866 | const MimeTypes& mimetypes, |
864 | bool showNew, bool showClose) | 867 | bool showNew, bool showClose) |
865 | :QWidget( parent, "OFileSelector" ) | 868 | :QWidget( parent, "OFileSelector" ) |
866 | { | 869 | { |
867 | m_current = 0; | 870 | m_current = 0; |
868 | m_shNew = showNew; | 871 | m_shNew = showNew; |
869 | m_shClose = showClose; | 872 | m_shClose = showClose; |
870 | m_mimeType = mimetypes; | 873 | m_mimeType = mimetypes; |
871 | m_startDir = dirName; | 874 | m_startDir = dirName; |
872 | 875 | ||
873 | m_mode = mode; | 876 | m_mode = mode; |
874 | m_selector = sel; | 877 | m_selector = sel; |
875 | 878 | ||
876 | m_allList = QStringList(); | 879 | m_allList = QStringList(); |
877 | 880 | ||
878 | initUI(); | 881 | initUI(); |
879 | m_lneEdit->setText( fileName ); | 882 | m_lneEdit->setText( fileName ); |
880 | initMime(); | 883 | initMime(); |
881 | initViews(); | 884 | initViews(); |
882 | 885 | ||
883 | QString str; | 886 | QString str; |
884 | switch ( m_selector ) | 887 | switch ( m_selector ) |
885 | { | 888 | { |
886 | default: | 889 | default: |
887 | case Normal: | 890 | case Normal: |
888 | if ( m_mode == DIRECTORYSELECTOR ) | 891 | if ( m_mode == DIRECTORYSELECTOR ) |
889 | str = QObject::tr("Directories"); | 892 | str = QObject::tr("Directories"); |
890 | else | 893 | else |
891 | str = QObject::tr("Documents"); | 894 | str = QObject::tr("Documents"); |
892 | m_cmbView->setCurrentItem( 0 ); | 895 | m_cmbView->setCurrentItem( 0 ); |
893 | break; | 896 | break; |
894 | case Extended: | 897 | case Extended: |
895 | if ( m_mode == DIRECTORYSELECTOR ) | 898 | if ( m_mode == DIRECTORYSELECTOR ) |
896 | { | 899 | { |
897 | str = QObject::tr("Directories"); | 900 | str = QObject::tr("Directories"); |
898 | m_cmbView->setCurrentItem( 0 ); | 901 | m_cmbView->setCurrentItem( 0 ); |
899 | } else { | 902 | } else { |
900 | str = QObject::tr("Files"); | 903 | str = QObject::tr("Files"); |
901 | m_cmbView->setCurrentItem( 1 ); | 904 | m_cmbView->setCurrentItem( 1 ); |
902 | } | 905 | } |
903 | break; | 906 | break; |
904 | case ExtendedAll: | 907 | case ExtendedAll: |
905 | if ( m_mode == DIRECTORYSELECTOR ) | 908 | if ( m_mode == DIRECTORYSELECTOR ) |
906 | { | 909 | { |
907 | str = QObject::tr("All Directories"); | 910 | str = QObject::tr("All Directories"); |
908 | m_cmbView->setCurrentItem( 1 ); | 911 | m_cmbView->setCurrentItem( 1 ); |
909 | } else { | 912 | } else { |
910 | str = QObject::tr("All Files"); | 913 | str = QObject::tr("All Files"); |
911 | m_cmbView->setCurrentItem( 2 ); | 914 | m_cmbView->setCurrentItem( 2 ); |
912 | } | 915 | } |
913 | break; | 916 | break; |
914 | } | 917 | } |
915 | slotViewChange( str ); | 918 | slotViewChange( str ); |
916 | 919 | ||
917 | } | 920 | } |
918 | 921 | ||
919 | 922 | ||
920 | /** | 923 | /** |
921 | * This a convience c'tor to just substitute the use of FileSelector | 924 | * This a convience c'tor to just substitute the use of FileSelector |
922 | */ | 925 | */ |
923 | OFileSelector::OFileSelector( const QString& mimeFilter, QWidget* parent, const char* name, | 926 | OFileSelector::OFileSelector( const QString& mimeFilter, QWidget* parent, const char* name, |
924 | bool showNew, bool showClose ) | 927 | bool showNew, bool showClose ) |
925 | : QWidget( parent, name ) | 928 | : QWidget( parent, name ) |
926 | { | 929 | { |
927 | m_current = 0; | 930 | m_current = 0; |
928 | m_shNew = showNew; | 931 | m_shNew = showNew; |
929 | m_shClose = showClose; | 932 | m_shClose = showClose; |
930 | m_startDir = QPEApplication::documentDir(); | 933 | m_startDir = QPEApplication::documentDir(); |
931 | 934 | ||
932 | if (!mimeFilter.isEmpty() ) | 935 | if (!mimeFilter.isEmpty() ) |
933 | m_mimeType.insert(mimeFilter, QStringList::split(";", mimeFilter ) ); | 936 | m_mimeType.insert(mimeFilter, QStringList::split(";", mimeFilter ) ); |
934 | 937 | ||
935 | m_mode = OFileSelector::FileSelector; | 938 | m_mode = OFileSelector::FileSelector; |
936 | m_selector = OFileSelector::Normal; | 939 | m_selector = OFileSelector::Normal; |
937 | 940 | ||
938 | initUI(); | 941 | initUI(); |
939 | initMime(); | 942 | initMime(); |
940 | initViews(); | 943 | initViews(); |
941 | m_cmbView->setCurrentItem( 0 ); | 944 | m_cmbView->setCurrentItem( 0 ); |
942 | slotViewChange( QObject::tr("Documents") ); | 945 | slotViewChange( QObject::tr("Documents") ); |
943 | } | 946 | } |
944 | 947 | ||
945 | /* | 948 | /* |
946 | * INIT UI will set up the basic GUI | 949 | * INIT UI will set up the basic GUI |
947 | * Layout: Simple VBoxLayout | 950 | * Layout: Simple VBoxLayout |
948 | * On top a WidgetStack containing the Views... | 951 | * On top a WidgetStack containing the Views... |
949 | * - List View | 952 | * - List View |
950 | * - Document View | 953 | * - Document View |
951 | * Below we will have a Label + LineEdit | 954 | * Below we will have a Label + LineEdit |
952 | * Below we will have two ComoBoxes one for choosing the view one for | 955 | * Below we will have two ComoBoxes one for choosing the view one for |
953 | * choosing the mimetype | 956 | * choosing the mimetype |
954 | */ | 957 | */ |
955 | void OFileSelector::initUI() | 958 | void OFileSelector::initUI() |
956 | { | 959 | { |
957 | QVBoxLayout* lay = new QVBoxLayout( this ); | 960 | QVBoxLayout* lay = new QVBoxLayout( this ); |
958 | 961 | ||
959 | m_stack = new QWidgetStack( this ); | 962 | m_stack = new QWidgetStack( this ); |
960 | lay->addWidget( m_stack, 1000 ); | 963 | lay->addWidget( m_stack, 1000 ); |
961 | 964 | ||
962 | m_nameBox = new QHBox( this ); | 965 | m_nameBox = new QHBox( this ); |
963 | (void)new QLabel( tr("Name:"), m_nameBox ); | 966 | (void)new QLabel( tr("Name:"), m_nameBox ); |
964 | m_lneEdit = new QLineEdit( m_nameBox ); | 967 | m_lneEdit = new QLineEdit( m_nameBox ); |
965 | m_lneEdit ->installEventFilter(this); | 968 | m_lneEdit ->installEventFilter(this); |
966 | lay->addWidget( m_nameBox ); | 969 | lay->addWidget( m_nameBox ); |
967 | 970 | ||
968 | m_cmbBox = new QHBox( this ); | 971 | m_cmbBox = new QHBox( this ); |
969 | m_cmbView = new QComboBox( m_cmbBox ); | 972 | m_cmbView = new QComboBox( m_cmbBox ); |
970 | m_cmbMime = new QComboBox( m_cmbBox ); | 973 | m_cmbMime = new QComboBox( m_cmbBox ); |
971 | lay->addWidget( m_cmbBox ); | 974 | lay->addWidget( m_cmbBox ); |
972 | } | 975 | } |
973 | 976 | ||
974 | /* | 977 | /* |
975 | * This will make sure that the return key in the name edit causes dialogs to close | 978 | * This will make sure that the return key in the name edit causes dialogs to close |
976 | */ | 979 | */ |
977 | 980 | ||
978 | bool OFileSelector::eventFilter (QObject *, QEvent *e) | 981 | bool OFileSelector::eventFilter (QObject *, QEvent *e) |
979 | { | 982 | { |
980 | if ( e->type() == QEvent::KeyPress ) | 983 | if ( e->type() == QEvent::KeyPress ) |
981 | { | 984 | { |
982 | QKeyEvent *k = (QKeyEvent *)e; | 985 | QKeyEvent *k = (QKeyEvent *)e; |
983 | if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) | 986 | if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) |
984 | { | 987 | { |
985 | emit ok(); | 988 | emit ok(); |
986 | return true; | 989 | return true; |
987 | } | 990 | } |
988 | } | 991 | } |
989 | return false; | 992 | return false; |
990 | } | 993 | } |
991 | 994 | ||
992 | /* | 995 | /* |
993 | * This will insert the MimeTypes into the Combo Box | 996 | * This will insert the MimeTypes into the Combo Box |
994 | * And also connect the changed signal | 997 | * And also connect the changed signal |
995 | * | 998 | * |
996 | * AutoMimeTyping is disabled for now. It used to reparse a dir and then set available mimetypes | 999 | * AutoMimeTyping is disabled for now. It used to reparse a dir and then set available mimetypes |
997 | */ | 1000 | */ |
998 | void OFileSelector::initMime() | 1001 | void OFileSelector::initMime() |
999 | { | 1002 | { |
1000 | MimeTypes::Iterator it; | 1003 | MimeTypes::Iterator it; |
1001 | for ( it = m_mimeType.begin(); it != m_mimeType.end(); ++it ) | 1004 | for ( it = m_mimeType.begin(); it != m_mimeType.end(); ++it ) |
1002 | { | 1005 | { |
1003 | m_cmbMime->insertItem( it.key() ); | 1006 | m_cmbMime->insertItem( it.key() ); |
1004 | } | 1007 | } |
1005 | m_cmbMime->setCurrentItem( 0 ); | 1008 | m_cmbMime->setCurrentItem( 0 ); |
1006 | 1009 | ||
1007 | connect( m_cmbMime, SIGNAL(activated(int) ), | 1010 | connect( m_cmbMime, SIGNAL(activated(int) ), |
1008 | this, SLOT(slotMimeTypeChanged() ) ); | 1011 | this, SLOT(slotMimeTypeChanged() ) ); |
1009 | 1012 | ||
1010 | } | 1013 | } |
1011 | 1014 | ||
1012 | void OFileSelector::initViews() | 1015 | void OFileSelector::initViews() |
1013 | { | 1016 | { |
1014 | if ( m_mode == OFileSelector::DIRECTORYSELECTOR ) | 1017 | if ( m_mode == OFileSelector::DIRECTORYSELECTOR ) |
1015 | { | 1018 | { |
1016 | m_cmbView->insertItem( QObject::tr("Directories") ); | 1019 | m_cmbView->insertItem( QObject::tr("Directories") ); |
1017 | m_cmbView->insertItem( QObject::tr("All Directories") ); | 1020 | m_cmbView->insertItem( QObject::tr("All Directories") ); |
1018 | } else { | 1021 | } else { |
1019 | m_cmbView->insertItem( QObject::tr("Documents") ); | 1022 | m_cmbView->insertItem( QObject::tr("Documents") ); |
1020 | m_cmbView->insertItem( QObject::tr("Files") ); | 1023 | m_cmbView->insertItem( QObject::tr("Files") ); |
1021 | m_cmbView->insertItem( QObject::tr("All Files") ); | 1024 | m_cmbView->insertItem( QObject::tr("All Files") ); |
1022 | } | 1025 | } |
1023 | 1026 | ||
1024 | connect(m_cmbView, SIGNAL(activated(const QString&) ), | 1027 | connect(m_cmbView, SIGNAL(activated(const QString&) ), |
1025 | this, SLOT(slotViewChange(const QString&) ) ); | 1028 | this, SLOT(slotViewChange(const QString&) ) ); |
1026 | 1029 | ||
1027 | /* see above why add both */ | 1030 | /* see above why add both */ |
1028 | OFileViewInterface* in = new OFileViewFileSystem( this ); | 1031 | OFileViewInterface* in = new OFileViewFileSystem( this ); |
1029 | 1032 | ||
1030 | if ( m_mode == OFileSelector::DIRECTORYSELECTOR ) | 1033 | if ( m_mode == OFileSelector::DIRECTORYSELECTOR ) |
1031 | { | 1034 | { |
1032 | m_views.insert( QObject::tr("Directories"), in ); | 1035 | m_views.insert( QObject::tr("Directories"), in ); |
1033 | m_views.insert( QObject::tr("All Directories"), in ); | 1036 | m_views.insert( QObject::tr("All Directories"), in ); |
1034 | m_allList.append( QObject::tr("All Directories") ); | 1037 | m_allList.append( QObject::tr("All Directories") ); |
1035 | } else { | 1038 | } else { |
1036 | m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) ); | 1039 | m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) ); |
1037 | m_views.insert( QObject::tr("Files"), in ); | 1040 | m_views.insert( QObject::tr("Files"), in ); |
1038 | m_views.insert( QObject::tr("All Files"), in ); | 1041 | m_views.insert( QObject::tr("All Files"), in ); |
1039 | m_allList.append( QObject::tr("All Files") ); | 1042 | m_allList.append( QObject::tr("All Files") ); |
1040 | } | 1043 | } |
1041 | } | 1044 | } |
1042 | 1045 | ||
1043 | void OFileSelector::registerView( const Internal::OFileViewInterface* iface ) { | 1046 | void OFileSelector::registerView( const Internal::OFileViewInterface* iface ) { |
1044 | m_viewsPtr.append( iface ); | 1047 | m_viewsPtr.append( iface ); |
1045 | } | 1048 | } |
1046 | 1049 | ||
1047 | 1050 | ||
1048 | /** | 1051 | /** |
1049 | * d'tor | 1052 | * d'tor |
1050 | */ | 1053 | */ |
1051 | OFileSelector::~OFileSelector() | 1054 | OFileSelector::~OFileSelector() |
1052 | { | 1055 | { |
1053 | m_viewsPtr.setAutoDelete( true ); | 1056 | m_viewsPtr.setAutoDelete( true ); |
1054 | m_viewsPtr.clear(); | 1057 | m_viewsPtr.clear(); |
1055 | } | 1058 | } |
1056 | 1059 | ||
1057 | 1060 | ||
1058 | 1061 | ||
1059 | /** | 1062 | /** |
1060 | * Convience function for the fileselector | 1063 | * Convience function for the fileselector |
1061 | * make sure to delete the DocLnk | 1064 | * make sure to delete the DocLnk |
1062 | * | 1065 | * |
1063 | * @see DocLnk | 1066 | * @see DocLnk |
1064 | * @todo remove in ODP | 1067 | * @todo remove in ODP |
1065 | */ | 1068 | */ |
1066 | const DocLnk* OFileSelector::selected() | 1069 | const DocLnk* OFileSelector::selected() |
1067 | { | 1070 | { |
1068 | DocLnk* lnk = new DocLnk( currentView()->selectedDocument() ); | 1071 | DocLnk* lnk = new DocLnk( currentView()->selectedDocument() ); |
1069 | return lnk; | 1072 | return lnk; |
1070 | } | 1073 | } |
1071 | 1074 | ||
1072 | /** | 1075 | /** |
1073 | * | 1076 | * |
1074 | * @return the name of the selected file | 1077 | * @return the name of the selected file |
1075 | */ | 1078 | */ |
1076 | QString OFileSelector::selectedName()const | 1079 | QString OFileSelector::selectedName()const |
1077 | { | 1080 | { |
1078 | return currentView()->selectedName(); | 1081 | return currentView()->selectedName(); |
1079 | } | 1082 | } |
1080 | 1083 | ||
1081 | 1084 | ||
1082 | /** | 1085 | /** |
1083 | * @return the selected path | 1086 | * @return the selected path |
1084 | */ | 1087 | */ |
1085 | QString OFileSelector::selectedPath()const | 1088 | QString OFileSelector::selectedPath()const |
1086 | { | 1089 | { |
1087 | return currentView()->selectedPath(); | 1090 | return currentView()->selectedPath(); |
1088 | } | 1091 | } |
1089 | 1092 | ||
1090 | /** | 1093 | /** |
1091 | * @return the directory name | 1094 | * @return the directory name |
1092 | */ | 1095 | */ |
1093 | QString OFileSelector::directory()const | 1096 | QString OFileSelector::directory()const |
1094 | { | 1097 | { |
1095 | return currentView()->directory(); | 1098 | return currentView()->directory(); |
1096 | } | 1099 | } |
1097 | 1100 | ||
1098 | /** | 1101 | /** |
1099 | * @return a DocLnk for the selected document | 1102 | * @return a DocLnk for the selected document |
1100 | */ | 1103 | */ |
1101 | DocLnk OFileSelector::selectedDocument()const | 1104 | DocLnk OFileSelector::selectedDocument()const |
1102 | { | 1105 | { |
1103 | return currentView()->selectedDocument(); | 1106 | return currentView()->selectedDocument(); |
1104 | } | 1107 | } |
1105 | 1108 | ||
1106 | /** | 1109 | /** |
1107 | * @return the number of items for the current view | 1110 | * @return the number of items for the current view |
1108 | */ | 1111 | */ |
1109 | int OFileSelector::fileCount()const | 1112 | int OFileSelector::fileCount()const |
1110 | { | 1113 | { |
1111 | return currentView()->fileCount(); | 1114 | return currentView()->fileCount(); |
1112 | } | 1115 | } |
1113 | 1116 | ||
1114 | /** | 1117 | /** |
1115 | * @return reparse the file content | 1118 | * @return reparse the file content |
1116 | */ | 1119 | */ |
1117 | void OFileSelector::reread() | 1120 | void OFileSelector::reread() |
1118 | { | 1121 | { |
1119 | return currentView()->reread(); | 1122 | return currentView()->reread(); |
1120 | } | 1123 | } |
1121 | 1124 | ||
1122 | OFileViewInterface* OFileSelector::currentView()const | 1125 | OFileViewInterface* OFileSelector::currentView()const |
1123 | { | 1126 | { |
1124 | return m_current; | 1127 | return m_current; |
1125 | } | 1128 | } |
1126 | 1129 | ||
1127 | bool OFileSelector::showNew()const | 1130 | bool OFileSelector::showNew()const |
1128 | { | 1131 | { |
1129 | return m_shNew; | 1132 | return m_shNew; |
1130 | } | 1133 | } |
1131 | 1134 | ||
1132 | bool OFileSelector::showClose()const | 1135 | bool OFileSelector::showClose()const |
1133 | { | 1136 | { |
1134 | return m_shClose; | 1137 | return m_shClose; |
1135 | } | 1138 | } |
1136 | 1139 | ||
1137 | MimeTypes OFileSelector::mimeTypes()const | 1140 | MimeTypes OFileSelector::mimeTypes()const |
1138 | { | 1141 | { |
1139 | return m_mimeType; | 1142 | return m_mimeType; |
1140 | } | 1143 | } |
1141 | 1144 | ||
1142 | /** | 1145 | /** |
1143 | * @return the Mode of the OFileSelector | 1146 | * @return the Mode of the OFileSelector |
1144 | */ | 1147 | */ |
1145 | int OFileSelector::mode()const | 1148 | int OFileSelector::mode()const |
1146 | { | 1149 | { |
1147 | return m_mode; | 1150 | return m_mode; |
1148 | } | 1151 | } |
1149 | 1152 | ||
1150 | 1153 | ||
1151 | /** | 1154 | /** |
1152 | * @return the Selector of the OFileSelector | 1155 | * @return the Selector of the OFileSelector |
1153 | */ | 1156 | */ |
1154 | int OFileSelector::selector()const | 1157 | int OFileSelector::selector()const |
1155 | { | 1158 | { |
1156 | return m_selector; | 1159 | return m_selector; |
1157 | } | 1160 | } |
1158 | 1161 | ||
1159 | QStringList OFileSelector::currentMimeType()const | 1162 | QStringList OFileSelector::currentMimeType()const |
1160 | { | 1163 | { |
1161 | return m_mimeType[m_cmbMime->currentText()]; | 1164 | return m_mimeType[m_cmbMime->currentText()]; |
1162 | } | 1165 | } |
1163 | 1166 | ||
1164 | void OFileSelector::slotMimeTypeChanged() | 1167 | void OFileSelector::slotMimeTypeChanged() |
1165 | { | 1168 | { |
1166 | reread(); | 1169 | reread(); |
1167 | } | 1170 | } |
1168 | 1171 | ||
1169 | void OFileSelector::slotDocLnkBridge( const DocLnk& lnk) | 1172 | void OFileSelector::slotDocLnkBridge( const DocLnk& lnk) |
1170 | { | 1173 | { |
1171 | m_lneEdit->setText( lnk.name() ); | 1174 | m_lneEdit->setText( lnk.name() ); |
1172 | emit fileSelected( lnk ); | 1175 | emit fileSelected( lnk ); |
1173 | emit fileSelected( lnk.name() ); | 1176 | emit fileSelected( lnk.name() ); |
1174 | } | 1177 | } |
1175 | 1178 | ||
1176 | void OFileSelector::slotFileBridge( const QString& str) | 1179 | void OFileSelector::slotFileBridge( const QString& str) |
1177 | { | 1180 | { |
1178 | DocLnk lnk( str ); | 1181 | DocLnk lnk( str ); |
1179 | emit fileSelected( lnk ); | 1182 | emit fileSelected( lnk ); |
1180 | } | 1183 | } |
1181 | 1184 | ||
1182 | void OFileSelector::slotViewChange( const QString& view ) | 1185 | void OFileSelector::slotViewChange( const QString& view ) |
1183 | { | 1186 | { |
1184 | OFileViewInterface* interface = m_views[view]; | 1187 | OFileViewInterface* interface = m_views[view]; |
1185 | if (!interface) | 1188 | if (!interface) |
1186 | return; | 1189 | return; |
1187 | 1190 | ||
1188 | if (m_current) | 1191 | if (m_current) |
1189 | m_stack->removeWidget( m_current->widget( m_stack ) ); | 1192 | m_stack->removeWidget( m_current->widget( m_stack ) ); |
1190 | 1193 | ||
1191 | static int id = 1; | 1194 | static int id = 1; |
1192 | 1195 | ||
1193 | m_stack->addWidget( interface->widget(m_stack), id ); | 1196 | m_stack->addWidget( interface->widget(m_stack), id ); |
1194 | m_stack->raiseWidget( id ); | 1197 | m_stack->raiseWidget( id ); |
1195 | 1198 | ||
1196 | interface->activate( view ); | 1199 | interface->activate( view ); |
1197 | interface->reread(); | 1200 | interface->reread(); |
1198 | m_current = interface; | 1201 | m_current = interface; |
1199 | 1202 | ||
1200 | id++; | 1203 | id++; |
1201 | } | 1204 | } |
1202 | 1205 | ||
1203 | void OFileSelector::setNewVisible( bool b ) | 1206 | void OFileSelector::setNewVisible( bool b ) |
1204 | { | 1207 | { |
1205 | m_shNew = b; | 1208 | m_shNew = b; |
1206 | currentView()->reread(); | 1209 | currentView()->reread(); |
1207 | } | 1210 | } |
1208 | 1211 | ||
1209 | void OFileSelector::setCloseVisible( bool b ) | 1212 | void OFileSelector::setCloseVisible( bool b ) |
1210 | { | 1213 | { |
1211 | m_shClose = b; | 1214 | m_shClose = b; |
1212 | currentView()->reread(); | 1215 | currentView()->reread(); |
1213 | } | 1216 | } |
1214 | 1217 | ||
1215 | void OFileSelector::setNameVisible( bool b ) | 1218 | void OFileSelector::setNameVisible( bool b ) |
1216 | { | 1219 | { |
1217 | if ( b ) | 1220 | if ( b ) |
1218 | m_nameBox->show(); | 1221 | m_nameBox->show(); |
1219 | else | 1222 | else |
1220 | m_nameBox->hide(); | 1223 | m_nameBox->hide(); |
1221 | } | 1224 | } |
1222 | 1225 | ||
1223 | } | 1226 | } |
1224 | } | 1227 | } |
diff --git a/libopie2/opieui/fileselector/ofileselector_p.h b/libopie2/opieui/fileselector/ofileselector_p.h index 790d2bd..15db916 100644 --- a/libopie2/opieui/fileselector/ofileselector_p.h +++ b/libopie2/opieui/fileselector/ofileselector_p.h | |||
@@ -1,194 +1,194 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (C) Holger Freyther <zecke@handhelds.org> | 3 | .=l. Copyright (C) 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 | #ifndef OFILESELECTOR_PRIVATE_H | 29 | #ifndef OFILESELECTOR_PRIVATE_H |
30 | #define OFILESELECTOR_PRIVATE_H | 30 | #define OFILESELECTOR_PRIVATE_H |
31 | 31 | ||
32 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <qpe/applnk.h> | 33 | #include <qpe/applnk.h> |
34 | #include <qpe/fileselector.h> | 34 | #include <qpe/fileselector.h> |
35 | 35 | ||
36 | /* QT */ | 36 | /* QT */ |
37 | #include <qmap.h> | 37 | #include <qmap.h> |
38 | #include <qstringlist.h> | 38 | #include <qstringlist.h> |
39 | #include <qwidget.h> | 39 | #include <qwidget.h> |
40 | #include <qlistview.h> | 40 | #include <qlistview.h> |
41 | 41 | ||
42 | /* | 42 | /* |
43 | * How to avoid having really two different objects | 43 | * How to avoid having really two different objects |
44 | * for Extended and ExtendedAll | 44 | * for Extended and ExtendedAll |
45 | * The only difference is the Lister... | 45 | * The only difference is the Lister... |
46 | * a) static object? | 46 | * a) static object? |
47 | * b) leave some object inside the OFileSelector which can be used? | 47 | * b) leave some object inside the OFileSelector which can be used? |
48 | * c) when switching views tell which view we want o have.. internally we can switch then | 48 | * c) when switching views tell which view we want o have.. internally we can switch then |
49 | * | 49 | * |
50 | * I'll take c) -zecke | 50 | * I'll take c) -zecke |
51 | */ | 51 | */ |
52 | 52 | ||
53 | typedef QMap<QString, QStringList> MimeTypes; | 53 | typedef QMap<QString, QStringList> MimeTypes; |
54 | 54 | ||
55 | /* the View Interface */ | 55 | /* the View Interface */ |
56 | class QFileInfo; | 56 | class QFileInfo; |
57 | class QToolButton; | 57 | class QToolButton; |
58 | 58 | ||
59 | namespace Opie{ | 59 | namespace Opie{ |
60 | namespace Ui{ | 60 | namespace Ui{ |
61 | class OFileSelector; | 61 | class OFileSelector; |
62 | namespace Internal { | 62 | namespace Internal { |
63 | 63 | ||
64 | class OFileViewInterface | 64 | class OFileViewInterface |
65 | { | 65 | { |
66 | public: | 66 | public: |
67 | OFileViewInterface( OFileSelector* selector ); | 67 | OFileViewInterface( OFileSelector* selector ); |
68 | virtual ~OFileViewInterface(); | 68 | virtual ~OFileViewInterface(); |
69 | virtual QString selectedName()const = 0; | 69 | virtual QString selectedName()const = 0; |
70 | virtual QString selectedPath()const = 0; | 70 | virtual QString selectedPath()const = 0; |
71 | virtual QString directory()const = 0; | 71 | virtual QString directory()const = 0; |
72 | virtual void reread() = 0; | 72 | virtual void reread() = 0; |
73 | virtual int fileCount()const = 0; | 73 | virtual int fileCount()const = 0; |
74 | virtual DocLnk selectedDocument()const; | 74 | virtual DocLnk selectedDocument()const; |
75 | virtual QWidget* widget( QWidget* parent) = 0; | 75 | virtual QWidget* widget( QWidget* parent) = 0; |
76 | virtual void activate( const QString& ); | 76 | virtual void activate( const QString& ); |
77 | QString name()const; | 77 | QString name()const; |
78 | bool allItem( const QString& )const; | 78 | bool allItem( const QString& )const; |
79 | protected: | 79 | protected: |
80 | OFileSelector* selector()const; | 80 | OFileSelector* selector()const; |
81 | void setName( const QString& ); | 81 | void setName( const QString& ); |
82 | bool showNew()const; | 82 | bool showNew()const; |
83 | bool showClose()const; | 83 | bool showClose()const; |
84 | MimeTypes mimeTypes()const; | 84 | MimeTypes mimeTypes()const; |
85 | QStringList currentMimeType()const; | 85 | QStringList currentMimeType()const; |
86 | QString startDirectory()const; | 86 | QString startDirectory()const; |
87 | protected: | 87 | protected: |
88 | void ok(); | 88 | void ok(); |
89 | void cancel(); | 89 | void cancel(); |
90 | void closeMe(); | 90 | void closeMe(); |
91 | void fileSelected( const QString& ); | 91 | void fileSelected( const QString& ); |
92 | void fileSelected( const DocLnk& ); | 92 | void fileSelected( const DocLnk& ); |
93 | void setCurrentFileName( const QString& ); | 93 | void setCurrentFileName( const QString& ); |
94 | QString currentFileName()const; | 94 | QString currentFileName()const; |
95 | 95 | ||
96 | private: | 96 | private: |
97 | QString m_name; | 97 | QString m_name; |
98 | OFileSelector* m_selector; | 98 | OFileSelector* m_selector; |
99 | }; | 99 | }; |
100 | 100 | ||
101 | 101 | ||
102 | /* THE Document View hosting a FileSelector*/ | 102 | /* THE Document View hosting a FileSelector*/ |
103 | class ODocumentFileView : public OFileViewInterface | 103 | class ODocumentFileView : public OFileViewInterface |
104 | { | 104 | { |
105 | public: | 105 | public: |
106 | ODocumentFileView( OFileSelector* selector ); | 106 | ODocumentFileView( OFileSelector* selector ); |
107 | ~ODocumentFileView(); | 107 | ~ODocumentFileView(); |
108 | 108 | ||
109 | QString selectedName() const; | 109 | QString selectedName() const; |
110 | QString selectedPath() const; | 110 | QString selectedPath() const; |
111 | 111 | ||
112 | QString directory() const; | 112 | QString directory() const; |
113 | void reread(); | 113 | void reread(); |
114 | int fileCount()const; | 114 | int fileCount()const; |
115 | DocLnk selectedDocument()const; | 115 | DocLnk selectedDocument()const; |
116 | 116 | ||
117 | QWidget* widget( QWidget* parent ); | 117 | QWidget* widget( QWidget* parent ); |
118 | 118 | ||
119 | private: | 119 | private: |
120 | mutable FileSelector* m_selector; | 120 | mutable FileSelector* m_selector; |
121 | 121 | ||
122 | }; | 122 | }; |
123 | 123 | ||
124 | 124 | ||
125 | class OFileSelectorItem : public QListViewItem | 125 | class OFileSelectorItem : public QListViewItem |
126 | { | 126 | { |
127 | public: | 127 | public: |
128 | OFileSelectorItem( QListView* view, const QPixmap& pixmap, | 128 | OFileSelectorItem( QListView* view, const QPixmap& pixmap, |
129 | const QString& path, const QString& date, | 129 | const QString& path, const QString& date, |
130 | const QString& size, const QString& mDir, | 130 | const QString& size, const QString& mDir, |
131 | bool isLocked = false, bool isDir = false ); | 131 | bool isLocked = false, bool isDir = false ); |
132 | ~OFileSelectorItem(); | 132 | ~OFileSelectorItem(); |
133 | bool isLocked()const; | 133 | bool isLocked()const; |
134 | bool isDir()const; | 134 | bool isDir()const; |
135 | QString directory()const; | 135 | QString directory()const; |
136 | QString path()const; | 136 | QString path()const; |
137 | QString key(int id, bool )const; | 137 | QString key(int id, bool )const; |
138 | 138 | ||
139 | private: | 139 | private: |
140 | bool m_locked : 1; | ||
141 | bool m_isDir : 1; | ||
142 | QString m_dir; | 140 | QString m_dir; |
141 | bool m_isDir : 1; | ||
142 | bool m_locked : 1; | ||
143 | }; | 143 | }; |
144 | 144 | ||
145 | class OFileViewFileListView : public QWidget | 145 | class OFileViewFileListView : public QWidget |
146 | { | 146 | { |
147 | Q_OBJECT | 147 | Q_OBJECT |
148 | public: | 148 | public: |
149 | OFileViewFileListView( QWidget* parent, const QString& dir, OFileSelector* selector ); | 149 | OFileViewFileListView( QWidget* parent, const QString& dir, OFileSelector* selector ); |
150 | ~OFileViewFileListView(); | 150 | ~OFileViewFileListView(); |
151 | 151 | ||
152 | OFileSelectorItem* currentItem()const; | 152 | OFileSelectorItem* currentItem()const; |
153 | void reread( bool all = false ); | 153 | void reread( bool all = false ); |
154 | int fileCount()const; | 154 | int fileCount()const; |
155 | QString currentDir()const; | 155 | QString currentDir()const; |
156 | protected: | 156 | protected: |
157 | bool eventFilter (QObject *o, QEvent *e); | 157 | bool eventFilter (QObject *o, QEvent *e); |
158 | private slots: | 158 | private slots: |
159 | void slotNew(); // will emit newSelected | 159 | void slotNew(); // will emit newSelected |
160 | void cdUP(); | 160 | void cdUP(); |
161 | void cdHome(); | 161 | void cdHome(); |
162 | void cdDoc(); | 162 | void cdDoc(); |
163 | void changeDir( const QString& ); | 163 | void changeDir( const QString& ); |
164 | void slotCurrentChanged( QListViewItem* ); | 164 | void slotCurrentChanged( QListViewItem* ); |
165 | void slotClicked(int, QListViewItem*, const QPoint&, int ); | 165 | void slotClicked(int, QListViewItem*, const QPoint&, int ); |
166 | void slotFSActivated(int); | 166 | void slotFSActivated(int); |
167 | 167 | ||
168 | protected: | 168 | protected: |
169 | OFileSelector* selector(); | 169 | OFileSelector* selector(); |
170 | 170 | ||
171 | private: | 171 | private: |
172 | QMap<QString, QString> m_dev; | 172 | QMap<QString, QString> m_dev; |
173 | bool m_all : 1; | 173 | bool m_all : 1; |
174 | OFileSelector* m_sel; | 174 | OFileSelector* m_sel; |
175 | QPopupMenu* m_fsPop; | 175 | QPopupMenu* m_fsPop; |
176 | bool compliesMime( const QString& ); | 176 | bool compliesMime( const QString& ); |
177 | QStringList m_mimes; // used in compy mime | 177 | QStringList m_mimes; // used in compy mime |
178 | QString m_currentDir; | 178 | QString m_currentDir; |
179 | QToolButton *m_btnNew, *m_btnClose; | 179 | QToolButton *m_btnNew, *m_btnClose; |
180 | void connectSlots(); | 180 | void connectSlots(); |
181 | void addFile( QFileInfo* info, bool symlink = FALSE ); | 181 | void addFile( QFileInfo* info, bool symlink = FALSE ); |
182 | void addDir ( QFileInfo* info, bool symlink = FALSE ); | 182 | void addDir ( QFileInfo* info, bool symlink = FALSE ); |
183 | void addSymlink( QFileInfo* info, bool = FALSE ); | 183 | void addSymlink( QFileInfo* info, bool = FALSE ); |
184 | 184 | ||
185 | 185 | ||
186 | private: | 186 | private: |
187 | QListView* m_view; | 187 | QListView* m_view; |
188 | }; | 188 | }; |
189 | 189 | ||
190 | } | 190 | } |
191 | } | 191 | } |
192 | } | 192 | } |
193 | 193 | ||
194 | #endif | 194 | #endif |