Diffstat (limited to 'noncore/apps/opie-reader/fileBrowser.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/fileBrowser.cpp | 84 |
1 files changed, 53 insertions, 31 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 @@ -13,4 +13,6 @@ Extensive modification by Tim Wentford to allow it to work in rotated mode #include <qlineedit.h> #include <qpushbutton.h> +#include <qfile.h> +#include <qmessagebox.h> #ifndef _WINDOWS #include <unistd.h> @@ -21,7 +23,4 @@ Extensive modification by Tim Wentford to allow it to work in rotated mode #endif -#include <qpe/qpeapplication.h> - - fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter, const QString iPath ) : QDialog( parent, name, true, @@ -32,21 +31,9 @@ fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, boo if ( !name ) 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" ) ); filterStr=filter; buttonOk = new QPushButton( this, "buttonOk" ); - buttonOk->setFixedSize( 25, 25 ); + // buttonOk->setFixedSize( 25, 25 ); buttonOk->setAutoDefault( false ); buttonOk->setText( tr( "/" ) ); @@ -75,15 +62,31 @@ fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, boo connect( buttonShowHidden, SIGNAL( toggled(bool) ), this, SLOT( setHidden(bool) ) ); connect( buttonOk, SIGNAL( clicked() ), this, SLOT( OnRoot() ) ); - connect( ListView, SIGNAL(doubleClicked(QListViewItem*)), SLOT(listDoubleClicked(QListViewItem*)) ); - connect( ListView, SIGNAL(clicked(QListViewItem*)), SLOT(listClicked(QListViewItem*)) ); - connect( ListView, SIGNAL(OnOKButton(QListViewItem*)), SLOT(listClicked(QListViewItem*)) ); - connect( ListView, SIGNAL(OnCentreButton(QListViewItem*)), SLOT(listClicked(QListViewItem*)) ); + connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); + connect( ListView, SIGNAL(clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); + connect( ListView, SIGNAL(OnOKButton( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); + connect( ListView, SIGNAL(OnCentreButton( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); connect( ListView, SIGNAL(OnCancelButton()), SLOT(OnCancel()) ); 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); if (allownew) @@ -115,6 +118,5 @@ fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, boo populateList(); - if (modal) - QPEApplication::showDialog( this ); + if (modal) showMaximized(); } @@ -133,5 +135,5 @@ void fileBrowser::populateList() { ListView->clear(); -////odebug << currentDir.canonicalPath() << oendl; +////qDebug(currentDir.canonicalPath()); // currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks ); currentDir.setFilter( filterspec ); @@ -157,5 +159,5 @@ void fileBrowser::populateList() else { -//// odebug << "Not a dir: "+currentDir.canonicalPath()+fileL << oendl; +//// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); } new QListViewItem( ListView,fileL,fileS ); @@ -170,5 +172,5 @@ void fileBrowser::populateList() void fileBrowser::upDir() { -//// odebug << currentDir.canonicalPath() << oendl; +//// qDebug(currentDir.canonicalPath()); } @@ -178,5 +180,5 @@ void fileBrowser::listClicked(QListViewItem *selectedItem) QString strItem=selectedItem->text(0); -//// odebug << "" << strItem << "" << oendl; +//// qDebug("%s", (const char*)strItem); @@ -233,7 +235,5 @@ void fileBrowser::OnOK() void fileBrowser::OnRoot() { - currentDir.cd("/", TRUE); - populateList(); - chdir("/"); + setdir("/"); } @@ -265,2 +265,24 @@ void fileBrowser::onReturn() OnOK(); } + +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); +} |