summaryrefslogtreecommitdiff
path: root/noncore/net/opieftp/opieftp.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/opieftp/opieftp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 7ca3fff..293c391 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -295,18 +295,20 @@ OpieFtp::OpieFtp( )
connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
this,SLOT(currentPathComboChanged()));
ProgressBar = new QProgressBar( this, "ProgressBar" );
layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4);
-// fillCombos();
+ fillCombos();
filterStr="*";
b=FALSE;
populateLocalView();
- readConfig();
+qDebug("read COnfig");
+ readConfig();
+ qDebug("Set current item");
ServerComboBox->setCurrentItem(currentServerConfig);
TabWidget->setCurrentPage(2);
}
OpieFtp::~OpieFtp()
@@ -428,13 +430,14 @@ void OpieFtp::connector()
connectServerBtn->setOn(FALSE);
connectServerBtn->setText( tr("Connect"));
return ;
}
remoteDirList("/") ;
setCaption(ftp_host);
- writeConfig();
+ if( currentServerConfig == -1)
+ writeConfig();
connectServerBtn->setText( tr("Disconnect"));
// QCopEnvelope ( "QPE/System", "notBusy()" );
}
void OpieFtp::disConnector()
{
@@ -1142,12 +1145,13 @@ 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()
{
@@ -1167,37 +1171,42 @@ void OpieFtp::writeConfig()
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.writeEntry("currentServer", numberOfEntries+1);
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;
int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
for (int i = 1; i <= numberOfEntries; i++) {
temp.setNum(i);
+ qDebug(temp);
cfg.setGroup("Server");
remoteServerStr = cfg.readEntry( temp,"");
+ qDebug( remoteServerStr);
int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
port = remoteServerStr.right( divider - 1);
bool ok;
PortSpinBox->setValue( port.toInt(&ok,10));
remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider);
+ qDebug( remoteServerStr);
ServerComboBox->insertItem( remoteServerStr );
// cfg.setGroup(temp);
// remotePathStr = cfg.readEntry(remoteServer,"");
// int divider = remoteServer.length() - remoteServer.find(":",0,TRUE);
// port = remoteServer.right( divider+1);
@@ -1220,14 +1229,15 @@ void OpieFtp::serverComboSelected(int index)
QString username, remoteServerStr, remotePathStr, password, port, temp;
// remoteServerStr = ServerComboBox->text(index);
Config cfg("opieftp");
cfg.setGroup("Server");
int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
- temp.setNum(index+1);
+ temp.setNum(index);
remoteServerStr = cfg.readEntry( temp,"");
+ qDebug("Group" +temp);
cfg.setGroup(temp);
// qDebug(temp);
int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
port = remoteServerStr.right( divider - 1);
bool ok;
int portInt = port.toInt(&ok,10);
@@ -1236,16 +1246,18 @@ void OpieFtp::serverComboSelected(int index)
PortSpinBox->setValue( portInt);
remotePath->setText(cfg.readEntry("RemotePath", "/"));
username = cfg.readEntry("Username", "anonymous");
UsernameComboBox->lineEdit()->setText(username);
-
+ qDebug(username);
// qDebug("Password is "+cfg.readEntryCrypt(username, "me@opieftp.org"));
PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org"));
-
+// UsernameComboBox
+// PasswordEdit
+
cfg.setGroup("Server");
temp.sprintf("%d",currentServerConfig);
cfg.writeEntry("currentServer", temp);
update();
}
// UsernameComboBox->lineEdit()->setText("root");