summaryrefslogtreecommitdiff
authorzecke <zecke>2002-04-27 22:09:26 (UTC)
committer zecke <zecke>2002-04-27 22:09:26 (UTC)
commit7d741c93b423a3ab721071971b2c345d2d8548e2 (patch) (unidiff)
treec6ae4fc904ccd5f3ab08fb2876f9666358544f4f
parent69e271e44d23befc74a96a98708ddb6ec754a4b6 (diff)
downloadopie-7d741c93b423a3ab721071971b2c345d2d8548e2.zip
opie-7d741c93b423a3ab721071971b2c345d2d8548e2.tar.gz
opie-7d741c93b423a3ab721071971b2c345d2d8548e2.tar.bz2
Fix automime and mime tested with textedit
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector.cc89
1 files changed, 49 insertions, 40 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index ce66f51..3a11032 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -37,95 +37,96 @@
37#include <qcheckbox.h> 37#include <qcheckbox.h>
38#include <qlabel.h> 38#include <qlabel.h>
39#include <qheader.h> 39#include <qheader.h>
40#include <qdir.h> 40#include <qdir.h>
41#include <qpainter.h> 41#include <qpainter.h>
42#include <qaction.h> 42#include <qaction.h>
43#include <qpopupmenu.h> 43#include <qpopupmenu.h>
44#include <qcursor.h> 44#include <qcursor.h>
45#include <qstringlist.h> 45#include <qstringlist.h>
46#include <qmessagebox.h> 46#include <qmessagebox.h>
47 47
48#include <qpe/qpeapplication.h> 48#include <qpe/qpeapplication.h>
49#include <qpe/fileselector.h> 49#include <qpe/fileselector.h>
50#include <qpe/applnk.h> 50#include <qpe/applnk.h>
51#include <qpe/global.h> 51#include <qpe/global.h>
52#include <qpe/mimetype.h> 52#include <qpe/mimetype.h>
53#include <qpe/resource.h> 53#include <qpe/resource.h>
54#include <qpe/storage.h> 54#include <qpe/storage.h>
55 55
56#include <unistd.h> 56#include <unistd.h>
57#include <stdlib.h> 57#include <stdlib.h>
58#include <sys/stat.h> 58#include <sys/stat.h>
59 59
60#include "ofileselector.h" 60#include "ofileselector.h"
61 61
62QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; 62QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0;
63 63
64namespace { 64namespace {
65 65
66 int indexByString( const QComboBox *box, const QString &str ){ 66 int indexByString( const QComboBox *box, const QString &str ){
67 int index= -1; 67 int index= -1;
68 for(int i= 0; i < box->count(); i++ ){ 68 for(int i= 0; i < box->count(); i++ ){
69 qWarning("str T%sT boxT%sT", str.latin1(), box->text(i).latin1() );
70 if( str == box->text(i ) ){ 69 if( str == box->text(i ) ){
71 index= i; 70 index= i;
72 break; 71 break;
73 } 72 }
74 } 73 }
75 return index; 74 return index;
76 } 75 }
77 76
78}; 77};
79 78
80 79
81OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName, 80OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString &dirName,
82 const QString &fileName, const QStringList &mimetypes ) : QWidget( wid ) 81 const QString &fileName, const QStringList &mimetypes ) : QWidget( wid )
83{ 82{
84 if(wid!=0) 83 if(wid!=0)
85 resize(wid->width(),wid->height()); 84 resize(wid->width(),wid->height());
86 m_selector = selector; 85 m_selector = selector;
87 m_currentDir = dirName; 86 m_currentDir = dirName;
88 m_name = fileName; 87 m_name = fileName;
89 requestedMimeTypesList = m_mimetypes = mimetypes; 88 m_mimetypes = mimetypes;
90 89
91// if( mimetypes.isEmpty() ) 90 if( mimetypes.isEmpty() )
92// m_autoMime = true; 91 m_autoMime = true;
93 92
93 qWarning("OFileSelector mimetypes %s", mimetypes.join(" ").latin1() );
94 m_mode = mode; 94 m_mode = mode;
95 m_shTool = true; 95 m_shTool = true;
96 m_shPerm = true; 96 m_shPerm = true;
97 m_shLne = true; 97 m_shLne = true;
98 m_shChooser = true; 98 m_shChooser = true;
99 m_shYesNo = true; 99 m_shYesNo = true;
100
100 // for FILESELECTOR only view is interesting 101 // for FILESELECTOR only view is interesting
101 m_location = 0; 102 m_location = 0;
102 m_homeButton = 0; 103 m_homeButton = 0;
103 m_docButton = 0; 104 m_docButton = 0;
104 m_hideButton = 0; 105 m_hideButton = 0;
105 m_ok = 0; 106 m_ok = 0;
106 m_cancel = 0; 107 m_cancel = 0;
107 m_reread = 0; 108 m_reread = 0;
108 m_up = 0; 109 m_up = 0;
109 m_View = 0; 110 m_View = 0;
110 m_select = 0; 111 m_select = 0;
111 m_stack = 0; 112 m_stack = 0;
112 113
113 m_select = 0; 114 m_select = 0;
114 m_stack = 0; 115 m_stack = 0;
115 m_lay = 0; 116 m_lay = 0;
116 m_boxToolbar = 0; 117 m_boxToolbar = 0;
117 m_boxOk = 0; 118 m_boxOk = 0;
118 m_edit = 0; 119 m_edit = 0;
119 120
120 m_fnLabel = 0; 121 m_fnLabel = 0;
121 m_checkPerm = 0; 122 m_checkPerm = 0;
122 m_mimeCheck = 0; 123 m_mimeCheck = 0;
123 m_viewCheck = 0; 124 m_viewCheck = 0;
124 125
125 m_pseudo = 0; 126 m_pseudo = 0;
126 m_pseudoLayout = 0; 127 m_pseudoLayout = 0;
127 128
128 m_dir = true; 129 m_dir = true;
129 m_files = true; 130 m_files = true;
130 m_custom = 0; 131 m_custom = 0;
131 m_showPopup = true; 132 m_showPopup = true;
@@ -160,92 +161,96 @@ void OFileSelector::initPics()
160// let's initialize the gui 161// let's initialize the gui
161/** 162/**
162 -------------------- 163 --------------------
163 | cmbBox Button | 164 | cmbBox Button |
164 -------------------- 165 --------------------
165 | FileSlector | 166 | FileSlector |
166 | or | 167 | or |
167 | OSelector | 168 | OSelector |
168 | | 169 | |
169 | | 170 | |
170 ____________________ 171 ____________________
171 | LineEdit | 172 | LineEdit |
172 ____________________ 173 ____________________
173 | Permission Bar | 174 | Permission Bar |
174 ____________________ 175 ____________________
175 | ViewChoose | 176 | ViewChoose |
176 ____________________ 177 ____________________
177 | Save Cancel| 178 | Save Cancel|
178 ____________________ 179 ____________________
179 */ 180 */
180void OFileSelector::delItems() 181void OFileSelector::delItems()
181{ 182{
182 QLayoutIterator it = m_lay->iterator(); 183 QLayoutIterator it = m_lay->iterator();
183 while ( it.current() != 0 ){ 184 while ( it.current() != 0 ){
184 it.deleteCurrent(); 185 it.deleteCurrent();
185 } 186 }
186} 187}
187 188
188void OFileSelector::init() 189void OFileSelector::init()
189{ 190{
190// qDebug("init"); 191// qDebug("init");
191 m_stack = new QWidgetStack(this, "wstack" ); 192 m_stack = new QWidgetStack(this, "wstack" );
193 if( m_selector == NORMAL ){
192 QString currMime; 194 QString currMime;
193 if( m_mimeCheck != 0 ) 195 if( m_mimeCheck != 0 )
194 currMime = m_mimeCheck->currentText(); 196 currMime = m_mimeCheck->currentText();
195 updateMimes(); 197 updateMimes();
196 m_select = new FileSelector( currMime == "All" ? QString::null : currMime , m_stack, "fileselector", FALSE, FALSE ); 198 m_select = new FileSelector( currMime == "All" ? QString::null : currMime ,
199 m_stack, "fileselector", FALSE, FALSE );
197 m_stack->addWidget(m_select, NORMAL ); 200 m_stack->addWidget(m_select, NORMAL );
198 m_lay->addWidget(m_stack ); 201 m_lay->addWidget(m_stack );
199 m_stack->raiseWidget(NORMAL ); 202 m_stack->raiseWidget(NORMAL );
200 connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); 203 connect(m_select, SIGNAL(fileSelected( const DocLnk &) ),
204 this, SLOT(slotFileBridgeSelected(const DocLnk &) ) );
201 m_pseudoLayout = 0l; 205 m_pseudoLayout = 0l;
202 if( m_selector != NORMAL ) { 206
207 } else {
203 initializeListView(); 208 initializeListView();
204 } 209 }
205 if(m_shLne ){ 210 if(m_shLne ){
206 initializeName(); 211 initializeName();
207 } 212 }
208 if(m_shPerm ){ 213 if(m_shPerm ){
209 m_checkPerm = new QCheckBox(tr("Set Permission"), this, "Permission" ); 214 m_checkPerm = new QCheckBox(tr("Set Permission"), this, "Permission" );
210 m_checkPerm->setChecked( false ); 215 m_checkPerm->setChecked( false );
211 m_lay->addWidget(m_checkPerm ); 216 m_lay->addWidget(m_checkPerm );
212 } 217 }
213 if( m_shChooser ) 218 if( m_shChooser )
214 initializeChooser(); 219 initializeChooser();
215 if(m_shYesNo ) 220 if(m_shYesNo )
216 initializeYes(); 221 initializeYes();
217 222
218 m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, requestedMimeTypesList.first()) ); 223 // m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, requestedMimeTypesList.first()) );
219 reparse(); 224 // reparse();
220 225
221} 226}
222 227
223void OFileSelector::setYesCancelVisible( bool show ) 228void OFileSelector::setYesCancelVisible( bool show )
224{ 229{
225 if ( show == m_shYesNo ) 230 if ( show == m_shYesNo )
226 return; 231 return;
227 m_shYesNo = show; 232 m_shYesNo = show;
228 if( !show ){ 233 if( !show ){
229 delete m_ok; 234 delete m_ok;
230 delete m_cancel; 235 delete m_cancel;
231 m_ok = 0; 236 m_ok = 0;
232 m_cancel = 0; 237 m_cancel = 0;
233 // delete m_boxOk; all ready deleted in delItems 238 // delete m_boxOk; all ready deleted in delItems
234 } 239 }
235 updateLay(); // recreate it and save the other states 240 updateLay(); // recreate it and save the other states
236} 241}
237 242
238void OFileSelector::setToolbarVisible( bool show ) 243void OFileSelector::setToolbarVisible( bool show )
239{ 244{
240 if ( m_shTool == show ) 245 if ( m_shTool == show )
241 return; 246 return;
242 if(!m_shTool ){ 247 if(!m_shTool ){
243 delete m_boxToolbar; 248 delete m_boxToolbar;
244 delete m_homeButton; 249 delete m_homeButton;
245 delete m_docButton; 250 delete m_docButton;
246 delete m_location; 251 delete m_location;
247 delete m_up; 252 delete m_up;
248 m_boxToolbar = 0; 253 m_boxToolbar = 0;
249 m_homeButton = 0; 254 m_homeButton = 0;
250 m_docButton = 0; 255 m_docButton = 0;
251 m_location = 0; 256 m_location = 0;
@@ -414,65 +419,68 @@ bool OFileSelector::compliesMime(const QString &path, const QString &mime )
414void OFileSelector::reparse() 419void OFileSelector::reparse()
415{ 420{
416 qDebug("reparse"); 421 qDebug("reparse");
417 if(m_View== 0 || m_selector == NORMAL) 422 if(m_View== 0 || m_selector == NORMAL)
418 return; 423 return;
419 m_View->clear(); 424 m_View->clear();
420 QString currMime =m_mimeCheck->currentText(); 425 QString currMime =m_mimeCheck->currentText();
421 // update the mimetype now 426 // update the mimetype now
422 if( m_autoMime ) { 427 if( m_autoMime ) {
423 QDir dir( m_currentDir ); 428 QDir dir( m_currentDir );
424 m_mimetypes.clear(); 429 m_mimetypes.clear();
425 m_mimeCheck->clear(); 430 m_mimeCheck->clear();
426 dir.setFilter( QDir::Files | QDir::Readable ); 431 dir.setFilter( QDir::Files | QDir::Readable );
427 dir.setSorting(QDir::Size ); 432 dir.setSorting(QDir::Size );
428 const QFileInfoList *list = dir.entryInfoList(); 433 const QFileInfoList *list = dir.entryInfoList();
429 QFileInfoListIterator it( *list ); 434 QFileInfoListIterator it( *list );
430 QFileInfo *fi; 435 QFileInfo *fi;
431 while( (fi=it.current()) ){ 436 while( (fi=it.current()) ){
432 if(fi->extension() == QString::fromLatin1("desktop") ){ 437 if(fi->extension() == QString::fromLatin1("desktop") ){
433 ++it; 438 ++it;
434 continue; 439 continue;
435 } 440 }
436 MimeType type(fi->filePath() ); 441 MimeType type(fi->filePath() );
437 if( !m_mimetypes.contains( type.id() ) ) 442 if( !m_mimetypes.contains( type.id() ) )
438 m_mimetypes.append( type.id() ); 443 m_mimetypes.append( type.id() );
439 444
440 ++it; 445 ++it;
441 } 446 }
442 m_mimetypes.prepend("All" ); 447 m_mimetypes.prepend("All" );
443 m_mimeCheck->insertStringList(m_mimetypes ); 448 m_mimeCheck->insertStringList(m_mimetypes );
444 // set it to the current mimetype 449 // set it to the current mimetype
445 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currMime ) ); 450 m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currMime ) );
446 }; 451 }else{
452 m_mimeCheck->clear();
453 m_mimeCheck->insertItem( m_mimetypes.join(";") );
454 }
447 455
448 QDir dir( m_currentDir ); 456 QDir dir( m_currentDir );
449 //dir.setFilter(-1 ); 457 //dir.setFilter(-1 );
450 int sort = QDir::Name | QDir::DirsFirst | QDir::Reversed; 458 int sort = QDir::Name | QDir::DirsFirst | QDir::Reversed;
451 if( m_case ) 459 if( m_case )
452 sort = QDir::IgnoreCase; 460 sort = QDir::IgnoreCase;
453 dir.setSorting( sort ); 461 dir.setSorting( sort );
454 462
455 int filter; 463 int filter;
456 /* if( m_dir && !m_files) 464 /* if( m_dir && !m_files)
457 filter |= QDir::Dirs; 465 filter |= QDir::Dirs;
458 else if( !m_dir && m_files ) 466 else if( !m_dir && m_files )
459 filter |= QDir::Files; 467 filter |= QDir::Files;
460 else 468 else
461 filter |= QDir::All; 469 filter |= QDir::All;
462 */ 470 */
463 if( m_selector == EXTENDED_ALL ) 471 if( m_selector == EXTENDED_ALL )
464 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; 472 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All;
465 else 473 else
466 filter = QDir::Files | QDir::Dirs | QDir::All; 474 filter = QDir::Files | QDir::Dirs | QDir::All;
467 dir.setFilter( filter ); 475 dir.setFilter( filter );
468 qDebug("infoList"); 476 qDebug("infoList");
469 const QFileInfoList *list = dir.entryInfoList(); 477 const QFileInfoList *list = dir.entryInfoList();
470 QFileInfoListIterator it( *list ); 478 QFileInfoListIterator it( *list );
471 QFileInfo *fi; 479 QFileInfo *fi;
472 while( (fi=it.current()) ){ 480 while( (fi=it.current()) ){
473 if(fi->fileName() == ".." || fi->fileName() == "." ){ 481 if(fi->fileName() == ".." || fi->fileName() == "." ){
474 ++it; 482 ++it;
475 continue; 483 continue;
476 } 484 }
477// qWarning("Test: %s", fi->fileName().latin1() ); 485// qWarning("Test: %s", fi->fileName().latin1() );
478 if(fi->isSymLink() ){ 486 if(fi->isSymLink() ){
@@ -549,70 +557,70 @@ void OFileSelector::initializeName()
549void OFileSelector::initializeYes() 557void OFileSelector::initializeYes()
550{ 558{
551 m_ok = new QPushButton("&Save", this, "save" ); 559 m_ok = new QPushButton("&Save", this, "save" );
552 m_cancel = new QPushButton("C&ancel", this, "cancel" ); 560 m_cancel = new QPushButton("C&ancel", this, "cancel" );
553 m_boxOk = new QHBoxLayout(this ); 561 m_boxOk = new QHBoxLayout(this );
554 m_boxOk->addWidget( m_ok, Qt::AlignHCenter ); 562 m_boxOk->addWidget( m_ok, Qt::AlignHCenter );
555 m_boxOk->insertSpacing(1, 8 ); 563 m_boxOk->insertSpacing(1, 8 );
556 m_boxOk->addWidget( m_cancel, Qt::AlignHCenter); 564 m_boxOk->addWidget( m_cancel, Qt::AlignHCenter);
557 m_lay->addLayout(m_boxOk ); 565 m_lay->addLayout(m_boxOk );
558 connect(m_ok, SIGNAL(clicked() ), 566 connect(m_ok, SIGNAL(clicked() ),
559 this, SLOT(slotOk() ) ); 567 this, SLOT(slotOk() ) );
560 connect(m_cancel, SIGNAL(clicked() ), 568 connect(m_cancel, SIGNAL(clicked() ),
561 this, SLOT(slotCancel() ) ); 569 this, SLOT(slotCancel() ) );
562 570
563} 571}
564 572
565void OFileSelector::initializeChooser() 573void OFileSelector::initializeChooser()
566{ 574{
567 m_boxView = new QHBoxLayout(this ); 575 m_boxView = new QHBoxLayout(this );
568 576
569 m_mimeCheck = new QComboBox(this, "mime check"); 577 m_mimeCheck = new QComboBox(this, "mime check");
570 m_viewCheck = new QComboBox(this, "view check"); 578 m_viewCheck = new QComboBox(this, "view check");
571 m_boxView->addWidget(m_viewCheck, 0 ); 579 m_boxView->addWidget(m_viewCheck, 0 );
572 m_boxView->insertSpacing(2, 8 ); 580 m_boxView->insertSpacing(2, 8 );
573 m_boxView->addWidget(m_mimeCheck, 0 ); 581 m_boxView->addWidget(m_mimeCheck, 0 );
574 m_lay->addLayout(m_boxView ); 582 m_lay->addLayout(m_boxView );
575 m_lay->insertSpacing( 4, 8); 583 m_lay->insertSpacing( 4, 8);
576 584
577 m_viewCheck->insertItem(tr("Documents") ); 585 m_viewCheck->insertItem(tr("Documents") );
578 m_viewCheck->insertItem(tr("Files") ); 586 m_viewCheck->insertItem(tr("Files") );
579 m_viewCheck->insertItem(tr("All Files") ); 587 m_viewCheck->insertItem(tr("All Files") );
580 588
581// if(!m_autoMime ) 589 if(!m_autoMime )
582// m_mimeCheck->insertItem(m_mimetypes.join("," ) ); 590 m_mimeCheck->insertItem(m_mimetypes.join("," ) );
583// else{ // check 591 else{ // check
584 updateMimes(); 592 updateMimes();
585 m_mimeCheck->insertStringList( m_mimetypes ); 593 m_mimeCheck->insertStringList( m_mimetypes );
586// } 594 }
587 595
588 connect( m_viewCheck, SIGNAL(activated(const QString &) ), 596 connect( m_viewCheck, SIGNAL(activated(const QString &) ),
589 this, SLOT(slotViewCheck(const QString & ) ) ); 597 this, SLOT(slotViewCheck(const QString & ) ) );
590 598
591 connect( m_mimeCheck, SIGNAL(activated(const QString &) ), 599 connect( m_mimeCheck, SIGNAL(activated(const QString &) ),
592 this, SLOT(slotMimeCheck(const QString & ) ) ); 600 this, SLOT(slotMimeCheck(const QString & ) ) );
593} 601}
594 602
595void OFileSelector::slotMimeCheck(const QString &view ){ 603void OFileSelector::slotMimeCheck(const QString &view ){
596 if(m_selector == NORMAL ){ 604 if(m_selector == NORMAL ){
597 delete m_select; 605 delete m_select;
598 m_select = new FileSelector(view == "All" ? QString::null : view 606 m_select = new FileSelector(view == "All" ? QString::null : view
599 , m_stack, "fileselector", FALSE, FALSE ); 607 , m_stack, "fileselector", FALSE, FALSE );
600 m_stack->addWidget( m_select, NORMAL ); 608 m_stack->addWidget( m_select, NORMAL );
601 m_stack->raiseWidget( NORMAL ); 609 m_stack->raiseWidget( NORMAL );
602 }else{ 610 }else{
603 reparse(); 611 reparse();
604 } 612 }
605} 613}
606 614
607void OFileSelector::slotViewCheck(const QString &view ){ 615void OFileSelector::slotViewCheck(const QString &view ){
608 qWarning("changed: show %s", view.latin1() ); 616 qWarning("changed: show %s", view.latin1() );
609 // if the current view is the one 617 // if the current view is the one
610 QString currMime = m_mimeCheck->currentText(); 618 QString currMime = m_mimeCheck->currentText();
611 if( view == QString::fromLatin1("Documents") ){ 619 if( view == QString::fromLatin1("Documents") ){
612 // get the mimetype now 620 // get the mimetype now
613 // check if we're the current widget and return 621 // check if we're the current widget and return
614 if( m_View != 0) { // delete 0 shouldn't crash but it did :( 622 if( m_View != 0) { // delete 0 shouldn't crash but it did :(
615 delete m_View; 623 delete m_View;
616 delete m_boxToolbar; 624 delete m_boxToolbar;
617 delete m_homeButton; 625 delete m_homeButton;
618 delete m_docButton; 626 delete m_docButton;
@@ -640,97 +648,98 @@ void OFileSelector::slotViewCheck(const QString &view ){
640 updateMimes(); 648 updateMimes();
641 m_mimeCheck->insertStringList( m_mimetypes ); 649 m_mimeCheck->insertStringList( m_mimetypes );
642 m_stack->raiseWidget( NORMAL ); 650 m_stack->raiseWidget( NORMAL );
643 connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); 651 connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) );
644 652
645 } else if(view == QString::fromLatin1("Files") ){ 653 } else if(view == QString::fromLatin1("Files") ){
646 // remove from the stack 654 // remove from the stack
647 delete m_select; 655 delete m_select;
648 m_select = 0; 656 m_select = 0;
649 delete m_View; 657 delete m_View;
650 m_View = 0; 658 m_View = 0;
651 659
652 m_selector = EXTENDED; 660 m_selector = EXTENDED;
653 initializeListView(); 661 initializeListView();
654 reparse(); 662 reparse();
655 } else if(view == QString::fromLatin1("All Files") ) { 663 } else if(view == QString::fromLatin1("All Files") ) {
656 // remove from the stack 664 // remove from the stack
657 delete m_select; 665 delete m_select;
658 m_select = 0; 666 m_select = 0;
659 delete m_View; 667 delete m_View;
660 m_View = 0; 668 m_View = 0;
661 669
662 m_selector = EXTENDED_ALL; 670 m_selector = EXTENDED_ALL;
663 initializeListView(); 671 initializeListView();
664 reparse(); 672 reparse();
665 } 673 }
666} 674}
667 675
668 676
669void OFileSelector::updateMimes() // lets check which mode is active 677void OFileSelector::updateMimes() // lets check which mode is active
670 // check the current dir for items then 678 // check the current dir for items then
671{ 679{
672 m_mimetypes.clear(); 680 if( m_autoMime ){
673 m_mimetypes.append("All" ); 681 m_mimetypes.clear();
674// if( m_selector == NORMAL ){ 682 m_mimetypes.append("All" );
675 DocLnkSet set; 683 if( m_selector == NORMAL ){
676 Global::findDocuments(&set, QString::null ); 684 DocLnkSet set;
677 QListIterator<DocLnk> dit( set.children() ); 685 Global::findDocuments(&set, QString::null );
678 for ( ; dit.current(); ++dit ) { 686 QListIterator<DocLnk> dit( set.children() );
679 if( !m_mimetypes.contains((*dit)->type() ) ) 687 for ( ; dit.current(); ++dit ) {
680 m_mimetypes.append( (*dit)->type() ); 688 if( !m_mimetypes.contains((*dit)->type() ) )
681 } 689 m_mimetypes.append( (*dit)->type() );
682// }else{ 690 }
683 // should be allreday updatet 691 }else{
684 // ; 692 // should be allreday updatet
685 // } 693 ;
694 }
695 }
686} 696}
687 697
688void OFileSelector::initializeListView() 698void OFileSelector::initializeListView()
689{ 699{
690 // in the instance that a developer selected the view to be Files or Entended, 700 // in the instance that a developer selected the view to be Files or Entended,
691 // in the initial initialization, you are deleting objects here 701 // in the initial initialization, you are deleting objects here
692 // that aren't even existing yet. 702 // that aren't even existing yet.
693 703
694 // just to make sure but clean it up better FIXME 704 // just to make sure but clean it up better FIXME
695 // if( m_View) delete m_View; 705 delete m_View;
696// m_View = 0; 706 m_View = 0;
697// if(m_boxToolbar) delete m_boxToolbar; 707 delete m_boxToolbar;
698// if(m_homeButton) delete m_homeButton; 708 delete m_homeButton;
699// if(m_docButton) delete m_docButton; 709 delete m_docButton;
700// if( m_location) delete m_location; 710 delete m_location;
701// if(m_up) delete m_up; 711 delete m_up;
702 //delete m_pseudo; 712 delete m_pseudo;
703 //if(m_pseudoLayout!=0 ) // why did you overload malloc 713
704 //delete m_pseudoLayout;
705 m_boxToolbar = 0; 714 m_boxToolbar = 0;
706 m_homeButton = 0; 715 m_homeButton = 0;
707 m_docButton = 0; 716 m_docButton = 0;
708 m_location = 0; 717 m_location = 0;
709 m_up = 0; 718 m_up = 0;
710 m_pseudo = 0; 719 m_pseudo = 0;
711 m_pseudoLayout = 0; 720 m_pseudoLayout = 0;
712 qDebug(" time for the toolbar "); 721 qDebug(" time for the toolbar ");
713 m_pseudo = new QWidget(m_stack, "Pseudo Widget"); 722 m_pseudo = new QWidget(m_stack, "Pseudo Widget");
714 m_pseudoLayout = new QVBoxLayout(m_pseudo ); 723 m_pseudoLayout = new QVBoxLayout(m_pseudo );
715 if(m_shTool ){ 724 if(m_shTool ){
716 m_boxToolbar = new QHBoxLayout( ); 725 m_boxToolbar = new QHBoxLayout( );
717 m_boxToolbar->setAutoAdd( true ); 726 m_boxToolbar->setAutoAdd( true );
718 m_location = new QComboBox(m_pseudo ); 727 m_location = new QComboBox(m_pseudo );
719 m_location ->setEditable(TRUE); 728 m_location ->setEditable(TRUE);
720 connect( m_location, SIGNAL(activated(const QString &) ), this, SLOT( locationComboActivated(const QString & ) ) ); 729 connect( m_location, SIGNAL(activated(const QString &) ), this, SLOT( locationComboActivated(const QString & ) ) );
721 connect( m_location->lineEdit(),SIGNAL(returnPressed()), this,SLOT( locationComboChanged())); 730 connect( m_location->lineEdit(),SIGNAL(returnPressed()), this,SLOT( locationComboChanged()));
722 731
723 m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton"); 732 m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton");
724 m_up->setFixedSize( QSize( 20, 20 ) ); 733 m_up->setFixedSize( QSize( 20, 20 ) );
725 connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); 734 connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) );
726 m_up->setFlat(TRUE); 735 m_up->setFlat(TRUE);
727 736
728 m_homeButton = new QPushButton(Resource::loadIconSet("home") , "", m_pseudo); 737 m_homeButton = new QPushButton(Resource::loadIconSet("home") , "", m_pseudo);
729 m_homeButton->setFixedSize( QSize( 20, 20 ) ); 738 m_homeButton->setFixedSize( QSize( 20, 20 ) );
730 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); 739 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) );
731 m_homeButton->setFlat(TRUE); 740 m_homeButton->setFlat(TRUE);
732 741
733 m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", m_pseudo,"docsButton"); 742 m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", m_pseudo,"docsButton");
734 m_docButton->setFixedSize( QSize( 20, 20 ) ); 743 m_docButton->setFixedSize( QSize( 20, 20 ) );
735 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); 744 connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) );
736 m_docButton->setFlat(TRUE); 745 m_docButton->setFlat(TRUE);