Diffstat (limited to 'noncore/apps/opie-reader/fileBrowser.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/fileBrowser.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/noncore/apps/opie-reader/fileBrowser.cpp b/noncore/apps/opie-reader/fileBrowser.cpp index 9cd371d..05f2c31 100644 --- a/noncore/apps/opie-reader/fileBrowser.cpp +++ b/noncore/apps/opie-reader/fileBrowser.cpp | |||
@@ -1,48 +1,50 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | 2 | ||
3 | Derived from a file browser which was | 3 | Derived from a file browser which was |
4 | 4 | ||
5 | ** copyright 2001 ljp ljp@llornkcor.com | 5 | ** copyright 2001 ljp ljp@llornkcor.com |
6 | 6 | ||
7 | Extensive modification by Tim Wentford to allow it to work in rotated mode | 7 | Extensive modification by Tim Wentford to allow it to work in rotated mode |
8 | 8 | ||
9 | ****************************************************************************/ | 9 | ****************************************************************************/ |
10 | #include "fileBrowser.h" | 10 | #include "fileBrowser.h" |
11 | 11 | ||
12 | #include "QtrListView.h" | 12 | #include "QtrListView.h" |
13 | #include <qlineedit.h> | 13 | #include <qlineedit.h> |
14 | #include <qpushbutton.h> | 14 | #include <qpushbutton.h> |
15 | #include <qfile.h> | 15 | #include <qfile.h> |
16 | #include <qmessagebox.h> | 16 | #include <qmessagebox.h> |
17 | #ifndef _WINDOWS | 17 | #ifndef _WINDOWS |
18 | #include <unistd.h> | 18 | #include <unistd.h> |
19 | #endif | 19 | #endif |
20 | #include <qlayout.h> | 20 | #include <qlayout.h> |
21 | #ifdef _WINDOWS | 21 | #ifdef _WINDOWS |
22 | #include <direct.h> | 22 | #include <direct.h> |
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | #include <qpe/qpeapplication.h> | ||
26 | |||
25 | #include "opie.h" | 27 | #include "opie.h" |
26 | 28 | ||
27 | fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter, const QString iPath ) | 29 | fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter, const QString iPath ) |
28 | : QDialog( parent, name, true, | 30 | : QDialog( parent, name, true, |
29 | fl/* | WStyle_Customize | WStyle_Tool*/), | 31 | fl/* | WStyle_Customize | WStyle_Tool*/), |
30 | filterspec(QDir::All) | 32 | filterspec(QDir::All) |
31 | { | 33 | { |
32 | // showMaximized(); | 34 | // showMaximized(); |
33 | if ( !name ) | 35 | if ( !name ) |
34 | setName( "fileBrowser" ); | 36 | setName( "fileBrowser" ); |
35 | /* | 37 | /* |
36 | if (parent != NULL) | 38 | if (parent != NULL) |
37 | { | 39 | { |
38 | #ifdef OPIE | 40 | #ifdef OPIE |
39 | move(0,0); | 41 | move(0,0); |
40 | resize( parent->width(), parent->height() ); | 42 | resize( parent->width(), parent->height() ); |
41 | #else | 43 | #else |
42 | setGeometry(parent->x(), parent->y(), parent->width(), parent->height() ); | 44 | setGeometry(parent->x(), parent->y(), parent->width(), parent->height() ); |
43 | #endif | 45 | #endif |
44 | } | 46 | } |
45 | */ | 47 | */ |
46 | // showFullScreen(); | 48 | // showFullScreen(); |
47 | setCaption(tr( "Browse for file" ) ); | 49 | setCaption(tr( "Browse for file" ) ); |
48 | filterStr=filter; | 50 | filterStr=filter; |
@@ -94,49 +96,50 @@ fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, boo | |||
94 | connect( m_filename, SIGNAL( returnPressed() ), this, SLOT( onReturn() )); | 96 | connect( m_filename, SIGNAL( returnPressed() ), this, SLOT( onReturn() )); |
95 | } | 97 | } |
96 | else | 98 | else |
97 | { | 99 | { |
98 | m_filename = NULL; | 100 | m_filename = NULL; |
99 | } | 101 | } |
100 | 102 | ||
101 | if (QFileInfo(iPath).exists()) | 103 | if (QFileInfo(iPath).exists()) |
102 | { | 104 | { |
103 | currentDir.setPath(iPath); | 105 | currentDir.setPath(iPath); |
104 | #ifdef _WINDOWS | 106 | #ifdef _WINDOWS |
105 | _chdir(iPath.latin1()); | 107 | _chdir(iPath.latin1()); |
106 | #else | 108 | #else |
107 | chdir(iPath.latin1()); | 109 | chdir(iPath.latin1()); |
108 | #endif | 110 | #endif |
109 | } | 111 | } |
110 | else | 112 | else |
111 | { | 113 | { |
112 | currentDir.setPath(QDir::currentDirPath()); | 114 | currentDir.setPath(QDir::currentDirPath()); |
113 | chdir(QDir::currentDirPath().latin1()); | 115 | chdir(QDir::currentDirPath().latin1()); |
114 | } | 116 | } |
115 | 117 | ||
116 | populateList(); | 118 | populateList(); |
117 | 119 | ||
118 | if (modal) showMaximized(); | 120 | if (modal) |
121 | QPEApplication::showDialog( this ); | ||
119 | } | 122 | } |
120 | 123 | ||
121 | void fileBrowser::resizeEvent(QResizeEvent* e) | 124 | void fileBrowser::resizeEvent(QResizeEvent* e) |
122 | { | 125 | { |
123 | ListView->setColumnWidth(1,(ListView->width())/4); | 126 | ListView->setColumnWidth(1,(ListView->width())/4); |
124 | ListView->setColumnWidth(0,ListView->width()-20-ListView->columnWidth(1)); | 127 | ListView->setColumnWidth(0,ListView->width()-20-ListView->columnWidth(1)); |
125 | } | 128 | } |
126 | 129 | ||
127 | fileBrowser::~fileBrowser() | 130 | fileBrowser::~fileBrowser() |
128 | { | 131 | { |
129 | } | 132 | } |
130 | 133 | ||
131 | 134 | ||
132 | void fileBrowser::populateList() | 135 | void fileBrowser::populateList() |
133 | { | 136 | { |
134 | ListView->clear(); | 137 | ListView->clear(); |
135 | ////qDebug(currentDir.canonicalPath()); | 138 | ////qDebug(currentDir.canonicalPath()); |
136 | // currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks ); | 139 | // currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks ); |
137 | currentDir.setFilter( filterspec ); | 140 | currentDir.setFilter( filterspec ); |
138 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 141 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
139 | currentDir.setMatchAllDirs(TRUE); | 142 | currentDir.setMatchAllDirs(TRUE); |
140 | 143 | ||
141 | currentDir.setNameFilter(filterStr); | 144 | currentDir.setNameFilter(filterStr); |
142 | // currentDir.setNameFilter("*.txt;*.etx"); | 145 | // currentDir.setNameFilter("*.txt;*.etx"); |