Diffstat (limited to 'noncore/apps/opie-reader/fileBrowser.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/fileBrowser.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/apps/opie-reader/fileBrowser.cpp b/noncore/apps/opie-reader/fileBrowser.cpp index e1cde6c..72a1222 100644 --- a/noncore/apps/opie-reader/fileBrowser.cpp +++ b/noncore/apps/opie-reader/fileBrowser.cpp | |||
@@ -111,94 +111,94 @@ fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, boo | |||
111 | currentDir.setPath(QDir::currentDirPath()); | 111 | currentDir.setPath(QDir::currentDirPath()); |
112 | chdir(QDir::currentDirPath().latin1()); | 112 | chdir(QDir::currentDirPath().latin1()); |
113 | } | 113 | } |
114 | 114 | ||
115 | populateList(); | 115 | populateList(); |
116 | 116 | ||
117 | if (modal) | 117 | if (modal) |
118 | QPEApplication::showDialog( this ); | 118 | QPEApplication::showDialog( this ); |
119 | } | 119 | } |
120 | 120 | ||
121 | void fileBrowser::resizeEvent(QResizeEvent* e) | 121 | void fileBrowser::resizeEvent(QResizeEvent* e) |
122 | { | 122 | { |
123 | ListView->setColumnWidth(1,(ListView->width())/4); | 123 | ListView->setColumnWidth(1,(ListView->width())/4); |
124 | ListView->setColumnWidth(0,ListView->width()-20-ListView->columnWidth(1)); | 124 | ListView->setColumnWidth(0,ListView->width()-20-ListView->columnWidth(1)); |
125 | } | 125 | } |
126 | 126 | ||
127 | fileBrowser::~fileBrowser() | 127 | fileBrowser::~fileBrowser() |
128 | { | 128 | { |
129 | } | 129 | } |
130 | 130 | ||
131 | 131 | ||
132 | void fileBrowser::populateList() | 132 | void fileBrowser::populateList() |
133 | { | 133 | { |
134 | ListView->clear(); | 134 | ListView->clear(); |
135 | ////qDebug(currentDir.canonicalPath()); | 135 | ////odebug << currentDir.canonicalPath() << oendl; |
136 | // currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks ); | 136 | // currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks ); |
137 | currentDir.setFilter( filterspec ); | 137 | currentDir.setFilter( filterspec ); |
138 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 138 | currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
139 | currentDir.setMatchAllDirs(TRUE); | 139 | currentDir.setMatchAllDirs(TRUE); |
140 | 140 | ||
141 | currentDir.setNameFilter(filterStr); | 141 | currentDir.setNameFilter(filterStr); |
142 | // currentDir.setNameFilter("*.txt;*.etx"); | 142 | // currentDir.setNameFilter("*.txt;*.etx"); |
143 | QString fileL, fileS; | 143 | QString fileL, fileS; |
144 | const QFileInfoList *list = currentDir.entryInfoList(); | 144 | const QFileInfoList *list = currentDir.entryInfoList(); |
145 | QFileInfoListIterator it(*list); | 145 | QFileInfoListIterator it(*list); |
146 | QFileInfo *fi; | 146 | QFileInfo *fi; |
147 | while ( (fi=it.current()) ) | 147 | while ( (fi=it.current()) ) |
148 | { | 148 | { |
149 | if (fi->fileName() != ".") | 149 | if (fi->fileName() != ".") |
150 | { | 150 | { |
151 | fileS.sprintf( "%10li", fi->size() ); | 151 | fileS.sprintf( "%10li", fi->size() ); |
152 | fileL.sprintf( "%s",fi->fileName().data() ); | 152 | fileL.sprintf( "%s",fi->fileName().data() ); |
153 | if( fi->isDir() ) | 153 | if( fi->isDir() ) |
154 | { | 154 | { |
155 | fileL+="/"; | 155 | fileL+="/"; |
156 | } | 156 | } |
157 | else | 157 | else |
158 | { | 158 | { |
159 | //// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); | 159 | //// odebug << "Not a dir: "+currentDir.canonicalPath()+fileL << oendl; |
160 | } | 160 | } |
161 | new QListViewItem( ListView,fileL,fileS ); | 161 | new QListViewItem( ListView,fileL,fileS ); |
162 | } | 162 | } |
163 | ++it; | 163 | ++it; |
164 | } | 164 | } |
165 | ListView->setSorting( 2, FALSE); | 165 | ListView->setSorting( 2, FALSE); |
166 | dirLabel->setText("Current Directory:\n"+currentDir.canonicalPath()); | 166 | dirLabel->setText("Current Directory:\n"+currentDir.canonicalPath()); |
167 | ListView->setFocus(); | 167 | ListView->setFocus(); |
168 | } | 168 | } |
169 | 169 | ||
170 | void fileBrowser::upDir() | 170 | void fileBrowser::upDir() |
171 | { | 171 | { |
172 | //// qDebug(currentDir.canonicalPath()); | 172 | //// odebug << currentDir.canonicalPath() << oendl; |
173 | } | 173 | } |
174 | 174 | ||
175 | void fileBrowser::listClicked(QListViewItem *selectedItem) | 175 | void fileBrowser::listClicked(QListViewItem *selectedItem) |
176 | { | 176 | { |
177 | if (selectedItem == NULL) return; | 177 | if (selectedItem == NULL) return; |
178 | QString strItem=selectedItem->text(0); | 178 | QString strItem=selectedItem->text(0); |
179 | 179 | ||
180 | //// qDebug("%s", (const char*)strItem); | 180 | //// odebug << "" << strItem << "" << oendl; |
181 | 181 | ||
182 | 182 | ||
183 | QString strSize=selectedItem->text(1); | 183 | QString strSize=selectedItem->text(1); |
184 | 184 | ||
185 | strSize.stripWhiteSpace(); | 185 | strSize.stripWhiteSpace(); |
186 | 186 | ||
187 | bool ok; | 187 | bool ok; |
188 | 188 | ||
189 | QFileInfo fi(strItem); | 189 | QFileInfo fi(strItem); |
190 | while (fi.isSymLink()) fi.setFile(fi.readLink()); | 190 | while (fi.isSymLink()) fi.setFile(fi.readLink()); |
191 | if (fi.isDir()) | 191 | if (fi.isDir()) |
192 | { | 192 | { |
193 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); | 193 | strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); |
194 | 194 | ||
195 | if(QDir(strItem).exists()) | 195 | if(QDir(strItem).exists()) |
196 | { | 196 | { |
197 | currentDir.cd(strItem, TRUE); | 197 | currentDir.cd(strItem, TRUE); |
198 | populateList(); | 198 | populateList(); |
199 | } | 199 | } |
200 | } else | 200 | } else |
201 | { | 201 | { |
202 | QListViewItem *selectedItem = ListView->selectedItem(); | 202 | QListViewItem *selectedItem = ListView->selectedItem(); |
203 | if (selectedItem == NULL) | 203 | if (selectedItem == NULL) |
204 | { | 204 | { |