author | zecke <zecke> | 2002-06-26 20:41:06 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-06-26 20:41:06 (UTC) |
commit | a078163b38383870dd5a659c1f0964e1238867b3 (patch) (unidiff) | |
tree | 68a517f1adc23cc0fa70b979fe772bcaa53790ab | |
parent | c229565c40d478555a9ed0aa4910b9ab8181884c (diff) | |
download | opie-a078163b38383870dd5a659c1f0964e1238867b3.zip opie-a078163b38383870dd5a659c1f0964e1238867b3.tar.gz opie-a078163b38383870dd5a659c1f0964e1238867b3.tar.bz2 |
OFileSelector is now a complete drop in replacement
of the QPE fileselector
-rw-r--r-- | libopie/ofileselector.cc | 36 |
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 | |||
@@ -125,7 +125,7 @@ OFileSelector::OFileSelector(const QString &mimeFilter, QWidget *parent, | |||
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; |
@@ -155,6 +155,8 @@ void OFileSelector::setNewVisible( bool visible ) | |||
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{ |
@@ -435,9 +437,11 @@ void OFileSelector::slotViewCheck(const QString &sel) | |||
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 ); |
@@ -494,10 +498,12 @@ void OFileSelector::slotMimeCheck(const QString &mime) | |||
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 ); |
@@ -560,10 +566,12 @@ void OFileSelector::init() | |||
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 ); |
@@ -874,8 +882,8 @@ void OFileSelector::initializeListView() | |||
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 |
@@ -1022,9 +1030,18 @@ void OFileSelector::slotCurrentChanged(QListViewItem* item ) | |||
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 | } |
@@ -1050,7 +1067,11 @@ void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint & | |||
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; |
@@ -1084,6 +1105,9 @@ void OFileSelector::slotOpen() | |||
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 | } |
1089 | void OFileSelector::slotRescan() | 1113 | void OFileSelector::slotRescan() |