summaryrefslogtreecommitdiff
path: root/libopie/ofileselector.cc
Side-by-side diff
Diffstat (limited to 'libopie/ofileselector.cc') (more/less context) (show whitespace changes)
-rw-r--r--libopie/ofileselector.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/libopie/ofileselector.cc b/libopie/ofileselector.cc
index 824acf2..3c3a6c4 100644
--- a/libopie/ofileselector.cc
+++ b/libopie/ofileselector.cc
@@ -327,15 +327,19 @@ QString OFileSelector::selectedName() const
QString name;
if( m_selector == NORMAL ){
const DocLnk *lnk = m_select->selected();
name = lnk->file();
delete lnk;
}else if( m_selector == EXTENDED || m_selector == EXTENDED_ALL ){
+ if ( m_shLne ) {
+ name = m_currentDir + "/" +m_edit->text();
+ }else{
QListViewItem *item = m_View->currentItem();
if( item != 0 )
name = m_currentDir + "/" + item->text( 1 );
+ }
}else { // installed view
;
}
return name;
}
QStringList OFileSelector::selectedNames()const
@@ -518,15 +522,26 @@ void OFileSelector::slotMimeCheck(const QString &mime)
//m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) );
}
reparse();
}
}
+/*
+ * Ok if a non dir gets inserted into this combobox
+ * we need to change it
+ * QFileInfo and dirPath will give us the right Dir
+ */
void OFileSelector::slotLocationActivated(const QString &file)
{
- cd(file.left(file.find("<-",0,TRUE)));
+ qWarning("slotLocationActivated");
+ QString name = file.left( file.find("<-", 0, TRUE ) );
+ QFileInfo info( name );
+ if ( info.isFile() )
+ cd(info.dirPath( TRUE ) ); //absolute
+ else
+ cd(name );
reparse();
}
void OFileSelector::slotInsertLocationPath(const QString &currentPath, int count)
{
QStringList pathList;
bool underDog = FALSE;
@@ -541,15 +556,25 @@ void OFileSelector::slotInsertLocationPath(const QString &currentPath, int count
pathList.append( currentPath.right(currentPath.length()-1) );
else
pathList.append( currentPath );
m_location->insertStringList( pathList,-1);
}
}
+/*
+ * Do not crash anymore
+ * don't try to change dir to a file
+ */
void OFileSelector::locationComboChanged()
{
+ QFileInfo info( m_location->lineEdit()->text() );
+ qWarning("info %s %s", info.dirPath(true).latin1(), m_location->lineEdit()->text().latin1() );
+ if (info.isFile() )
+ cd(info.dirPath(TRUE) ); //absolute path
+ else
cd( m_location->lineEdit()->text());
+
reparse();
}
void OFileSelector::init()
{
m_lay = new QVBoxLayout( this );
m_lay->setSpacing(0 );