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 | 41 |
1 files changed, 28 insertions, 13 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 | |||
@@ -125,17 +125,19 @@ OpieFtp::OpieFtp( ) | |||
125 | 125 | ||
126 | Local_View = new QListView( tab, "Local_View" ); | 126 | Local_View = new QListView( tab, "Local_View" ); |
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); |
130 | Local_View->setColumnAlignment(1,QListView::AlignRight); | 130 | Local_View->setColumnAlignment(1,QListView::AlignRight); |
131 | Local_View->addColumn( tr("Date"),-1); | 131 | Local_View->addColumn( tr("Date"),-1); |
132 | Local_View->setColumnAlignment(2,QListView::AlignRight); | 132 | Local_View->setColumnAlignment(2,QListView::AlignRight); |
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); |
135 | 137 | ||
136 | tabLayout->addWidget( Local_View, 0, 0 ); | 138 | tabLayout->addWidget( Local_View, 0, 0 ); |
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 *)) ); |
140 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 142 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
141 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 143 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
@@ -148,7 +150,7 @@ OpieFtp::OpieFtp( ) | |||
148 | tabLayout_2->setMargin( 2); | 150 | tabLayout_2->setMargin( 2); |
149 | 151 | ||
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); |
153 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 155 | Remote_View->setColumnAlignment(1,QListView::AlignRight); |
154 | Remote_View->addColumn( tr("Date"),-1); | 156 | Remote_View->addColumn( tr("Date"),-1); |
@@ -156,9 +158,11 @@ OpieFtp::OpieFtp( ) | |||
156 | Remote_View->addColumn( tr("Dir"),-1); | 158 | Remote_View->addColumn( tr("Dir"),-1); |
157 | Remote_View->setColumnAlignment(4,QListView::AlignRight); | 159 | Remote_View->setColumnAlignment(4,QListView::AlignRight); |
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 *)) ); |
163 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 167 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
164 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); | 168 | this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) ); |
@@ -407,7 +411,11 @@ void OpieFtp::localUpload() | |||
407 | int fsz; | 411 | int fsz; |
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 ); |
415 | QListViewItemIterator it( Local_View ); | ||
416 | for ( ; it.current(); ++it ) { | ||
417 | if ( it.current()->isSelected() ) { | ||
418 | QString strItem = it.current()->text(0); | ||
411 | QString localFile = currentDir.canonicalPath()+"/"+strItem; | 419 | QString localFile = currentDir.canonicalPath()+"/"+strItem; |
412 | QString remoteFile= currentRemoteDir+strItem; | 420 | QString remoteFile= currentRemoteDir+strItem; |
413 | QFileInfo fi(localFile); | 421 | QFileInfo fi(localFile); |
@@ -427,11 +435,14 @@ void OpieFtp::localUpload() | |||
427 | msg.replace(QRegExp(":"),"\n"); | 435 | msg.replace(QRegExp(":"),"\n"); |
428 | QMessageBox::message(tr("Note"),msg); | 436 | QMessageBox::message(tr("Note"),msg); |
429 | } | 437 | } |
430 | ProgressBar->reset(); | ||
431 | nullifyCallBack(); | ||
432 | } else { | 438 | } else { |
433 | QMessageBox::message(tr("Note"),tr("Cannot upload directories")); | 439 | QMessageBox::message(tr("Note"),tr("Cannot upload directories")); |
434 | } | 440 | } |
441 | ProgressBar->reset(); | ||
442 | nullifyCallBack(); | ||
443 | it.current()->setSelected(FALSE); | ||
444 | } //end currentSelected | ||
445 | } | ||
435 | TabWidget->setCurrentPage(1); | 446 | TabWidget->setCurrentPage(1); |
436 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 447 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
437 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 448 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
@@ -443,7 +454,6 @@ void OpieFtp::nullifyCallBack() | |||
443 | FtpOptions(FTPLIB_IDLETIME, NULL, conn); | 454 | FtpOptions(FTPLIB_IDLETIME, NULL, conn); |
444 | FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); | 455 | FtpOptions(FTPLIB_CALLBACKARG, NULL, conn); |
445 | FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); | 456 | FtpOptions(FTPLIB_CALLBACKBYTES, NULL, conn); |
446 | |||
447 | } | 457 | } |
448 | 458 | ||
449 | void OpieFtp::remoteDownload() | 459 | void OpieFtp::remoteDownload() |
@@ -451,9 +461,13 @@ void OpieFtp::remoteDownload() | |||
451 | // qApp->processEvents(); | 461 | // qApp->processEvents(); |
452 | int fsz; | 462 | int fsz; |
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 | ||
465 | QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); | ||
466 | QListViewItemIterator it( Remote_View ); | ||
467 | for ( ; it.current(); ++it ) { | ||
468 | if ( it.current()->isSelected() ) { | ||
469 | QString strItem = it.current()->text(0); | ||
470 | // strItem=strItem.right(strItem.length()-1); | ||
457 | QString localFile = currentDir.canonicalPath(); | 471 | QString localFile = currentDir.canonicalPath(); |
458 | if(localFile.right(1).find("/",0,TRUE) == -1) | 472 | if(localFile.right(1).find("/",0,TRUE) == -1) |
459 | localFile += "/"; | 473 | localFile += "/"; |
@@ -480,6 +494,9 @@ void OpieFtp::remoteDownload() | |||
480 | } | 494 | } |
481 | ProgressBar->reset(); | 495 | ProgressBar->reset(); |
482 | nullifyCallBack(); | 496 | nullifyCallBack(); |
497 | it.current()->setSelected(FALSE); | ||
498 | } | ||
499 | } | ||
483 | TabWidget->setCurrentPage(0); | 500 | TabWidget->setCurrentPage(0); |
484 | populateLocalView(); | 501 | populateLocalView(); |
485 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 502 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
@@ -567,7 +584,7 @@ void OpieFtp::populateLocalView() | |||
567 | pm = Resource::loadPixmap( "locked" ); | 584 | pm = Resource::loadPixmap( "locked" ); |
568 | else { | 585 | else { |
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()) |
572 | pm = Resource::loadPixmap( "UnknownDocument-14" ); | 589 | pm = Resource::loadPixmap( "UnknownDocument-14" ); |
573 | item->setPixmap( 0,pm); | 590 | item->setPixmap( 0,pm); |
@@ -589,7 +606,6 @@ void OpieFtp::populateLocalView() | |||
589 | Local_View->setSorting( 3,FALSE); | 606 | Local_View->setSorting( 3,FALSE); |
590 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); | 607 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); |
591 | fillCombo( (const QString &)currentDir); | 608 | fillCombo( (const QString &)currentDir); |
592 | |||
593 | } | 609 | } |
594 | 610 | ||
595 | bool OpieFtp::populateRemoteView( ) | 611 | bool OpieFtp::populateRemoteView( ) |
@@ -911,7 +927,6 @@ void OpieFtp::remoteDelete() | |||
911 | QMessageBox::message(tr("Note"),msg); | 927 | QMessageBox::message(tr("Note"),msg); |
912 | } | 928 | } |
913 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 929 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
914 | |||
915 | } | 930 | } |
916 | break; | 931 | break; |
917 | }; | 932 | }; |