author | llornkcor <llornkcor> | 2002-04-24 12:24:16 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-24 12:24:16 (UTC) |
commit | 997b7685dcc48cc36737240ca53331f83b66dbeb (patch) (unidiff) | |
tree | 21148b19266eea39859646c249d0e04f3f40fd9a /libopie | |
parent | 8f67324fd1a60c165ae7043b9457f911b9690e43 (diff) | |
download | opie-997b7685dcc48cc36737240ca53331f83b66dbeb.zip opie-997b7685dcc48cc36737240ca53331f83b66dbeb.tar.gz opie-997b7685dcc48cc36737240ca53331f83b66dbeb.tar.bz2 |
fixed requested mimetype- for now.. still needs work
-rw-r--r-- | libopie/ofileselector.cc | 135 | ||||
-rw-r--r-- | libopie/ofileselector.h | 4 |
2 files changed, 69 insertions, 70 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc index d1f1e1f..ce66f51 100644 --- a/libopie/ofileselector.cc +++ b/libopie/ofileselector.cc | |||
@@ -86,7 +86,8 @@ OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString | |||
86 | m_selector = selector; | 86 | m_selector = selector; |
87 | m_currentDir = dirName; | 87 | m_currentDir = dirName; |
88 | m_name = fileName; | 88 | m_name = fileName; |
89 | m_mimetypes = mimetypes; | 89 | requestedMimeTypesList = m_mimetypes = mimetypes; |
90 | |||
90 | // if( mimetypes.isEmpty() ) | 91 | // if( mimetypes.isEmpty() ) |
91 | // m_autoMime = true; | 92 | // m_autoMime = true; |
92 | 93 | ||
@@ -186,13 +187,11 @@ void OFileSelector::delItems() | |||
186 | 187 | ||
187 | void OFileSelector::init() | 188 | void OFileSelector::init() |
188 | { | 189 | { |
189 | 190 | // qDebug("init"); | |
190 | m_stack = new QWidgetStack(this, "wstack" ); | 191 | m_stack = new QWidgetStack(this, "wstack" ); |
191 | if( m_selector == NORMAL ){ | ||
192 | QString currMime; | 192 | QString currMime; |
193 | if( m_mimeCheck != 0 ) | 193 | if( m_mimeCheck != 0 ) |
194 | currMime = m_mimeCheck->currentText(); | 194 | currMime = m_mimeCheck->currentText(); |
195 | |||
196 | updateMimes(); | 195 | updateMimes(); |
197 | m_select = new FileSelector( currMime == "All" ? QString::null : currMime , m_stack, "fileselector", FALSE, FALSE ); | 196 | m_select = new FileSelector( currMime == "All" ? QString::null : currMime , m_stack, "fileselector", FALSE, FALSE ); |
198 | m_stack->addWidget(m_select, NORMAL ); | 197 | m_stack->addWidget(m_select, NORMAL ); |
@@ -200,26 +199,24 @@ void OFileSelector::init() | |||
200 | m_stack->raiseWidget(NORMAL ); | 199 | m_stack->raiseWidget(NORMAL ); |
201 | connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); | 200 | connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); |
202 | m_pseudoLayout = 0l; | 201 | m_pseudoLayout = 0l; |
203 | }else { | 202 | if( m_selector != NORMAL ) { |
204 | initializeListView(); | 203 | initializeListView(); |
205 | } | 204 | } |
206 | |||
207 | if(m_shLne ){ | 205 | if(m_shLne ){ |
208 | initializeName(); | 206 | initializeName(); |
209 | } | 207 | } |
210 | |||
211 | if(m_shPerm ){ | 208 | if(m_shPerm ){ |
212 | m_checkPerm = new QCheckBox(tr("Set Permission"), this, "Permission" ); | 209 | m_checkPerm = new QCheckBox(tr("Set Permission"), this, "Permission" ); |
213 | m_checkPerm->setChecked( false ); | 210 | m_checkPerm->setChecked( false ); |
214 | m_lay->addWidget(m_checkPerm ); | 211 | m_lay->addWidget(m_checkPerm ); |
215 | } | 212 | } |
216 | |||
217 | if( m_shChooser ) | 213 | if( m_shChooser ) |
218 | initializeChooser(); | 214 | initializeChooser(); |
219 | |||
220 | if(m_shYesNo ) | 215 | if(m_shYesNo ) |
221 | initializeYes(); | 216 | initializeYes(); |
222 | 217 | ||
218 | m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, requestedMimeTypesList.first()) ); | ||
219 | reparse(); | ||
223 | 220 | ||
224 | } | 221 | } |
225 | 222 | ||
@@ -416,12 +413,10 @@ bool OFileSelector::compliesMime(const QString &path, const QString &mime ) | |||
416 | 413 | ||
417 | void OFileSelector::reparse() | 414 | void OFileSelector::reparse() |
418 | { | 415 | { |
416 | qDebug("reparse"); | ||
419 | if(m_View== 0 || m_selector == NORMAL) | 417 | if(m_View== 0 || m_selector == NORMAL) |
420 | return; | 418 | return; |
421 | |||
422 | m_View->clear(); | 419 | m_View->clear(); |
423 | |||
424 | |||
425 | QString currMime =m_mimeCheck->currentText(); | 420 | QString currMime =m_mimeCheck->currentText(); |
426 | // update the mimetype now | 421 | // update the mimetype now |
427 | if( m_autoMime ) { | 422 | if( m_autoMime ) { |
@@ -470,7 +465,7 @@ void OFileSelector::reparse() | |||
470 | else | 465 | else |
471 | filter = QDir::Files | QDir::Dirs | QDir::All; | 466 | filter = QDir::Files | QDir::Dirs | QDir::All; |
472 | dir.setFilter( filter ); | 467 | dir.setFilter( filter ); |
473 | 468 | qDebug("infoList"); | |
474 | const QFileInfoList *list = dir.entryInfoList(); | 469 | const QFileInfoList *list = dir.entryInfoList(); |
475 | QFileInfoListIterator it( *list ); | 470 | QFileInfoListIterator it( *list ); |
476 | QFileInfo *fi; | 471 | QFileInfo *fi; |
@@ -479,31 +474,31 @@ void OFileSelector::reparse() | |||
479 | ++it; | 474 | ++it; |
480 | continue; | 475 | continue; |
481 | } | 476 | } |
482 | qWarning("Test: %s", fi->fileName().latin1() ); | 477 | // qWarning("Test: %s", fi->fileName().latin1() ); |
483 | if(fi->isSymLink() ){ | 478 | if(fi->isSymLink() ){ |
484 | qWarning("Symlink %s", fi->fileName().latin1() ); | 479 | // qWarning("Symlink %s", fi->fileName().latin1() ); |
485 | QString file = fi->dirPath(true)+"/"+ fi->readLink(); | 480 | QString file = fi->dirPath(true)+"/"+ fi->readLink(); |
486 | qWarning("File ->%s", file.latin1() ); | 481 | // qWarning("File ->%s", file.latin1() ); |
487 | for(int i=0; i<=4; i++ ){ // prepend from dos | 482 | for(int i=0; i<=4; i++ ){ // prepend from dos |
488 | QFileInfo info( file ); | 483 | QFileInfo info( file ); |
489 | if( !info.exists() ){ | 484 | if( !info.exists() ){ |
490 | qWarning("does not exist" ); | 485 | // qWarning("does not exist" ); |
491 | addSymlink(currMime, fi, TRUE ); | 486 | addSymlink(currMime, fi, TRUE ); |
492 | break; | 487 | break; |
493 | }else if( info.isDir() ){ | 488 | }else if( info.isDir() ){ |
494 | qWarning("isDir" ); | 489 | // qWarning("isDir" ); |
495 | addDir(currMime, fi, TRUE ); | 490 | addDir(currMime, fi, TRUE ); |
496 | break; | 491 | break; |
497 | }else if( info.isFile() ){ | 492 | }else if( info.isFile() ){ |
498 | qWarning("isFile" ); | 493 | // qWarning("isFile" ); |
499 | addFile(currMime, fi, TRUE ); | 494 | addFile(currMime, fi, TRUE ); |
500 | break; | 495 | break; |
501 | }else if( info.isSymLink() ){ | 496 | }else if( info.isSymLink() ){ |
502 | file = info.dirPath(true)+ "/"+ info.readLink(); | 497 | file = info.dirPath(true)+ "/"+ info.readLink(); |
503 | qWarning("isSymlink again %s", file.latin1() ); | 498 | // qWarning("isSymlink again %s", file.latin1() ); |
504 | }else if( i == 4 ){ // just insert it and have the symlink symbol | 499 | }else if( i == 4 ){ // just insert it and have the symlink symbol |
505 | addSymlink(currMime, fi ); | 500 | addSymlink(currMime, fi ); |
506 | qWarning("level too deep" ); | 501 | // qWarning("level too deep" ); |
507 | } | 502 | } |
508 | } | 503 | } |
509 | }else if( fi->isDir() ){ | 504 | }else if( fi->isDir() ){ |
@@ -514,6 +509,7 @@ void OFileSelector::reparse() | |||
514 | ++it; | 509 | ++it; |
515 | } | 510 | } |
516 | m_View->sort(); | 511 | m_View->sort(); |
512 | // m_View->ensureItemVisible(); | ||
517 | } | 513 | } |
518 | 514 | ||
519 | QString OFileSelector::directory()const | 515 | QString OFileSelector::directory()const |
@@ -586,7 +582,7 @@ void OFileSelector::initializeChooser() | |||
586 | // m_mimeCheck->insertItem(m_mimetypes.join("," ) ); | 582 | // m_mimeCheck->insertItem(m_mimetypes.join("," ) ); |
587 | // else{ // check | 583 | // else{ // check |
588 | updateMimes(); | 584 | updateMimes(); |
589 | m_mimeCheck->insertStringList( m_mimetypes ); | 585 | m_mimeCheck->insertStringList( m_mimetypes ); |
590 | // } | 586 | // } |
591 | 587 | ||
592 | connect( m_viewCheck, SIGNAL(activated(const QString &) ), | 588 | connect( m_viewCheck, SIGNAL(activated(const QString &) ), |
@@ -646,21 +642,17 @@ void OFileSelector::slotViewCheck(const QString &view ){ | |||
646 | m_stack->raiseWidget( NORMAL ); | 642 | m_stack->raiseWidget( NORMAL ); |
647 | connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); | 643 | connect(m_select, SIGNAL(fileSelected( const DocLnk &) ), this, SLOT(slotFileBridgeSelected(const DocLnk &) ) ); |
648 | 644 | ||
649 | }else if(view == QString::fromLatin1("Files") ){ | 645 | } else if(view == QString::fromLatin1("Files") ){ |
650 | // remove from the stack | 646 | // remove from the stack |
651 | delete m_select; | 647 | delete m_select; |
652 | m_select = 0; | 648 | m_select = 0; |
653 | delete m_View; | 649 | delete m_View; |
654 | m_View = 0; | 650 | m_View = 0; |
655 | 651 | ||
656 | |||
657 | |||
658 | m_selector = EXTENDED; | 652 | m_selector = EXTENDED; |
659 | // create the ListView or IconView | ||
660 | initializeListView(); | 653 | initializeListView(); |
661 | |||
662 | reparse(); | 654 | reparse(); |
663 | }else if(view == QString::fromLatin1("All Files") ) { | 655 | } else if(view == QString::fromLatin1("All Files") ) { |
664 | // remove from the stack | 656 | // remove from the stack |
665 | delete m_select; | 657 | delete m_select; |
666 | m_select = 0; | 658 | m_select = 0; |
@@ -670,7 +662,7 @@ void OFileSelector::slotViewCheck(const QString &view ){ | |||
670 | m_selector = EXTENDED_ALL; | 662 | m_selector = EXTENDED_ALL; |
671 | initializeListView(); | 663 | initializeListView(); |
672 | reparse(); | 664 | reparse(); |
673 | }; | 665 | } |
674 | } | 666 | } |
675 | 667 | ||
676 | 668 | ||
@@ -679,7 +671,7 @@ void OFileSelector::updateMimes() // lets check which mode is active | |||
679 | { | 671 | { |
680 | m_mimetypes.clear(); | 672 | m_mimetypes.clear(); |
681 | m_mimetypes.append("All" ); | 673 | m_mimetypes.append("All" ); |
682 | if( m_selector == NORMAL ){ | 674 | // if( m_selector == NORMAL ){ |
683 | DocLnkSet set; | 675 | DocLnkSet set; |
684 | Global::findDocuments(&set, QString::null ); | 676 | Global::findDocuments(&set, QString::null ); |
685 | QListIterator<DocLnk> dit( set.children() ); | 677 | QListIterator<DocLnk> dit( set.children() ); |
@@ -687,22 +679,26 @@ void OFileSelector::updateMimes() // lets check which mode is active | |||
687 | if( !m_mimetypes.contains((*dit)->type() ) ) | 679 | if( !m_mimetypes.contains((*dit)->type() ) ) |
688 | m_mimetypes.append( (*dit)->type() ); | 680 | m_mimetypes.append( (*dit)->type() ); |
689 | } | 681 | } |
690 | }else{ | 682 | // }else{ |
691 | // should be allreday updatet | 683 | // should be allreday updatet |
692 | ; | 684 | // ; |
693 | } | 685 | // } |
694 | } | 686 | } |
695 | 687 | ||
696 | void OFileSelector::initializeListView() | 688 | void OFileSelector::initializeListView() |
697 | { | 689 | { |
690 | // in the instance that a developer selected the view to be Files or Entended, | ||
691 | // in the initial initialization, you are deleting objects here | ||
692 | // that aren't even existing yet. | ||
693 | |||
698 | // just to make sure but clean it up better FIXME | 694 | // just to make sure but clean it up better FIXME |
699 | delete m_View; | 695 | // if( m_View) delete m_View; |
700 | m_View = 0; | 696 | // m_View = 0; |
701 | delete m_boxToolbar; | 697 | // if(m_boxToolbar) delete m_boxToolbar; |
702 | delete m_homeButton; | 698 | // if(m_homeButton) delete m_homeButton; |
703 | delete m_docButton; | 699 | // if(m_docButton) delete m_docButton; |
704 | delete m_location; | 700 | // if( m_location) delete m_location; |
705 | delete m_up; | 701 | // if(m_up) delete m_up; |
706 | //delete m_pseudo; | 702 | //delete m_pseudo; |
707 | //if(m_pseudoLayout!=0 ) // why did you overload malloc | 703 | //if(m_pseudoLayout!=0 ) // why did you overload malloc |
708 | //delete m_pseudoLayout; | 704 | //delete m_pseudoLayout; |
@@ -713,14 +709,16 @@ void OFileSelector::initializeListView() | |||
713 | m_up = 0; | 709 | m_up = 0; |
714 | m_pseudo = 0; | 710 | m_pseudo = 0; |
715 | m_pseudoLayout = 0; | 711 | m_pseudoLayout = 0; |
716 | // time for the toolbar | 712 | qDebug(" time for the toolbar "); |
717 | m_pseudo = new QWidget(m_stack, "Pseudo Widget"); | 713 | m_pseudo = new QWidget(m_stack, "Pseudo Widget"); |
718 | m_pseudoLayout = new QVBoxLayout(m_pseudo ); | 714 | m_pseudoLayout = new QVBoxLayout(m_pseudo ); |
719 | if(m_shTool ){ | 715 | if(m_shTool ){ |
720 | m_boxToolbar = new QHBoxLayout( ); | 716 | m_boxToolbar = new QHBoxLayout( ); |
721 | m_boxToolbar->setAutoAdd( true ); | 717 | m_boxToolbar->setAutoAdd( true ); |
722 | m_location = new QComboBox(m_pseudo ); | 718 | m_location = new QComboBox(m_pseudo ); |
719 | m_location ->setEditable(TRUE); | ||
723 | connect( m_location, SIGNAL(activated(const QString &) ), this, SLOT( locationComboActivated(const QString & ) ) ); | 720 | connect( m_location, SIGNAL(activated(const QString &) ), this, SLOT( locationComboActivated(const QString & ) ) ); |
721 | connect( m_location->lineEdit(),SIGNAL(returnPressed()), this,SLOT( locationComboChanged())); | ||
724 | 722 | ||
725 | m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton"); | 723 | m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton"); |
726 | m_up->setFixedSize( QSize( 20, 20 ) ); | 724 | m_up->setFixedSize( QSize( 20, 20 ) ); |
@@ -742,7 +740,7 @@ void OFileSelector::initializeListView() | |||
742 | m_boxToolbar->addWidget(m_homeButton ); | 740 | m_boxToolbar->addWidget(m_homeButton ); |
743 | m_boxToolbar->addWidget(m_docButton ); | 741 | m_boxToolbar->addWidget(m_docButton ); |
744 | m_pseudoLayout->addLayout(m_boxToolbar ); | 742 | m_pseudoLayout->addLayout(m_boxToolbar ); |
745 | // lets fill the combobox | 743 | qDebug("lets fill the combobox"); |
746 | StorageInfo storage; | 744 | StorageInfo storage; |
747 | const QList<FileSystem> &fs = storage.fileSystems(); | 745 | const QList<FileSystem> &fs = storage.fileSystems(); |
748 | QListIterator<FileSystem> it ( fs ); | 746 | QListIterator<FileSystem> it ( fs ); |
@@ -755,6 +753,7 @@ void OFileSelector::initializeListView() | |||
755 | m_location->insertItem(m_currentDir ); | 753 | m_location->insertItem(m_currentDir ); |
756 | m_location->setCurrentItem( count ); | 754 | m_location->setCurrentItem( count ); |
757 | }; | 755 | }; |
756 | |||
758 | m_View = new QListView(m_pseudo, "Extended view" ); | 757 | m_View = new QListView(m_pseudo, "Extended view" ); |
759 | m_stack->addWidget( m_pseudo, EXTENDED ); | 758 | m_stack->addWidget( m_pseudo, EXTENDED ); |
760 | m_stack->raiseWidget( EXTENDED ); | 759 | m_stack->raiseWidget( EXTENDED ); |
@@ -783,6 +782,7 @@ void OFileSelector::initializeListView() | |||
783 | 782 | ||
784 | 783 | ||
785 | }; | 784 | }; |
785 | |||
786 | /* If a item is locked depends on the mode | 786 | /* If a item is locked depends on the mode |
787 | if we're in OPEN !isReadable is locked | 787 | if we're in OPEN !isReadable is locked |
788 | if we're in SAVE !isWriteable is locked | 788 | if we're in SAVE !isWriteable is locked |
@@ -792,9 +792,9 @@ void OFileSelector::initializeListView() | |||
792 | 792 | ||
793 | 793 | ||
794 | void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink ){ | 794 | void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink ){ |
795 | qWarning("Add Files" ); | 795 | // qWarning("Add Files" ); |
796 | if( !m_files ){ | 796 | if( !m_files ){ |
797 | qWarning("not mfiles" ); | 797 | // qWarning("not mfiles" ); |
798 | return; | 798 | return; |
799 | } | 799 | } |
800 | 800 | ||
@@ -901,17 +901,17 @@ void OFileSelector::slotSelectionChanged() // get the current items | |||
901 | 901 | ||
902 | void OFileSelector::slotCurrentChanged(QListViewItem *item ) | 902 | void OFileSelector::slotCurrentChanged(QListViewItem *item ) |
903 | { | 903 | { |
904 | qWarning("current changed" ); | 904 | // qWarning("current changed" ); |
905 | if( item == 0 ) | 905 | if( item == 0 ) |
906 | return; | 906 | return; |
907 | 907 | ||
908 | if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ | 908 | if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ |
909 | OFileSelectorItem *sel = (OFileSelectorItem*)item; | 909 | OFileSelectorItem *sel = (OFileSelectorItem*)item; |
910 | if(!sel->isDir() ){ | 910 | if(!sel->isDir() ){ |
911 | qWarning("is not dir" ); | 911 | // qWarning("is not dir" ); |
912 | if(m_shLne ){ | 912 | if(m_shLne ){ |
913 | m_edit->setText(sel->text(1) ); | 913 | m_edit->setText(sel->text(1) ); |
914 | qWarning("setTexy" ); | 914 | // qWarning("setTexy" ); |
915 | } | 915 | } |
916 | } | 916 | } |
917 | }else { | 917 | }else { |
@@ -928,16 +928,16 @@ void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint & | |||
928 | if( button != Qt::LeftButton ) | 928 | if( button != Qt::LeftButton ) |
929 | return; | 929 | return; |
930 | 930 | ||
931 | qWarning("clicked" ); | 931 | // qWarning("clicked" ); |
932 | if(m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ | 932 | if(m_selector == EXTENDED || m_selector == EXTENDED_ALL ){ |
933 | qWarning("inside" ); | 933 | // qWarning("inside" ); |
934 | OFileSelectorItem *sel = (OFileSelectorItem*)item; | 934 | OFileSelectorItem *sel = (OFileSelectorItem*)item; |
935 | if(!sel->isLocked() ){ // not locked either changedir or open | 935 | if(!sel->isLocked() ){ // not locked either changedir or open |
936 | QStringList str = QStringList::split("->", sel->text(1) ); | 936 | QStringList str = QStringList::split("->", sel->text(1) ); |
937 | if(sel->isDir() ){ | 937 | if(sel->isDir() ){ |
938 | cd( sel->directory() + "/" + str[0] ); | 938 | cd( sel->directory() + "/" + str[0] ); |
939 | } else { | 939 | } else { |
940 | qWarning("file" ); | 940 | // qWarning("file" ); |
941 | if(m_shLne ) | 941 | if(m_shLne ) |
942 | m_edit->setText(str[0] ); | 942 | m_edit->setText(str[0] ); |
943 | emit fileSelected(str[0] ); | 943 | emit fileSelected(str[0] ); |
@@ -956,13 +956,13 @@ void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoin | |||
956 | 956 | ||
957 | if( button != Qt::RightButton ) | 957 | if( button != Qt::RightButton ) |
958 | return; | 958 | return; |
959 | qWarning("right button" ); | 959 | // qWarning("right button" ); |
960 | slotContextMenu(item); | 960 | slotContextMenu(item); |
961 | } | 961 | } |
962 | 962 | ||
963 | void OFileSelector::slotContextMenu(QListViewItem *item) | 963 | void OFileSelector::slotContextMenu(QListViewItem *item) |
964 | { | 964 | { |
965 | qWarning("context menu" ); | 965 | // qWarning("context menu" ); |
966 | if( item ==0 || !m_showPopup ) | 966 | if( item ==0 || !m_showPopup ) |
967 | return; | 967 | return; |
968 | 968 | ||
@@ -1014,7 +1014,7 @@ void OFileSelector::slotContextMenu(QListViewItem *item) | |||
1014 | 1014 | ||
1015 | bool OFileSelector::cd(const QString &str ) | 1015 | bool OFileSelector::cd(const QString &str ) |
1016 | { | 1016 | { |
1017 | qWarning(" dir %s", str.latin1() ); | 1017 | // qWarning(" dir %s", str.latin1() ); |
1018 | QDir dir( str); | 1018 | QDir dir( str); |
1019 | if(dir.exists() ){ | 1019 | if(dir.exists() ){ |
1020 | m_currentDir = dir.absPath(); | 1020 | m_currentDir = dir.absPath(); |
@@ -1031,10 +1031,13 @@ bool OFileSelector::cd(const QString &str ) | |||
1031 | 1031 | ||
1032 | void OFileSelector::insertLocationPath(const QString ¤tPath, int count) { | 1032 | void OFileSelector::insertLocationPath(const QString ¤tPath, int count) { |
1033 | QStringList pathList; | 1033 | QStringList pathList; |
1034 | bool underDog = FALSE; | ||
1034 | for(int i=0;i<count;i++) { | 1035 | for(int i=0;i<count;i++) { |
1035 | pathList << m_location->text(i); | 1036 | pathList << m_location->text(i); |
1037 | if( m_location->text(i) == currentPath) | ||
1038 | underDog = TRUE; | ||
1036 | } | 1039 | } |
1037 | if( pathList.grep( currentPath,TRUE).isEmpty() ) { | 1040 | if( !underDog) { |
1038 | m_location->clear(); | 1041 | m_location->clear(); |
1039 | if( currentPath.left(2)=="//") | 1042 | if( currentPath.left(2)=="//") |
1040 | pathList.append( currentPath.right(currentPath.length()-1) ); | 1043 | pathList.append( currentPath.right(currentPath.length()-1) ); |
@@ -1075,7 +1078,7 @@ void OFileSelector::slotRename() | |||
1075 | 1078 | ||
1076 | void OFileSelector::slotDelete() | 1079 | void OFileSelector::slotDelete() |
1077 | { | 1080 | { |
1078 | qWarning("delete slot" ); | 1081 | // qWarning("delete slot" ); |
1079 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); | 1082 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); |
1080 | QStringList list = QStringList::split("->", sel->text(1) ); | 1083 | QStringList list = QStringList::split("->", sel->text(1) ); |
1081 | if( sel->isDir() ){ | 1084 | if( sel->isDir() ){ |
@@ -1101,22 +1104,13 @@ void OFileSelector::cdUP() | |||
1101 | m_currentDir = dir.absPath(); | 1104 | m_currentDir = dir.absPath(); |
1102 | reparse(); | 1105 | reparse(); |
1103 | int count = m_location->count(); | 1106 | int count = m_location->count(); |
1104 | insertLocationPath( m_currentDir,count ); | 1107 | insertLocationPath( m_currentDir, count); |
1105 | m_location->setCurrentItem( indexFromString(m_currentDir )); | 1108 | m_location->setCurrentItem( indexByString( m_location, m_currentDir)); |
1106 | //this wont work in all instances | 1109 | //this wont work in all instances |
1107 | // FIXME | 1110 | // FIXME |
1108 | } | 1111 | } |
1109 | } | 1112 | } |
1110 | 1113 | ||
1111 | int OFileSelector::indexFromString(const QString &str) { | ||
1112 | |||
1113 | for(int i=0;i< m_location->count();i++) { | ||
1114 | if(str == m_location->text(i)) | ||
1115 | return i; | ||
1116 | } | ||
1117 | return 0; | ||
1118 | } | ||
1119 | |||
1120 | void OFileSelector::slotHome() | 1114 | void OFileSelector::slotHome() |
1121 | { | 1115 | { |
1122 | cd(QDir::homeDirPath() ); | 1116 | cd(QDir::homeDirPath() ); |
@@ -1136,3 +1130,8 @@ void OFileSelector::locationComboActivated(const QString & file ) { | |||
1136 | cd(file.left(file.find("<-",0,TRUE))); | 1130 | cd(file.left(file.find("<-",0,TRUE))); |
1137 | reparse(); | 1131 | reparse(); |
1138 | } | 1132 | } |
1133 | |||
1134 | void OFileSelector::locationComboChanged() { | ||
1135 | cd( m_location->lineEdit()->text()); | ||
1136 | reparse(); | ||
1137 | } | ||
diff --git a/libopie/ofileselector.h b/libopie/ofileselector.h index 81a9e63..babe09f 100644 --- a/libopie/ofileselector.h +++ b/libopie/ofileselector.h | |||
@@ -192,7 +192,7 @@ class OFileSelector : public QWidget { | |||
192 | void slotMimeCheck(const QString & ); | 192 | void slotMimeCheck(const QString & ); |
193 | void locationComboActivated(const QString & ); | 193 | void locationComboActivated(const QString & ); |
194 | void insertLocationPath(const QString &, int); | 194 | void insertLocationPath(const QString &, int); |
195 | int indexFromString(const QString &); | 195 | void locationComboChanged(); |
196 | protected: | 196 | protected: |
197 | void init(); | 197 | void init(); |
198 | void updateMimes(); | 198 | void updateMimes(); |
@@ -211,7 +211,7 @@ class OFileSelector : public QWidget { | |||
211 | 211 | ||
212 | QString m_currentDir; | 212 | QString m_currentDir; |
213 | QString m_name; | 213 | QString m_name; |
214 | QStringList m_mimetypes; | 214 | QStringList m_mimetypes, requestedMimeTypesList; |
215 | 215 | ||
216 | FileSelector *m_select; | 216 | FileSelector *m_select; |
217 | QWidgetStack *m_stack; | 217 | QWidgetStack *m_stack; |