author | llornkcor <llornkcor> | 2002-03-28 01:29:02 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-03-28 01:29:02 (UTC) |
commit | d360439051f476cd847c4d8cec27a52addcd72a2 (patch) (unidiff) | |
tree | 764e49aae53298ab9f020accc5a09042fd0ca874 | |
parent | 2e385535ffffa1a1cebf2f3a842cfe429b0c1909 (diff) | |
download | opie-d360439051f476cd847c4d8cec27a52addcd72a2.zip opie-d360439051f476cd847c4d8cec27a52addcd72a2.tar.gz opie-d360439051f476cd847c4d8cec27a52addcd72a2.tar.bz2 |
added multi selection up/down. may have broken something- who knows...
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 153 |
1 files changed, 84 insertions, 69 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index fd6b028..907a812 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -103,3 +103,3 @@ OpieFtp::OpieFtp( ) | |||
103 | localMenu->setCheckable(TRUE); | 103 | localMenu->setCheckable(TRUE); |
104 | 104 | ||
105 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 105 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
@@ -127,3 +127,3 @@ OpieFtp::OpieFtp( ) | |||
127 | // Local_View->setResizePolicy( QListView::AutoOneFit ); | 127 | // Local_View->setResizePolicy( QListView::AutoOneFit ); |
128 | Local_View->addColumn( tr("File"),120); | 128 | Local_View->addColumn( tr("File"),150); |
129 | Local_View->addColumn( tr("Size"),-1); | 129 | Local_View->addColumn( tr("Size"),-1); |
@@ -133,2 +133,4 @@ OpieFtp::OpieFtp( ) | |||
133 | Local_View->setAllColumnsShowFocus(TRUE); | 133 | Local_View->setAllColumnsShowFocus(TRUE); |
134 | Local_View->setMultiSelection( TRUE ); | ||
135 | |||
134 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); | 136 | QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); |
@@ -137,3 +139,3 @@ OpieFtp::OpieFtp( ) | |||
137 | 139 | ||
138 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), | 140 | connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), |
139 | this,SLOT( localListClicked(QListViewItem *)) ); | 141 | this,SLOT( localListClicked(QListViewItem *)) ); |
@@ -150,3 +152,3 @@ OpieFtp::OpieFtp( ) | |||
150 | Remote_View = new QListView( tab_2, "Remote_View" ); | 152 | Remote_View = new QListView( tab_2, "Remote_View" ); |
151 | Remote_View->addColumn( tr("File"),120); | 153 | Remote_View->addColumn( tr("File"),150); |
152 | Remote_View->addColumn( tr("Size"),-1); | 154 | Remote_View->addColumn( tr("Size"),-1); |
@@ -158,5 +160,7 @@ OpieFtp::OpieFtp( ) | |||
158 | Remote_View->setAllColumnsShowFocus(TRUE); | 160 | Remote_View->setAllColumnsShowFocus(TRUE); |
161 | Remote_View->setMultiSelection( TRUE ); | ||
162 | |||
159 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 163 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
160 | 164 | ||
161 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), | 165 | connect( Remote_View, SIGNAL( doubleClicked( QListViewItem*)), |
162 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 166 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
@@ -401,3 +405,3 @@ void OpieFtp::disConnector() | |||
401 | connectServerBtn->setOn(FALSE); | 405 | connectServerBtn->setOn(FALSE); |
402 | 406 | ||
403 | } | 407 | } |
@@ -408,31 +412,38 @@ void OpieFtp::localUpload() | |||
408 | QCopEnvelope ( "QPE/System", "busy()" ); | 412 | QCopEnvelope ( "QPE/System", "busy()" ); |
409 | // qApp->processEvents(); | 413 | // qApp->processEvents(); |
410 | QString strItem = Local_View->currentItem()->text(0); | 414 | QList<QListViewItem> * getSelectedItems( QListView * Local_View ); |
411 | QString localFile = currentDir.canonicalPath()+"/"+strItem; | 415 | QListViewItemIterator it( Local_View ); |
412 | QString remoteFile= currentRemoteDir+strItem; | 416 | for ( ; it.current(); ++it ) { |
413 | QFileInfo fi(localFile); | 417 | if ( it.current()->isSelected() ) { |
414 | if( !fi.isDir()) { | 418 | QString strItem = it.current()->text(0); |
415 | fsz=fi.size(); | 419 | QString localFile = currentDir.canonicalPath()+"/"+strItem; |
416 | ProgressBar->setTotalSteps(fsz); | 420 | QString remoteFile= currentRemoteDir+strItem; |
417 | 421 | QFileInfo fi(localFile); | |
418 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 422 | if( !fi.isDir()) { |
419 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 423 | fsz=fi.size(); |
420 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 424 | ProgressBar->setTotalSteps(fsz); |
421 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 425 | |
422 | qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); | 426 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
423 | 427 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | |
424 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 428 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
425 | QString msg; | 429 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
426 | msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); | 430 | qDebug("Put: %s, %s",localFile.latin1(),remoteFile.latin1()); |
427 | msg.replace(QRegExp(":"),"\n"); | 431 | |
428 | QMessageBox::message(tr("Note"),msg); | 432 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
433 | QString msg; | ||
434 | msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); | ||
435 | msg.replace(QRegExp(":"),"\n"); | ||
436 | QMessageBox::message(tr("Note"),msg); | ||
437 | } | ||
438 | } else { | ||
439 | QMessageBox::message(tr("Note"),tr("Cannot upload directories")); | ||
440 | } | ||
441 | ProgressBar->reset(); | ||
442 | nullifyCallBack(); | ||
443 | it.current()->setSelected(FALSE); | ||
444 | } //end currentSelected | ||
429 | } | 445 | } |
430 | ProgressBar->reset(); | 446 | TabWidget->setCurrentPage(1); |
431 | nullifyCallBack(); | 447 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
432 | } else { | 448 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
433 | QMessageBox::message(tr("Note"),tr("Cannot upload directories")); | ||
434 | } | ||
435 | TabWidget->setCurrentPage(1); | ||
436 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | ||
437 | QCopEnvelope ( "QPE/System", "notBusy()" ); | ||
438 | } | 449 | } |
@@ -445,3 +456,2 @@ void OpieFtp::nullifyCallBack() | |||
445 | FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); | 456 | FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); |
446 | |||
447 | } | 457 | } |
@@ -453,31 +463,38 @@ void OpieFtp::remoteDownload() | |||
453 | QCopEnvelope ( "QPE/System", "busy()" ); | 463 | QCopEnvelope ( "QPE/System", "busy()" ); |
454 | QString strItem = Remote_View->currentItem()->text(0); | ||
455 | // strItem=strItem.right(strItem.length()-1); | ||
456 | 464 | ||
457 | QString localFile = currentDir.canonicalPath(); | 465 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); |
458 | if(localFile.right(1).find("/",0,TRUE) == -1) | 466 | QListViewItemIterator it( Remote_View ); |
459 | localFile += "/"; | 467 | for ( ; it.current(); ++it ) { |
460 | localFile += strItem; | 468 | if ( it.current()->isSelected() ) { |
469 | QString strItem = it.current()->text(0); | ||
470 | // strItem=strItem.right(strItem.length()-1); | ||
471 | QString localFile = currentDir.canonicalPath(); | ||
472 | if(localFile.right(1).find("/",0,TRUE) == -1) | ||
473 | localFile += "/"; | ||
474 | localFile += strItem; | ||
461 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | 475 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; |
462 | QString remoteFile= currentRemoteDir+strItem; | 476 | QString remoteFile= currentRemoteDir+strItem; |
463 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) | 477 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) |
464 | fsz = 0; | 478 | fsz = 0; |
465 | QString temp; | 479 | QString temp; |
466 | temp.sprintf( remoteFile+" "+" %dkb", fsz); | 480 | temp.sprintf( remoteFile+" "+" %dkb", fsz); |
467 | 481 | ||
468 | ProgressBar->setTotalSteps(fsz); | 482 | ProgressBar->setTotalSteps(fsz); |
469 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 483 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
470 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 484 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
471 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 485 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
472 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 486 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
473 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); | 487 | qDebug("Get: %s, %s",localFile.latin1(),remoteFile.latin1()); |
474 | 488 | ||
475 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 489 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
476 | QString msg; | 490 | QString msg; |
477 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); | 491 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); |
478 | msg.replace(QRegExp(":"),"\n"); | 492 | msg.replace(QRegExp(":"),"\n"); |
479 | QMessageBox::message(tr("Note"),msg); | 493 | QMessageBox::message(tr("Note"),msg); |
494 | } | ||
495 | ProgressBar->reset(); | ||
496 | nullifyCallBack(); | ||
497 | it.current()->setSelected(FALSE); | ||
498 | } | ||
480 | } | 499 | } |
481 | ProgressBar->reset(); | ||
482 | nullifyCallBack(); | ||
483 | TabWidget->setCurrentPage(0); | 500 | TabWidget->setCurrentPage(0); |
@@ -559,5 +576,5 @@ void OpieFtp::populateLocalView() | |||
559 | if(isDir || fileL.find("/",0,TRUE) != -1) { | 576 | if(isDir || fileL.find("/",0,TRUE) != -1) { |
560 | if( !QDir( fi->filePath() ).isReadable()) | 577 | if( !QDir( fi->filePath() ).isReadable()) |
561 | pm = Resource::loadPixmap( "lockedfolder" ); | 578 | pm = Resource::loadPixmap( "lockedfolder" ); |
562 | else | 579 | else |
563 | pm= Resource::loadPixmap( "folder" ); | 580 | pm= Resource::loadPixmap( "folder" ); |
@@ -569,3 +586,3 @@ void OpieFtp::populateLocalView() | |||
569 | MimeType mt(fi->filePath()); | 586 | MimeType mt(fi->filePath()); |
570 | pm=mt.pixmap(); | 587 | pm=mt.pixmap(); //sets the correct pixmap for mimetype |
571 | if(pm.isNull()) | 588 | if(pm.isNull()) |
@@ -591,3 +608,2 @@ void OpieFtp::populateLocalView() | |||
591 | fillCombo( (const QString &)currentDir); | 608 | fillCombo( (const QString &)currentDir); |
592 | |||
593 | } | 609 | } |
@@ -645,3 +661,3 @@ bool OpieFtp::populateRemoteView( ) | |||
645 | Remote_View->setSorting( 4,TRUE); | 661 | Remote_View->setSorting( 4,TRUE); |
646 | return true; | 662 | return true; |
647 | } | 663 | } |
@@ -761,3 +777,3 @@ void OpieFtp::showHidden() | |||
761 | b=TRUE; | 777 | b=TRUE; |
762 | 778 | ||
763 | } else { | 779 | } else { |
@@ -858,3 +874,3 @@ void OpieFtp::localDelete() | |||
858 | }; | 874 | }; |
859 | 875 | ||
860 | } else { | 876 | } else { |
@@ -913,3 +929,2 @@ void OpieFtp::remoteDelete() | |||
913 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 929 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
914 | |||
915 | } | 930 | } |