author | llornkcor <llornkcor> | 2002-04-24 03:22:24 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-24 03:22:24 (UTC) |
commit | 219994e9d1de70b44c994ccee57060741f22d428 (patch) (unidiff) | |
tree | 2acfcae2a6bfc432266ee1d0cb76285a95fe683f | |
parent | c9159a3d5192799f5b2911d13337f04f50b1ac5a (diff) | |
download | opie-219994e9d1de70b44c994ccee57060741f22d428.zip opie-219994e9d1de70b44c994ccee57060741f22d428.tar.gz opie-219994e9d1de70b44c994ccee57060741f22d428.tar.bz2 |
fixed location combo showing redundant directories and multiple seperators
-rw-r--r-- | libopie/ofileselector.cc | 123 | ||||
-rw-r--r-- | libopie/ofileselector.h | 15 |
2 files changed, 111 insertions, 27 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc index cb18039..d1f1e1f 100644 --- a/libopie/ofileselector.cc +++ b/libopie/ofileselector.cc | |||
@@ -42,6 +42,8 @@ | |||
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> | ||
46 | #include <qmessagebox.h> | ||
45 | 47 | ||
46 | #include <qpe/qpeapplication.h> | 48 | #include <qpe/qpeapplication.h> |
47 | #include <qpe/fileselector.h> | 49 | #include <qpe/fileselector.h> |
@@ -134,6 +136,7 @@ OFileSelector::OFileSelector(QWidget *wid, int mode, int selector, const QString | |||
134 | init(); | 136 | init(); |
135 | m_edit->setText( fileName ); | 137 | m_edit->setText( fileName ); |
136 | } | 138 | } |
139 | |||
137 | void OFileSelector::initPics() | 140 | void OFileSelector::initPics() |
138 | { | 141 | { |
139 | qWarning("init pics" ); | 142 | qWarning("init pics" ); |
@@ -151,7 +154,8 @@ void OFileSelector::initPics() | |||
151 | pm2.setMask( pm2.createHeuristicMask( FALSE ) ); | 154 | pm2.setMask( pm2.createHeuristicMask( FALSE ) ); |
152 | m_pixmaps->insert("symlinkedlocked", pm2 ); | 155 | m_pixmaps->insert("symlinkedlocked", pm2 ); |
153 | 156 | ||
154 | }; | 157 | } |
158 | |||
155 | // let's initialize the gui | 159 | // let's initialize the gui |
156 | /** | 160 | /** |
157 | -------------------- | 161 | -------------------- |
@@ -179,6 +183,7 @@ void OFileSelector::delItems() | |||
179 | it.deleteCurrent(); | 183 | it.deleteCurrent(); |
180 | } | 184 | } |
181 | } | 185 | } |
186 | |||
182 | void OFileSelector::init() | 187 | void OFileSelector::init() |
183 | { | 188 | { |
184 | 189 | ||
@@ -216,7 +221,7 @@ void OFileSelector::init() | |||
216 | initializeYes(); | 221 | initializeYes(); |
217 | 222 | ||
218 | 223 | ||
219 | }; | 224 | } |
220 | 225 | ||
221 | void OFileSelector::setYesCancelVisible( bool show ) | 226 | void OFileSelector::setYesCancelVisible( bool show ) |
222 | { | 227 | { |
@@ -261,6 +266,7 @@ void OFileSelector::setPermissionBarVisible( bool show ) | |||
261 | 266 | ||
262 | updateLay(); | 267 | updateLay(); |
263 | } | 268 | } |
269 | |||
264 | void OFileSelector::setLineEditVisible( bool show ) | 270 | void OFileSelector::setLineEditVisible( bool show ) |
265 | { | 271 | { |
266 | if( show == m_shLne ) | 272 | if( show == m_shLne ) |
@@ -276,6 +282,7 @@ void OFileSelector::setLineEditVisible( bool show ) | |||
276 | } | 282 | } |
277 | updateLay(); | 283 | updateLay(); |
278 | } | 284 | } |
285 | |||
279 | void OFileSelector::setChooserVisible( bool show ) | 286 | void OFileSelector::setChooserVisible( bool show ) |
280 | { | 287 | { |
281 | if( show = m_shChooser ) | 288 | if( show = m_shChooser ) |
@@ -289,24 +296,29 @@ void OFileSelector::setChooserVisible( bool show ) | |||
289 | } | 296 | } |
290 | updateLay(); | 297 | updateLay(); |
291 | } | 298 | } |
299 | |||
292 | QCheckBox* OFileSelector::permissionCheckbox( ) | 300 | QCheckBox* OFileSelector::permissionCheckbox( ) |
293 | { | 301 | { |
294 | return m_checkPerm; | 302 | return m_checkPerm; |
295 | } | 303 | } |
304 | |||
296 | void OFileSelector::setCaseSensetive( bool caSe ) | 305 | void OFileSelector::setCaseSensetive( bool caSe ) |
297 | { | 306 | { |
298 | m_case = caSe; | 307 | m_case = caSe; |
299 | reparse(); | 308 | reparse(); |
300 | } | 309 | } |
310 | |||
301 | void OFileSelector::setShowFiles(bool files ){ | 311 | void OFileSelector::setShowFiles(bool files ){ |
302 | m_files = files; | 312 | m_files = files; |
303 | reparse(); | 313 | reparse(); |
304 | } | 314 | } |
315 | |||
305 | void OFileSelector::setPopupMenu(QPopupMenu *pop ) | 316 | void OFileSelector::setPopupMenu(QPopupMenu *pop ) |
306 | { | 317 | { |
307 | //delete oldpopup; | 318 | //delete oldpopup; |
308 | m_custom = pop; | 319 | m_custom = pop; |
309 | } | 320 | } |
321 | |||
310 | bool OFileSelector::setPermission( ) const | 322 | bool OFileSelector::setPermission( ) const |
311 | { | 323 | { |
312 | if( m_checkPerm == 0 ) | 324 | if( m_checkPerm == 0 ) |
@@ -314,12 +326,14 @@ bool OFileSelector::setPermission( ) const | |||
314 | else | 326 | else |
315 | return m_checkPerm->isChecked(); | 327 | return m_checkPerm->isChecked(); |
316 | } | 328 | } |
329 | |||
317 | void OFileSelector::setPermissionChecked( bool check ) | 330 | void OFileSelector::setPermissionChecked( bool check ) |
318 | { | 331 | { |
319 | if( m_checkPerm == 0 ) | 332 | if( m_checkPerm == 0 ) |
320 | return; | 333 | return; |
321 | m_checkPerm->setChecked( check ); | 334 | m_checkPerm->setChecked( check ); |
322 | } | 335 | } |
336 | |||
323 | QString OFileSelector::selectedName( )const | 337 | QString OFileSelector::selectedName( )const |
324 | { | 338 | { |
325 | QString string; | 339 | QString string; |
@@ -334,11 +348,13 @@ QString OFileSelector::selectedName( )const | |||
334 | } | 348 | } |
335 | return string; | 349 | return string; |
336 | } | 350 | } |
351 | |||
337 | QStringList OFileSelector::selectedNames()const | 352 | QStringList OFileSelector::selectedNames()const |
338 | { | 353 | { |
339 | QStringList list; | 354 | QStringList list; |
340 | return list; | 355 | return list; |
341 | } | 356 | } |
357 | |||
342 | DocLnk OFileSelector::selectedDocument( )const | 358 | DocLnk OFileSelector::selectedDocument( )const |
343 | { | 359 | { |
344 | DocLnk lnk; | 360 | DocLnk lnk; |
@@ -385,6 +401,7 @@ void OFileSelector::updateLay() | |||
385 | if( m_shPerm ) | 401 | if( m_shPerm ) |
386 | m_checkPerm->setChecked(check ); | 402 | m_checkPerm->setChecked(check ); |
387 | } | 403 | } |
404 | |||
388 | // let's update the mimetypes. Use the current mimefilter for the 2nd QDir retrieve | 405 | // let's update the mimetypes. Use the current mimefilter for the 2nd QDir retrieve |
389 | // insert QListViewItems with the right options | 406 | // insert QListViewItems with the right options |
390 | bool OFileSelector::compliesMime(const QString &path, const QString &mime ) | 407 | bool OFileSelector::compliesMime(const QString &path, const QString &mime ) |
@@ -432,6 +449,7 @@ void OFileSelector::reparse() | |||
432 | // set it to the current mimetype | 449 | // set it to the current mimetype |
433 | m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currMime ) ); | 450 | m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currMime ) ); |
434 | }; | 451 | }; |
452 | |||
435 | QDir dir( m_currentDir ); | 453 | QDir dir( m_currentDir ); |
436 | //dir.setFilter(-1 ); | 454 | //dir.setFilter(-1 ); |
437 | int sort = QDir::Name | QDir::DirsFirst | QDir::Reversed; | 455 | int sort = QDir::Name | QDir::DirsFirst | QDir::Reversed; |
@@ -497,18 +515,23 @@ void OFileSelector::reparse() | |||
497 | } | 515 | } |
498 | m_View->sort(); | 516 | m_View->sort(); |
499 | } | 517 | } |
518 | |||
500 | QString OFileSelector::directory()const | 519 | QString OFileSelector::directory()const |
501 | { | 520 | { |
502 | return m_currentDir; | 521 | QDir d( m_currentDir); |
522 | return d.absPath(); | ||
503 | } | 523 | } |
524 | |||
504 | int OFileSelector::fileCount() | 525 | int OFileSelector::fileCount() |
505 | { | 526 | { |
506 | return 0; | 527 | return 0; |
507 | } | 528 | } |
529 | |||
508 | void OFileSelector::slotOk( ) | 530 | void OFileSelector::slotOk( ) |
509 | { | 531 | { |
510 | emit ok(); | 532 | emit ok(); |
511 | } | 533 | } |
534 | |||
512 | void OFileSelector::slotCancel( ) | 535 | void OFileSelector::slotCancel( ) |
513 | { | 536 | { |
514 | emit cancel(); | 537 | emit cancel(); |
@@ -526,6 +549,7 @@ void OFileSelector::initializeName() | |||
526 | 549 | ||
527 | m_lay->addLayout(m_boxName); | 550 | m_lay->addLayout(m_boxName); |
528 | } | 551 | } |
552 | |||
529 | void OFileSelector::initializeYes() | 553 | void OFileSelector::initializeYes() |
530 | { | 554 | { |
531 | m_ok = new QPushButton("&Save", this, "save" ); | 555 | m_ok = new QPushButton("&Save", this, "save" ); |
@@ -541,6 +565,7 @@ void OFileSelector::initializeYes() | |||
541 | this, SLOT(slotCancel() ) ); | 565 | this, SLOT(slotCancel() ) ); |
542 | 566 | ||
543 | } | 567 | } |
568 | |||
544 | void OFileSelector::initializeChooser() | 569 | void OFileSelector::initializeChooser() |
545 | { | 570 | { |
546 | m_boxView = new QHBoxLayout(this ); | 571 | m_boxView = new QHBoxLayout(this ); |
@@ -570,6 +595,7 @@ void OFileSelector::initializeChooser() | |||
570 | connect( m_mimeCheck, SIGNAL(activated(const QString &) ), | 595 | connect( m_mimeCheck, SIGNAL(activated(const QString &) ), |
571 | this, SLOT(slotMimeCheck(const QString & ) ) ); | 596 | this, SLOT(slotMimeCheck(const QString & ) ) ); |
572 | } | 597 | } |
598 | |||
573 | void OFileSelector::slotMimeCheck(const QString &view ){ | 599 | void OFileSelector::slotMimeCheck(const QString &view ){ |
574 | if(m_selector == NORMAL ){ | 600 | if(m_selector == NORMAL ){ |
575 | delete m_select; | 601 | delete m_select; |
@@ -645,7 +671,7 @@ void OFileSelector::slotViewCheck(const QString &view ){ | |||
645 | initializeListView(); | 671 | initializeListView(); |
646 | reparse(); | 672 | reparse(); |
647 | }; | 673 | }; |
648 | }; | 674 | } |
649 | 675 | ||
650 | 676 | ||
651 | void OFileSelector::updateMimes() // lets check which mode is active | 677 | void OFileSelector::updateMimes() // lets check which mode is active |
@@ -665,7 +691,8 @@ void OFileSelector::updateMimes() // lets check which mode is active | |||
665 | // should be allreday updatet | 691 | // should be allreday updatet |
666 | ; | 692 | ; |
667 | } | 693 | } |
668 | }; | 694 | } |
695 | |||
669 | void OFileSelector::initializeListView() | 696 | void OFileSelector::initializeListView() |
670 | { | 697 | { |
671 | // just to make sure but clean it up better FIXME | 698 | // just to make sure but clean it up better FIXME |
@@ -693,6 +720,7 @@ void OFileSelector::initializeListView() | |||
693 | m_boxToolbar = new QHBoxLayout( ); | 720 | m_boxToolbar = new QHBoxLayout( ); |
694 | m_boxToolbar->setAutoAdd( true ); | 721 | m_boxToolbar->setAutoAdd( true ); |
695 | m_location = new QComboBox(m_pseudo ); | 722 | m_location = new QComboBox(m_pseudo ); |
723 | connect( m_location, SIGNAL(activated(const QString &) ), this, SLOT( locationComboActivated(const QString & ) ) ); | ||
696 | 724 | ||
697 | m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton"); | 725 | m_up = new QPushButton(Resource::loadIconSet("up"),"", m_pseudo,"cdUpButton"); |
698 | m_up->setFixedSize( QSize( 20, 20 ) ); | 726 | m_up->setFixedSize( QSize( 20, 20 ) ); |
@@ -805,6 +833,7 @@ void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink ) | |||
805 | QString::number( info->size() ), | 833 | QString::number( info->size() ), |
806 | dir, locked ); | 834 | dir, locked ); |
807 | } | 835 | } |
836 | |||
808 | void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink ) | 837 | void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink ) |
809 | { | 838 | { |
810 | if(!m_dir ) | 839 | if(!m_dir ) |
@@ -842,6 +871,7 @@ void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink ) | |||
842 | 871 | ||
843 | } | 872 | } |
844 | } | 873 | } |
874 | |||
845 | void OFileSelector::setShowDirs(bool dir ) | 875 | void OFileSelector::setShowDirs(bool dir ) |
846 | { | 876 | { |
847 | m_dir = dir; | 877 | m_dir = dir; |
@@ -856,16 +886,19 @@ void OFileSelector::slotFileSelected(const QString &string ) | |||
856 | emit fileSelected( string ); | 886 | emit fileSelected( string ); |
857 | // do AppLnk stuff | 887 | // do AppLnk stuff |
858 | } | 888 | } |
889 | |||
859 | void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) | 890 | void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) |
860 | { | 891 | { |
861 | slotFileSelected(lnk.name() ); | 892 | slotFileSelected(lnk.name() ); |
862 | emit fileSelected( lnk ); | 893 | emit fileSelected( lnk ); |
863 | } | 894 | } |
895 | |||
864 | void OFileSelector::slotSelectionChanged() // get the current items | 896 | void OFileSelector::slotSelectionChanged() // get the current items |
865 | // fixme | 897 | // fixme |
866 | { | 898 | { |
867 | qWarning("selection changed" ); | 899 | qWarning("selection changed" ); |
868 | } | 900 | } |
901 | |||
869 | void OFileSelector::slotCurrentChanged(QListViewItem *item ) | 902 | void OFileSelector::slotCurrentChanged(QListViewItem *item ) |
870 | { | 903 | { |
871 | qWarning("current changed" ); | 904 | qWarning("current changed" ); |
@@ -885,6 +918,7 @@ void OFileSelector::slotCurrentChanged(QListViewItem *item ) | |||
885 | qWarning("mode not extended" ); | 918 | qWarning("mode not extended" ); |
886 | } | 919 | } |
887 | } | 920 | } |
921 | |||
888 | // either select or change dir | 922 | // either select or change dir |
889 | void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &point, int ) | 923 | void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &point, int ) |
890 | { | 924 | { |
@@ -901,19 +935,20 @@ void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint & | |||
901 | if(!sel->isLocked() ){ // not locked either changedir or open | 935 | if(!sel->isLocked() ){ // not locked either changedir or open |
902 | QStringList str = QStringList::split("->", sel->text(1) ); | 936 | QStringList str = QStringList::split("->", sel->text(1) ); |
903 | if(sel->isDir() ){ | 937 | if(sel->isDir() ){ |
904 | cd( sel->directory() + "/" + str[0] ); | 938 | cd( sel->directory() + "/" + str[0] ); |
905 | }else{ | 939 | } else { |
906 | qWarning("file" ); | 940 | qWarning("file" ); |
907 | if(m_shLne ) | 941 | if(m_shLne ) |
908 | m_edit->setText(str[0] ); | 942 | m_edit->setText(str[0] ); |
909 | emit fileSelected(str[0] ); | 943 | emit fileSelected(str[0] ); |
910 | // emit DocLnk need to do it | 944 | // emit DocLnk need to do it |
911 | } | 945 | } |
912 | }else{ | 946 | } else { |
913 | qWarning( "locked" ); | 947 | qWarning( "locked" ); |
914 | } | 948 | } |
915 | }; | 949 | }; |
916 | } | 950 | } |
951 | |||
917 | void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int ) | 952 | void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int ) |
918 | { | 953 | { |
919 | if (item == 0 ) | 954 | if (item == 0 ) |
@@ -924,6 +959,7 @@ void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoin | |||
924 | qWarning("right button" ); | 959 | qWarning("right button" ); |
925 | slotContextMenu(item); | 960 | slotContextMenu(item); |
926 | } | 961 | } |
962 | |||
927 | void OFileSelector::slotContextMenu(QListViewItem *item) | 963 | void OFileSelector::slotContextMenu(QListViewItem *item) |
928 | { | 964 | { |
929 | qWarning("context menu" ); | 965 | qWarning("context menu" ); |
@@ -975,16 +1011,17 @@ void OFileSelector::slotContextMenu(QListViewItem *item) | |||
975 | menu.exec(QCursor::pos() ); | 1011 | menu.exec(QCursor::pos() ); |
976 | } | 1012 | } |
977 | } | 1013 | } |
1014 | |||
978 | bool OFileSelector::cd(const QString &str ) | 1015 | bool OFileSelector::cd(const QString &str ) |
979 | { | 1016 | { |
980 | qWarning(" dir %s", str.latin1() ); | 1017 | qWarning(" dir %s", str.latin1() ); |
981 | QDir dir( str); | 1018 | QDir dir( str); |
982 | if(dir.exists() ){ | 1019 | if(dir.exists() ){ |
983 | m_currentDir = str; | 1020 | m_currentDir = dir.absPath(); |
984 | reparse(); | 1021 | reparse(); |
985 | if(m_shTool ){ | 1022 | if(m_shTool ){ |
986 | int count = m_location->count(); | 1023 | int count = m_location->count(); |
987 | m_location->insertItem(str ); | 1024 | insertLocationPath( str ,count ); |
988 | m_location->setCurrentItem( count ); | 1025 | m_location->setCurrentItem( count ); |
989 | } | 1026 | } |
990 | return true; | 1027 | return true; |
@@ -992,14 +1029,31 @@ bool OFileSelector::cd(const QString &str ) | |||
992 | return false; | 1029 | return false; |
993 | } | 1030 | } |
994 | 1031 | ||
1032 | void OFileSelector::insertLocationPath(const QString ¤tPath, int count) { | ||
1033 | QStringList pathList; | ||
1034 | for(int i=0;i<count;i++) { | ||
1035 | pathList << m_location->text(i); | ||
1036 | } | ||
1037 | if( pathList.grep( currentPath,TRUE).isEmpty() ) { | ||
1038 | m_location->clear(); | ||
1039 | if( currentPath.left(2)=="//") | ||
1040 | pathList.append( currentPath.right(currentPath.length()-1) ); | ||
1041 | else | ||
1042 | pathList.append( currentPath ); | ||
1043 | m_location->insertStringList( pathList,-1); | ||
1044 | } | ||
1045 | } | ||
1046 | |||
995 | void OFileSelector::slotChangedDir() | 1047 | void OFileSelector::slotChangedDir() |
996 | { | 1048 | { |
997 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); | 1049 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); |
998 | if(sel->isDir() ){ | 1050 | if(sel->isDir() ){ |
999 | QStringList str = QStringList::split("->", sel->text(1) ); | 1051 | QStringList str = QStringList::split("->", sel->text(1) ); |
1000 | cd( sel->directory() + "/" + str[0] ); | 1052 | cd( sel->directory() + "/" + str[0] ); |
1053 | |||
1001 | } | 1054 | } |
1002 | } | 1055 | } |
1056 | |||
1003 | void OFileSelector::slotOpen() | 1057 | void OFileSelector::slotOpen() |
1004 | { | 1058 | { |
1005 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); | 1059 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); |
@@ -1008,23 +1062,31 @@ void OFileSelector::slotOpen() | |||
1008 | slotFileSelected( str[0] ); | 1062 | slotFileSelected( str[0] ); |
1009 | } | 1063 | } |
1010 | } | 1064 | } |
1065 | |||
1011 | void OFileSelector::slotRescan() | 1066 | void OFileSelector::slotRescan() |
1012 | { | 1067 | { |
1013 | reparse(); | 1068 | reparse(); |
1014 | } | 1069 | } |
1070 | |||
1015 | void OFileSelector::slotRename() | 1071 | void OFileSelector::slotRename() |
1016 | { | 1072 | { |
1017 | // rename inline | 1073 | // rename inline |
1018 | } | 1074 | } |
1075 | |||
1019 | void OFileSelector::slotDelete() | 1076 | void OFileSelector::slotDelete() |
1020 | { | 1077 | { |
1021 | qWarning("delete slot" ); | 1078 | qWarning("delete slot" ); |
1022 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); | 1079 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); |
1023 | QStringList list = QStringList::split("->", sel->text(1) ); | 1080 | QStringList list = QStringList::split("->", sel->text(1) ); |
1024 | if( sel->isDir() ){ | 1081 | if( sel->isDir() ){ |
1025 | QString str = QString::fromLatin1("rm -rf ") + list[0]; | 1082 | QString str = QString::fromLatin1("rm -rf ") + list[0]; //better safe than sorry |
1026 | ::system(str.utf8().data() ); | 1083 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0], |
1027 | }else{ | 1084 | tr("Yes"),tr("No"),0,1,1) ) { |
1085 | case 0: | ||
1086 | ::system(str.utf8().data() ); | ||
1087 | break; | ||
1088 | } | ||
1089 | } else { | ||
1028 | QFile::remove( list[0] ); | 1090 | QFile::remove( list[0] ); |
1029 | } | 1091 | } |
1030 | m_View->takeItem( sel ); | 1092 | m_View->takeItem( sel ); |
@@ -1039,19 +1101,38 @@ void OFileSelector::cdUP() | |||
1039 | m_currentDir = dir.absPath(); | 1101 | m_currentDir = dir.absPath(); |
1040 | reparse(); | 1102 | reparse(); |
1041 | int count = m_location->count(); | 1103 | int count = m_location->count(); |
1042 | m_location->insertItem(m_currentDir ); | 1104 | insertLocationPath( m_currentDir,count ); |
1043 | m_location->setCurrentItem( count ); | 1105 | m_location->setCurrentItem( indexFromString(m_currentDir )); |
1106 | //this wont work in all instances | ||
1107 | // FIXME | ||
1044 | } | 1108 | } |
1045 | } | 1109 | } |
1110 | |||
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 | |||
1046 | void OFileSelector::slotHome() | 1120 | void OFileSelector::slotHome() |
1047 | { | 1121 | { |
1048 | cd(QDir::homeDirPath() ); | 1122 | cd(QDir::homeDirPath() ); |
1049 | } | 1123 | } |
1124 | |||
1050 | void OFileSelector::slotDoc() | 1125 | void OFileSelector::slotDoc() |
1051 | { | 1126 | { |
1052 | cd(QDir::homeDirPath() + "/Documents" ); | 1127 | cd(QDir::homeDirPath() + "/Documents" ); |
1053 | } | 1128 | } |
1129 | |||
1054 | void OFileSelector::slotNavigate() | 1130 | void OFileSelector::slotNavigate() |
1055 | { | 1131 | { |
1056 | 1132 | ||
1057 | } | 1133 | } |
1134 | |||
1135 | void OFileSelector::locationComboActivated(const QString & file ) { | ||
1136 | cd(file.left(file.find("<-",0,TRUE))); | ||
1137 | reparse(); | ||
1138 | } | ||
diff --git a/libopie/ofileselector.h b/libopie/ofileselector.h index 5e98a1e..81a9e63 100644 --- a/libopie/ofileselector.h +++ b/libopie/ofileselector.h | |||
@@ -67,8 +67,8 @@ class QFileInfo; | |||
67 | class OFileSelectorItem : public QListViewItem { | 67 | class OFileSelectorItem : public QListViewItem { |
68 | public: | 68 | public: |
69 | OFileSelectorItem(QListView *view, const QPixmap &pixmap, const QString &path, | 69 | OFileSelectorItem(QListView *view, const QPixmap &pixmap, const QString &path, |
70 | const QString &date, const QString &size, const QString &mDir, | 70 | const QString &date, const QString &size, const QString &mDir, |
71 | bool isLocked=false, bool isDir=false ): QListViewItem(view) { | 71 | bool isLocked=false, bool isDir=false ): QListViewItem(view) { |
72 | setPixmap(0, pixmap ); | 72 | setPixmap(0, pixmap ); |
73 | setText(1, path ); | 73 | setText(1, path ); |
74 | setText(2, size ); | 74 | setText(2, size ); |
@@ -94,11 +94,11 @@ class OFileSelectorItem : public QListViewItem { | |||
94 | QString ke; | 94 | QString ke; |
95 | if( id == 0 || id == 1 ){ // name | 95 | if( id == 0 || id == 1 ){ // name |
96 | if( dir ){ | 96 | if( dir ){ |
97 | ke.append("0" ); | 97 | ke.append("0" ); |
98 | ke.append( text(1) ); | 98 | ke.append( text(1) ); |
99 | }else{ | 99 | }else{ |
100 | ke.append("1" ); | 100 | ke.append("1" ); |
101 | ke.append( text(1) ); | 101 | ke.append( text(1) ); |
102 | } | 102 | } |
103 | }else if( id == 2 ){ // size | 103 | }else if( id == 2 ){ // size |
104 | return text(2); | 104 | return text(2); |
@@ -190,6 +190,9 @@ class OFileSelector : public QWidget { | |||
190 | void slotCancel(); | 190 | void slotCancel(); |
191 | void slotViewCheck(const QString & ); | 191 | void slotViewCheck(const QString & ); |
192 | void slotMimeCheck(const QString & ); | 192 | void slotMimeCheck(const QString & ); |
193 | void locationComboActivated(const QString & ); | ||
194 | void insertLocationPath(const QString &, int); | ||
195 | int indexFromString(const QString &); | ||
193 | protected: | 196 | protected: |
194 | void init(); | 197 | void init(); |
195 | void updateMimes(); | 198 | void updateMimes(); |