summaryrefslogtreecommitdiff
path: root/libopie
Side-by-side diff
Diffstat (limited to 'libopie') (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,
if (!mimeFilter.isEmpty() ) {
QStringList list = QStringList::split(";", mimeFilter );
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;
m_shPerm = false;
m_shYesNo = false;
@@ -152,12 +152,14 @@ void OFileSelector::setNewVisible( bool visible )
QString mime = currentMimeType();
m_select = new FileSelector( mime ,
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();
}
}
@@ -432,15 +434,17 @@ void OFileSelector::slotViewCheck(const QString &sel)
if( m_select == 0 ){
// autMime? fix cause now we use All and not the current
// 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 );
}
m_stack->raiseWidget( NORMAL );
m_selector = NORMAL;
@@ -491,16 +495,18 @@ void OFileSelector::slotMimeCheck(const QString &mime)
newMimeType = 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();
updateMimeCheck();
m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) );
@@ -557,16 +563,18 @@ void OFileSelector::init()
it = m_mimetypes.begin(); // cause we're in the init
mime = it.data().join(";");
}
}
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 );
}else{ // we're in init so it will be EXTENDED or EXTENDED_ALL
// and initializeListview will take care of those
@@ -871,14 +879,14 @@ void OFileSelector::initializeListView()
m_up->hide( );
m_homeButton->hide( );
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
m_View = new QListView( m_pseudo, "Extended view");
QPEApplication::setStylusOperation( m_View->viewport(),
@@ -1019,15 +1027,24 @@ void OFileSelector::slotSelectionChanged()
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)
{
if ( item == 0 )
@@ -1047,13 +1064,17 @@ void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &
if( sel->isDir() ){
cd( sel->directory() + "/" + str[0].stripWhiteSpace() );
// 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;
}
}
}
@@ -1081,12 +1102,15 @@ void OFileSelector::slotChangedDir()
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()
{
}