summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-09-25 05:01:41 (UTC)
committer llornkcor <llornkcor>2004-09-25 05:01:41 (UTC)
commit45a59fcd4a35c9c0ce35162c0ac7a5c914e24a52 (patch) (unidiff)
tree99fd7480b1825b8eb956f40f163aa3fc20cfc6cf
parent06073d16f0dd3fb332af60467bb90480e21ebc28 (diff)
downloadopie-45a59fcd4a35c9c0ce35162c0ac7a5c914e24a52.zip
opie-45a59fcd4a35c9c0ce35162c0ac7a5c914e24a52.tar.gz
opie-45a59fcd4a35c9c0ce35162c0ac7a5c914e24a52.tar.bz2
redunancy
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/advancedfm/advancedfm.cpp31
-rw-r--r--noncore/apps/advancedfm/advancedfm.h1
2 files changed, 4 insertions, 28 deletions
diff --git a/noncore/apps/advancedfm/advancedfm.cpp b/noncore/apps/advancedfm/advancedfm.cpp
index 3bfec7d..3cd2067 100644
--- a/noncore/apps/advancedfm/advancedfm.cpp
+++ b/noncore/apps/advancedfm/advancedfm.cpp
@@ -217,257 +217,257 @@ void AdvancedFm::rePopulate() {
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
224void AdvancedFm::ListClicked(QListViewItem *selectedItem) { 224void 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
260void AdvancedFm::ListPressed( int mouse, QListViewItem *item, const QPoint& , int ) { 260void 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
277void AdvancedFm::refreshCurrentTab() { 277void AdvancedFm::refreshCurrentTab() {
278 populateView(); 278 populateView();
279 // if ( TabWidget->currentWidget() == tab) { 279 // if ( TabWidget->currentWidget() == tab) {
280 280
281} 281}
282 282
283void AdvancedFm::switchToLocalTab() { 283void 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
289void AdvancedFm::switchToRemoteTab() { 289void 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
295void AdvancedFm::currentPathComboChanged() { 295void AdvancedFm::currentPathComboChanged() {
296 if(QDir( currentPathCombo->lineEdit()->text()).exists()) { 296 if(QDir( currentPathCombo->lineEdit()->text()).exists()) {
297 CurrentDir()->setPath( currentPathCombo->lineEdit()->text() ); 297 CurrentDir()->setPath( currentPathCombo->lineEdit()->text() );
298 populateView(); 298 populateView();
299 } else { 299 } else {
300 QMessageBox::message(tr("Note"),tr("That directory does not exist")); 300 QMessageBox::message(tr("Note"),tr("That directory does not exist"));
301 } 301 }
302} 302}
303 303
304void AdvancedFm::fillCombo(const QString &currentPath) { 304void AdvancedFm::fillCombo(const QString &currentPath) {
305 305
306 if ( TabWidget->currentWidget() == tab) { 306 if ( TabWidget->currentWidget() == tab) {
307// if ( whichTab == 1) { 307// if ( whichTab == 1) {
308 currentPathCombo->lineEdit()->setText( currentPath); 308 currentPathCombo->lineEdit()->setText( currentPath);
309 if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 309 if( localDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
310 currentPathCombo->clear(); 310 currentPathCombo->clear();
311 localDirPathStringList.prepend( currentPath ); 311 localDirPathStringList.prepend( currentPath );
312 currentPathCombo->insertStringList( localDirPathStringList,-1); 312 currentPathCombo->insertStringList( localDirPathStringList,-1);
313 } 313 }
314 } else { 314 } else {
315 currentPathCombo->lineEdit()->setText( currentPath); 315 currentPathCombo->lineEdit()->setText( currentPath);
316 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) { 316 if( remoteDirPathStringList.grep( currentPath,TRUE).isEmpty() ) {
317 currentPathCombo->clear(); 317 currentPathCombo->clear();
318 remoteDirPathStringList.prepend( currentPath ); 318 remoteDirPathStringList.prepend( currentPath );
319 currentPathCombo->insertStringList( remoteDirPathStringList,-1); 319 currentPathCombo->insertStringList( remoteDirPathStringList,-1);
320 } 320 }
321 } 321 }
322} 322}
323 323
324void AdvancedFm::currentPathComboActivated(const QString & currentPath) { 324void AdvancedFm::currentPathComboActivated(const QString & currentPath) {
325 chdir( currentPath.latin1() ); 325 chdir( currentPath.latin1() );
326 CurrentDir()->cd( currentPath, TRUE); 326 CurrentDir()->cd( currentPath, TRUE);
327 populateView(); 327 populateView();
328 update(); 328 update();
329} 329}
330 330
331QStringList AdvancedFm::getPath() { 331QStringList AdvancedFm::getPath() {
332 QStringList strList; 332 QStringList strList;
333 QListView *thisView=CurrentView(); 333 QListView *thisView=CurrentView();
334 QList<QListViewItem> * getSelectedItems( QListView * thisView ); 334 QList<QListViewItem> * getSelectedItems( QListView * thisView );
335 QListViewItemIterator it( thisView ); 335 QListViewItemIterator it( thisView );
336 for ( ; it.current(); ++it ) { 336 for ( ; it.current(); ++it ) {
337 if ( it.current()->isSelected() ) { 337 if ( it.current()->isSelected() ) {
338 strList << it.current()->text(0); 338 strList << it.current()->text(0);
339// odebug << it.current()->text(0) << oendl; 339// odebug << it.current()->text(0) << oendl;
340 } 340 }
341 } 341 }
342 return strList; 342 return strList;
343} 343}
344 344
345void AdvancedFm::changeTo(QString dir) { 345void AdvancedFm::changeTo(const QString dir) {
346 chdir( dir.latin1()); 346 chdir( dir.latin1());
347 CurrentDir()->cd(dir, TRUE); 347 CurrentDir()->cd(dir, TRUE);
348 populateView(); 348 populateView();
349 update(); 349 update();
350} 350}
351 351
352void AdvancedFm::homeButtonPushed() { 352void AdvancedFm::homeButtonPushed() {
353 changeTo(QDir::homeDirPath()); 353 changeTo(QDir::homeDirPath());
354} 354}
355 355
356void AdvancedFm::docButtonPushed() { 356void AdvancedFm::docButtonPushed() {
357 changeTo(QPEApplication::documentDir()); 357 changeTo(QPEApplication::documentDir());
358} 358}
359 359
360void AdvancedFm::SDButtonPushed() { 360void AdvancedFm::SDButtonPushed() {
361 changeTo("/mnt/card");// this can change so fix 361 changeTo("/mnt/card");// this can change so fix
362} 362}
363 363
364void AdvancedFm::CFButtonPushed() { 364void AdvancedFm::CFButtonPushed() {
365 if(zaurusDevice) 365 if(zaurusDevice)
366 changeTo("/mnt/cf"); //zaurus 366 changeTo("/mnt/cf"); //zaurus
367 else 367 else
368 changeTo("/mnt/hda"); //ipaq 368 changeTo("/mnt/hda"); //ipaq
369} 369}
370 370
371void AdvancedFm::QPEButtonPushed() { 371void AdvancedFm::QPEButtonPushed() {
372 changeTo(QPEApplication::qpeDir()); 372 changeTo(QPEApplication::qpeDir());
373} 373}
374 374
375void AdvancedFm::doAbout() { 375void AdvancedFm::doAbout() {
376 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>")); 376 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>"));
377} 377}
378 378
379void AdvancedFm::keyPressEvent( QKeyEvent *e) { 379void AdvancedFm::keyPressEvent( QKeyEvent *e) {
380 Q_UNUSED(e); 380 Q_UNUSED(e);
381} 381}
382 382
383void AdvancedFm::keyReleaseEvent( QKeyEvent *e) { 383void AdvancedFm::keyReleaseEvent( QKeyEvent *e) {
384 if( CurrentView()->hasFocus() ) 384 if( CurrentView()->hasFocus() )
385 e->ignore(); 385 e->ignore();
386 if( e->key() == Key_Left ) 386 if( e->key() == Key_Left )
387 upDir(); 387 upDir();
388 else if( e->key() == Key_Return || e->key() == Key_Enter) 388 else if( e->key() == Key_Return || e->key() == Key_Enter)
389 navigateToSelected(); 389 navigateToSelected();
390 else if( e->key() == Key_Tab) 390 else if( e->key() == Key_Tab)
391 setOtherTabCurrent(); 391 setOtherTabCurrent();
392 else if( e->key() == Key_Delete ) 392 else if( e->key() == Key_Delete )
393 del(); 393 del();
394 else if( e->key() == Key_A) 394 else if( e->key() == Key_A)
395 copyAs(); 395 copyAs();
396 else if( e->key() == Key_C) 396 else if( e->key() == Key_C)
397 copy(); 397 copy();
398 else if( e->key() == Key_E) 398 else if( e->key() == Key_E)
399 runThis(); 399 runThis();
400 else if( e->key() == Key_G) 400 else if( e->key() == Key_G)
401 currentPathCombo->lineEdit()->setFocus(); 401 currentPathCombo->lineEdit()->setFocus();
402 else if( e->key() == Key_H ) 402 else if( e->key() == Key_H )
403 showHidden(); 403 showHidden();
404 else if( e->key() == Key_I) 404 else if( e->key() == Key_I)
405 fileStatus(); 405 fileStatus();
406 else if( e->key() == Key_M) 406 else if( e->key() == Key_M)
407 move(); 407 move();
408 else if( e->key() == Key_N ) 408 else if( e->key() == Key_N )
409 mkDir(); 409 mkDir();
410 else if( e->key() == Key_P) 410 else if( e->key() == Key_P)
411 filePerms(); 411 filePerms();
412 else if( e->key() == Key_R ) 412 else if( e->key() == Key_R )
413 rn(); 413 rn();
414 else if( e->key() == Key_U ) 414 else if( e->key() == Key_U )
415 upDir(); 415 upDir();
416 else if( e->key() == Key_1) 416 else if( e->key() == Key_1)
417 switchToLocalTab(); 417 switchToLocalTab();
418 else if( e->key() == Key_2) 418 else if( e->key() == Key_2)
419 switchToRemoteTab(); 419 switchToRemoteTab();
420 else if( e->key() == Key_3) 420 else if( e->key() == Key_3)
421 CFButtonPushed(); 421 CFButtonPushed();
422 else if( e->key() == Key_4) 422 else if( e->key() == Key_4)
423 SDButtonPushed(); 423 SDButtonPushed();
424 else if( e->key() == Key_5 ) 424 else if( e->key() == Key_5 )
425 homeButtonPushed(); 425 homeButtonPushed();
426 else if( e->key() == Key_6 ) 426 else if( e->key() == Key_6 )
427 docButtonPushed(); 427 docButtonPushed();
428 else 428 else
429 e->accept(); 429 e->accept();
430} 430}
431 431
432 432
433void AdvancedFm::parsetab(const QString &fileName) { 433void AdvancedFm::parsetab(const QString &fileName) {
434 434
435 fileSystemTypeList.clear(); 435 fileSystemTypeList.clear();
436 fsList.clear(); 436 fsList.clear();
437 struct mntent *me; 437 struct mntent *me;
438 FILE *mntfp = setmntent( fileName.latin1(), "r" ); 438 FILE *mntfp = setmntent( fileName.latin1(), "r" );
439 if ( mntfp ) { 439 if ( mntfp ) {
440 while ( (me = getmntent( mntfp )) != 0 ) { 440 while ( (me = getmntent( mntfp )) != 0 ) {
441 QString deviceName = me->mnt_fsname; 441 QString deviceName = me->mnt_fsname;
442 QString filesystemType = me->mnt_type; 442 QString filesystemType = me->mnt_type;
443 QString mountDir = me->mnt_dir; 443 QString mountDir = me->mnt_dir;
444 if(deviceName != "none") { 444 if(deviceName != "none") {
445 if( fsList.contains(filesystemType) == 0 445 if( fsList.contains(filesystemType) == 0
446 & filesystemType.find("proc",0,TRUE) == -1 446 & filesystemType.find("proc",0,TRUE) == -1
447 & filesystemType.find("cramfs",0,TRUE) == -1 447 & filesystemType.find("cramfs",0,TRUE) == -1
448 & filesystemType.find("auto",0,TRUE) == -1) 448 & filesystemType.find("auto",0,TRUE) == -1)
449 fsList << filesystemType; 449 fsList << filesystemType;
450 fileSystemTypeList << mountDir+"::"+filesystemType; 450 fileSystemTypeList << mountDir+"::"+filesystemType;
451 } 451 }
452 } 452 }
453 } 453 }
454 endmntent( mntfp ); 454 endmntent( mntfp );
455} 455}
456 456
457QString AdvancedFm::getFileSystemType(const QString &currentText) { 457QString AdvancedFm::getFileSystemType(const QString &currentText) {
458 parsetab("/etc/mtab"); //why did TT forget filesystem type? 458 parsetab("/etc/mtab"); //why did TT forget filesystem type?
459 QString current = currentText;//.right( currentText.length()-1); 459 QString current = currentText;//.right( currentText.length()-1);
460 QString baseFs; 460 QString baseFs;
461 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { 461 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) {
462 QString temp = (*it); 462 QString temp = (*it);
463 QString path = temp.left(temp.find("::",0,TRUE) ); 463 QString path = temp.left(temp.find("::",0,TRUE) );
464 path = path.right( path.length()-1); 464 path = path.right( path.length()-1);
465 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 465 if(path.isEmpty()) baseFs = temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
466 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) { 466 if( current.find( path,0,TRUE) != -1 && !path.isEmpty()) {
467 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 467 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
468 } 468 }
469 } 469 }
470 return baseFs; 470 return baseFs;
471} 471}
472 472
473QString AdvancedFm::getDiskSpace( const QString &path) { 473QString AdvancedFm::getDiskSpace( const QString &path) {
@@ -574,250 +574,227 @@ QString AdvancedFm::checkDiskSpace(const QString &path) {
574 574
575void AdvancedFm::addToDocs() { 575void AdvancedFm::addToDocs() {
576 QStringList strListPaths = getPath(); 576 QStringList strListPaths = getPath();
577 QDir *thisDir = CurrentDir(); 577 QDir *thisDir = CurrentDir();
578 578
579 if( strListPaths.count() > 0) { 579 if( strListPaths.count() > 0) {
580 QString curFile; 580 QString curFile;
581 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) { 581 for ( QStringList::Iterator it = strListPaths.begin(); it != strListPaths.end(); ++it ) {
582 curFile = thisDir->canonicalPath()+"/"+(*it); 582 curFile = thisDir->canonicalPath()+"/"+(*it);
583// odebug << curFile << oendl; 583// odebug << curFile << oendl;
584 QFileInfo fi(curFile); 584 QFileInfo fi(curFile);
585 DocLnk f; 585 DocLnk f;
586// curFile.replace(QRegExp("\\..*"),""); 586// curFile.replace(QRegExp("\\..*"),"");
587 f.setName(fi.baseName() ); 587 f.setName(fi.baseName() );
588 f.setFile( curFile); 588 f.setFile( curFile);
589 f.writeLink(); 589 f.writeLink();
590 } 590 }
591 } 591 }
592} 592}
593 593
594 594
595void AdvancedFm::customDirsToMenu() { 595void AdvancedFm::customDirsToMenu() {
596 596
597 Config cfg("AdvancedFm"); 597 Config cfg("AdvancedFm");
598 cfg.setGroup("Menu"); 598 cfg.setGroup("Menu");
599 599
600 QStringList list = cfg.readListEntry( "CustomDir", ','); 600 QStringList list = cfg.readListEntry( "CustomDir", ',');
601 menuButton->insertItems(list ); 601 menuButton->insertItems(list );
602 602
603// for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) 603// for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
604// { 604// {
605// customDirMenu->insertItem(*it ); 605// customDirMenu->insertItem(*it );
606// } 606// }
607} 607}
608 608
609void AdvancedFm::dirMenuSelected(int item) { 609void AdvancedFm::dirMenuSelected(int item) {
610 switch(item) 610 switch(item)
611 { 611 {
612 612
613 case -21: 613 case -21:
614 case 0: 614 case 0:
615 addCustomDir(); 615 addCustomDir();
616 break; 616 break;
617 case -22: 617 case -22:
618 case 1: 618 case 1:
619 removeCustomDir(); 619 removeCustomDir();
620 break; 620 break;
621 default: 621 default:
622 { 622 {
623// gotoCustomDir( menuButton->text(item)); 623// gotoCustomDir( menuButton->text(item));
624// gotoCustomDir( customDirMenu->text(item)); 624// gotoCustomDir( customDirMenu->text(item));
625 } 625 }
626 break; 626 break;
627 627
628 }; 628 };
629} 629}
630 630
631void AdvancedFm::addCustomDir() { 631void AdvancedFm::addCustomDir() {
632 Config cfg("AdvancedFm"); 632 Config cfg("AdvancedFm");
633 cfg.setGroup("Menu"); 633 cfg.setGroup("Menu");
634 QString dir; 634 QString dir;
635 QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); 635 QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)',');
636 636
637 dir = CurrentDir()->canonicalPath(); 637 dir = CurrentDir()->canonicalPath();
638 638
639 bool addIt=true; 639 bool addIt=true;
640 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { 640 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
641 if( dir == (*it)) { 641 if( dir == (*it)) {
642 addIt=false; 642 addIt=false;
643 } 643 }
644 } 644 }
645 if(addIt) { 645 if(addIt) {
646 menuButton->insertItem(dir); 646 menuButton->insertItem(dir);
647// customDirMenu->insertItem(dir); 647// customDirMenu->insertItem(dir);
648 list << dir; 648 list << dir;
649 } 649 }
650 650
651 cfg.writeEntry("CustomDir", list, ','); 651 cfg.writeEntry("CustomDir", list, ',');
652 cfg.write(); 652 cfg.write();
653} 653}
654 654
655void AdvancedFm::removeCustomDir() { 655void AdvancedFm::removeCustomDir() {
656// odebug << "remove custom dir" << oendl; 656// odebug << "remove custom dir" << oendl;
657 Config cfg("AdvancedFm"); 657 Config cfg("AdvancedFm");
658 cfg.setGroup("Menu"); 658 cfg.setGroup("Menu");
659 QString dir; 659 QString dir;
660 QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)','); 660 QStringList list = cfg.readListEntry( (const QString &)"CustomDir", (const QChar)',');
661 QStringList list2; 661 QStringList list2;
662 dir = CurrentDir()->canonicalPath(); 662 dir = CurrentDir()->canonicalPath();
663 int ramble=2; 663 int ramble=2;
664// int ramble=-24; 664// int ramble=-24;
665//first remove list 665//first remove list
666 if(list.grep(dir,true).isEmpty()) { 666 if(list.grep(dir,true).isEmpty()) {
667 QMessageBox::message(tr( "AdvancedFm" ), 667 QMessageBox::message(tr( "AdvancedFm" ),
668 tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!")); 668 tr("Cannot remove current directory\nfrom bookmarks.\nIt is not bookmarked!"));
669 } else { 669 } else {
670 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { 670 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
671 if((*it) != dir) { 671 if((*it) != dir) {
672//current item is not our current dir, so add it to temp list 672//current item is not our current dir, so add it to temp list
673 list2 <<(*it); 673 list2 <<(*it);
674 } else { 674 } else {
675// customDirMenu->removeItem( ramble); 675// customDirMenu->removeItem( ramble);
676 menuButton->remove( ramble); 676 menuButton->remove( ramble);
677 677
678 } 678 }
679 ramble++; 679 ramble++;
680// ramble--; 680// ramble--;
681 } 681 }
682 682
683 cfg.writeEntry("CustomDir", list2, ','); 683 cfg.writeEntry("CustomDir", list2, ',');
684 cfg.write(); 684 cfg.write();
685 } 685 }
686// customDirsToMenu(); 686// customDirsToMenu();
687 687
688} 688}
689 689
690void AdvancedFm::gotoCustomDir(const QString &dir) { 690void AdvancedFm::gotoCustomDir(const QString &dir) {
691// odebug << "gotoCustomDir(const QString &dir) " +dir << oendl; 691// odebug << "gotoCustomDir(const QString &dir) " +dir << oendl;
692// QString curDir = dir; 692// QString curDir = dir;
693// QDir *thisDir = CurrentDir(); 693// QDir *thisDir = CurrentDir();
694// if( curDir.isEmpty()) { 694// if( curDir.isEmpty()) {
695// } 695// }
696 if( dir == s_addBookmark) { 696 if( dir == s_addBookmark) {
697 addCustomDir(); 697 addCustomDir();
698 } 698 }
699 if( dir == s_removeBookmark) { 699 if( dir == s_removeBookmark) {
700 removeCustomDir( ); 700 removeCustomDir( );
701 } else { 701 } else {
702 gotoDirectory( dir); 702 changeTo( dir);
703// if(QDir( curDir).exists() ) 703// if(QDir( curDir).exists() )
704// { 704// {
705// thisDir->setPath( curDir ); 705// thisDir->setPath( curDir );
706// chdir( curDir.latin1() ); 706// chdir( curDir.latin1() );
707// thisDir->cd( curDir, TRUE); 707// thisDir->cd( curDir, TRUE);
708// populateView(); 708// populateView();
709// } 709// }
710 } 710 }
711} 711}
712 712
713QDir *AdvancedFm::CurrentDir() { 713QDir *AdvancedFm::CurrentDir() {
714 if ( whichTab == 1) { 714 if ( whichTab == 1) {
715 // qDebug("CurrentTab is Local"); 715 // qDebug("CurrentTab is Local");
716 return &currentDir; 716 return &currentDir;
717 } else { 717 } else {
718 // qDebug("CurrentTab is Remote"); 718 // qDebug("CurrentTab is Remote");
719 return &currentRemoteDir; 719 return &currentRemoteDir;
720 } 720 }
721} 721}
722 722
723QDir *AdvancedFm::OtherDir() { 723QDir *AdvancedFm::OtherDir() {
724 // if ( TabWidget->currentWidget() == tab) { 724 // if ( TabWidget->currentWidget() == tab) {
725 if ( whichTab == 1) { 725 if ( whichTab == 1) {
726 return &currentRemoteDir; 726 return &currentRemoteDir;
727 } else { 727 } else {
728 return &currentDir; 728 return &currentDir;
729 } 729 }
730} 730}
731 731
732QListView * AdvancedFm::CurrentView() { 732QListView * AdvancedFm::CurrentView() {
733 // if ( TabWidget->currentWidget() == tab) { 733 // if ( TabWidget->currentWidget() == tab) {
734 if ( whichTab == 1) { 734 if ( whichTab == 1) {
735 // qDebug("CurrentView: local"); 735 // qDebug("CurrentView: local");
736 return Local_View; 736 return Local_View;
737 } else { 737 } else {
738// owarn << "CurrentView Tab 2" << oendl; 738// owarn << "CurrentView Tab 2" << oendl;
739 // qDebug("CurrentView: remote"); 739 // qDebug("CurrentView: remote");
740 return Remote_View; 740 return Remote_View;
741 } 741 }
742} 742}
743 743
744QListView * AdvancedFm::OtherView() { 744QListView * AdvancedFm::OtherView() {
745 if ( whichTab == 1) 745 if ( whichTab == 1)
746 return Remote_View; 746 return Remote_View;
747 else 747 else
748 return Local_View; 748 return Local_View;
749} 749}
750 750
751void AdvancedFm::setOtherTabCurrent() { 751void AdvancedFm::setOtherTabCurrent() {
752 // qDebug("setOtherTabCurrent() %d",whichTab); 752 // qDebug("setOtherTabCurrent() %d",whichTab);
753 if ( whichTab == 1) { 753 if ( whichTab == 1) {
754 TabWidget->setCurrentWidget(1); 754 TabWidget->setCurrentWidget(1);
755 } else { 755 } else {
756 TabWidget->setCurrentWidget(0); 756 TabWidget->setCurrentWidget(0);
757 } 757 }
758 OtherView()->setFocus(); 758 OtherView()->setFocus();
759 OtherView()->setSelected( CurrentView()->firstChild(), true); 759 OtherView()->setSelected( CurrentView()->firstChild(), true);
760} 760}
761 761
762void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) { 762void AdvancedFm::qcopReceive(const QCString &msg, const QByteArray &data) {
763// odebug << "qcop message "+msg << oendl; 763// odebug << "qcop message "+msg << oendl;
764 QDataStream stream ( data, IO_ReadOnly ); 764 QDataStream stream ( data, IO_ReadOnly );
765 if ( msg == "openDirectory(QString)" ) { 765 if ( msg == "openDirectory(QString)" ) {
766// odebug << "received" << oendl; 766// odebug << "received" << oendl;
767 QString file; 767 QString file;
768 stream >> file; 768 stream >> file;
769 gotoDirectory( (const QString &) file); 769 changeTo( (const QString &) file);
770 } 770 }
771} 771}
772 772
773void AdvancedFm::setDocument(const QString &file) { 773void AdvancedFm::setDocument(const QString &file) {
774 gotoDirectory( file); 774 changeTo( file);
775 775
776} 776}
777 777
778void AdvancedFm::gotoDirectory(const QString &file) {
779// qDebug("goto dir "+file);
780 QString curDir = file;
781 QDir *thisDir = CurrentDir();
782 if(QDir( curDir).exists() ) {
783 thisDir->setPath( curDir );
784 chdir( curDir.latin1() );
785 thisDir->cd( curDir, TRUE);
786 populateView();
787 }
788 else if(QFileInfo(curDir).exists()) {
789 QFileInfo fileInfo(curDir);
790 curDir=fileInfo.dirPath();
791 if(QDir( curDir).exists() ) {
792 thisDir->setPath( curDir );
793 chdir( curDir.latin1() );
794 thisDir->cd( curDir, TRUE);
795 populateView();
796 }
797 findFile(file);
798 }
799
800}
801 778
802void AdvancedFm::findFile(const QString &fileName) { 779void AdvancedFm::findFile(const QString &fileName) {
803 QFileInfo fi(fileName); 780 QFileInfo fi(fileName);
804 QListView *thisView = CurrentView(); 781 QListView *thisView = CurrentView();
805 QListViewItemIterator it( thisView ); 782 QListViewItemIterator it( thisView );
806 for ( ; it.current(); ++it ) { 783 for ( ; it.current(); ++it ) {
807 if(it.current()->text(0) == fi.fileName()) { 784 if(it.current()->text(0) == fi.fileName()) {
808 it.current()->setSelected(true); 785 it.current()->setSelected(true);
809 thisView->ensureItemVisible(it.current()); 786 thisView->ensureItemVisible(it.current());
810 } 787 }
811 } 788 }
812} 789}
813 790
814void AdvancedFm::slotSwitchMenu(int item) { 791void AdvancedFm::slotSwitchMenu(int item) {
815 Q_UNUSED(item); 792 Q_UNUSED(item);
816 // qDebug( "Switch %d",item); 793 // qDebug( "Switch %d",item);
817 // viewMenu->setItemChecked(item, true); 794 // viewMenu->setItemChecked(item, true);
818} 795}
819 796
820void AdvancedFm::navigateToSelected() { 797void AdvancedFm::navigateToSelected() {
821 if( !CurrentView()->currentItem()) return; 798 if( !CurrentView()->currentItem()) return;
822 doDirChange(); 799 doDirChange();
823} 800}
diff --git a/noncore/apps/advancedfm/advancedfm.h b/noncore/apps/advancedfm/advancedfm.h
index 9dbdc70..00ab909 100644
--- a/noncore/apps/advancedfm/advancedfm.h
+++ b/noncore/apps/advancedfm/advancedfm.h
@@ -52,143 +52,142 @@ class Ir;
52 52
53class AdvancedFm : public QMainWindow 53class AdvancedFm : public QMainWindow
54{ 54{
55 Q_OBJECT 55 Q_OBJECT
56public: 56public:
57 static QString appName() { return QString::fromLatin1("advancedfm"); } 57 static QString appName() { return QString::fromLatin1("advancedfm"); }
58 AdvancedFm(QWidget *p = 0, const char* name = 0, WFlags fl = 0); 58 AdvancedFm(QWidget *p = 0, const char* name = 0, WFlags fl = 0);
59 ~AdvancedFm(); 59 ~AdvancedFm();
60protected: 60protected:
61 61
62 Opie::Ui::OSplitter *TabWidget; 62 Opie::Ui::OSplitter *TabWidget;
63 QCopChannel * channel; 63 QCopChannel * channel;
64 QPixmap unknownXpm; 64 QPixmap unknownXpm;
65 int whichTab; 65 int whichTab;
66// QTabWidget *TabWidget; 66// QTabWidget *TabWidget;
67 QWidget *tab, *tab_2, *tab_3; 67 QWidget *tab, *tab_2, *tab_3;
68 QListView *Local_View, *Remote_View; 68 QListView *Local_View, *Remote_View;
69 69
70 QLineEdit *currentPathEdit; 70 QLineEdit *currentPathEdit;
71 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/; 71 QPopupMenu *fileMenu, *localMenu, *remoteMenu, *viewMenu /*, *customDirMenu*/;
72 QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; 72 QToolButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
73// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton; 73// QPushButton *homeButton, *docButton, *cdUpButton, *sdButton, *cfButton, *qpeDirButton;
74 QDir currentDir, currentRemoteDir; 74 QDir currentDir, currentRemoteDir;
75 QComboBox *currentPathCombo; 75 QComboBox *currentPathCombo;
76 QString filterStr, s_addBookmark, s_removeBookmark; 76 QString filterStr, s_addBookmark, s_removeBookmark;
77 QListViewItem * item; 77 QListViewItem * item;
78 bool b; 78 bool b;
79 QStringList fileSystemTypeList, fsList; 79 QStringList fileSystemTypeList, fsList;
80 int currentServerConfig; 80 int currentServerConfig;
81 bool zaurusDevice; 81 bool zaurusDevice;
82 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3; 82 QGridLayout *tabLayout, *tabLayout_2, *tabLayout_3;
83 QStringList remoteDirPathStringList, localDirPathStringList; 83 QStringList remoteDirPathStringList, localDirPathStringList;
84 QLineEdit *renameBox; 84 QLineEdit *renameBox;
85 85
86 void init(); 86 void init();
87 void initConnections(); 87 void initConnections();
88 void keyReleaseEvent( QKeyEvent *); 88 void keyReleaseEvent( QKeyEvent *);
89 void keyPressEvent( QKeyEvent *); 89 void keyPressEvent( QKeyEvent *);
90 QString getFileSystemType(const QString &); 90 QString getFileSystemType(const QString &);
91 QString getDiskSpace(const QString &); 91 QString getDiskSpace(const QString &);
92 void parsetab(const QString &fileName); 92 void parsetab(const QString &fileName);
93 QString checkDiskSpace(const QString &); 93 QString checkDiskSpace(const QString &);
94 QString dealWithSymName(const QString &); 94 QString dealWithSymName(const QString &);
95 QDir *CurrentDir(); 95 QDir *CurrentDir();
96 QDir *OtherDir(); 96 QDir *OtherDir();
97 QListView *CurrentView(); 97 QListView *CurrentView();
98 QListView *OtherView(); 98 QListView *OtherView();
99 void setOtherTabCurrent(); 99 void setOtherTabCurrent();
100 void changeTo(const QString dir); 100 void changeTo(const QString dir);
101 101
102//protected signals: 102//protected signals:
103 // void newPath(QString); 103 // void newPath(QString);
104 104
105protected slots: 105protected slots:
106 void slotSwitchMenu(int); 106 void slotSwitchMenu(int);
107 void selectAll(); 107 void selectAll();
108 void addToDocs(); 108 void addToDocs();
109 void doDirChange(); 109 void doDirChange();
110 void mkDir(); 110 void mkDir();
111 void del(); 111 void del();
112 void rn(); 112 void rn();
113 void populateView(); 113 void populateView();
114 void rePopulate(); 114 void rePopulate();
115 void showHidden(); 115 void showHidden();
116 void showMenuHidden(); 116 void showMenuHidden();
117 void ListClicked(QListViewItem *); 117 void ListClicked(QListViewItem *);
118 void ListPressed( int, QListViewItem *, const QPoint&, int); 118 void ListPressed( int, QListViewItem *, const QPoint&, int);
119 void makeDir(); 119 void makeDir();
120 void doDelete(); 120 void doDelete();
121 void tabChanged(QWidget*); 121 void tabChanged(QWidget*);
122 void cleanUp(); 122 void cleanUp();
123 void renameIt(); 123 void renameIt();
124 void runThis(); 124 void runThis();
125 void runText(); 125 void runText();
126 void filePerms(); 126 void filePerms();
127 void doProperties(); 127 void doProperties();
128 void runCommand(); 128 void runCommand();
129 void runCommandStd(); 129 void runCommandStd();
130 QStringList getPath(); 130 QStringList getPath();
131 void mkSym(); 131 void mkSym();
132 void switchToLocalTab(); 132 void switchToLocalTab();
133 void switchToRemoteTab(); 133 void switchToRemoteTab();
134 void refreshCurrentTab(); 134 void refreshCurrentTab();
135 135
136 void openSearch(); 136 void openSearch();
137 void dirMenuSelected(int); 137 void dirMenuSelected(int);
138 void showFileMenu(); 138 void showFileMenu();
139 void homeButtonPushed(); 139 void homeButtonPushed();
140 void docButtonPushed(); 140 void docButtonPushed();
141 void SDButtonPushed(); 141 void SDButtonPushed();
142 void CFButtonPushed(); 142 void CFButtonPushed();
143 void QPEButtonPushed(); 143 void QPEButtonPushed();
144 void upDir(); 144 void upDir();
145 void currentPathComboChanged(); 145 void currentPathComboChanged();
146 146
147 void copy(); 147 void copy();
148 void copyTimer(); 148 void copyTimer();
149 void copyAs(); 149 void copyAs();
150 void copyAsTimer(); 150 void copyAsTimer();
151 void copySameDir(); 151 void copySameDir();
152 void copySameDirTimer(); 152 void copySameDirTimer();
153 void move(); 153 void move();
154 void moveTimer(); 154 void moveTimer();
155 155
156 void currentPathComboActivated(const QString &); 156 void currentPathComboActivated(const QString &);
157 void fillCombo(const QString &); 157 void fillCombo(const QString &);
158 bool copyFile( const QString & , const QString & ); 158 bool copyFile( const QString & , const QString & );
159 void fileStatus(); 159 void fileStatus();
160 void doAbout(); 160 void doAbout();
161 void doBeam(); 161 void doBeam();
162 void fileBeamFinished( Ir *); 162 void fileBeamFinished( Ir *);
163 bool copyDirectory( const QString & , const QString & ); 163 bool copyDirectory( const QString & , const QString & );
164// void navigateToSelected(); 164// void navigateToSelected();
165 bool moveDirectory( const QString & , const QString & ); 165 bool moveDirectory( const QString & , const QString & );
166 166
167// void slotSwitchtoLocal(int); 167// void slotSwitchtoLocal(int);
168 168
169private: 169private:
170 MenuButton *menuButton; 170 MenuButton *menuButton;
171 QString oldName, localViewDir, remoteViewDir; 171 QString oldName, localViewDir, remoteViewDir;
172 void startProcess(const QString &); 172 void startProcess(const QString &);
173 bool eventFilter( QObject * , QEvent * ); 173 bool eventFilter( QObject * , QEvent * );
174 void cancelRename(); 174 void cancelRename();
175 void doRename(QListView *); 175 void doRename(QListView *);
176 void okRename(); 176 void okRename();
177 void customDirsToMenu(); 177 void customDirsToMenu();
178 void addCustomDir(); 178 void addCustomDir();
179 void removeCustomDir(); 179 void removeCustomDir();
180 void gotoDirectory(const QString &);
181 void navigateToSelected(); 180 void navigateToSelected();
182 void findFile(const QString &); 181 void findFile(const QString &);
183 182
184private slots: 183private slots:
185 void processEnded(Opie::Core::OProcess *); 184 void processEnded(Opie::Core::OProcess *);
186 void oprocessStderr(Opie::Core::OProcess *, char *, int); 185 void oprocessStderr(Opie::Core::OProcess *, char *, int);
187 void gotoCustomDir(const QString &); 186 void gotoCustomDir(const QString &);
188 void qcopReceive(const QCString&, const QByteArray&); 187 void qcopReceive(const QCString&, const QByteArray&);
189 void setDocument(const QString &); 188 void setDocument(const QString &);
190 // void doMenu(int 189 // void doMenu(int
191 190
192}; 191};
193 192
194#endif // ADVANCEDFM_H 193#endif // ADVANCEDFM_H