author | llornkcor <llornkcor> | 2002-04-05 01:34:24 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-05 01:34:24 (UTC) |
commit | dd5bc1f9d61cdd8cfde4c7a7fbba3b53b77b2670 (patch) (side-by-side diff) | |
tree | e8ebf3f926e3ac7e4d612964a05bce834fe6fc2e | |
parent | 8674b15e0768d5108d9a225ff2631538283e1019 (diff) | |
download | opie-dd5bc1f9d61cdd8cfde4c7a7fbba3b53b77b2670.zip opie-dd5bc1f9d61cdd8cfde4c7a7fbba3b53b77b2670.tar.gz opie-dd5bc1f9d61cdd8cfde4c7a7fbba3b53b77b2670.tar.bz2 |
fixed bug where same server was being saved multiple times
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index b451925..919649e 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp @@ -111,17 +111,17 @@ OpieFtp::OpieFtp( ) tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() )); tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() )); tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() )); tabMenu->setCheckable(TRUE); TabWidget = new QTabWidget( this, "TabWidget" ); layout->addMultiCellWidget( TabWidget, 1, 1, 0, 3 ); - TabWidget->setTabShape(QTabWidget::Triangular); +// TabWidget->setTabShape(QTabWidget::Triangular); tab = new QWidget( TabWidget, "tab" ); tabLayout = new QGridLayout( tab ); tabLayout->setSpacing( 2); tabLayout->setMargin( 2); Local_View = new QListView( tab, "Local_View" ); // Local_View->setResizePolicy( QListView::AutoOneFit ); @@ -262,17 +262,18 @@ OpieFtp::OpieFtp( ) layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 ); // fillCombos(); filterStr="*"; b=FALSE; populateLocalView(); readConfig(); - ServerComboBox->setCurrentItem(currentServerConfig); + ServerComboBox->setCurrentItem(currentServerConfig); + TabWidget->setCurrentPage(2); } OpieFtp::~OpieFtp() { } void OpieFtp::cleanUp() @@ -318,19 +319,19 @@ void OpieFtp::newConnection() ServerComboBox->lineEdit()->setText( ""); remotePath->setText( currentRemoteDir = "/"); PortSpinBox->setValue( 21); TabWidget->setCurrentPage(2); } void OpieFtp::serverComboEdited(const QString & edit) { - if( !edit.isEmpty() ) { + if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { + qDebug("ServerComboEdited"); currentServerConfig = -1; -// qDebug("comboedited"); } } void OpieFtp::connectorBtnToggled(bool On) { if(On) { connector(); } else { @@ -518,17 +519,17 @@ bool OpieFtp::remoteDirList(const QString &dir) bool OpieFtp::remoteChDir(const QString &dir) { QCopEnvelope ( "QPE/System", "busy()" ); if (!FtpChdir( dir.latin1(), conn )) { QString msg; msg.sprintf(tr("Unable to change directories\n")+dir+"\n%s",FtpLastResponse(conn)); msg.replace(QRegExp(":"),"\n"); QMessageBox::message(tr("Note"),msg); - qDebug(msg); +// qDebug(msg); QCopEnvelope ( "QPE/System", "notBusy()" ); return FALSE; } QCopEnvelope ( "QPE/System", "notBusy()" ); return TRUE; } void OpieFtp::populateLocalView() @@ -662,25 +663,25 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem) 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"); QMessageBox::message(tr("Note"),msg); - qDebug(msg); +// qDebug(msg); } char path[256]; if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string QString msg; msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); msg.replace(QRegExp(":"),"\n"); QMessageBox::message(tr("Note"),msg); - qDebug(msg); +// qDebug(msg); } currentRemoteDir=path; } 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)) { @@ -1060,32 +1061,32 @@ void OpieFtp::switchToConfigTab() } void OpieFtp::readConfig() { fillCombos(); Config cfg("opieftp"); cfg.setGroup("Server"); currentServerConfig = cfg.readNumEntry("currentServer", -1); +// qDebug("Reading %d", currentServerConfig); 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"); |