summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector.cc36
1 files changed, 30 insertions, 6 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index 98290e0..824acf2 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -122,13 +122,13 @@ OFileSelector::OFileSelector(const QString &mimeFilter, QWidget *parent,
122 if (!mimeFilter.isEmpty() ) { 122 if (!mimeFilter.isEmpty() ) {
123 QStringList list = QStringList::split(";", mimeFilter ); 123 QStringList list = QStringList::split(";", mimeFilter );
124 m_mimetypes.insert(mimeFilter, list ); 124 m_mimetypes.insert(mimeFilter, list );
125 } 125 }
126 initVars(); 126 initVars();
127 m_currentDir = QPEApplication::documentDir(); 127 m_currentDir = QPEApplication::documentDir();
128 m_mode = OPEN; 128 m_mode = FILESELECTOR;
129 m_selector = NORMAL; 129 m_selector = NORMAL;
130 m_shClose = closeVisible; 130 m_shClose = closeVisible;
131 m_shNew = newVisible; 131 m_shNew = newVisible;
132 m_shLne = false; 132 m_shLne = false;
133 m_shPerm = false; 133 m_shPerm = false;
134 m_shYesNo = false; 134 m_shYesNo = false;
@@ -152,12 +152,14 @@ void OFileSelector::setNewVisible( bool visible )
152 QString mime = currentMimeType(); 152 QString mime = currentMimeType();
153 m_select = new FileSelector( mime , 153 m_select = new FileSelector( mime ,
154 m_stack, "fileselector", 154 m_stack, "fileselector",
155 m_shNew, m_shClose); 155 m_shNew, m_shClose);
156 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), 156 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
157 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); 157 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
158 connect(m_select, SIGNAL(closeMe() ),
159 this, SIGNAL(closeMe() ) );
158 //connect to close me and other signals as well 160 //connect to close me and other signals as well
159 m_stack->addWidget( m_select, NORMAL ); 161 m_stack->addWidget( m_select, NORMAL );
160 }else{ 162 }else{
161 m_new->show(); 163 m_new->show();
162 } 164 }
163} 165}
@@ -432,15 +434,17 @@ void OFileSelector::slotViewCheck(const QString &sel)
432 if( m_select == 0 ){ 434 if( m_select == 0 ){
433 // autMime? fix cause now we use All and not the current 435 // autMime? fix cause now we use All and not the current
434 // yes currentMime fixes that for us 436 // yes currentMime fixes that for us
435 QString mime = currentMimeType(); 437 QString mime = currentMimeType();
436 m_select = new FileSelector(mime, 438 m_select = new FileSelector(mime,
437 m_stack, "fileselector", 439 m_stack, "fileselector",
438 FALSE, FALSE); 440 m_shNew, m_shClose);
439 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), 441 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
440 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); 442 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
443 connect(m_select, SIGNAL(closeMe() ),
444 this, SIGNAL(closeMe() ) );
441 //connect to close me and other signals as well 445 //connect to close me and other signals as well
442 446
443 m_stack->addWidget( m_select, NORMAL ); 447 m_stack->addWidget( m_select, NORMAL );
444 } 448 }
445 m_stack->raiseWidget( NORMAL ); 449 m_stack->raiseWidget( NORMAL );
446 m_selector = NORMAL; 450 m_selector = NORMAL;
@@ -491,16 +495,18 @@ void OFileSelector::slotMimeCheck(const QString &mime)
491 newMimeType = mime; 495 newMimeType = mime;
492 } 496 }
493 } 497 }
494 delete m_select; 498 delete m_select;
495 m_select = new FileSelector( newMimeType, 499 m_select = new FileSelector( newMimeType,
496 m_stack, "fileselector", 500 m_stack, "fileselector",
497 FALSE, FALSE); 501 m_shNew, m_shClose);
498 502
499 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), 503 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
500 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); 504 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
505 connect(m_select, SIGNAL(closeMe() ),
506 this, SIGNAL(closeMe() ) );
501 //connect to close me and other signals as well 507 //connect to close me and other signals as well
502 m_stack->addWidget( m_select, NORMAL ); 508 m_stack->addWidget( m_select, NORMAL );
503 m_stack->raiseWidget( NORMAL ); 509 m_stack->raiseWidget( NORMAL );
504 updateMimes(); 510 updateMimes();
505 updateMimeCheck(); 511 updateMimeCheck();
506 m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); 512 m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) );
@@ -557,16 +563,18 @@ void OFileSelector::init()
557 it = m_mimetypes.begin(); // cause we're in the init 563 it = m_mimetypes.begin(); // cause we're in the init
558 mime = it.data().join(";"); 564 mime = it.data().join(";");
559 } 565 }
560 } 566 }
561 m_select = new FileSelector(mime, 567 m_select = new FileSelector(mime,
562 m_stack, "fileselector", 568 m_stack, "fileselector",
563 FALSE, FALSE); 569 m_shNew, m_shClose);
564 570
565 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), 571 connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ),
566 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); 572 this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) );
573 connect(m_select, SIGNAL(closeMe() ),
574 this, SIGNAL( closeMe() ) );
567 //connect to close me and other signals as well 575 //connect to close me and other signals as well
568 576
569 m_stack->addWidget( m_select, NORMAL ); 577 m_stack->addWidget( m_select, NORMAL );
570 m_stack->raiseWidget( NORMAL ); 578 m_stack->raiseWidget( NORMAL );
571 }else{ // we're in init so it will be EXTENDED or EXTENDED_ALL 579 }else{ // we're in init so it will be EXTENDED or EXTENDED_ALL
572 // and initializeListview will take care of those 580 // and initializeListview will take care of those
@@ -871,14 +879,14 @@ void OFileSelector::initializeListView()
871 m_up->hide( ); 879 m_up->hide( );
872 m_homeButton->hide( ); 880 m_homeButton->hide( );
873 m_docButton->hide( ); 881 m_docButton->hide( );
874 } 882 }
875 if(!m_shClose ) 883 if(!m_shClose )
876 m_close->hide(); 884 m_close->hide();
877 if(!m_shNew) 885 //if(!m_shNew)
878 m_close->hide(); 886 //m_close->hide();
879 887
880 } // off toolbar 888 } // off toolbar
881 // the Main ListView 889 // the Main ListView
882 // make a QWidgetStack first so Views can share the Toolbar 890 // make a QWidgetStack first so Views can share the Toolbar
883 m_View = new QListView( m_pseudo, "Extended view"); 891 m_View = new QListView( m_pseudo, "Extended view");
884 QPEApplication::setStylusOperation( m_View->viewport(), 892 QPEApplication::setStylusOperation( m_View->viewport(),
@@ -1019,15 +1027,24 @@ void OFileSelector::slotSelectionChanged()
1019void OFileSelector::slotCurrentChanged(QListViewItem* item ) 1027void OFileSelector::slotCurrentChanged(QListViewItem* item )
1020{ 1028{
1021 if( item == 0 ) 1029 if( item == 0 )
1022 return; 1030 return;
1023 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) { 1031 if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) {
1024 OFileSelectorItem *sel = (OFileSelectorItem*) item; // start to use the C++ casts ;) 1032 OFileSelectorItem *sel = (OFileSelectorItem*) item; // start to use the C++ casts ;)
1033 qWarning("current changed");
1025 if(!sel->isDir() ){ 1034 if(!sel->isDir() ){
1026 if( m_shLne ) 1035 if( m_shLne )
1027 m_edit->setText( sel->text(1) ); 1036 m_edit->setText( sel->text(1) );
1037
1038 if (m_mode == FILESELECTOR ) {
1039 QStringList str = QStringList::split("->", sel->text(1) );
1040 QString path =sel->directory() + "/" + str[0].stripWhiteSpace();
1041 emit fileSelected(path );
1042 DocLnk lnk( path );
1043 emit fileSelected(lnk );
1044 }
1028 } 1045 }
1029 } 1046 }
1030} 1047}
1031void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &, int) 1048void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &, int)
1032{ 1049{
1033 if ( item == 0 ) 1050 if ( item == 0 )
@@ -1047,13 +1064,17 @@ void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &
1047 if( sel->isDir() ){ 1064 if( sel->isDir() ){
1048 cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); 1065 cd( sel->directory() + "/" + str[0].stripWhiteSpace() );
1049 // if MODE Dir m_shLne set the Text 1066 // if MODE Dir m_shLne set the Text
1050 }else{ 1067 }else{
1051 if( m_shLne ) 1068 if( m_shLne )
1052 m_edit->setText( str[0].stripWhiteSpace() ); 1069 m_edit->setText( str[0].stripWhiteSpace() );
1070 qWarning("selected here in slot clicked");
1053 emit fileSelected( sel->directory() + "/" + str[0].stripWhiteSpace() ); 1071 emit fileSelected( sel->directory() + "/" + str[0].stripWhiteSpace() );
1072 DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() );
1073 qWarning("file selected");
1074 emit fileSelected( lnk );
1054 } 1075 }
1055 } 1076 }
1056 break; 1077 break;
1057 } 1078 }
1058 } 1079 }
1059} 1080}
@@ -1081,12 +1102,15 @@ void OFileSelector::slotChangedDir()
1081void OFileSelector::slotOpen() 1102void OFileSelector::slotOpen()
1082{ 1103{
1083 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); 1104 OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem();
1084 if(!sel->isDir() ){ 1105 if(!sel->isDir() ){
1085 QStringList str = QStringList::split("->", sel->text(1) ); 1106 QStringList str = QStringList::split("->", sel->text(1) );
1086 slotFileSelected( sel->directory() +"/" +str[0].stripWhiteSpace() ); 1107 slotFileSelected( sel->directory() +"/" +str[0].stripWhiteSpace() );
1108 qWarning("slot open");
1109 // DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() );
1110 //emit fileSelected( lnk );
1087 } 1111 }
1088} 1112}
1089void OFileSelector::slotRescan() 1113void OFileSelector::slotRescan()
1090{ 1114{
1091 1115
1092} 1116}