author | zecke <zecke> | 2002-03-29 00:53:55 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-03-29 00:53:55 (UTC) |
commit | 4d2839434de70bc67dca076ccf6a09d2d578d627 (patch) (unidiff) | |
tree | 7cb5823e727eb4b3bf19d224e9fbb041180b7c5c | |
parent | e5c50fab1c8a84f6e2337ebe85be57f354bef676 (diff) | |
download | opie-4d2839434de70bc67dca076ccf6a09d2d578d627.zip opie-4d2839434de70bc67dca076ccf6a09d2d578d627.tar.gz opie-4d2839434de70bc67dca076ccf6a09d2d578d627.tar.bz2 |
interface updates. and some more implementation
-rw-r--r-- | libopie/ofileselector.cc | 132 | ||||
-rw-r--r-- | libopie/ofileselector.h | 12 |
2 files changed, 132 insertions, 12 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc index c9abde1..b911d37 100644 --- a/libopie/ofileselector.cc +++ b/libopie/ofileselector.cc | |||
@@ -1,66 +1,70 @@ | |||
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 <> | 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> | ||
40 | #include <qdir.h> | ||
39 | 41 | ||
42 | #include <qpe/qpeapplication.h> | ||
40 | #include <qpe/fileselector.h> | 43 | #include <qpe/fileselector.h> |
41 | #include <qpe/applnk.h> | 44 | #include <qpe/applnk.h> |
42 | #include <qpe/global.h> | 45 | #include <qpe/global.h> |
46 | #include <qpe/mimetype.h> | ||
43 | 47 | ||
44 | #include "ofileselector.h" | 48 | #include "ofileselector.h" |
45 | 49 | ||
46 | 50 | ||
47 | OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, | 51 | OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, |
48 | const QString &fileName, const QStringList mimetypes ) : QWidget( wid ) | 52 | const QString &fileName, const QStringList mimetypes ) : QWidget( wid ) |
49 | { | 53 | { |
50 | m_selector = selector; | 54 | m_selector = selector; |
51 | m_currentDir = dirName; | 55 | m_currentDir = dirName; |
52 | m_name = fileName; | 56 | m_name = fileName; |
53 | m_mimetypes = mimetypes; | 57 | m_mimetypes = mimetypes; |
54 | if( mimetypes.isEmpty() ) | 58 | if( mimetypes.isEmpty() ) |
55 | m_autoMime = true; | 59 | m_autoMime = true; |
56 | 60 | ||
57 | m_mode = mode; | 61 | m_mode = mode; |
58 | m_shTool = true; | 62 | m_shTool = true; |
59 | m_shPerm = true; | 63 | m_shPerm = true; |
60 | m_shLne = true; | 64 | m_shLne = true; |
61 | m_shChooser = true; | 65 | m_shChooser = true; |
62 | m_shYesNo = true; | 66 | m_shYesNo = true; |
63 | // for FILESELECTOR only view is interesting | 67 | // for FILESELECTOR only view is interesting |
64 | m_location = 0; | 68 | m_location = 0; |
65 | m_homeButton = 0; | 69 | m_homeButton = 0; |
66 | m_docButton = 0; | 70 | m_docButton = 0; |
@@ -247,51 +251,123 @@ void OFileSelector::updateLay() | |||
247 | check = m_checkPerm->isChecked(); | 251 | check = m_checkPerm->isChecked(); |
248 | QString text; | 252 | QString text; |
249 | 253 | ||
250 | if( m_edit != 0 ) | 254 | if( m_edit != 0 ) |
251 | text = m_edit->text(); | 255 | text = m_edit->text(); |
252 | // save current mimetype | 256 | // save current mimetype |
253 | 257 | ||
254 | delItems(); | 258 | delItems(); |
255 | delete m_checkPerm; | 259 | delete m_checkPerm; |
256 | delete m_edit; | 260 | delete m_edit; |
257 | delete m_fnLabel; | 261 | delete m_fnLabel; |
258 | delete m_ok; | 262 | delete m_ok; |
259 | delete m_cancel; | 263 | delete m_cancel; |
260 | delete m_mimeCheck; | 264 | delete m_mimeCheck; |
261 | delete m_viewCheck; | 265 | delete m_viewCheck; |
262 | delete m_select; // test | 266 | delete m_select; // test |
263 | delete m_stack; | 267 | delete m_stack; |
264 | //delete m_list; | 268 | //delete m_list; |
265 | init(); | 269 | init(); |
266 | if( m_shLne ) | 270 | if( m_shLne ) |
267 | m_edit->setText(text ); | 271 | m_edit->setText(text ); |
268 | if( m_shPerm ) | 272 | if( m_shPerm ) |
269 | m_checkPerm->setChecked(check ); | 273 | m_checkPerm->setChecked(check ); |
270 | } | 274 | } |
275 | // let's update the mimetypes. Use the current mimefilter for the 2nd QDir retrieve | ||
276 | // insert QListViewItems with the right options | ||
277 | bool OFileSelector::compliesMime(const QString &path, const QString &mime ) | ||
278 | { | ||
279 | if( mime == "All" ) | ||
280 | return true; | ||
281 | MimeType type( path ); | ||
282 | if( type.id() == mime ) | ||
283 | return true; | ||
284 | return false; | ||
285 | } | ||
286 | |||
271 | void OFileSelector::reparse() | 287 | void OFileSelector::reparse() |
272 | { | 288 | { |
289 | if(m_View== 0) | ||
290 | return; | ||
291 | |||
292 | m_View->clear(); | ||
293 | |||
294 | QDir dir( m_currentDir ); | ||
295 | QString currMime =m_mimeCheck->currentText(); | ||
296 | // update the mimetype now | ||
297 | if( m_autoMime ) { | ||
298 | m_mimetypes.clear(); | ||
299 | m_mimeCheck->clear(); | ||
300 | dir.setFilter( QDir::Files | QDir::Readable ); | ||
301 | dir.setSorting(QDir::Size ); | ||
302 | const QFileInfoList *list = dir.entryInfoList(); | ||
303 | QFileInfoListIterator it( *list ); | ||
304 | QFileInfo *fi; | ||
305 | while( (fi=it.current()) ){ | ||
306 | if(fi->extension() == QString::fromLatin1("desktop") ){ | ||
307 | ++it; | ||
308 | continue; | ||
309 | } | ||
310 | MimeType type(fi->filePath() ); | ||
311 | if( !m_mimetypes.contains( type.id() ) ) | ||
312 | m_mimetypes.append( type.id() ); | ||
313 | |||
314 | ++it; | ||
315 | } | ||
316 | m_mimeCheck->insertStringList(m_mimetypes ); | ||
317 | // set it to the current mimetype | ||
318 | }; | ||
319 | dir.setFilter(QDir::All ); | ||
320 | dir.setSorting(QDir::Name | QDir::DirsFirst ); | ||
321 | const QFileInfoList *list = dir.entryInfoList(); | ||
322 | QFileInfoListIterator it( *list ); | ||
323 | QFileInfo *fi; | ||
324 | while( (fi=it.current()) ){ | ||
325 | if(fi->isSymLink() ){ | ||
326 | QString file = fi->readLink(); | ||
327 | for(int i=0; i<=4; i++ ){ // prepend from dos | ||
328 | QFileInfo info( file ); | ||
329 | if( !info.exists() ){ | ||
330 | addSymlink(m_currentDir, info.fileName(), TRUE ); | ||
331 | break; | ||
332 | }else if( info.isDir() ){ | ||
333 | //addDir( ); | ||
334 | }else if( info.isFile() ){ | ||
335 | |||
336 | }else if( info.isSymLink() ){ | ||
337 | file = info.readLink(); | ||
338 | }else if( i == 4 ){ // just insert it and have the symlink symbol | ||
339 | addSymlink(m_currentDir, info.fileName() ); | ||
340 | } | ||
341 | } | ||
342 | }else if( fi->isDir() ){ | ||
343 | |||
344 | }else if( fi->isFile() ) { // file ? | ||
273 | 345 | ||
346 | |||
347 | } | ||
348 | ++it; | ||
349 | } | ||
274 | } | 350 | } |
275 | QString OFileSelector::directory() | 351 | QString OFileSelector::directory() |
276 | { | 352 | { |
277 | QString string; | 353 | QString string; |
278 | return string; | 354 | return string; |
279 | } | 355 | } |
280 | int OFileSelector::fileCount() | 356 | int OFileSelector::fileCount() |
281 | { | 357 | { |
282 | return 0; | 358 | return 0; |
283 | } | 359 | } |
284 | void OFileSelector::slotOk( ) | 360 | void OFileSelector::slotOk( ) |
285 | { | 361 | { |
286 | emit ok(); | 362 | emit ok(); |
287 | } | 363 | } |
288 | void OFileSelector::slotCancel( ) | 364 | void OFileSelector::slotCancel( ) |
289 | { | 365 | { |
290 | emit cancel(); | 366 | emit cancel(); |
291 | } | 367 | } |
292 | 368 | ||
293 | void OFileSelector::initializeName() | 369 | void OFileSelector::initializeName() |
294 | { | 370 | { |
295 | m_boxName = new QHBoxLayout(this ); | 371 | m_boxName = new QHBoxLayout(this ); |
296 | m_edit = new QLineEdit(this ); | 372 | m_edit = new QLineEdit(this ); |
297 | m_fnLabel = new QLabel(this ); | 373 | m_fnLabel = new QLabel(this ); |
@@ -344,70 +420,102 @@ void OFileSelector::initializeChooser() | |||
344 | 420 | ||
345 | connect( m_mimeCheck, SIGNAL(activated(const QString &) ), | 421 | connect( m_mimeCheck, SIGNAL(activated(const QString &) ), |
346 | this, SLOT(slotMimeCheck(const QString & ) ) ); | 422 | this, SLOT(slotMimeCheck(const QString & ) ) ); |
347 | } | 423 | } |
348 | void OFileSelector::slotMimeCheck(const QString &view ){ | 424 | void OFileSelector::slotMimeCheck(const QString &view ){ |
349 | if(m_selector == NORMAL ){ | 425 | if(m_selector == NORMAL ){ |
350 | delete m_select; | 426 | delete m_select; |
351 | m_select = new FileSelector(view == "All" ? QString::null : view | 427 | m_select = new FileSelector(view == "All" ? QString::null : view |
352 | , m_stack, "fileselector", FALSE, FALSE ); | 428 | , m_stack, "fileselector", FALSE, FALSE ); |
353 | m_stack->addWidget( m_select, NORMAL ); | 429 | m_stack->addWidget( m_select, NORMAL ); |
354 | m_stack->raiseWidget( NORMAL ); | 430 | m_stack->raiseWidget( NORMAL ); |
355 | }else{ | 431 | }else{ |
356 | 432 | ||
357 | 433 | ||
358 | } | 434 | } |
359 | } | 435 | } |
360 | 436 | ||
361 | void OFileSelector::slotViewCheck(const QString &view ){ | 437 | void OFileSelector::slotViewCheck(const QString &view ){ |
362 | qWarning("changed: show %s", view.latin1() ); | 438 | qWarning("changed: show %s", view.latin1() ); |
363 | // if the current view is the one | 439 | // if the current view is the one |
364 | QString currMime = m_mimeCheck->currentText(); | 440 | QString currMime = m_mimeCheck->currentText(); |
365 | if( view == QString::fromLatin1("Documents") ){ | 441 | if( view == QString::fromLatin1("Documents") ){ |
366 | // get the mimetype now | 442 | // get the mimetype now |
367 | // check if we're the current widget and return | 443 | // check if we're the current widget and return |
444 | if( m_View != 0) // delete 0 shouldn't crash but it did :( | ||
445 | delete m_View; | ||
446 | m_View = 0; | ||
368 | delete m_select; | 447 | delete m_select; |
369 | m_select = new FileSelector( currMime == "All" ? QString::null : currMime, | 448 | m_select = new FileSelector( currMime == "All" ? QString::null : currMime, |
370 | m_stack,"fileselector", FALSE, FALSE ); | 449 | m_stack,"fileselector", FALSE, FALSE ); |
371 | m_stack->addWidget( m_select, NORMAL ); | 450 | m_stack->addWidget( m_select, NORMAL ); |
372 | m_stack->raiseWidget( NORMAL ); | 451 | m_stack->raiseWidget( NORMAL ); |
373 | m_selector = NORMAL; | 452 | m_selector = NORMAL; |
374 | 453 | ||
375 | }else if(view == QString::fromLatin1("Files") ){ | 454 | }else if(view == QString::fromLatin1("Files") ){ |
376 | if( m_select != 0 ){ | 455 | // remove from the stack |
377 | // remove from the stack | 456 | delete m_select; |
378 | delete m_select; | 457 | m_select = 0; |
379 | m_select = 0; | 458 | delete m_View; |
380 | m_selector = EXTENDED; | 459 | m_View = 0; |
381 | // create the ListView or IconView | 460 | m_selector = EXTENDED; |
382 | 461 | // create the ListView or IconView | |
383 | reparse(); | 462 | initializeListView(); |
384 | } | 463 | |
464 | reparse(); | ||
385 | }else if(view == QString::fromLatin1("All Files") ) { | 465 | }else if(view == QString::fromLatin1("All Files") ) { |
386 | // remove from the stack | 466 | // remove from the stack |
387 | delete m_select; | 467 | delete m_select; |
388 | m_select = 0; | 468 | m_select = 0; |
469 | delete m_View; | ||
470 | m_View = 0; | ||
389 | m_selector = EXTENDED_ALL; | 471 | m_selector = EXTENDED_ALL; |
390 | 472 | initializeListView(); | |
391 | reparse(); | 473 | reparse(); |
392 | }; | 474 | }; |
393 | }; | 475 | }; |
394 | 476 | ||
395 | 477 | ||
396 | void OFileSelector::updateMimes() // lets check which mode is active | 478 | void OFileSelector::updateMimes() // lets check which mode is active |
397 | // check the current dir for items then | 479 | // check the current dir for items then |
398 | { | 480 | { |
399 | m_mimetypes.clear(); | 481 | m_mimetypes.clear(); |
400 | m_mimetypes.append("All" ); | 482 | m_mimetypes.append("All" ); |
401 | if( m_selector == NORMAL ){ | 483 | if( m_selector == NORMAL ){ |
402 | DocLnkSet set; | 484 | DocLnkSet set; |
403 | Global::findDocuments(&set, QString::null ); | 485 | Global::findDocuments(&set, QString::null ); |
404 | QListIterator<DocLnk> dit( set.children() ); | 486 | QListIterator<DocLnk> dit( set.children() ); |
405 | for ( ; dit.current(); ++dit ) { | 487 | for ( ; dit.current(); ++dit ) { |
406 | if( !m_mimetypes.contains((*dit)->type() ) ) | 488 | if( !m_mimetypes.contains((*dit)->type() ) ) |
407 | m_mimetypes.append( (*dit)->type() ); | 489 | m_mimetypes.append( (*dit)->type() ); |
408 | } | 490 | } |
409 | }else{ | 491 | }else{ |
410 | 492 | // should be allreday updatet | |
411 | 493 | ||
412 | } | 494 | } |
413 | }; | 495 | }; |
496 | void OFileSelector::initializeListView() | ||
497 | { | ||
498 | m_View = new QListView(m_stack, "Extended view" ); | ||
499 | m_stack->addWidget( m_View, EXTENDED ); | ||
500 | m_stack->raiseWidget( EXTENDED ); | ||
501 | QPEApplication::setStylusOperation( m_View->viewport(),QPEApplication::RightOnHold); | ||
502 | // set up the stuff | ||
503 | // Pixmap Name Date Size mime | ||
504 | //(m_View->header() )->hide(); | ||
505 | //m_View->setRootIsDecorated(false); | ||
506 | m_View->addColumn(" "); | ||
507 | m_View->addColumn(tr("Name") ); | ||
508 | m_View->addColumn(tr("Size") ); | ||
509 | m_View->addColumn(tr("Date"), 60 ); | ||
510 | m_View->addColumn(tr("Mime Type") ); | ||
511 | QHeader *header = m_View->header(); | ||
512 | header->hide(); | ||
513 | }; | ||
514 | |||
515 | |||
516 | |||
517 | |||
518 | |||
519 | |||
520 | |||
521 | |||
diff --git a/libopie/ofileselector.h b/libopie/ofileselector.h index 757a960..a90219f 100644 --- a/libopie/ofileselector.h +++ b/libopie/ofileselector.h | |||
@@ -37,96 +37,102 @@ | |||
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 | 41 | ||
42 | #include <qlistview.h> | 42 | #include <qlistview.h> |
43 | /** This is OPIEs FileDialog Widget. You can use it | 43 | /** This is OPIEs FileDialog Widget. You can use it |
44 | * as a dropin replacement of the fileselector and | 44 | * as a dropin replacement of the fileselector and |
45 | * or use any of the new features. | 45 | * or use any of the new features. |
46 | * This is also a complete FileSave and FileLoad widget | 46 | * This is also a complete FileSave and FileLoad widget |
47 | * If you look for a Dialog check OFileDialog | 47 | * If you look for a Dialog check OFileDialog |
48 | * | 48 | * |
49 | */ | 49 | */ |
50 | class DocLnk; | 50 | class DocLnk; |
51 | class QCheckBox; | 51 | class QCheckBox; |
52 | class QComboBox; | 52 | class QComboBox; |
53 | class QPushButton; | 53 | class QPushButton; |
54 | class FileSelector; | 54 | class FileSelector; |
55 | class QGridLayout; | 55 | class QGridLayout; |
56 | class QLineEdit; | 56 | class QLineEdit; |
57 | class QLabel; | 57 | class QLabel; |
58 | class QWidgetStack; | 58 | class QWidgetStack; |
59 | class QHBoxLayout; | 59 | class QHBoxLayout; |
60 | class QVBoxLayout; | 60 | class QVBoxLayout; |
61 | class QPopupMenu; | ||
62 | |||
61 | 63 | ||
62 | class OFileSelectorItem : public QListViewItem { | 64 | class OFileSelectorItem : public QListViewItem { |
63 | public: | 65 | public: |
64 | OFileSelectorItem(QListView *view, const QPixmap &pixmap, const QString &path, | 66 | OFileSelectorItem(QListView *view, const QPixmap &pixmap, const QString &path, |
65 | const QString &date, const QString &size, | 67 | const QString &date, const QString &size, |
66 | bool isDir=false ): QListViewItem(view) { | 68 | bool isDir=false ): QListViewItem(view) { |
67 | setPixmap(0, pixmap ); | 69 | setPixmap(0, pixmap ); |
68 | setText(1, path ); | 70 | setText(1, path ); |
69 | setText(2, size ); | 71 | setText(2, size ); |
70 | setText(3, date ); | 72 | setText(3, date ); |
71 | dir = isDir; | 73 | dir = isDir; |
72 | } | 74 | } |
73 | bool isDir()const{ | 75 | bool isDir()const{ |
74 | return dir; | 76 | return dir; |
75 | } | 77 | } |
76 | QString path()const{ | 78 | QString path()const{ |
77 | return text(1 ); | 79 | return text(1 ); |
78 | } | 80 | } |
79 | private: | 81 | private: |
80 | bool dir:1; | 82 | bool dir:1; |
81 | }; | 83 | }; |
82 | 84 | ||
83 | class OFileSelector : public QWidget { | 85 | class OFileSelector : public QWidget { |
84 | Q_OBJECT | 86 | Q_OBJECT |
85 | public: | 87 | public: |
86 | enum Mode {OPEN=1, SAVE, FILESELECTOR }; | 88 | enum Mode {OPEN=1, SAVE, FILESELECTOR }; |
87 | enum Selector{NORMAL=1, EXTENDED = 2, EXTENDED_ALL =4 }; | 89 | enum Selector{NORMAL=1, EXTENDED = 2, EXTENDED_ALL =4 }; |
88 | enum View { DIRS = 1, FILES = 2, TREE = 4, ICON = 8 }; | 90 | enum View { DIRS = 1, FILES = 2, TREE = 4, ICON = 8 }; |
89 | OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, const QString &fileName = QString::null, const QStringList mimetypes = QStringList() ); | 91 | OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, const QString &fileName = QString::null, const QStringList mimetypes = QStringList() ); |
90 | 92 | ||
91 | bool showToolbar() const { return m_shTool; }; | 93 | bool showToolbar() const { return m_shTool; }; |
92 | bool showPermissionBar() const { return m_shPerm; }; | 94 | bool showPermissionBar() const { return m_shPerm; }; |
93 | bool showLineEdit()const { return m_shLne; }; | 95 | bool showLineEdit()const { return m_shLne; }; |
94 | bool showChooser( )const { return m_shChooser; }; | 96 | bool showChooser( )const { return m_shChooser; }; |
95 | bool showYesCancel()const { return m_shYesNo; }; | 97 | bool showYesCancel()const { return m_shYesNo; }; |
96 | void setShowYesCancel( bool show ); | 98 | void setShowYesCancel( bool show ); |
97 | void setShowToolbar( bool show ); | 99 | void setShowToolbar( bool show ); |
98 | void setShowPermissionBar( bool show ); | 100 | void setShowPermissionBar( bool show ); |
99 | void setShowLineEdit(bool show) ; | 101 | void setShowLineEdit(bool show) ; |
100 | void setShowChooser( bool chooser ); | 102 | void setShowChooser( bool chooser ); |
101 | QCheckBox* permissionCheckbox(); | 103 | QCheckBox* permissionCheckbox(); |
102 | bool setPermission() const; | 104 | bool setPermission() const; |
103 | void setPermissionChecked( bool check ); | 105 | void setPermissionChecked( bool check ); |
104 | void setMode( int ); | 106 | void setMode( int ); |
107 | void setShowDirs(bool dir ) { }; | ||
108 | bool showDirs() {bool turn; return turn; } | ||
105 | int mode()const { return m_mode; }; | 109 | int mode()const { return m_mode; }; |
106 | int selector()const { return m_selector; }; | 110 | int selector()const { return m_selector; }; |
107 | void setSelector( int ); | 111 | void setSelector( int ); |
108 | QString selectedName( ); | 112 | QString selectedName( ); |
113 | void setPopupMenu( const QPopupMenu * ); | ||
114 | |||
109 | const DocLnk* selectedDocument()const; | 115 | const DocLnk* selectedDocument()const; |
110 | void updateLay(); | 116 | void updateLay(); |
111 | 117 | ||
112 | void reparse(); // re reads the dir | 118 | void reparse(); // re reads the dir |
113 | QString directory(); | 119 | QString directory(); |
114 | int fileCount(); | 120 | int fileCount(); |
115 | 121 | ||
116 | signals: | 122 | signals: |
117 | void fileSelected( const DocLnk & ); | 123 | void fileSelected( const DocLnk & ); |
118 | void fileSelected( const QString & ); | 124 | void fileSelected( const QString & ); |
119 | void closeMe(); | 125 | void closeMe(); |
120 | void ok(); | 126 | void ok(); |
121 | void cancel(); | 127 | void cancel(); |
122 | 128 | ||
123 | protected slots: | 129 | protected slots: |
124 | void slotOk(); | 130 | void slotOk(); |
125 | void slotCancel(); | 131 | void slotCancel(); |
126 | void slotViewCheck(const QString & ); | 132 | void slotViewCheck(const QString & ); |
127 | void slotMimeCheck(const QString & ); | 133 | void slotMimeCheck(const QString & ); |
128 | protected: | 134 | protected: |
129 | void init(); | 135 | void init(); |
130 | void updateMimes(); | 136 | void updateMimes(); |
131 | int m_mode, m_selector; | 137 | int m_mode, m_selector; |
132 | QComboBox *m_location, *m_mimeCheck, *m_viewCheck; | 138 | QComboBox *m_location, *m_mimeCheck, *m_viewCheck; |
@@ -141,36 +147,42 @@ class OFileSelector : public QWidget { | |||
141 | 147 | ||
142 | FileSelector *m_select; | 148 | FileSelector *m_select; |
143 | QWidgetStack *m_stack; | 149 | QWidgetStack *m_stack; |
144 | QVBoxLayout *m_lay; | 150 | QVBoxLayout *m_lay; |
145 | QGridLayout *m_Oselector; | 151 | QGridLayout *m_Oselector; |
146 | 152 | ||
147 | QHBoxLayout *m_boxToolbar; | 153 | QHBoxLayout *m_boxToolbar; |
148 | QHBoxLayout *m_boxOk; | 154 | QHBoxLayout *m_boxOk; |
149 | QHBoxLayout *m_boxName; | 155 | QHBoxLayout *m_boxName; |
150 | QHBoxLayout *m_boxView; | 156 | QHBoxLayout *m_boxView; |
151 | 157 | ||
152 | QLineEdit *m_edit; | 158 | QLineEdit *m_edit; |
153 | QLabel *m_fnLabel; | 159 | QLabel *m_fnLabel; |
154 | bool m_shTool:1; | 160 | bool m_shTool:1; |
155 | bool m_shPerm:1; | 161 | bool m_shPerm:1; |
156 | bool m_shLne:1; | 162 | bool m_shLne:1; |
157 | bool m_shChooser:1; | 163 | bool m_shChooser:1; |
158 | bool m_shYesNo:1; | 164 | bool m_shYesNo:1; |
159 | bool m_boCheckPerm:1; | 165 | bool m_boCheckPerm:1; |
160 | bool m_autoMime:1; | 166 | bool m_autoMime:1; |
161 | 167 | ||
162 | protected: | 168 | protected: |
163 | 169 | ||
164 | private: | 170 | private: |
171 | // implementation todo | ||
172 | virtual void addFile(const QString &path, const QString &name, bool symlink = FALSE ) {}; | ||
173 | virtual void addDir( const QString &path, const QString &dir , bool symlink = FALSE ){}; | ||
174 | virtual void addSymlink(const QString &path, const QString &name, bool broken = FALSE ){}; | ||
165 | void delItems(); | 175 | void delItems(); |
166 | void initializeName(); | 176 | void initializeName(); |
167 | void initializeYes(); | 177 | void initializeYes(); |
168 | void initializeChooser(); | 178 | void initializeChooser(); |
179 | void initializeListView(); | ||
180 | bool compliesMime(const QString &path, const QString &mime); | ||
169 | 181 | ||
170 | class OFileSelectorPrivate; | 182 | class OFileSelectorPrivate; |
171 | OFileSelectorPrivate *d; | 183 | OFileSelectorPrivate *d; |
172 | 184 | ||
173 | }; | 185 | }; |
174 | 186 | ||
175 | 187 | ||
176 | #endif | 188 | #endif |