-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 3dda17e..e64fd73 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp @@ -128,16 +128,17 @@ OpieFtp::OpieFtp( ) Local_View->addColumn( tr("File"),150); Local_View->addColumn( tr("Size"),-1); Local_View->setColumnAlignment(1,QListView::AlignRight); Local_View->addColumn( tr("Date"),-1); Local_View->setColumnAlignment(2,QListView::AlignRight); Local_View->setAllColumnsShowFocus(TRUE); Local_View->setMultiSelection( TRUE ); Local_View->setSelectionMode(QListView::Extended); + QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold); tabLayout->addWidget( Local_View, 0, 0 ); connect( Local_View, SIGNAL( clicked( QListViewItem*)), this,SLOT( localListClicked(QListViewItem *)) ); // connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), // this,SLOT( localListClicked(QListViewItem *)) ); @@ -313,17 +314,16 @@ void OpieFtp::tabChanged(QWidget *w) void OpieFtp::newConnection() { UsernameComboBox->lineEdit()->setText(""); PasswordEdit->setText( "" ); ServerComboBox->lineEdit()->setText( ""); remotePath->setText( currentRemoteDir = "/"); PortSpinBox->setValue( 21); TabWidget->setCurrentPage(2); - currentServerConfig = -1; } void OpieFtp::serverComboEdited(const QString & edit) { if( !edit.isEmpty() ) { currentServerConfig = -1; // qDebug("comboedited"); } @@ -427,18 +427,18 @@ void OpieFtp::localUpload() msg.replace(QRegExp(":"),"\n"); QMessageBox::message(tr("Note"),msg); } } else { QMessageBox::message(tr("Note"),tr("Cannot upload directories")); } ProgressBar->reset(); nullifyCallBack(); - it.current()->setSelected(FALSE); } //end currentSelected + it.current()->setSelected(FALSE); } TabWidget->setCurrentPage(1); remoteDirList( (const QString &)currentRemoteDir); //this also calls populate QCopEnvelope ( "QPE/System", "notBusy()" ); } void OpieFtp::nullifyCallBack() { @@ -481,18 +481,18 @@ void OpieFtp::remoteDownload() if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { QString msg; msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); msg.replace(QRegExp(":"),"\n"); QMessageBox::message(tr("Note"),msg); } ProgressBar->reset(); nullifyCallBack(); - it.current()->setSelected(FALSE); } + it.current()->setSelected(FALSE); } TabWidget->setCurrentPage(0); populateLocalView(); QCopEnvelope ( "QPE/System", "notBusy()" ); } bool OpieFtp::remoteDirList(const QString &dir) { @@ -652,17 +652,17 @@ bool OpieFtp::populateRemoteView( ) qDebug("temp file not opened successfullly "+sfile); Remote_View->setSorting( 4,TRUE); return true; } void OpieFtp::remoteListClicked(QListViewItem *selectedItem) { if( selectedItem) { - QCopEnvelope ( "QPE/System", "busy()" ); +// QCopEnvelope ( "QPE/System", "busy()" ); QString oldRemoteCurrentDir = currentRemoteDir; QString strItem=selectedItem->text(0); strItem=strItem.simplifyWhiteSpace(); if(strItem == "../") { // the user wants to go ^ if( FtpCDUp( conn) == 0) { QString msg; msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); msg.replace(QRegExp(":"),"\n"); @@ -681,38 +681,38 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) } else { if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 ); strItem = strItem.stripWhiteSpace(); currentRemoteDir = strItem; if( !remoteChDir( (const QString &)strItem)) { currentRemoteDir = oldRemoteCurrentDir; strItem=""; - qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); +// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); } } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory - qDebug("trying directory"); if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) { currentRemoteDir = oldRemoteCurrentDir; strItem=""; - qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); +// qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir); } else { currentRemoteDir = currentRemoteDir+strItem; } } else { - qDebug("download "+strItem); + QCopEnvelope ( "QPE/System", "notBusy()" ); + return; } } remoteDirList( (const QString &)currentRemoteDir); //this also calls populate if(currentRemoteDir.right(1) !="/") currentRemoteDir +="/"; currentPathCombo->lineEdit()->setText( currentRemoteDir ); - fillRemoteCombo( (const QString &)currentDir); - QCopEnvelope ( "QPE/System", "notBusy()" ); + fillRemoteCombo( (const QString &)currentRemoteDir); +// QCopEnvelope ( "QPE/System", "notBusy()" ); } } void OpieFtp::localListClicked(QListViewItem *selectedItem) { if(selectedItem!= NULL) { QString strItem=selectedItem->text(0); @@ -722,32 +722,34 @@ void OpieFtp::localListClicked(QListViewItem *selectedItem) // is symlink QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4); if(QDir(strItem2).exists() ) { currentDir.cd(strItem2, TRUE); populateLocalView(); } } else { // not a symlink if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) { + if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) { strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); currentDir.cd(strItem,FALSE); populateLocalView(); } else { currentDir.cdUp(); populateLocalView(); } if(QDir(strItem).exists()){ currentDir.cd(strItem, TRUE); populateLocalView(); } } else { strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem); if( QFile::exists(strItem ) ) { // qDebug("upload "+strItem); + return; } } //end not symlink chdir(strItem.latin1()); } } } void OpieFtp::doLocalCd() @@ -1063,39 +1065,42 @@ void OpieFtp::readConfig() Config cfg("opieftp"); cfg.setGroup("Server"); currentServerConfig = cfg.readNumEntry("currentServer", -1); serverComboSelected( currentServerConfig); } void OpieFtp::writeConfig() { - Config cfg("opieftp"); cfg.setGroup("Server"); QString username, remoteServerStr, remotePathStr, password, port, temp; int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); if( currentServerConfig == -1) { + for (int i = 1; i <= numberOfEntries; i++) { + temp.setNum(i); + cfg.setGroup("Server"); + QString tempStr = cfg.readEntry( temp,""); + } temp.setNum( numberOfEntries + 1); cfg.setGroup("Server"); remoteServerStr = cfg.readEntry( temp,""); int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); temp.setNum(numberOfEntries+1); cfg.setGroup("Server"); cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() ); cfg.setGroup(temp); cfg.writeEntry("RemotePath", remotePath->text()); cfg.writeEntry("Username", UsernameComboBox->currentText()); cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text()); cfg.setGroup("Server"); cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); - } } void OpieFtp::fillCombos() { Config cfg("opieftp"); cfg.setGroup("Server"); QString username, remoteServerStr, remotePathStr, password, port, temp; |