summaryrefslogtreecommitdiff
authorzecke <zecke>2002-06-26 18:01:53 (UTC)
committer zecke <zecke>2002-06-26 18:01:53 (UTC)
commit76f87a51800511fe108edbcd14d4dd40ead6f391 (patch) (unidiff)
tree1d1b3cf7c3bbd98d294cac738b3bfa277964b32d
parent125dc1fe52d7a3c8be1b955c79d729cc935c8b6d (diff)
downloadopie-76f87a51800511fe108edbcd14d4dd40ead6f391.zip
opie-76f87a51800511fe108edbcd14d4dd40ead6f391.tar.gz
opie-76f87a51800511fe108edbcd14d4dd40ead6f391.tar.bz2
Improve mimetype handling
API is now fixed 2 Bugs outstanding though
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofiledialog.cc18
-rw-r--r--libopie/ofiledialog.h18
-rw-r--r--libopie/ofileselector.cc160
-rw-r--r--libopie/ofileselector.h77
4 files changed, 192 insertions, 81 deletions
diff --git a/libopie/ofiledialog.cc b/libopie/ofiledialog.cc
index 164fadd..4783004 100644
--- a/libopie/ofiledialog.cc
+++ b/libopie/ofiledialog.cc
@@ -4,3 +4,3 @@
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
@@ -10,4 +10,4 @@
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;
@@ -18,6 +18,6 @@
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,
@@ -39,3 +39,3 @@ OFileDialog::OFileDialog(const QString &caption,
39 const QString &fileName, 39 const QString &fileName,
40 const QStringList &mimetypes ) 40 const QMap<QString,QStringList>& mimetypes )
41 : QDialog( wid, "OFileDialog", true ) 41 : QDialog( wid, "OFileDialog", true )
@@ -59,3 +59,3 @@ OFileDialog::OFileDialog(const QString &caption,
59 59
60 60
61 file->setYesCancelVisible( false ); // relayout 61 file->setYesCancelVisible( false ); // relayout
@@ -77,3 +77,3 @@ QString OFileDialog::getOpenFileName(int selector,
77 const QString &file, 77 const QString &file,
78 const QStringList &mimes, 78 const MimeTypes &mimes,
79 QWidget *wid, 79 QWidget *wid,
@@ -93,3 +93,3 @@ QString OFileDialog::getSaveFileName(int selector,
93 const QString &file, 93 const QString &file,
94 const QStringList &mimes, 94 const MimeTypes &mimes,
95 QWidget *wid, 95 QWidget *wid,
diff --git a/libopie/ofiledialog.h b/libopie/ofiledialog.h
index 40d147e..e14253c 100644
--- a/libopie/ofiledialog.h
+++ b/libopie/ofiledialog.h
@@ -4,3 +4,3 @@
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
@@ -10,4 +10,4 @@
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;
@@ -18,6 +18,6 @@
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,
@@ -41,5 +41,5 @@ class OFileDialog : public QDialog {
41 QWidget *, int mode, int selector, 41 QWidget *, int mode, int selector,
42 const QString &dirName, 42 const QString &dirName,
43 const QString &fileName = QString::null, 43 const QString &fileName = QString::null,
44 const QStringList &mimetypes = QStringList() ); 44 const MimeTypes &mimetypes = MimeTypes() );
45 QString mimetype() const; 45 QString mimetype() const;
@@ -52,3 +52,3 @@ class OFileDialog : public QDialog {
52 const QString &fileName = QString::null, 52 const QString &fileName = QString::null,
53 const QStringList& mimefilter = QStringList(), 53 const MimeTypes& mime = MimeTypes(),
54 QWidget *wid = 0, 54 QWidget *wid = 0,
@@ -59,3 +59,3 @@ class OFileDialog : public QDialog {
59 const QString& fileName = QString::null, 59 const QString& fileName = QString::null,
60 const QStringList& mimefilter = QStringList(), 60 const MimeTypes& mimefilter = MimeTypes(),
61 QWidget *wid = 0, 61 QWidget *wid = 0,
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index 7a67ab2..6c59f89 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -101,4 +101,4 @@ OFileSelector::OFileSelector( QWidget *wid, int mode, int selector,
101 const QString &dirName, 101 const QString &dirName,
102 const QString &fileName, 102 const QString &fileName,
103 const QStringList &mimeTypes ) 103 const QMap<QString,QStringList>& mimeTypes)
104 : QWidget( wid, "OFileSelector") 104 : QWidget( wid, "OFileSelector")
@@ -106,2 +106,4 @@ OFileSelector::OFileSelector( QWidget *wid, int mode, int selector,
106 m_mimetypes = mimeTypes; 106 m_mimetypes = mimeTypes;
107 if (mode == SAVE )
108 m_name = fileName;
107 initVars(); 109 initVars();
@@ -111,3 +113,3 @@ OFileSelector::OFileSelector( QWidget *wid, int mode, int selector,
111 init(); 113 init();
112QTimer::singleShot(6*1000, this, SLOT( slotTest() ) ); 114 //QTimer::singleShot(6*1000, this, SLOT( slotTest() ) );
113} 115}
@@ -119,5 +121,8 @@ OFileSelector::OFileSelector(const QString &mimeFilter, QWidget *parent,
119{ 121{
120 m_mimetypes = QStringList::split(";", mimeFilter ); 122 if (!mimeFilter.isEmpty() ) {
123 QStringList list = QStringList::split(";", mimeFilter );
124 m_mimetypes.insert(mimeFilter, list );
125 }
121 initVars(); 126 initVars();
122 m_currentDir = QPEApplication::documentDir(); 127 m_currentDir = QPEApplication::documentDir();
123 m_mode = OPEN; 128 m_mode = OPEN;
@@ -131,3 +136,3 @@ OFileSelector::OFileSelector(const QString &mimeFilter, QWidget *parent,
131 136
132 137
133} 138}
@@ -137,2 +142,3 @@ OFileSelector::~OFileSelector()
137 142
143
138} 144}
@@ -145,4 +151,4 @@ void OFileSelector::setNewVisible( bool visible )
145 // we need to initialize but keep the selected mimetype 151 // we need to initialize but keep the selected mimetype
146 QString mime = m_mimeCheck == 0 ? QString::null : m_mimeCheck->currentText() ; 152 QString mime = currentMimeType();
147 m_select = new FileSelector( m_autoMime ? mime : m_mimetypes.join(";") , 153 m_select = new FileSelector( mime ,
148 m_stack, "fileselector", 154 m_stack, "fileselector",
@@ -343,3 +349,3 @@ QStringList OFileSelector::selectedNames()const
343/** If mode is set to the Dir selection this will return the selected path. 349/** If mode is set to the Dir selection this will return the selected path.
344 * 350 *
345 * 351 *
@@ -366,3 +372,3 @@ QString OFileSelector::directory()const
366 return QPEApplication::documentDir(); 372 return QPEApplication::documentDir();
367 373
368 return QDir(m_currentDir).absPath(); 374 return QDir(m_currentDir).absPath();
@@ -427,3 +433,5 @@ void OFileSelector::slotViewCheck(const QString &sel)
427 // autMime? fix cause now we use All and not the current 433 // autMime? fix cause now we use All and not the current
428 m_select = new FileSelector(m_autoMime ? QString::null : m_mimetypes.join(";"), 434 // yes currentMime fixes that for us
435 QString mime = currentMimeType();
436 m_select = new FileSelector(mime,
429 m_stack, "fileselector", 437 m_stack, "fileselector",
@@ -433,3 +441,3 @@ void OFileSelector::slotViewCheck(const QString &sel)
433 //connect to close me and other signals as well 441 //connect to close me and other signals as well
434 442
435 m_stack->addWidget( m_select, NORMAL ); 443 m_stack->addWidget( m_select, NORMAL );
@@ -447,5 +455,26 @@ void OFileSelector::slotViewCheck(const QString &sel)
447 reparse(); 455 reparse();
448 m_stack->raiseWidget( EXTENDED ); // same widget other QFileFilter 456 m_stack->raiseWidget( EXTENDED ); // same widget other QFileFilter
449 } 457 }
450} 458}
459// not yet finished.....
460QString OFileSelector::currentMimeType() const{
461 QString mime;
462 QString currentText;
463 if (m_shChooser )
464 currentText = m_mimeCheck->currentText();
465
466 if (tr("All") == currentText ) return QString::null;
467 else if (currentText.isEmpty() ) {
468 ;
469 }else {
470 QMap<QString, QStringList>::ConstIterator it;
471 it = m_mimetypes.find( currentText );
472 if ( it == m_mimetypes.end() ) {
473 mime = it.data().join(";");
474 }else{
475 mime = currentText;
476 }
477 }
478 return mime;
479}
451void OFileSelector::slotMimeCheck(const QString &mime) 480void OFileSelector::slotMimeCheck(const QString &mime)
@@ -453,7 +482,17 @@ void OFileSelector::slotMimeCheck(const QString &mime)
453 if( m_selector == NORMAL ){ 482 if( m_selector == NORMAL ){
454 if( m_autoMime ){ 483 //if( m_autoMime ){
484 QString newMimeType;
485 if (mime != tr("All") ) {
486 QMap<QString, QStringList>::Iterator it;
487 it = m_mimetypes.find(mime);
488 if ( it != m_mimetypes.end() ) {
489 newMimeType = it.data().join(";");
490 }else{
491 newMimeType = mime;
492 }
493 }
455 delete m_select; 494 delete m_select;
456 m_select = new FileSelector( mime == tr("All") ? QString::null : mime, 495 m_select = new FileSelector( newMimeType,
457 m_stack, "fileselector", 496 m_stack, "fileselector",
458 FALSE, FALSE); 497 FALSE, FALSE);
459 498
@@ -465,6 +504,5 @@ void OFileSelector::slotMimeCheck(const QString &mime)
465 updateMimes(); 504 updateMimes();
466 m_mimeCheck->clear(); 505 updateMimeCheck();
467 m_mimeCheck->insertStringList(m_mimetypes );
468 m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); 506 m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) );
469 } 507 //}
470 }else{ // others 508 }else{ // others
@@ -514,3 +552,11 @@ void OFileSelector::init()
514 if( m_selector == NORMAL ){ 552 if( m_selector == NORMAL ){
515 m_select = new FileSelector(m_autoMime ? QString::null : m_mimetypes.join(";"), 553 QString mime;
554 if (!m_autoMime) {
555 if (!m_mimetypes.isEmpty() ) {
556 QMap<QString, QStringList>::Iterator it;
557 it = m_mimetypes.begin(); // cause we're in the init
558 mime = it.data().join(";");
559 }
560 }
561 m_select = new FileSelector(mime,
516 m_stack, "fileselector", 562 m_stack, "fileselector",
@@ -547,3 +593,3 @@ void OFileSelector::updateMimes()
547 m_mimetypes.clear(); 593 m_mimetypes.clear();
548 m_mimetypes.append( tr("All") ); 594 m_mimetypes.insert( tr("All"), QString::null );
549 if( m_selector == NORMAL ){ 595 if( m_selector == NORMAL ){
@@ -554,3 +600,3 @@ void OFileSelector::updateMimes()
554 if( !m_mimetypes.contains( (*dit)->type() ) ) 600 if( !m_mimetypes.contains( (*dit)->type() ) )
555 m_mimetypes.append( (*dit)->type() ); 601 m_mimetypes.insert( (*dit)->type(), (*dit)->type() );
556 } 602 }
@@ -630,3 +676,3 @@ void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink)
630 ( m_mode == SAVE && !info->isWritable() ) ){ 676 ( m_mode == SAVE && !info->isWritable() ) ){
631 677
632 locked = true; pix = Resource::loadPixmap("locked"); 678 locked = true; pix = Resource::loadPixmap("locked");
@@ -659,3 +705,3 @@ void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink )
659 info->lastModified().toString(), 705 info->lastModified().toString(),
660 QString::number( info->size() ), 706 QString::number( info->size() ),
661 info->dirPath( true ), locked, 707 info->dirPath( true ), locked,
@@ -672,4 +718,4 @@ void OFileSelector::initializeName()
672 /** Name Layout Line 718 /** Name Layout Line
673 * This is the Layout line arranged in 719 * This is the Layout line arranged in
674 * horizontal way each components 720 * horizontal way each components
675 * are next to each other 721 * are next to each other
@@ -683,2 +729,3 @@ void OFileSelector::initializeName()
683 m_edit = new QLineEdit( m_boxName ); 729 m_edit = new QLineEdit( m_boxName );
730 m_edit->setText( m_name );
684 //m_boxName->addWidget( m_fnLabel ); 731 //m_boxName->addWidget( m_fnLabel );
@@ -690,3 +737,3 @@ void OFileSelector::initializeName()
690 }// else we already initialized 737 }// else we already initialized
691 // maybe show the components? 738 // maybe show the components?
692 // 739 //
@@ -715,2 +762,20 @@ void OFileSelector::initializeYes()
715} 762}
763/*
764 * OK m_mimeCheck is a QComboBox we now want to fill
765 * out that combobox
766 * if automime we need to update the mimetypes
767 */
768void OFileSelector::updateMimeCheck() {
769 m_mimeCheck->clear();
770 if (m_autoMime ) {
771 //m_mimeCheck->insertItem( tr("All") );
772 updateMimes();
773 }
774
775 QMap<QString, QStringList>::Iterator it;
776 for (it = m_mimetypes.begin(); it != m_mimetypes.end(); ++it ) {
777 m_mimeCheck->insertItem( it.key() );
778 }
779}
780
716void OFileSelector::initializeChooser() 781void OFileSelector::initializeChooser()
@@ -727,8 +792,4 @@ void OFileSelector::initializeChooser()
727 m_viewCheck->insertItem( tr("All Files") ); 792 m_viewCheck->insertItem( tr("All Files") );
728 if(!m_autoMime ) 793 updateMimeCheck();
729 m_mimeCheck->insertItem(m_mimetypes.join(",") ); 794
730 else{
731 updateMimes();
732 m_mimeCheck->insertStringList( m_mimetypes );
733 }
734 connect( m_viewCheck, SIGNAL( activated(const QString & ) ), 795 connect( m_viewCheck, SIGNAL( activated(const QString & ) ),
@@ -748,3 +809,3 @@ void OFileSelector::initializeListView()
748 809
749 // toolbar members 810 // toolbar members
750 { 811 {
@@ -752,3 +813,3 @@ void OFileSelector::initializeListView()
752 m_location = new QComboBox( m_boxToolbar ); 813 m_location = new QComboBox( m_boxToolbar );
753 m_location->setEditable( TRUE ); 814 m_location->setEditable( TRUE );
754 m_location->setDuplicatesEnabled( FALSE ); 815 m_location->setDuplicatesEnabled( FALSE );
@@ -833,9 +894,9 @@ void OFileSelector::initializeListView()
833 894
834 connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ), 895 connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ),
835 this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) ); 896 this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) );
836 897
837 connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )), 898 connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )),
838 this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) ); 899 this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) );
839 900
840 m_pseudoLayout->addWidget( m_View, 288 ); 901 m_pseudoLayout->addWidget( m_View, 288 );
841 m_stack->addWidget( m_pseudo, EXTENDED ); 902 m_stack->addWidget( m_pseudo, EXTENDED );
@@ -878,3 +939,8 @@ bool OFileSelector::compliesMime( const QString &path, const QString &mime )
878} 939}
940/* check if the mimetype in mime
941 * complies with the one which is current
942 */
943bool OFileSelector::compliesMime( const QString& mime ) {
879 944
945}
880void OFileSelector::slotFileSelected( const QString &string ) 946void OFileSelector::slotFileSelected( const QString &string )
@@ -1052,3 +1118,3 @@ void OFileSelector::reparse()
1052 //qWarning("Type %s", type.id().latin1() ); 1118 //qWarning("Type %s", type.id().latin1() );
1053 m_mimetypes.append( type.id() ); 1119 m_mimetypes.insert( type.id(), type.id() );
1054 } 1120 }
@@ -1058,4 +1124,3 @@ void OFileSelector::reparse()
1058 // add them to the chooser 1124 // add them to the chooser
1059 m_mimeCheck->insertItem( tr("All") ); 1125 updateMimeCheck();
1060 m_mimeCheck->insertStringList( m_mimetypes );
1061 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currentMimeType ) ); 1126 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currentMimeType ) );
@@ -1064,6 +1129,7 @@ void OFileSelector::reparse()
1064 }else { // no autoMime 1129 }else { // no autoMime
1065 currentMimeType = m_mimetypes.join(";"); 1130 // let the mimetype be set from out side the m_mimeCheck FEATURE
1131
1066 if( m_shChooser ){ 1132 if( m_shChooser ){
1067 m_mimeCheck->clear(); 1133 currentMimeType = m_mimeCheck->currentText();
1068 m_mimeCheck->insertItem(m_mimetypes.join(",") ); 1134 updateMimeCheck();
1069 } 1135 }
@@ -1077,3 +1143,3 @@ void OFileSelector::reparse()
1077 sort = (QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed); 1143 sort = (QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed);
1078 else 1144 else
1079 sort = (QDir::Name | QDir::DirsFirst | QDir::Reversed); 1145 sort = (QDir::Name | QDir::DirsFirst | QDir::Reversed);
@@ -1127,3 +1193,3 @@ void OFileSelector::reparse()
1127 } // of while loop 1193 } // of while loop
1128 m_View->sort(); 1194 m_View->sort();
1129 if( m_shTool ){ 1195 if( m_shTool ){
diff --git a/libopie/ofileselector.h b/libopie/ofileselector.h
index 47697b9..f2d5f84 100644
--- a/libopie/ofileselector.h
+++ b/libopie/ofileselector.h
@@ -1,3 +1,3 @@
1/* 1/*
2 This is based on code and idea of 2 This is based on code and ideas of
3 L. J. Potter ljp@llornkcor.com 3 L. J. Potter ljp@llornkcor.com
@@ -9,3 +9,3 @@
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This library is free software; you can 10 _;:,     .>    :=|. This library is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
@@ -15,4 +15,4 @@
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This library is distributed in the hope that 17    .i_,=:_.      -<s. This library is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
@@ -23,6 +23,6 @@
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
@@ -45,2 +45,3 @@
45#include <qlistview.h> 45#include <qlistview.h>
46
46/** This is OPIEs FileDialog Widget. You can use it 47/** This is OPIEs FileDialog Widget. You can use it
@@ -49,3 +50,3 @@
49 * This is also a complete FileSave and FileLoad widget 50 * This is also a complete FileSave and FileLoad widget
50 * If you look for a Dialog check OFileDialog 51 * If you look for a Dialog check OFileDialog
51 * 52 *
@@ -66,4 +67,5 @@ class QFileInfo;
66class QHBox; 67class QHBox;
67// 68//
68 69
70typedef QMap< QString, QStringList> MimeTypes;
69 71
@@ -72,12 +74,44 @@ class OFileSelector : public QWidget {
72 public: 74 public:
75 /**
76 * The mode of the file selector
77 * Either open, save, fileselector or dir browsing mode
78 *
79 */
73 enum Mode {OPEN=1, SAVE=2, FILESELECTOR=4, DIR=8 }; 80 enum Mode {OPEN=1, SAVE=2, FILESELECTOR=4, DIR=8 };
81
82 /**
83 * Selector. Either NORMAL for the one shipped with
84 * libqpe or EXTENDED. for the EXTENDED
85 * EXTENDED_ALL also shows 'hidden' files
86 */
74 enum Selector{NORMAL=0, EXTENDED = 1, EXTENDED_ALL =2 }; 87 enum Selector{NORMAL=0, EXTENDED = 1, EXTENDED_ALL =2 };
88
89 /**
90 * This is reserved for futrue views
91 */
75 enum View { DIRS = 1, FILES = 2, TREE = 4, ICON = 8 }; 92 enum View { DIRS = 1, FILES = 2, TREE = 4, ICON = 8 };
76 93
77 OFileSelector(QWidget *wid, int mode, int selector, 94 /**
95 * A c'tor which should be used for advanced mode
96 * @param wid the parent
97 * @param mode the Mode of the Selector
98 * @param selector the current View of the Selector
99 * @param dirName in which dir to start
100 * @param fileName a proposed filename
101 * @param mimetypes A list of mimetypes \
102 * QString is for a identifier name like "Text files"
103 * the coresponding QStringList is used for the mimetypes
104 * if empty it'll fill the list of mimetypes depending
105 * on the content of the current directory
106 */
107
108 OFileSelector(QWidget *wid, int mode, int selector,
78 const QString &dirName, 109 const QString &dirName,
79 const QString &fileName = QString::null, 110 const QString &fileName = QString::null,
80 const QStringList &mimetypes = QStringList() ); 111 const MimeTypes &mimetypes = MimeTypes() );
81 112
82 113
114 /**
115 * This is a QPE compatible c'tor
116 */
83 OFileSelector(const QString &mimeFilter, QWidget *parent, 117 OFileSelector(const QString &mimeFilter, QWidget *parent,
@@ -132,3 +166,3 @@ class OFileSelector : public QWidget {
132 void setSelector( int ); 166 void setSelector( int );
133 167
134 bool showPopup()const { return m_showPopup; }; 168 bool showPopup()const { return m_showPopup; };
@@ -177,3 +211,3 @@ class OFileSelector : public QWidget {
177 void updateMimes(); 211 void updateMimes();
178 212
179 protected: 213 protected:
@@ -192,3 +226,4 @@ class OFileSelector : public QWidget {
192 QString m_name; 226 QString m_name;
193 QStringList m_mimetypes; 227// QStringList m_mimetypes;
228 QMap<QString, QStringList> m_mimetypes;
194 229
@@ -234,4 +269,14 @@ class OFileSelector : public QWidget {
234 void initPics(); 269 void initPics();
235 bool compliesMime(const QString &path, const QString &mime); 270 bool compliesMime(const QString &path,
236 271 const QString &mime);
272 bool compliesMime(const QString& mime );
273 /**
274 * Updates the QComboBox with the current mimetypes
275 */
276 void updateMimeCheck();
277
278 /**
279 * Returns the current mimetype
280 */
281 QString currentMimeType()const;
237 class OFileSelectorPrivate; 282 class OFileSelectorPrivate;
@@ -239,3 +284,3 @@ class OFileSelector : public QWidget {
239 static QMap<QString,QPixmap> *m_pixmaps; 284 static QMap<QString,QPixmap> *m_pixmaps;
240 285
241private slots: 286private slots: