summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-03-16 15:16:58 (UTC)
committer llornkcor <llornkcor>2002-03-16 15:16:58 (UTC)
commit1d20ca78752b9da597950087438daa9ff8cb7951 (patch) (unidiff)
tree5cce2048ba6cd8fd16e98bf9f4ab8c5ead4fe8b3
parent585373903040f7d283c8fef1841147739f0510d8 (diff)
downloadopie-1d20ca78752b9da597950087438daa9ff8cb7951.zip
opie-1d20ca78752b9da597950087438daa9ff8cb7951.tar.gz
opie-1d20ca78752b9da597950087438daa9ff8cb7951.tar.bz2
added cd to stylus hold, so user doesn't have to double click
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp37
-rw-r--r--noncore/net/opieftp/opieftp.h6
2 files changed, 32 insertions, 11 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 523a36c..ed7f4bb 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -414,46 +414,47 @@ void OpieFtp::populateLocalView()
414// qDebug( fileL); 414// qDebug( fileL);
415 } 415 }
416 } 416 }
417 item= new QListViewItem( Local_View,fileL,fileS, fileDate); 417 item= new QListViewItem( Local_View,fileL,fileS, fileDate);
418 ++it; 418 ++it;
419 } 419 }
420 Local_View->setSorting( 3,FALSE); 420 Local_View->setSorting( 3,FALSE);
421 currentPathEdit->setText( currentDir.canonicalPath() ); 421 currentPathEdit->setText( currentDir.canonicalPath() );
422} 422}
423 423
424bool OpieFtp::populateRemoteView() 424bool OpieFtp::populateRemoteView()
425{ 425{
426 Remote_View->clear(); 426 Remote_View->clear();
427 QFile tmp("./._temp"); 427 QFile tmp("./._temp");
428 QString s, File_Name; 428 QString s, File_Name;
429 QString fileL, fileS, fileDate; 429 QString fileL, fileS, fileDate;
430 new QListViewItem( Remote_View, "../"); 430 new QListViewItem( Remote_View, "../");
431 if (tmp.open(IO_ReadOnly)) { 431 if (tmp.open(IO_ReadOnly)) {
432 QTextStream t( &tmp ); // use a text stream 432 QTextStream t( &tmp ); // use a text stream
433 while ( !t.eof()) { 433 while ( !t.eof()) {
434 s = t.readLine(); 434 s = t.readLine();
435 fileL = s.right(s.length()-55); 435 fileL = s.right(s.length()-55);
436 fileL = fileL.stripWhiteSpace(); 436 fileL = fileL.stripWhiteSpace();
437 if(s.left(1) == "d") 437 if(s.left(1) == "d")
438 fileL = fileL+"/"; 438 fileL = fileL+"/";
439 fileS = s.mid( 30, 42-30); 439 fileS = s.mid( 30, 42-30);
440 fileS = fileS.stripWhiteSpace(); 440 fileS = fileS.stripWhiteSpace();
441 fileDate = s.mid( 42, 55-42); 441 fileDate = s.mid( 42, 55-42);
442 fileDate = fileDate.stripWhiteSpace(); 442 fileDate = fileDate.stripWhiteSpace();
443 if(fileL.find("total",0,TRUE) == -1) 443 if(fileL.find("total",0,TRUE) == -1)
444 new QListViewItem( Remote_View, fileL, fileS, fileDate); 444 new QListViewItem( Remote_View, fileL, fileS, fileDate);
445 } 445 }
446 tmp.close(); 446 tmp.close();
447 } 447 } else
448 qDebug("temp file not opened successfullly");
448 return true; 449 return true;
449} 450}
450 451
451void OpieFtp::remoteListClicked(QListViewItem *selectedItem) 452void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
452{ 453{
453 QCopEnvelope ( "QPE/System", "busy()" ); 454 QCopEnvelope ( "QPE/System", "busy()" );
454 QString oldRemoteCurrentDir = currentRemoteDir; 455 QString oldRemoteCurrentDir = currentRemoteDir;
455 QString strItem=selectedItem->text(0); 456 QString strItem=selectedItem->text(0);
456 strItem=strItem.simplifyWhiteSpace(); 457 strItem=strItem.simplifyWhiteSpace();
457 if(strItem == "../") { // the user wants to go ^ 458 if(strItem == "../") { // the user wants to go ^
458 if( FtpCDUp( conn) == 0) { 459 if( FtpCDUp( conn) == 0) {
459 QString msg; 460 QString msg;
@@ -495,25 +496,25 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
495 } 496 }
496 } else { 497 } else {
497 qDebug("download "+strItem); 498 qDebug("download "+strItem);
498 } 499 }
499 } 500 }
500 if(currentRemoteDir.right(1) !="/") 501 if(currentRemoteDir.right(1) !="/")
501 currentRemoteDir +="/"; 502 currentRemoteDir +="/";
502 currentPathEdit->setText( currentRemoteDir ); 503 currentPathEdit->setText( currentRemoteDir );
503 remoteDirList( (const QString &)currentRemoteDir); 504 remoteDirList( (const QString &)currentRemoteDir);
504 QCopEnvelope ( "QPE/System", "notBusy()" ); 505 QCopEnvelope ( "QPE/System", "notBusy()" );
505} 506}
506 507
507 void OpieFtp::localListClicked(QListViewItem *selectedItem) 508void OpieFtp::localListClicked(QListViewItem *selectedItem)
508{ 509{
509 QString strItem=selectedItem->text(0); 510 QString strItem=selectedItem->text(0);
510 QString strSize=selectedItem->text(1); 511 QString strSize=selectedItem->text(1);
511 strSize=strSize.stripWhiteSpace(); 512 strSize=strSize.stripWhiteSpace();
512 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink 513 if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
513 // is symlink 514 // is symlink
514 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); 515 QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
515 if(QDir(strItem2).exists() ) { 516 if(QDir(strItem2).exists() ) {
516 currentDir.cd(strItem2, TRUE); 517 currentDir.cd(strItem2, TRUE);
517 populateLocalView(); 518 populateLocalView();
518 } 519 }
519 } else { // not a symlink 520 } else { // not a symlink
@@ -531,76 +532,94 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
531 populateLocalView(); 532 populateLocalView();
532 } 533 }
533 } else { 534 } else {
534 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); 535 strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
535 if( QFile::exists(strItem ) ) { 536 if( QFile::exists(strItem ) ) {
536 qDebug("upload "+strItem); 537 qDebug("upload "+strItem);
537 } 538 }
538 } //end not symlink 539 } //end not symlink
539 chdir(strItem.latin1()); 540 chdir(strItem.latin1());
540 } 541 }
541} 542}
542 543
544void OpieFtp::doLocalCd()
545{
546 localListClicked( Local_View->currentItem());
547}
548
549void OpieFtp:: doRemoteCd()
550{
551 remoteListClicked( Remote_View->currentItem());
552
553}
554
543void OpieFtp::showHidden() 555void OpieFtp::showHidden()
544{ 556{
545 if (!b) { 557 if (!b) {
546 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); 558 currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
547// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 559// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
548 b=TRUE; 560 b=TRUE;
549 561
550 } else { 562 } else {
551 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); 563 currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
552// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); 564// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
553 b=FALSE; 565 b=FALSE;
554 } 566 }
555 populateLocalView(); 567 populateLocalView();
556} 568}
557 569
558void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 570void OpieFtp::ListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
559{ 571{
560 switch (mouse) { 572 switch (mouse) {
561 case 1: 573 case 1:
562 break; 574 break;
563 case 2: 575 case 2:
564 showLocalMenu(); 576 showLocalMenu(item);
565 break; 577 break;
566 }; 578 };
567} 579}
568 580
569void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i) 581void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &point, int i)
570{ 582{
571 switch (mouse) { 583 switch (mouse) {
572 case 1: 584 case 1:
573 break; 585 break;
574 case 2: 586 case 2:
575 showRemoteMenu(); 587 showRemoteMenu(item);
576 break; 588 break;
577 }; 589 };
578} 590}
579 591
580void OpieFtp::showRemoteMenu() 592void OpieFtp::showRemoteMenu(QListViewItem * item)
581{ 593{
582 QPopupMenu m;// = new QPopupMenu( Local_View ); 594 QPopupMenu m;// = new QPopupMenu( Local_View );
595 if(item->text(0).right(1) == "/")
596 m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() ));
597 else
583 m.insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); 598 m.insertItem( tr( "Download" ), this, SLOT( remoteDownload() ));
584 m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); 599 m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
585 m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); 600 m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
586 m.insertSeparator(); 601 m.insertSeparator();
587 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); 602 m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
588 m.exec( QCursor::pos() ); 603 m.exec( QCursor::pos() );
589} 604}
590 605
591void OpieFtp::showLocalMenu() 606void OpieFtp::showLocalMenu(QListViewItem * item)
592{ 607{
593 QPopupMenu m; 608 QPopupMenu m;
594 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); 609 m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
610 m.insertSeparator();
611 if(item->text(0).right(1) == "/")
612 m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() ));
613 else
595 m.insertItem( tr( "Upload" ), this, SLOT( localUpload() )); 614 m.insertItem( tr( "Upload" ), this, SLOT( localUpload() ));
596 m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); 615 m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
597 m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); 616 m.insertItem( tr( "Rename" ), this, SLOT( localRename() ));
598 m.insertSeparator(); 617 m.insertSeparator();
599 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); 618 m.insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
600 m.exec( QCursor::pos() ); 619 m.exec( QCursor::pos() );
601} 620}
602 621
603void OpieFtp::localMakDir() 622void OpieFtp::localMakDir()
604{ 623{
605 InputDialog *fileDlg; 624 InputDialog *fileDlg;
606 fileDlg = new InputDialog(this,"Make Directory",TRUE, 0); 625 fileDlg = new InputDialog(this,"Make Directory",TRUE, 0);
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h
index e00a398..5d1c63d 100644
--- a/noncore/net/opieftp/opieftp.h
+++ b/noncore/net/opieftp/opieftp.h
@@ -52,26 +52,28 @@ public:
52 QComboBox *UsernameComboBox, *ServerComboBox; 52 QComboBox *UsernameComboBox, *ServerComboBox;
53 QLineEdit *PasswordEdit, *remotePath, *currentPathEdit; 53 QLineEdit *PasswordEdit, *remotePath, *currentPathEdit;
54 QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; 54 QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;;
55 QSpinBox* PortSpinBox; 55 QSpinBox* PortSpinBox;
56 QPopupMenu *connectionMenu, *localMenu, *remoteMenu; 56 QPopupMenu *connectionMenu, *localMenu, *remoteMenu;
57 QDir currentDir; 57 QDir currentDir;
58 QString currentRemoteDir; 58 QString currentRemoteDir;
59 QString filterStr; 59 QString filterStr;
60 QListViewItem * item; 60 QListViewItem * item;
61 bool b; 61 bool b;
62 62
63protected slots: 63protected slots:
64 void showLocalMenu( ); 64 void showLocalMenu( QListViewItem *);
65 void showRemoteMenu( ); 65 void showRemoteMenu( QListViewItem *);
66 void doLocalCd();
67 void doRemoteCd();
66 void localUpload(); 68 void localUpload();
67 void remoteDownload(); 69 void remoteDownload();
68 void newConnection(); 70 void newConnection();
69 void connector(); 71 void connector();
70 void disConnector(); 72 void disConnector();
71 void populateLocalView(); 73 void populateLocalView();
72 bool populateRemoteView(); 74 bool populateRemoteView();
73 void showHidden(); 75 void showHidden();
74 76
75 void localListClicked(QListViewItem *); 77 void localListClicked(QListViewItem *);
76 void remoteListClicked(QListViewItem *); 78 void remoteListClicked(QListViewItem *);
77 void ListPressed( int, QListViewItem *, const QPoint&, int); 79 void ListPressed( int, QListViewItem *, const QPoint&, int);