author | llornkcor <llornkcor> | 2002-09-14 02:19:09 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-09-14 02:19:09 (UTC) |
commit | 2d0c1ffcb39f9fac8193ed2e9e93794de0bd7975 (patch) (unidiff) | |
tree | eeed16b5f80dd5883991a7a06133f5f7a6936256 /noncore/apps/opie-reader/fileBrowser.cpp | |
parent | 5a95ed6a000a56849b8f093deea500214856c626 (diff) | |
download | opie-2d0c1ffcb39f9fac8193ed2e9e93794de0bd7975.zip opie-2d0c1ffcb39f9fac8193ed2e9e93794de0bd7975.tar.gz opie-2d0c1ffcb39f9fac8193ed2e9e93794de0bd7975.tar.bz2 |
update by Tim
Diffstat (limited to 'noncore/apps/opie-reader/fileBrowser.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/fileBrowser.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/noncore/apps/opie-reader/fileBrowser.cpp b/noncore/apps/opie-reader/fileBrowser.cpp index def988f..b21d59d 100644 --- a/noncore/apps/opie-reader/fileBrowser.cpp +++ b/noncore/apps/opie-reader/fileBrowser.cpp | |||
@@ -18,5 +18,5 @@ Extensive modification by Tim Wentford to allow it to work in rotated mode | |||
18 | 18 | ||
19 | fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter, const QString iPath ) | 19 | fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter, const QString iPath ) |
20 | : QDialog( parent, name, modal, fl ) | 20 | : QDialog( parent, name, modal, fl ), filterspec(QDir::All) |
21 | { | 21 | { |
22 | // showMaximized(); | 22 | // showMaximized(); |
@@ -29,6 +29,14 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags | |||
29 | buttonOk = new QPushButton( this, "buttonOk" ); | 29 | buttonOk = new QPushButton( this, "buttonOk" ); |
30 | buttonOk->setFixedSize( 25, 25 ); | 30 | buttonOk->setFixedSize( 25, 25 ); |
31 | buttonOk->setAutoDefault( false ); | ||
31 | buttonOk->setText( tr( "/" ) ); | 32 | buttonOk->setText( tr( "/" ) ); |
32 | 33 | ||
34 | buttonShowHidden = new QPushButton( this, "buttonShowHidden" ); | ||
35 | // buttonShowHidden->setFixedSize( 50, 25 ); | ||
36 | buttonShowHidden->setText( tr( "Hidden" ) ); | ||
37 | buttonShowHidden->setAutoDefault( false ); | ||
38 | buttonShowHidden->setToggleButton( true ); | ||
39 | buttonShowHidden->setOn( false ); | ||
40 | |||
33 | dirLabel = new QLabel(this, "DirLabel"); | 41 | dirLabel = new QLabel(this, "DirLabel"); |
34 | dirLabel->setText(currentDir.canonicalPath()); | 42 | dirLabel->setText(currentDir.canonicalPath()); |
@@ -39,8 +47,8 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags | |||
39 | ListView->addColumn( tr( "Size" ) ); | 47 | ListView->addColumn( tr( "Size" ) ); |
40 | ListView->setSelectionMode(QListView::Single); | 48 | ListView->setSelectionMode(QListView::Single); |
41 | |||
42 | ListView->setAllColumnsShowFocus( TRUE ); | 49 | ListView->setAllColumnsShowFocus( TRUE ); |
43 | 50 | ||
44 | // signals and slots connections | 51 | // signals and slots connections |
52 | connect( buttonShowHidden, SIGNAL( toggled(bool) ), this, SLOT( setHidden(bool) ) ); | ||
45 | connect( buttonOk, SIGNAL( clicked() ), this, SLOT( OnRoot() ) ); | 53 | connect( buttonOk, SIGNAL( clicked() ), this, SLOT( OnRoot() ) ); |
46 | connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); | 54 | connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); |
@@ -53,4 +61,5 @@ fileBrowser::fileBrowser( QWidget* parent, const char* name, bool modal, WFlags | |||
53 | QHBoxLayout* hgrid = new QHBoxLayout(grid); | 61 | QHBoxLayout* hgrid = new QHBoxLayout(grid); |
54 | hgrid->addWidget(dirLabel,1); | 62 | hgrid->addWidget(dirLabel,1); |
63 | hgrid->addWidget(buttonShowHidden); | ||
55 | hgrid->addWidget(buttonOk); | 64 | hgrid->addWidget(buttonOk); |
56 | grid->addWidget(ListView,1); | 65 | grid->addWidget(ListView,1); |
@@ -86,5 +95,5 @@ void fileBrowser::populateList() | |||
86 | //qDebug(currentDir.canonicalPath()); | 95 | //qDebug(currentDir.canonicalPath()); |
87 | // currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks ); | 96 | // currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks ); |
88 | currentDir.setFilter( QDir::All ); | 97 | currentDir.setFilter( filterspec ); |
89 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 98 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
90 | currentDir.setMatchAllDirs(TRUE); | 99 | currentDir.setMatchAllDirs(TRUE); |
@@ -93,5 +102,5 @@ void fileBrowser::populateList() | |||
93 | // currentDir.setNameFilter("*.txt;*.etx"); | 102 | // currentDir.setNameFilter("*.txt;*.etx"); |
94 | QString fileL, fileS; | 103 | QString fileL, fileS; |
95 | const QFileInfoList *list = currentDir.entryInfoList(QDir::All); | 104 | const QFileInfoList *list = currentDir.entryInfoList(); |
96 | QFileInfoListIterator it(*list); | 105 | QFileInfoListIterator it(*list); |
97 | QFileInfo *fi; | 106 | QFileInfo *fi; |
@@ -116,4 +125,5 @@ void fileBrowser::populateList() | |||
116 | ListView->setSorting( 2, FALSE); | 125 | ListView->setSorting( 2, FALSE); |
117 | dirLabel->setText("Current Directory:\n"+currentDir.canonicalPath()); | 126 | dirLabel->setText("Current Directory:\n"+currentDir.canonicalPath()); |
127 | ListView->setFocus(); | ||
118 | } | 128 | } |
119 | 129 | ||
@@ -184,2 +194,11 @@ void fileBrowser::OnCancel() | |||
184 | reject(); | 194 | reject(); |
185 | } | 195 | } |
196 | |||
197 | void fileBrowser::setHidden(bool _hidden) | ||
198 | { | ||
199 | if (_hidden) | ||
200 | filterspec = QDir::All | QDir::Hidden; | ||
201 | else | ||
202 | filterspec = QDir::All; | ||
203 | populateList(); | ||
204 | } | ||