author | llornkcor <llornkcor> | 2002-04-10 19:17:31 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-10 19:17:31 (UTC) |
commit | 5cf7797af9fb965916f5017f84898516157c4620 (patch) (side-by-side diff) | |
tree | 032bda2f3ccfb8ebb7d930ba49f959ea504ce205 | |
parent | 9237a75548f9b932fbb1900d8ea28dbee9da81ac (diff) | |
download | opie-5cf7797af9fb965916f5017f84898516157c4620.zip opie-5cf7797af9fb965916f5017f84898516157c4620.tar.gz opie-5cf7797af9fb965916f5017f84898516157c4620.tar.bz2 |
bug fix and added icons the previous commit here, and forgot in the log.. heheheh
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 256 |
1 files changed, 141 insertions, 115 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index fb57193..7f5d71c 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp @@ -156,6 +156,8 @@ OpieFtp::OpieFtp( ) Local_View->setColumnAlignment(2,QListView::AlignRight); Local_View->setAllColumnsShowFocus(TRUE); - Local_View->setMultiSelection( TRUE ); + + Local_View->setMultiSelection( TRUE); Local_View->setSelectionMode(QListView::Extended); + Local_View->setFocusPolicy(QWidget::ClickFocus); QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); @@ -186,6 +188,8 @@ OpieFtp::OpieFtp( ) Remote_View->setColumnAlignment(4,QListView::AlignRight); Remote_View->setAllColumnsShowFocus(TRUE); - Remote_View->setMultiSelection( TRUE ); + + Remote_View->setMultiSelection( FALSE); Remote_View->setSelectionMode(QListView::Extended); + Remote_View->setFocusPolicy(QWidget::ClickFocus); QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); @@ -379,5 +383,5 @@ void OpieFtp::connectorBtnToggled(bool On) void OpieFtp::connector() { -// QCopEnvelope ( "QPE/System", "busy()" ); + QCopEnvelope ( "QPE/System", "busy()" ); // qApp->processEvents(); currentRemoteDir=remotePath->text(); @@ -422,5 +426,5 @@ void OpieFtp::connector() writeConfig(); connectServerBtn->setText( tr("Disconnect")); -// QCopEnvelope ( "QPE/System", "notBusy()" ); + QCopEnvelope ( "QPE/System", "notBusy()" ); } @@ -470,11 +474,14 @@ void OpieFtp::localUpload() ProgressBar->reset(); nullifyCallBack(); - } //end currentSelected it.current()->setSelected(FALSE); + } //end currentSelected + } + for ( ; it.current(); ++it ) { + Local_View->clearSelection(); } + Local_View->clearFocus(); TabWidget->setCurrentPage(1); remoteDirList( (const QString &)currentRemoteDir); //this also calls populate -// QCopEnvelope ( "QPE/System", "notBusy()" ); - + QCopEnvelope ( "QPE/System", "notBusy()" ); } @@ -491,5 +498,5 @@ void OpieFtp::remoteDownload() // qApp->processEvents(); int fsz; -// QCopEnvelope ( "QPE/System", "busy()" ); + QCopEnvelope ( "QPE/System", "busy()" ); QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); @@ -525,11 +532,14 @@ void OpieFtp::remoteDownload() ProgressBar->reset(); nullifyCallBack(); - } it.current()->setSelected(FALSE); + } + } + for ( ; it.current(); ++it ) { + Remote_View->clearSelection(); } + Remote_View->setFocus(); TabWidget->setCurrentPage(0); populateLocalView(); -// QCopEnvelope ( "QPE/System", "notBusy()" ); - + QCopEnvelope ( "QPE/System", "notBusy()" ); } @@ -542,5 +552,5 @@ bool OpieFtp::remoteDirList(const QString &dir) tmp+="._temp"; // qDebug("Listing remote dir "+tmp); -// QCopEnvelope ( "QPE/System", "busy()" ); + QCopEnvelope ( "QPE/System", "busy()" ); if (!FtpDir( tmp.latin1(), dir.latin1(), conn) ) { QString msg; @@ -551,5 +561,5 @@ bool OpieFtp::remoteDirList(const QString &dir) } populateRemoteView() ; -// QCopEnvelope ( "QPE/System", "notBusy()" ); + QCopEnvelope ( "QPE/System", "notBusy()" ); return true; } @@ -557,5 +567,5 @@ bool OpieFtp::remoteDirList(const QString &dir) bool OpieFtp::remoteChDir(const QString &dir) { -// QCopEnvelope ( "QPE/System", "busy()" ); + QCopEnvelope ( "QPE/System", "busy()" ); if (!FtpChdir( dir.latin1(), conn )) { QString msg; @@ -564,8 +574,8 @@ bool OpieFtp::remoteChDir(const QString &dir) QMessageBox::message(tr("Note"),msg); // qDebug(msg); -// QCopEnvelope ( "QPE/System", "notBusy()" ); + QCopEnvelope ( "QPE/System", "notBusy()" ); return FALSE; } -// QCopEnvelope ( "QPE/System", "notBusy()" ); + QCopEnvelope ( "QPE/System", "notBusy()" ); return TRUE; } @@ -638,5 +648,4 @@ void OpieFtp::populateLocalView() currentPathCombo->lineEdit()->setText( currentDir.canonicalPath() ); fillCombo( (const QString &)currentDir); - } @@ -739,5 +748,5 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) } } else { -// QCopEnvelope ( "QPE/System", "notBusy()" ); + QCopEnvelope ( "QPE/System", "notBusy()" ); return; } @@ -791,5 +800,4 @@ void OpieFtp::localListClicked(QListViewItem *selectedItem) } } - } @@ -839,14 +847,16 @@ void OpieFtp::RemoteListPressed( int mouse, QListViewItem *item, const QPoint &p void OpieFtp::showRemoteMenu(QListViewItem * item) { - QPopupMenu m;// = new QPopupMenu( Local_View ); + QPopupMenu * m;// = new QPopupMenu( Local_View ); + m = new QPopupMenu(this); if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) != -1) - m.insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); + m->insertItem( tr( "Change Directory" ), this, SLOT( doRemoteCd() )); else - m.insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); - m.insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); - m.insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); - m.insertSeparator(); - m.insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); - m.exec( QCursor::pos() ); + m->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); + m->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); + m->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); + m->insertSeparator(); + m->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() )); + m->exec( QCursor::pos() ); + delete m; } @@ -854,22 +864,24 @@ void OpieFtp::showLocalMenu(QListViewItem * item) { - QPopupMenu m; - m.insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); - m.insertSeparator(); + QPopupMenu *m; + m = new QPopupMenu( this); + m->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); + m->insertSeparator(); if( /*item->text(0).right(1) == "/" ||*/ item->text(0).find("/",0,TRUE) !=-1) - m.insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); + m->insertItem( tr( "Change Directory" ), this, SLOT( doLocalCd() )); else - m.insertItem( tr( "Upload" ), this, SLOT( localUpload() )); - m.insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); - m.insertItem( tr( "Rename" ), this, SLOT( localRename() )); - m.insertSeparator(); - m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); - m.setCheckable(TRUE); + m->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); + m->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); + m->insertItem( tr( "Rename" ), this, SLOT( localRename() )); + m->insertSeparator(); + m->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); + m->setCheckable(TRUE); if (b) - m.setItemChecked(m.idAt(0),TRUE); + m->setItemChecked(m->idAt(0),TRUE); else - m.setItemChecked(m.idAt(0),FALSE); + m->setItemChecked(m->idAt(0),FALSE); - m.exec( QCursor::pos() ); + m->exec( QCursor::pos() ); + delete m; } @@ -888,35 +900,44 @@ void OpieFtp::localMakDir() void OpieFtp::localDelete() { - QString f = Local_View->currentItem()->text(0); - if(QDir(f).exists() ) { - switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ - tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { - case 0: { - f=currentDir.canonicalPath()+"/"+f; - QString cmd="rmdir "+f; - system( cmd.latin1()); - populateLocalView(); - } - break; - case 1: - // exit - break; - }; + QList<QListViewItem> * getSelectedItems( QListView * Local_View ); + QListViewItemIterator it( Local_View ); + for ( ; it.current(); ++it ) { + if ( it.current()->isSelected() ) { + QString f = it.current()->text(0); + it.current()->setSelected(FALSE); + +// QString f = Local_View->currentItem()->text(0); + if(QDir(f).exists() ) { + switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+ + tr(" ?\nIt must be empty"),tr("Yes"),tr("No"),0,0,1) ) { + case 0: { + f=currentDir.canonicalPath()+"/"+f; + QString cmd="rmdir "+f; + system( cmd.latin1()); + } + break; + case 1: + // exit + break; + }; - } else { - switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f - +" ?",tr("Yes"),tr("No"),0,0,1) ) { - case 0: { - f=currentDir.canonicalPath()+"/"+f; - QString cmd="rm "+f; - system( cmd.latin1()); - populateLocalView(); - } - break; - case 1: - // exit - break; - }; + } else { + switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f + +" ?",tr("Yes"),tr("No"),0,0,1) ) { + case 0: { + f=currentDir.canonicalPath()+"/"+f; + QString cmd="rm "+f; + system( cmd.latin1()); + } + break; + case 1: + // exit + break; + }; + } + } } + populateLocalView(); + } @@ -929,5 +950,5 @@ void OpieFtp::remoteMakDir() QString filename = fileDlg->LineEdit1->text();//+".playlist"; QString tmp=currentRemoteDir+filename; -// QCopEnvelope ( "QPE/System", "busy()" ); + QCopEnvelope ( "QPE/System", "busy()" ); if(FtpMkdir( tmp.latin1(), conn) == 0) { QString msg; @@ -936,5 +957,5 @@ void OpieFtp::remoteMakDir() QMessageBox::message(tr("Note"),msg); } -// QCopEnvelope ( "QPE/System", "notBusy()" ); + QCopEnvelope ( "QPE/System", "notBusy()" ); remoteDirList( (const QString &)currentRemoteDir); //this also calls populate } @@ -943,39 +964,46 @@ void OpieFtp::remoteMakDir() void OpieFtp::remoteDelete() { - QString f = Remote_View->currentItem()->text(0); -// QCopEnvelope ( "QPE/System", "busy()" ); - if( f.right(1) =="/") { - QString path= currentRemoteDir+f; - switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" - ,tr("Yes"),tr("No"),0,0,1) ) { - case 0: { - f=currentDir.canonicalPath()+"/"+f; - if(FtpRmdir( path.latin1(), conn) ==0) { - QString msg; - msg.sprintf(tr("Unable to remove directory\n")+"%s",FtpLastResponse(conn)); - msg.replace(QRegExp(":"),"\n"); - QMessageBox::message(tr("Note"),msg); - } - remoteDirList( (const QString &)currentRemoteDir); //this also calls populate - } - break; - }; - } else { - switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" - ,tr("Yes"),tr("No"),0,0,1) ) { - case 0: { - QString path= currentRemoteDir+f; - if(FtpDelete( path.latin1(), conn)==0) { - QString msg; - msg.sprintf(tr("Unable to delete file\n")+"%s",FtpLastResponse(conn)); - msg.replace(QRegExp(":"),"\n"); - QMessageBox::message(tr("Note"),msg); - } - remoteDirList( (const QString &)currentRemoteDir); //this also calls populate - } - break; - }; + QList<QListViewItem> * getSelectedItems( QListView * Remote_View ); + QListViewItemIterator it( Remote_View ); + for ( ; it.current(); ++it ) { + if ( it.current()->isSelected() ) { + QString f = it.current()->text(0); +// QString f = Remote_View->currentItem()->text(0); + QCopEnvelope ( "QPE/System", "busy()" ); + if( f.right(1) =="/") { + QString path= currentRemoteDir+f; + switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" + ,tr("Yes"),tr("No"),0,0,1) ) { + case 0: { + f=currentDir.canonicalPath()+"/"+f; + if(FtpRmdir( path.latin1(), conn) ==0) { + QString msg; + msg.sprintf(tr("Unable to remove directory\n")+"%s",FtpLastResponse(conn)); + msg.replace(QRegExp(":"),"\n"); + QMessageBox::message(tr("Note"),msg); + } + remoteDirList( (const QString &)currentRemoteDir); //this also calls populate + } + break; + }; + } else { + switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+f+"?" + ,tr("Yes"),tr("No"),0,0,1) ) { + case 0: { + QString path= currentRemoteDir+f; + if(FtpDelete( path.latin1(), conn)==0) { + QString msg; + msg.sprintf(tr("Unable to delete file\n")+"%s",FtpLastResponse(conn)); + msg.replace(QRegExp(":"),"\n"); + QMessageBox::message(tr("Note"),msg); + } + remoteDirList( (const QString &)currentRemoteDir); //this also calls populate + } + break; + }; + } + } } -// QCopEnvelope ( "QPE/System", "notBusy()" ); + QCopEnvelope ( "QPE/System", "notBusy()" ); } @@ -990,5 +1018,5 @@ void OpieFtp::remoteRename() QString oldName = currentRemoteDir +"/"+ curFile; QString newName = currentRemoteDir +"/"+ fileDlg->LineEdit1->text();//+".playlist"; -// QCopEnvelope ( "QPE/System", "busy()" ); + QCopEnvelope ( "QPE/System", "busy()" ); if(FtpRename( oldName.latin1(), newName.latin1(),conn) == 0) { QString msg; @@ -997,5 +1025,5 @@ void OpieFtp::remoteRename() QMessageBox::message(tr("Note"),msg); } -// QCopEnvelope ( "QPE/System", "notBusy()" ); + QCopEnvelope ( "QPE/System", "notBusy()" ); remoteDirList( (const QString &)currentRemoteDir); //this also calls populate } @@ -1266,5 +1294,5 @@ void OpieFtp::upDir() currentPathCombo->lineEdit()->setText( currentRemoteDir); fillRemoteCombo( (const QString &)currentRemoteDir); - populateRemoteView( ); + } } @@ -1280,10 +1308,8 @@ void OpieFtp::docButtonPushed() { void OpieFtp::homeButtonPushed() { - if (TabWidget->currentPageIndex() == 0) { - QString current = QDir::homeDirPath(); - chdir( current.latin1() ); - currentDir.cd( current, TRUE); - populateLocalView(); - update(); - } + QString current = QDir::homeDirPath(); + chdir( current.latin1() ); + currentDir.cd( current, TRUE); + populateLocalView(); + update(); } |