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 | |
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 | |||
@@ -88,3 +88,4 @@ OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString | |||
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() ) |
@@ -188,5 +189,4 @@ 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; |
@@ -194,3 +194,2 @@ void OFileSelector::init() | |||
194 | currMime = m_mimeCheck->currentText(); | 194 | currMime = m_mimeCheck->currentText(); |
195 | |||
196 | updateMimes(); | 195 | updateMimes(); |
@@ -202,6 +201,5 @@ void OFileSelector::init() | |||
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 ){ |
@@ -209,3 +207,2 @@ void OFileSelector::init() | |||
209 | } | 207 | } |
210 | |||
211 | if(m_shPerm ){ | 208 | if(m_shPerm ){ |
@@ -215,9 +212,9 @@ void OFileSelector::init() | |||
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 | ||
@@ -418,8 +415,6 @@ 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(); |
@@ -472,3 +467,3 @@ void OFileSelector::reparse() | |||
472 | dir.setFilter( filter ); | 467 | dir.setFilter( filter ); |
473 | 468 | qDebug("infoList"); | |
474 | const QFileInfoList *list = dir.entryInfoList(); | 469 | const QFileInfoList *list = dir.entryInfoList(); |
@@ -481,7 +476,7 @@ void OFileSelector::reparse() | |||
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 |
@@ -489,3 +484,3 @@ void OFileSelector::reparse() | |||
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 ); |
@@ -493,3 +488,3 @@ void OFileSelector::reparse() | |||
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 ); |
@@ -497,3 +492,3 @@ void OFileSelector::reparse() | |||
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 ); |
@@ -502,6 +497,6 @@ void OFileSelector::reparse() | |||
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 | } |
@@ -516,2 +511,3 @@ void OFileSelector::reparse() | |||
516 | m_View->sort(); | 511 | m_View->sort(); |
512 | // m_View->ensureItemVisible(); | ||
517 | } | 513 | } |
@@ -588,3 +584,3 @@ void OFileSelector::initializeChooser() | |||
588 | updateMimes(); | 584 | updateMimes(); |
589 | m_mimeCheck->insertStringList( m_mimetypes ); | 585 | m_mimeCheck->insertStringList( m_mimetypes ); |
590 | // } | 586 | // } |
@@ -648,3 +644,3 @@ void OFileSelector::slotViewCheck(const QString &view ){ | |||
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 |
@@ -655,10 +651,6 @@ void OFileSelector::slotViewCheck(const QString &view ){ | |||
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 |
@@ -672,3 +664,3 @@ void OFileSelector::slotViewCheck(const QString &view ){ | |||
672 | reparse(); | 664 | reparse(); |
673 | }; | 665 | } |
674 | } | 666 | } |
@@ -681,3 +673,3 @@ void OFileSelector::updateMimes() // lets check which mode is active | |||
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; |
@@ -689,6 +681,6 @@ void OFileSelector::updateMimes() // lets check which mode is active | |||
689 | } | 681 | } |
690 | }else{ | 682 | // }else{ |
691 | // should be allreday updatet | 683 | // should be allreday updatet |
692 | ; | 684 | // ; |
693 | } | 685 | // } |
694 | } | 686 | } |
@@ -696,11 +688,15 @@ void OFileSelector::updateMimes() // lets check which mode is active | |||
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; |
@@ -715,3 +711,3 @@ void OFileSelector::initializeListView() | |||
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"); |
@@ -722,3 +718,5 @@ void OFileSelector::initializeListView() | |||
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 | ||
@@ -744,3 +742,3 @@ void OFileSelector::initializeListView() | |||
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; |
@@ -757,2 +755,3 @@ void OFileSelector::initializeListView() | |||
757 | }; | 755 | }; |
756 | |||
758 | m_View = new QListView(m_pseudo, "Extended view" ); | 757 | m_View = new QListView(m_pseudo, "Extended view" ); |
@@ -785,2 +784,3 @@ void OFileSelector::initializeListView() | |||
785 | }; | 784 | }; |
785 | |||
786 | /* If a item is locked depends on the mode | 786 | /* If a item is locked depends on the mode |
@@ -794,5 +794,5 @@ void OFileSelector::initializeListView() | |||
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; |
@@ -903,3 +903,3 @@ void OFileSelector::slotCurrentChanged(QListViewItem *item ) | |||
903 | { | 903 | { |
904 | qWarning("current changed" ); | 904 | // qWarning("current changed" ); |
905 | if( item == 0 ) | 905 | if( item == 0 ) |
@@ -910,6 +910,6 @@ void OFileSelector::slotCurrentChanged(QListViewItem *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 | } |
@@ -930,5 +930,5 @@ void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint & | |||
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; |
@@ -939,3 +939,3 @@ void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint & | |||
939 | } else { | 939 | } else { |
940 | qWarning("file" ); | 940 | // qWarning("file" ); |
941 | if(m_shLne ) | 941 | if(m_shLne ) |
@@ -958,3 +958,3 @@ void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoin | |||
958 | return; | 958 | return; |
959 | qWarning("right button" ); | 959 | // qWarning("right button" ); |
960 | slotContextMenu(item); | 960 | slotContextMenu(item); |
@@ -964,3 +964,3 @@ 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 ) |
@@ -1016,3 +1016,3 @@ 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); |
@@ -1033,6 +1033,9 @@ 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(); |
@@ -1077,3 +1080,3 @@ 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(); |
@@ -1103,4 +1106,4 @@ void OFileSelector::cdUP() | |||
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 |
@@ -1110,11 +1113,2 @@ void OFileSelector::cdUP() | |||
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() |
@@ -1138 +1132,6 @@ void OFileSelector::locationComboActivated(const QString & file ) { | |||
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 | |||
@@ -194,3 +194,3 @@ class OFileSelector : public QWidget { | |||
194 | void insertLocationPath(const QString &, int); | 194 | void insertLocationPath(const QString &, int); |
195 | int indexFromString(const QString &); | 195 | void locationComboChanged(); |
196 | protected: | 196 | protected: |
@@ -213,3 +213,3 @@ class OFileSelector : public QWidget { | |||
213 | QString m_name; | 213 | QString m_name; |
214 | QStringList m_mimetypes; | 214 | QStringList m_mimetypes, requestedMimeTypesList; |
215 | 215 | ||