summaryrefslogtreecommitdiff
path: root/core/apps/textedit/fileBrowser.cpp
Side-by-side diff
Diffstat (limited to 'core/apps/textedit/fileBrowser.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/fileBrowser.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/core/apps/textedit/fileBrowser.cpp b/core/apps/textedit/fileBrowser.cpp
index 2275388..3e3cc3a 100644
--- a/core/apps/textedit/fileBrowser.cpp
+++ b/core/apps/textedit/fileBrowser.cpp
@@ -10,30 +10,38 @@
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
#include "fileBrowser.h"
#include <qpe/config.h>
+#include <qpe/resource.h>
#include <qlistview.h>
#include <qpushbutton.h>
#include <qfile.h>
#include <qmessagebox.h>
#include <unistd.h>
fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter )
: QDialog( parent, name, modal, fl )
{
if ( !name )
setName( "fileBrowser" );
- resize( 236, 280 );
+ resize( 240, 280 );
setCaption(tr( "Browse for file" ) );
filterStr=filter;
+
dirLabel = new QLabel(this, "DirLabel");
dirLabel->setText(currentDir.canonicalPath());
- dirLabel->setGeometry(10,4,230,30);
+ dirLabel->setGeometry(10,20,230,15);
+
+ QPushButton *homeButton;
+ homeButton = new QPushButton(Resource::loadIconSet("home"),"",this,"homeButton");
+ homeButton->setGeometry(200,4,25,25);
+ connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
+
ListView = new QListView( this, "ListView" );
ListView->addColumn( tr( "Name" ) );
ListView->setColumnWidth(0,140);
ListView->setSorting( 2, FALSE);
ListView->addColumn( tr( "Size" ) );
ListView->setColumnWidth(1,59);
@@ -48,12 +56,13 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags
// signals and slots connections
connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) );
connect( ListView, SIGNAL(pressed( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
currentDir.setPath(QDir::currentDirPath());
populateList();
+ move(0,15);
}
fileBrowser::~fileBrowser()
{
}
@@ -91,13 +100,13 @@ void fileBrowser::populateList()
}
}
item= new QListViewItem( ListView,fileL,fileS );
++it;
}
ListView->setSorting( 2, FALSE);
- dirLabel->setText("Current Directory:\n"+currentDir.canonicalPath());
+ dirLabel->setText(currentDir.canonicalPath());
}
void fileBrowser::upDir()
{
// qDebug(currentDir.canonicalPath());
}
@@ -159,6 +168,13 @@ void fileBrowser::OnOK()
qDebug("selected filename is "+selectedFileName);
fileList.append( selectedFileName );
}
}
accept();
}
+
+void fileBrowser::homeButtonPushed() {
+ chdir( QDir::homeDirPath().latin1() );
+ currentDir.cd( QDir::homeDirPath(), TRUE);
+ populateList();
+ update();
+}