-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 @@ -124,9 +124,9 @@ OFileSelector::OFileSelector(const QString &mimeFilter, QWidget *parent, m_mimetypes.insert(mimeFilter, list ); } initVars(); m_currentDir = QPEApplication::documentDir(); - m_mode = OPEN; + m_mode = FILESELECTOR; m_selector = NORMAL; m_shClose = closeVisible; m_shNew = newVisible; m_shLne = false; @@ -154,8 +154,10 @@ void OFileSelector::setNewVisible( bool visible ) m_stack, "fileselector", m_shNew, m_shClose); connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); + connect(m_select, SIGNAL(closeMe() ), + this, SIGNAL(closeMe() ) ); //connect to close me and other signals as well m_stack->addWidget( m_select, NORMAL ); }else{ m_new->show(); @@ -434,11 +436,13 @@ void OFileSelector::slotViewCheck(const QString &sel) // yes currentMime fixes that for us QString mime = currentMimeType(); m_select = new FileSelector(mime, m_stack, "fileselector", - FALSE, FALSE); + m_shNew, m_shClose); connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); + connect(m_select, SIGNAL(closeMe() ), + this, SIGNAL(closeMe() ) ); //connect to close me and other signals as well m_stack->addWidget( m_select, NORMAL ); } @@ -493,12 +497,14 @@ void OFileSelector::slotMimeCheck(const QString &mime) } delete m_select; m_select = new FileSelector( newMimeType, m_stack, "fileselector", - FALSE, FALSE); + m_shNew, m_shClose); connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); + connect(m_select, SIGNAL(closeMe() ), + this, SIGNAL(closeMe() ) ); //connect to close me and other signals as well m_stack->addWidget( m_select, NORMAL ); m_stack->raiseWidget( NORMAL ); updateMimes(); @@ -559,12 +565,14 @@ void OFileSelector::init() } } m_select = new FileSelector(mime, m_stack, "fileselector", - FALSE, FALSE); + m_shNew, m_shClose); connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); + connect(m_select, SIGNAL(closeMe() ), + this, SIGNAL( closeMe() ) ); //connect to close me and other signals as well m_stack->addWidget( m_select, NORMAL ); m_stack->raiseWidget( NORMAL ); @@ -873,10 +881,10 @@ void OFileSelector::initializeListView() m_docButton->hide( ); } if(!m_shClose ) m_close->hide(); - if(!m_shNew) - m_close->hide(); + //if(!m_shNew) + //m_close->hide(); } // off toolbar // the Main ListView // make a QWidgetStack first so Views can share the Toolbar @@ -1021,11 +1029,20 @@ void OFileSelector::slotCurrentChanged(QListViewItem* item ) if( item == 0 ) return; if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ) { OFileSelectorItem *sel = (OFileSelectorItem*) item; // start to use the C++ casts ;) + qWarning("current changed"); if(!sel->isDir() ){ if( m_shLne ) m_edit->setText( sel->text(1) ); + + if (m_mode == FILESELECTOR ) { + QStringList str = QStringList::split("->", sel->text(1) ); + QString path =sel->directory() + "/" + str[0].stripWhiteSpace(); + emit fileSelected(path ); + DocLnk lnk( path ); + emit fileSelected(lnk ); + } } } } void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &, int) @@ -1049,9 +1066,13 @@ void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint & // if MODE Dir m_shLne set the Text }else{ if( m_shLne ) m_edit->setText( str[0].stripWhiteSpace() ); + qWarning("selected here in slot clicked"); emit fileSelected( sel->directory() + "/" + str[0].stripWhiteSpace() ); + DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); + qWarning("file selected"); + emit fileSelected( lnk ); } } break; } @@ -1083,8 +1104,11 @@ void OFileSelector::slotOpen() OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); if(!sel->isDir() ){ QStringList str = QStringList::split("->", sel->text(1) ); slotFileSelected( sel->directory() +"/" +str[0].stripWhiteSpace() ); + qWarning("slot open"); + // DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); + //emit fileSelected( lnk ); } } void OFileSelector::slotRescan() { |