summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/fileBrowser.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader/fileBrowser.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/fileBrowser.cpp84
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
@@ -14,2 +14,4 @@ Extensive modification by Tim Wentford to allow it to work in rotated mode
14#include <qpushbutton.h> 14#include <qpushbutton.h>
15#include <qfile.h>
16#include <qmessagebox.h>
15#ifndef _WINDOWS 17#ifndef _WINDOWS
@@ -22,5 +24,2 @@ Extensive modification by Tim Wentford to allow it to work in rotated mode
22 24
23#include <qpe/qpeapplication.h>
24
25
26fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter, const QString iPath ) 25fileBrowser::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
33 setName( "fileBrowser" ); 32 setName( "fileBrowser" );
34/*
35 if (parent != NULL)
36 {
37#ifdef OPIE
38 move(0,0);
39 resize( parent->width(), parent->height() );
40#else
41 setGeometry(parent->x(), parent->y(), parent->width(), parent->height() );
42#endif
43 }
44*/
45// showFullScreen();
46 setCaption(tr( "Browse for file" ) ); 33 setCaption(tr( "Browse for file" ) );
@@ -49,3 +36,3 @@ fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, boo
49 buttonOk = new QPushButton( this, "buttonOk" ); 36 buttonOk = new QPushButton( this, "buttonOk" );
50 buttonOk->setFixedSize( 25, 25 ); 37 // buttonOk->setFixedSize( 25, 25 );
51 buttonOk->setAutoDefault( false ); 38 buttonOk->setAutoDefault( false );
@@ -76,6 +63,6 @@ fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, boo
76 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( OnRoot() ) ); 63 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( OnRoot() ) );
77 connect( ListView, SIGNAL(doubleClicked(QListViewItem*)), SLOT(listDoubleClicked(QListViewItem*)) ); 64 connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) );
78 connect( ListView, SIGNAL(clicked(QListViewItem*)), SLOT(listClicked(QListViewItem*)) ); 65 connect( ListView, SIGNAL(clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
79 connect( ListView, SIGNAL(OnOKButton(QListViewItem*)), SLOT(listClicked(QListViewItem*)) ); 66 connect( ListView, SIGNAL(OnOKButton( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
80 connect( ListView, SIGNAL(OnCentreButton(QListViewItem*)), SLOT(listClicked(QListViewItem*)) ); 67 connect( ListView, SIGNAL(OnCentreButton( QListViewItem*)), SLOT(listClicked(QListViewItem *)) );
81 connect( ListView, SIGNAL(OnCancelButton()), SLOT(OnCancel()) ); 68 connect( ListView, SIGNAL(OnCancelButton()), SLOT(OnCancel()) );
@@ -83,6 +70,22 @@ fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, boo
83 QVBoxLayout* grid = new QVBoxLayout(this); 70 QVBoxLayout* grid = new QVBoxLayout(this);
71 grid->addWidget(dirLabel);
84 QHBoxLayout* hgrid = new QHBoxLayout(grid); 72 QHBoxLayout* hgrid = new QHBoxLayout(grid);
85 hgrid->addWidget(dirLabel,1); 73
86 hgrid->addWidget(buttonShowHidden); 74 QPushButton* bt = new QPushButton( this );
75 bt->setText( tr( "SD" ) );
76 connect( bt, SIGNAL( clicked() ), this, SLOT( onSD() ) );
77 hgrid->addWidget(bt);
78
79 bt = new QPushButton( this );
80 bt->setText( tr( "CF" ) );
81 connect( bt, SIGNAL( clicked() ), this, SLOT( onCF() ) );
82 hgrid->addWidget(bt);
83
84 bt = new QPushButton( this );
85 bt->setText( tr( "Home" ) );
86 connect( bt, SIGNAL( clicked() ), this, SLOT( onHome() ) );
87 hgrid->addWidget(bt);
88
87 hgrid->addWidget(buttonOk); 89 hgrid->addWidget(buttonOk);
90 hgrid->addWidget(buttonShowHidden);
88 grid->addWidget(ListView,1); 91 grid->addWidget(ListView,1);
@@ -116,4 +119,3 @@ fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, boo
116 119
117 if (modal) 120 if (modal) showMaximized();
118 QPEApplication::showDialog( this );
119} 121}
@@ -134,3 +136,3 @@ void fileBrowser::populateList()
134 ListView->clear(); 136 ListView->clear();
135////odebug << currentDir.canonicalPath() << oendl; 137////qDebug(currentDir.canonicalPath());
136// currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks ); 138// currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks );
@@ -158,3 +160,3 @@ void fileBrowser::populateList()
158 { 160 {
159//// odebug << "Not a dir: "+currentDir.canonicalPath()+fileL << oendl; 161//// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL);
160 } 162 }
@@ -171,3 +173,3 @@ void fileBrowser::upDir()
171{ 173{
172//// odebug << currentDir.canonicalPath() << oendl; 174//// qDebug(currentDir.canonicalPath());
173} 175}
@@ -179,3 +181,3 @@ void fileBrowser::listClicked(QListViewItem *selectedItem)
179 181
180//// odebug << "" << strItem << "" << oendl; 182//// qDebug("%s", (const char*)strItem);
181 183
@@ -234,5 +236,3 @@ void fileBrowser::OnRoot()
234{ 236{
235 currentDir.cd("/", TRUE); 237 setdir("/");
236 populateList();
237 chdir("/");
238} 238}
@@ -266 +266,23 @@ void fileBrowser::onReturn()
266} 266}
267
268void fileBrowser::onCF()
269{
270 setdir("/mnt/cf");
271}
272
273void fileBrowser::onSD()
274{
275 setdir("/mnt/card");
276}
277
278void fileBrowser::onHome()
279{
280 setdir(QDir::homeDirPath());
281}
282
283void fileBrowser::setdir(const QString& s)
284{
285 currentDir.cd(s, TRUE);
286 populateList();
287 chdir(s);
288}