-rw-r--r-- | noncore/apps/advancedfm/advancedfm.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp index 6f017b4..ec7a08a 100644 --- a/noncore/apps/advancedfm/advancedfm.cpp +++ b/noncore/apps/advancedfm/advancedfm.cpp | |||
@@ -200,197 +200,198 @@ void AdvancedFm::populateView() { | |||
200 | 200 | ||
201 | closedir(dir); | 201 | closedir(dir); |
202 | } | 202 | } |
203 | 203 | ||
204 | thisView->setSorting( 3,FALSE); | 204 | thisView->setSorting( 3,FALSE); |
205 | fillCombo( (const QString &) path ); | 205 | fillCombo( (const QString &) path ); |
206 | } | 206 | } |
207 | 207 | ||
208 | void AdvancedFm::rePopulate() { | 208 | void AdvancedFm::rePopulate() { |
209 | // qDebug("repopulate views"); | 209 | // qDebug("repopulate views"); |
210 | populateView(); | 210 | populateView(); |
211 | setOtherTabCurrent(); | 211 | setOtherTabCurrent(); |
212 | populateView(); | 212 | populateView(); |
213 | 213 | ||
214 | // int tmpTab = whichTab; | 214 | // int tmpTab = whichTab; |
215 | // // odebug << "" << tmpTab << "" << oendl; | 215 | // // odebug << "" << tmpTab << "" << oendl; |
216 | 216 | ||
217 | // for(int i =1; i < 3; i++) { | 217 | // for(int i =1; i < 3; i++) { |
218 | // TabWidget->setCurrentWidget(i - 1); | 218 | // TabWidget->setCurrentWidget(i - 1); |
219 | // populateView(); | 219 | // populateView(); |
220 | // } | 220 | // } |
221 | // TabWidget->setCurrentWidget( tmpTab - 1); | 221 | // TabWidget->setCurrentWidget( tmpTab - 1); |
222 | } | 222 | } |
223 | 223 | ||
224 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) { | 224 | void AdvancedFm::ListClicked(QListViewItem *selectedItem) { |
225 | // if ( TabWidget->currentWidget() == tab) | 225 | // if ( TabWidget->currentWidget() == tab) |
226 | // qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked local"); | 226 | // qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked local"); |
227 | // else | 227 | // else |
228 | // qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked remote"); | 228 | // qDebug("XXXXXXXXXXXXXXXXXXXXXXXX ListClicked remote"); |
229 | 229 | ||
230 | 230 | ||
231 | if(selectedItem) { | 231 | if(selectedItem) { |
232 | QString strItem=selectedItem->text(0); | 232 | QString strItem=selectedItem->text(0); |
233 | // owarn << strItem << oendl; | 233 | // owarn << strItem << oendl; |
234 | QString strSize=selectedItem->text(1); | 234 | QString strSize=selectedItem->text(1); |
235 | strSize=strSize.stripWhiteSpace(); | 235 | strSize=strSize.stripWhiteSpace(); |
236 | bool isDirectory = false; | 236 | bool isDirectory = false; |
237 | QString strItem2; | 237 | QString strItem2; |
238 | 238 | ||
239 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink | 239 | if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) {//if symlink |
240 | strItem2 = dealWithSymName((const QString&)strItem); | 240 | strItem2 = dealWithSymName((const QString&)strItem); |
241 | if(QDir(strItem2).exists() ) | 241 | if(QDir(strItem2).exists() ) |
242 | strItem = strItem2; | 242 | strItem = strItem2; |
243 | } | 243 | } |
244 | 244 | ||
245 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { | 245 | if( strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { |
246 | 246 | ||
247 | if(QDir(strItem).exists()) | 247 | if(QDir(strItem).exists()) |
248 | isDirectory = true; | 248 | isDirectory = true; |
249 | } | 249 | } |
250 | 250 | ||
251 | if( isDirectory ) { | 251 | if( isDirectory ) { |
252 | CurrentDir()->cd( strItem, TRUE); | 252 | CurrentDir()->cd( strItem, TRUE); |
253 | populateView(); | 253 | populateView(); |
254 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); | 254 | CurrentView()->ensureItemVisible( CurrentView()->firstChild()); |
255 | } | 255 | } |
256 | chdir( strItem.latin1()); | 256 | chdir( strItem.latin1()); |
257 | } | 257 | } |
258 | } | 258 | } |
259 | 259 | ||
260 | void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { | 260 | void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { |
261 | Q_UNUSED(item); | 261 | Q_UNUSED(item); |
262 | switch (mouse) { | 262 | switch (mouse) { |
263 | case 1: | 263 | case 1: |
264 | { | 264 | { |
265 | if(renameBox != 0 ) { | 265 | if(renameBox != 0 ) { |
266 | cancelRename(); | 266 | cancelRename(); |
267 | } | 267 | } |
268 | } | 268 | } |
269 | break; | 269 | break; |
270 | // case 2: | 270 | // case 2: |
271 | // menuTimer.start( 50, TRUE ); | 271 | // menuTimer.start( 50, TRUE ); |
272 | // break; | 272 | // break; |
273 | }; | 273 | }; |
274 | } | 274 | } |
275 | 275 | ||
276 | 276 | ||
277 | void AdvancedFm::refreshCurrentTab() { | 277 | void AdvancedFm::refreshCurrentTab() { |
278 | populateView(); | 278 | populateView(); |
279 | // if ( TabWidget->currentWidget() == tab) { | 279 | // if ( TabWidget->currentWidget() == tab) { |
280 | 280 | ||
281 | } | 281 | } |
282 | 282 | ||
283 | void AdvancedFm::switchToLocalTab() { | 283 | void AdvancedFm::switchToLocalTab() { |
284 | TabWidget->setCurrentWidget(0); | 284 | TabWidget->setCurrentWidget(0); |
285 | // Local_View->setFocus(); | 285 | // Local_View->setFocus(); |
286 | whichTab = 1; | 286 | whichTab = 1; |
287 | } | 287 | } |
288 | 288 | ||
289 | void AdvancedFm::switchToRemoteTab() { | 289 | void AdvancedFm::switchToRemoteTab() { |
290 | TabWidget->setCurrentWidget(1); | 290 | TabWidget->setCurrentWidget(1); |
291 | // Remote_View->setFocus(); | 291 | // Remote_View->setFocus(); |
292 | whichTab = 2; | 292 | whichTab = 2; |
293 | } | 293 | } |
294 | 294 | ||
295 | void AdvancedFm::currentPathComboChanged() { | 295 | void AdvancedFm::currentPathComboChanged() { |
296 | if(QDir( currentPathCombo->lineEdit()->text()).exists()) { | 296 | QString pDir = currentPathCombo->lineEdit()->text(); |
297 | CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); | 297 | if(QDir(pDir).exists()) { |
298 | CurrentDir()->setPath(pDir ); | ||
298 | populateView(); | 299 | populateView(); |
299 | } else { | 300 | } else { |
300 | QMessageBox::message(tr("Note"),tr("<p>That directory does not exist</p>")); | 301 | QMessageBox::message(tr("Note"),tr("<p>%1 does not exist</p>").arg(pDir)); |
301 | } | 302 | } |
302 | } | 303 | } |
303 | 304 | ||
304 | void AdvancedFm::fillCombo(const QString ¤tPath) { | 305 | void AdvancedFm::fillCombo(const QString ¤tPath) { |
305 | 306 | ||
306 | if ( TabWidget->currentWidget() == tab) { | 307 | if ( TabWidget->currentWidget() == tab) { |
307 | // if ( whichTab == 1) { | 308 | // if ( whichTab == 1) { |
308 | currentPathCombo->lineEdit()->setText( currentPath); | 309 | currentPathCombo->lineEdit()->setText( currentPath); |
309 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 310 | if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
310 | currentPathCombo->clear(); | 311 | currentPathCombo->clear(); |
311 | localDirPathStringList.prepend( currentPath ); | 312 | localDirPathStringList.prepend( currentPath ); |
312 | currentPathCombo->insertStringList( localDirPathStringList,-1); | 313 | currentPathCombo->insertStringList( localDirPathStringList,-1); |
313 | } | 314 | } |
314 | } else { | 315 | } else { |
315 | currentPathCombo->lineEdit()->setText( currentPath); | 316 | currentPathCombo->lineEdit()->setText( currentPath); |
316 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { | 317 | if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { |
317 | currentPathCombo->clear(); | 318 | currentPathCombo->clear(); |
318 | remoteDirPathStringList.prepend( currentPath ); | 319 | remoteDirPathStringList.prepend( currentPath ); |
319 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); | 320 | currentPathCombo->insertStringList( remoteDirPathStringList,-1); |
320 | } | 321 | } |
321 | } | 322 | } |
322 | } | 323 | } |
323 | 324 | ||
324 | QStringList AdvancedFm::getPath() { | 325 | QStringList AdvancedFm::getPath() { |
325 | QStringList strList; | 326 | QStringList strList; |
326 | QListView *thisView=CurrentView(); | 327 | QListView *thisView=CurrentView(); |
327 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); | 328 | QList<QListViewItem> * getSelectedItems( QListView * thisView ); |
328 | QListViewItemIterator it( thisView ); | 329 | QListViewItemIterator it( thisView ); |
329 | for ( ; it.current(); ++it ) { | 330 | for ( ; it.current(); ++it ) { |
330 | if ( it.current()->isSelected() ) { | 331 | if ( it.current()->isSelected() ) { |
331 | strList << it.current()->text(0); | 332 | strList << it.current()->text(0); |
332 | // odebug << it.current()->text(0) << oendl; | 333 | // odebug << it.current()->text(0) << oendl; |
333 | } | 334 | } |
334 | } | 335 | } |
335 | return strList; | 336 | return strList; |
336 | } | 337 | } |
337 | 338 | ||
338 | void AdvancedFm::changeTo(const QString dir) { | 339 | void AdvancedFm::changeTo(const QString dir) { |
339 | chdir( dir.latin1()); | 340 | chdir( dir.latin1()); |
340 | CurrentDir()->cd(dir, TRUE); | 341 | CurrentDir()->cd(dir, TRUE); |
341 | populateView(); | 342 | populateView(); |
342 | update(); | 343 | update(); |
343 | } | 344 | } |
344 | 345 | ||
345 | void AdvancedFm::homeButtonPushed() { | 346 | void AdvancedFm::homeButtonPushed() { |
346 | changeTo(QDir::homeDirPath()); | 347 | changeTo(QDir::homeDirPath()); |
347 | } | 348 | } |
348 | 349 | ||
349 | void AdvancedFm::docButtonPushed() { | 350 | void AdvancedFm::docButtonPushed() { |
350 | changeTo(QPEApplication::documentDir()); | 351 | changeTo(QPEApplication::documentDir()); |
351 | } | 352 | } |
352 | 353 | ||
353 | void AdvancedFm::SDButtonPushed() { | 354 | void AdvancedFm::SDButtonPushed() { |
354 | changeTo("/mnt/card");// this can change so fix | 355 | changeTo("/mnt/card");// this can change so fix |
355 | } | 356 | } |
356 | 357 | ||
357 | void AdvancedFm::CFButtonPushed() { | 358 | void AdvancedFm::CFButtonPushed() { |
358 | if(zaurusDevice) | 359 | if(zaurusDevice) |
359 | changeTo("/mnt/cf"); //zaurus | 360 | changeTo("/mnt/cf"); //zaurus |
360 | else | 361 | else |
361 | changeTo("/mnt/hda"); //ipaq | 362 | changeTo("/mnt/hda"); //ipaq |
362 | } | 363 | } |
363 | 364 | ||
364 | void AdvancedFm::QPEButtonPushed() { | 365 | void AdvancedFm::QPEButtonPushed() { |
365 | changeTo(QPEApplication::qpeDir()); | 366 | changeTo(QPEApplication::qpeDir()); |
366 | } | 367 | } |
367 | 368 | ||
368 | void AdvancedFm::doAbout() { | 369 | void AdvancedFm::doAbout() { |
369 | QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>")); | 370 | QMessageBox::message("AdvancedFm",tr("<P>Advanced FileManager is copyright 2002-2003 by L.J.Potter<llornkcor@handhelds.org> and is licensed by the GPL</P>")); |
370 | } | 371 | } |
371 | 372 | ||
372 | void AdvancedFm::keyPressEvent( QKeyEvent *e) { | 373 | void AdvancedFm::keyPressEvent( QKeyEvent *e) { |
373 | Q_UNUSED(e); | 374 | Q_UNUSED(e); |
374 | } | 375 | } |
375 | 376 | ||
376 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { | 377 | void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { |
377 | // if( CurrentView()->hasFocus() ) | 378 | // if( CurrentView()->hasFocus() ) |
378 | // e->ignore(); | 379 | // e->ignore(); |
379 | if( currentPathCombo->lineEdit()->hasFocus()) { | 380 | if( currentPathCombo->lineEdit()->hasFocus()) { |
380 | // qDebug("shout!"); | 381 | // qDebug("shout!"); |
381 | } | 382 | } |
382 | 383 | ||
383 | else if( e->key() == Key_Left ) | 384 | else if( e->key() == Key_Left ) |
384 | upDir(); | 385 | upDir(); |
385 | else if( e->key() == Key_Return || e->key() == Key_Enter) | 386 | else if( e->key() == Key_Return || e->key() == Key_Enter) |
386 | navigateToSelected(); | 387 | navigateToSelected(); |
387 | else if( e->key() == Key_Tab) | 388 | else if( e->key() == Key_Tab) |
388 | setOtherTabCurrent(); | 389 | setOtherTabCurrent(); |
389 | else if( e->key() == Key_Delete ) | 390 | else if( e->key() == Key_Delete ) |
390 | del(); | 391 | del(); |
391 | else if( e->key() == Key_A) | 392 | else if( e->key() == Key_A) |
392 | copyAs(); | 393 | copyAs(); |
393 | else if( e->key() == Key_C) | 394 | else if( e->key() == Key_C) |
394 | copy(); | 395 | copy(); |
395 | else if( e->key() == Key_E) | 396 | else if( e->key() == Key_E) |
396 | runThis(); | 397 | runThis(); |