Diffstat (limited to 'noncore/apps/opie-reader/fileBrowser.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/fileBrowser.cpp | 76 |
1 files changed, 49 insertions, 27 deletions
diff --git a/noncore/apps/opie-reader/fileBrowser.cpp b/noncore/apps/opie-reader/fileBrowser.cpp index 72a1222..2291c85 100644 --- a/noncore/apps/opie-reader/fileBrowser.cpp +++ b/noncore/apps/opie-reader/fileBrowser.cpp @@ -14,2 +14,4 @@ Extensive modification by Tim Wentford to allow it to work in rotated mode #include <qpushbutton.h> +#include <qfile.h> +#include <qmessagebox.h> #ifndef _WINDOWS @@ -22,5 +24,2 @@ Extensive modification by Tim Wentford to allow it to work in rotated mode -#include <qpe/qpeapplication.h> - - fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter, const QString iPath ) @@ -33,14 +32,2 @@ fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, boo setName( "fileBrowser" ); -/* - if (parent != NULL) - { -#ifdef OPIE - move(0,0); - resize( parent->width(), parent->height() ); -#else - setGeometry(parent->x(), parent->y(), parent->width(), parent->height() ); -#endif - } -*/ -// showFullScreen(); setCaption(tr( "Browse for file" ) ); @@ -49,3 +36,3 @@ fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, boo buttonOk = new QPushButton( this, "buttonOk" ); - buttonOk->setFixedSize( 25, 25 ); + // buttonOk->setFixedSize( 25, 25 ); buttonOk->setAutoDefault( false ); @@ -83,6 +70,22 @@ fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, boo QVBoxLayout* grid = new QVBoxLayout(this); + grid->addWidget(dirLabel); QHBoxLayout* hgrid = new QHBoxLayout(grid); - hgrid->addWidget(dirLabel,1); - hgrid->addWidget(buttonShowHidden); + + QPushButton* bt = new QPushButton( this ); + bt->setText( tr( "SD" ) ); + connect( bt, SIGNAL( clicked() ), this, SLOT( onSD() ) ); + hgrid->addWidget(bt); + + bt = new QPushButton( this ); + bt->setText( tr( "CF" ) ); + connect( bt, SIGNAL( clicked() ), this, SLOT( onCF() ) ); + hgrid->addWidget(bt); + + bt = new QPushButton( this ); + bt->setText( tr( "Home" ) ); + connect( bt, SIGNAL( clicked() ), this, SLOT( onHome() ) ); + hgrid->addWidget(bt); + hgrid->addWidget(buttonOk); + hgrid->addWidget(buttonShowHidden); grid->addWidget(ListView,1); @@ -116,4 +119,3 @@ fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, boo - if (modal) - QPEApplication::showDialog( this ); + if (modal) showMaximized(); } @@ -134,3 +136,3 @@ void fileBrowser::populateList() ListView->clear(); -////odebug << currentDir.canonicalPath() << oendl; +////qDebug(currentDir.canonicalPath()); // currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks ); @@ -158,3 +160,3 @@ void fileBrowser::populateList() { -//// odebug << "Not a dir: "+currentDir.canonicalPath()+fileL << oendl; +//// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); } @@ -171,3 +173,3 @@ void fileBrowser::upDir() { -//// odebug << currentDir.canonicalPath() << oendl; +//// qDebug(currentDir.canonicalPath()); } @@ -179,3 +181,3 @@ void fileBrowser::listClicked(QListViewItem *selectedItem) -//// odebug << "" << strItem << "" << oendl; +//// qDebug("%s", (const char*)strItem); @@ -234,5 +236,3 @@ void fileBrowser::OnRoot() { - currentDir.cd("/", TRUE); - populateList(); - chdir("/"); + setdir("/"); } @@ -266 +266,23 @@ void fileBrowser::onReturn() } + +void fileBrowser::onCF() +{ + setdir("/mnt/cf"); +} + +void fileBrowser::onSD() +{ + setdir("/mnt/card"); +} + +void fileBrowser::onHome() +{ + setdir(QDir::homeDirPath()); +} + +void fileBrowser::setdir(const QString& s) +{ + currentDir.cd(s, TRUE); + populateList(); + chdir(s); +} |