-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 24 |
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 | |||
@@ -298,12 +298,14 @@ OpieFtp::OpieFtp( ) | |||
298 | ProgressBar = new QProgressBar( this, "ProgressBar" ); | 298 | ProgressBar = new QProgressBar( this, "ProgressBar" ); |
299 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); | 299 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); |
300 | 300 | ||
301 | // fillCombos(); | 301 | fillCombos(); |
302 | 302 | ||
303 | filterStr="*"; | 303 | filterStr="*"; |
304 | b=FALSE; | 304 | b=FALSE; |
305 | populateLocalView(); | 305 | populateLocalView(); |
306 | readConfig(); | 306 | qDebug("read COnfig"); |
307 | readConfig(); | ||
308 | qDebug("Set current item"); | ||
307 | ServerComboBox->setCurrentItem(currentServerConfig); | 309 | ServerComboBox->setCurrentItem(currentServerConfig); |
308 | 310 | ||
309 | TabWidget->setCurrentPage(2); | 311 | TabWidget->setCurrentPage(2); |
@@ -431,7 +433,8 @@ void OpieFtp::connector() | |||
431 | } | 433 | } |
432 | remoteDirList("/") ; | 434 | remoteDirList("/") ; |
433 | setCaption(ftp_host); | 435 | setCaption(ftp_host); |
434 | writeConfig(); | 436 | if( currentServerConfig == -1) |
437 | writeConfig(); | ||
435 | connectServerBtn->setText( tr("Disconnect")); | 438 | connectServerBtn->setText( tr("Disconnect")); |
436 | // QCopEnvelope ( "QPE/System", "notBusy()" ); | 439 | // QCopEnvelope ( "QPE/System", "notBusy()" ); |
437 | } | 440 | } |
@@ -1145,6 +1148,7 @@ void OpieFtp::readConfig() | |||
1145 | Config cfg("opieftp"); | 1148 | Config cfg("opieftp"); |
1146 | cfg.setGroup("Server"); | 1149 | cfg.setGroup("Server"); |
1147 | currentServerConfig = cfg.readNumEntry("currentServer", -1); | 1150 | currentServerConfig = cfg.readNumEntry("currentServer", -1); |
1151 | |||
1148 | // qDebug("Reading %d", currentServerConfig); | 1152 | // qDebug("Reading %d", currentServerConfig); |
1149 | serverComboSelected( currentServerConfig); | 1153 | serverComboSelected( currentServerConfig); |
1150 | } | 1154 | } |
@@ -1170,12 +1174,14 @@ void OpieFtp::writeConfig() | |||
1170 | temp.setNum(numberOfEntries+1); | 1174 | temp.setNum(numberOfEntries+1); |
1171 | cfg.setGroup("Server"); | 1175 | cfg.setGroup("Server"); |
1172 | cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() ); | 1176 | cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() ); |
1177 | cfg.writeEntry("currentServer", numberOfEntries+1); | ||
1173 | cfg.setGroup(temp); | 1178 | cfg.setGroup(temp); |
1174 | cfg.writeEntry("RemotePath", remotePath->text()); | 1179 | cfg.writeEntry("RemotePath", remotePath->text()); |
1175 | cfg.writeEntry("Username", UsernameComboBox->currentText()); | 1180 | cfg.writeEntry("Username", UsernameComboBox->currentText()); |
1176 | cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text()); | 1181 | cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text()); |
1177 | cfg.setGroup("Server"); | 1182 | cfg.setGroup("Server"); |
1178 | cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); | 1183 | cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); |
1184 | |||
1179 | } | 1185 | } |
1180 | } | 1186 | } |
1181 | 1187 | ||
@@ -1187,14 +1193,17 @@ void OpieFtp::fillCombos() | |||
1187 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1193 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1188 | for (int i = 1; i <= numberOfEntries; i++) { | 1194 | for (int i = 1; i <= numberOfEntries; i++) { |
1189 | temp.setNum(i); | 1195 | temp.setNum(i); |
1196 | qDebug(temp); | ||
1190 | cfg.setGroup("Server"); | 1197 | cfg.setGroup("Server"); |
1191 | remoteServerStr = cfg.readEntry( temp,""); | 1198 | remoteServerStr = cfg.readEntry( temp,""); |
1199 | qDebug( remoteServerStr); | ||
1192 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); | 1200 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); |
1193 | port = remoteServerStr.right( divider - 1); | 1201 | port = remoteServerStr.right( divider - 1); |
1194 | bool ok; | 1202 | bool ok; |
1195 | PortSpinBox->setValue( port.toInt(&ok,10)); | 1203 | PortSpinBox->setValue( port.toInt(&ok,10)); |
1196 | 1204 | ||
1197 | remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); | 1205 | remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); |
1206 | qDebug( remoteServerStr); | ||
1198 | ServerComboBox->insertItem( remoteServerStr ); | 1207 | ServerComboBox->insertItem( remoteServerStr ); |
1199 | // cfg.setGroup(temp); | 1208 | // cfg.setGroup(temp); |
1200 | 1209 | ||
@@ -1223,8 +1232,9 @@ void OpieFtp::serverComboSelected(int index) | |||
1223 | cfg.setGroup("Server"); | 1232 | cfg.setGroup("Server"); |
1224 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1233 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1225 | 1234 | ||
1226 | temp.setNum(index+1); | 1235 | temp.setNum(index); |
1227 | remoteServerStr = cfg.readEntry( temp,""); | 1236 | remoteServerStr = cfg.readEntry( temp,""); |
1237 | qDebug("Group" +temp); | ||
1228 | cfg.setGroup(temp); | 1238 | cfg.setGroup(temp); |
1229 | // qDebug(temp); | 1239 | // qDebug(temp); |
1230 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); | 1240 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); |
@@ -1239,10 +1249,12 @@ void OpieFtp::serverComboSelected(int index) | |||
1239 | 1249 | ||
1240 | username = cfg.readEntry("Username", "anonymous"); | 1250 | username = cfg.readEntry("Username", "anonymous"); |
1241 | UsernameComboBox->lineEdit()->setText(username); | 1251 | UsernameComboBox->lineEdit()->setText(username); |
1242 | 1252 | qDebug(username); | |
1243 | // qDebug("Password is "+cfg.readEntryCrypt(username, "me@opieftp.org")); | 1253 | // qDebug("Password is "+cfg.readEntryCrypt(username, "me@opieftp.org")); |
1244 | PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org")); | 1254 | PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org")); |
1245 | 1255 | // UsernameComboBox | |
1256 | // PasswordEdit | ||
1257 | |||
1246 | cfg.setGroup("Server"); | 1258 | cfg.setGroup("Server"); |
1247 | temp.sprintf("%d",currentServerConfig); | 1259 | temp.sprintf("%d",currentServerConfig); |
1248 | cfg.writeEntry("currentServer", temp); | 1260 | cfg.writeEntry("currentServer", temp); |