summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/fileselector/ofileselector.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp
index 718f743..74aca96 100644
--- a/libopie2/opieui/fileselector/ofileselector.cpp
+++ b/libopie2/opieui/fileselector/ofileselector.cpp
@@ -64,2 +64,12 @@ namespace Ui {
64namespace Internal { 64namespace Internal {
65/*
66 * Create a path by adding a '/'/QDir::seperator in between
67 * base and ending, but only if base is not empty
68 */
69static inline QString createNewPath(const QString& base, const QString &ending) {
70 return base == QString::fromLatin1("/") ?
71 base + ending : base + "/" + ending;
72}
73
74
65OFileViewInterface::OFileViewInterface( OFileSelector* _selector ) 75OFileViewInterface::OFileViewInterface( OFileSelector* _selector )
@@ -472,3 +482,3 @@ void OFileViewFileListView::reread( bool all )
472 { 482 {
473 QString file = fi->dirPath( true ) + "/" + fi->readLink(); 483 QString file = createNewPath(fi->dirPath( true ),fi->readLink());
474 for( int i = 0; i<=4; i++) 484 for( int i = 0; i<=4; i++)
@@ -493,3 +503,3 @@ void OFileViewFileListView::reread( bool all )
493 { 503 {
494 file = info.dirPath(true ) + "/" + info.readLink() ; 504 file = createNewPath(info.dirPath(true ),info.readLink());
495 break; 505 break;
@@ -565,3 +575,3 @@ void OFileViewFileListView::slotCurrentChanged( QListViewItem* item)
565 QStringList str = QStringList::split("->", sel->text(1) ); 575 QStringList str = QStringList::split("->", sel->text(1) );
566 QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); 576 QString path = createNewPath(sel->directory(),str[0].stripWhiteSpace());
567 emit selector()->fileSelected( path ); 577 emit selector()->fileSelected( path );
@@ -585,3 +595,3 @@ void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const
585 { 595 {
586 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); 596 m_currentDir = createNewPath(sel->directory(),str[0].stripWhiteSpace());
587 emit selector()->dirSelected( m_currentDir ); 597 emit selector()->dirSelected( m_currentDir );
@@ -593,3 +603,3 @@ void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const
593 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); 603 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() );
594 QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); 604 QString path = createNewPath(sel->directory(),str[0].stripWhiteSpace());
595 emit selector()->fileSelected( path ); 605 emit selector()->fileSelected( path );
@@ -619,3 +629,3 @@ void OFileViewFileListView::addFile( QFileInfo* info, bool symlink )
619 if ( symlink ) 629 if ( symlink )
620 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink(); 630 name = info->fileName() + " -> " + createNewPath(info->dirPath(),info->readLink());
621 else 631 else
@@ -650,3 +660,3 @@ void OFileViewFileListView::addDir( QFileInfo* info, bool symlink )
650 660
651 name = symlink ? info->fileName() + " -> " + info->dirPath(true) + "/" + info->readLink() : 661 name = symlink ? info->fileName() + " -> " + createNewPath(info->dirPath(true),info->readLink()) :
652 info->fileName(); 662 info->fileName();
@@ -782,3 +792,3 @@ QString OFileViewFileSystem::selectedName()const
782 if (cFN.startsWith("/")) return cFN; 792 if (cFN.startsWith("/")) return cFN;
783 return m_view->currentDir() + "/" + cFN; 793 return createNewPath(m_view->currentDir(),cFN);
784} 794}