-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 260 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.h | 42 |
2 files changed, 237 insertions, 65 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 9d6356d..9beac94 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -53,2 +53,3 @@ extern "C" { | |||
53 | #include <qregexp.h> | 53 | #include <qregexp.h> |
54 | #include <qlistbox.h> | ||
54 | 55 | ||
@@ -76,3 +77,3 @@ OpieFtp::OpieFtp( ) | |||
76 | setCaption( tr( "OpieFtp" ) ); | 77 | setCaption( tr( "OpieFtp" ) ); |
77 | 78 | fuckeduphack=FALSE; | |
78 | QGridLayout *layout = new QGridLayout( this ); | 79 | QGridLayout *layout = new QGridLayout( this ); |
@@ -226,2 +227,4 @@ OpieFtp::OpieFtp( ) | |||
226 | 227 | ||
228 | connect( UsernameComboBox,SIGNAL(textChanged(const QString &)),this,SLOT( UsernameComboBoxEdited(const QString & ) )); | ||
229 | |||
227 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); | 230 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); |
@@ -233,2 +236,5 @@ OpieFtp::OpieFtp( ) | |||
233 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); | 236 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); |
237 | |||
238 | connect( PasswordEdit,SIGNAL(textChanged(const QString &)),this,SLOT( PasswordEditEdited(const QString & ) )); | ||
239 | |||
234 | //PasswordEdit->setFixedWidth(85); | 240 | //PasswordEdit->setFixedWidth(85); |
@@ -261,10 +267,10 @@ OpieFtp::OpieFtp( ) | |||
261 | 267 | ||
262 | QPushButton *deleteServerBtn; | 268 | serverListView = new QListBox( tab_3, "ServerListView" ); |
263 | deleteServerBtn = new QPushButton( "Delete Server", tab_3 , "OpenButton" ); | 269 | tabLayout_3->addMultiCellWidget( serverListView , 5, 5, 0, 5); |
264 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 5, 5, 2, 3); | ||
265 | |||
266 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); | ||
267 | 270 | ||
271 | connect( serverListView, SIGNAL( highlighted( const QString &)), | ||
272 | this,SLOT( serverListClicked( const QString &) ) ); | ||
273 | |||
268 | connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); | 274 | connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); |
269 | tabLayout_3->addMultiCellWidget( connectServerBtn, 5, 5, 0, 1); | 275 | tabLayout_3->addMultiCellWidget( connectServerBtn, 6, 6, 0, 1); |
270 | connectServerBtn->setToggleButton(TRUE); | 276 | connectServerBtn->setToggleButton(TRUE); |
@@ -272,2 +278,13 @@ OpieFtp::OpieFtp( ) | |||
272 | 278 | ||
279 | newServerButton= new QPushButton( "Add", tab_3 , "NewServerButton" ); | ||
280 | tabLayout_3->addMultiCellWidget( newServerButton, 6, 6, 2, 2); | ||
281 | connect( newServerButton,SIGNAL( clicked()),SLOT( NewServer() )); | ||
282 | |||
283 | QPushButton *deleteServerBtn; | ||
284 | deleteServerBtn = new QPushButton( "Delete", tab_3 , "OpenButton" ); | ||
285 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 6, 6, 3, 3); | ||
286 | |||
287 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); | ||
288 | |||
289 | |||
273 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 290 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
@@ -298,5 +315,3 @@ OpieFtp::OpieFtp( ) | |||
298 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); | 315 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); |
299 | 316 | ProgressBar->setMaximumHeight(10); | |
300 | fillCombos(); | ||
301 | |||
302 | filterStr="*"; | 317 | filterStr="*"; |
@@ -304,6 +319,5 @@ OpieFtp::OpieFtp( ) | |||
304 | populateLocalView(); | 319 | populateLocalView(); |
305 | qDebug("read COnfig"); | 320 | readConfig(); |
306 | readConfig(); | 321 | |
307 | qDebug("Set current item"); | 322 | // ServerComboBox->setCurrentItem(currentServerConfig); |
308 | ServerComboBox->setCurrentItem(currentServerConfig); | ||
309 | 323 | ||
@@ -328,2 +342,6 @@ void OpieFtp::cleanUp() | |||
328 | file.remove(); | 342 | file.remove(); |
343 | Config cfg("opieftp"); | ||
344 | cfg.setGroup("Server"); | ||
345 | cfg.writeEntry("currentServer", currentServerConfig); | ||
346 | |||
329 | exit(0); | 347 | exit(0); |
@@ -375,6 +393,14 @@ void OpieFtp::serverComboEdited(const QString & edit) | |||
375 | { | 393 | { |
376 | if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { | 394 | // if( ServerComboBox->text(currentServerConfig) != edit /*edit.isEmpty() */) { |
377 | qDebug("ServerComboEdited"); | 395 | // qDebug("ServerComboEdited"); |
378 | currentServerConfig = -1; | 396 | // // currentServerConfig = -1; |
379 | } | 397 | // } |
398 | } | ||
399 | |||
400 | void OpieFtp::UsernameComboBoxEdited(const QString & use) { | ||
401 | // currentServerConfig = -1; | ||
402 | } | ||
403 | |||
404 | void OpieFtp::PasswordEditEdited(const QString & pass) { | ||
405 | // currentServerConfig = -1; | ||
380 | } | 406 | } |
@@ -396,3 +422,5 @@ void OpieFtp::connector() | |||
396 | currentRemoteDir=remotePath->text(); | 422 | currentRemoteDir=remotePath->text(); |
397 | if(ServerComboBox->currentText().isEmpty()) { | 423 | |
424 | if( ServerComboBox->currentText().isEmpty()) { | ||
425 | |||
398 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); | 426 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); |
@@ -404,3 +432,5 @@ void OpieFtp::connector() | |||
404 | } | 432 | } |
433 | |||
405 | FtpInit(); | 434 | FtpInit(); |
435 | |||
406 | TabWidget->setCurrentPage(1); | 436 | TabWidget->setCurrentPage(1); |
@@ -412,2 +442,15 @@ void OpieFtp::connector() | |||
412 | 442 | ||
443 | Config cfg("opieftp"); | ||
444 | cfg.setGroup("Server"); | ||
445 | int current=cfg.readNumEntry("currentServer", 1); | ||
446 | |||
447 | // if(ftp_host!= cfg.readEntry(QString::number( current))) | ||
448 | // currentServerConfig=-1; | ||
449 | // cfg.setGroup(QString::number(current)); | ||
450 | // if( ftp_user != cfg.readEntry("Username")) | ||
451 | // currentServerConfig=-1; | ||
452 | // if(ftp_pass != cfg.readEntry(cfg.readEntry("Username"))) | ||
453 | // currentServerConfig=-1; | ||
454 | |||
455 | |||
413 | if(ftp_host.find("ftp://",0, TRUE) != -1 ) | 456 | if(ftp_host.find("ftp://",0, TRUE) != -1 ) |
@@ -415,2 +458,3 @@ void OpieFtp::connector() | |||
415 | ftp_host+=":"+port; | 458 | ftp_host+=":"+port; |
459 | |||
416 | if (!FtpConnect( ftp_host.latin1(), &conn)) { | 460 | if (!FtpConnect( ftp_host.latin1(), &conn)) { |
@@ -421,2 +465,3 @@ void OpieFtp::connector() | |||
421 | } | 465 | } |
466 | |||
422 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { | 467 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { |
@@ -432,5 +477,6 @@ void OpieFtp::connector() | |||
432 | } | 477 | } |
478 | |||
433 | remoteDirList("/") ; | 479 | remoteDirList("/") ; |
434 | setCaption(ftp_host); | 480 | setCaption(ftp_host); |
435 | if( currentServerConfig == -1) | 481 | if( currentServerConfig == -1) |
436 | writeConfig(); | 482 | writeConfig(); |
@@ -624,3 +670,3 @@ void OpieFtp::populateLocalView() | |||
624 | if(fileL !="./" && fi->exists()) { | 670 | if(fileL !="./" && fi->exists()) { |
625 | item= new QListViewItem( Local_View,fileL, fileDate, fileS ); | 671 | item = new QListViewItem( Local_View,fileL, fileDate, fileS ); |
626 | QPixmap pm; | 672 | QPixmap pm; |
@@ -1151,3 +1197,4 @@ void OpieFtp::readConfig() | |||
1151 | // qDebug("Reading %d", currentServerConfig); | 1197 | // qDebug("Reading %d", currentServerConfig); |
1152 | serverComboSelected( currentServerConfig); | 1198 | serverComboSelected( currentServerConfig-1); |
1199 | |||
1153 | } | 1200 | } |
@@ -1156,8 +1203,13 @@ void OpieFtp::writeConfig() | |||
1156 | { | 1203 | { |
1204 | qDebug("write config"); | ||
1157 | Config cfg("opieftp"); | 1205 | Config cfg("opieftp"); |
1158 | cfg.setGroup("Server"); | 1206 | cfg.setGroup("Server"); |
1207 | |||
1159 | QString username, remoteServerStr, remotePathStr, password, port, temp; | 1208 | QString username, remoteServerStr, remotePathStr, password, port, temp; |
1209 | |||
1160 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1210 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1211 | |||
1161 | if( currentServerConfig == -1) { | 1212 | if( currentServerConfig == -1) { |
1162 | for (int i = 1; i <= numberOfEntries; i++) { | 1213 | |
1214 | for (int i = 1; i <= numberOfEntries; i++) { | ||
1163 | temp.setNum(i); | 1215 | temp.setNum(i); |
@@ -1166,5 +1218,8 @@ void OpieFtp::writeConfig() | |||
1166 | } | 1218 | } |
1219 | |||
1167 | temp.setNum( numberOfEntries + 1); | 1220 | temp.setNum( numberOfEntries + 1); |
1168 | cfg.setGroup("Server"); | 1221 | cfg.setGroup("Server"); |
1222 | |||
1169 | remoteServerStr = cfg.readEntry( temp,""); | 1223 | remoteServerStr = cfg.readEntry( temp,""); |
1224 | |||
1170 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); | 1225 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); |
@@ -1174,9 +1229,20 @@ void OpieFtp::writeConfig() | |||
1174 | cfg.setGroup("Server"); | 1229 | cfg.setGroup("Server"); |
1230 | |||
1175 | cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() ); | 1231 | cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() ); |
1176 | cfg.writeEntry("currentServer", numberOfEntries+1); | 1232 | cfg.writeEntry("currentServer", numberOfEntries+1); |
1233 | |||
1234 | currentServerConfig = numberOfEntries+1; | ||
1235 | qDebug("setting currentserverconfig to %d", currentServerConfig); | ||
1236 | |||
1177 | cfg.setGroup(temp); | 1237 | cfg.setGroup(temp); |
1238 | if(!newServerName.isEmpty()) | ||
1239 | cfg.writeEntry("ServerName", newServerName); | ||
1240 | |||
1178 | cfg.writeEntry("RemotePath", remotePath->text()); | 1241 | cfg.writeEntry("RemotePath", remotePath->text()); |
1242 | |||
1179 | cfg.writeEntry("Username", UsernameComboBox->currentText()); | 1243 | cfg.writeEntry("Username", UsernameComboBox->currentText()); |
1244 | |||
1180 | cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text()); | 1245 | cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text()); |
1181 | cfg.setGroup("Server"); | 1246 | cfg.setGroup("Server"); |
1247 | |||
1182 | cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); | 1248 | cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); |
@@ -1186,4 +1252,15 @@ void OpieFtp::writeConfig() | |||
1186 | 1252 | ||
1253 | void OpieFtp::clearCombos() { | ||
1254 | qDebug("clearing"); | ||
1255 | ServerComboBox->clear(); | ||
1256 | UsernameComboBox->clear(); | ||
1257 | PasswordEdit->clear(); | ||
1258 | serverListView->clear(); | ||
1259 | } | ||
1260 | |||
1261 | |||
1187 | void OpieFtp::fillCombos() | 1262 | void OpieFtp::fillCombos() |
1188 | { | 1263 | { |
1264 | clearCombos(); | ||
1265 | |||
1189 | Config cfg("opieftp"); | 1266 | Config cfg("opieftp"); |
@@ -1192,2 +1269,3 @@ void OpieFtp::fillCombos() | |||
1192 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1269 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1270 | |||
1193 | for (int i = 1; i <= numberOfEntries; i++) { | 1271 | for (int i = 1; i <= numberOfEntries; i++) { |
@@ -1198,2 +1276,3 @@ void OpieFtp::fillCombos() | |||
1198 | qDebug( remoteServerStr); | 1276 | qDebug( remoteServerStr); |
1277 | |||
1199 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); | 1278 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); |
@@ -1204,18 +1283,13 @@ void OpieFtp::fillCombos() | |||
1204 | remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); | 1283 | remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); |
1205 | qDebug( remoteServerStr); | 1284 | qDebug( "remote server string "+remoteServerStr); |
1206 | ServerComboBox->insertItem( remoteServerStr ); | 1285 | ServerComboBox->insertItem( remoteServerStr ); |
1207 | // cfg.setGroup(temp); | ||
1208 | 1286 | ||
1209 | // remotePathStr = cfg.readEntry(remoteServer,""); | 1287 | cfg.setGroup(temp); |
1210 | // int divider = remoteServer.length() - remoteServer.find(":",0,TRUE); | ||
1211 | // port = remoteServer.right( divider+1); | ||
1212 | // PortSpinBox->setValue( port); | ||
1213 | 1288 | ||
1214 | // remoteServer = remoteServer.left(divider - 1); | 1289 | username = cfg.readEntry(temp); |
1215 | // remotePath->setText( remotePathStr); | 1290 | UsernameComboBox->insertItem(username); |
1291 | password = cfg.readEntryCrypt(username,""); | ||
1292 | PasswordEdit->setText(password); | ||
1216 | 1293 | ||
1217 | // username = cfg.readEntry(temp); | 1294 | serverListView->insertItem( cfg.readEntry("ServerName")); |
1218 | // UsernameComboBox->insertItem(username); | ||
1219 | // password = cfg.readEntryCrypt(username,""); | ||
1220 | // PasswordEdit->setText(password); | ||
1221 | } | 1295 | } |
@@ -1226,5 +1300,7 @@ void OpieFtp::serverComboSelected(int index) | |||
1226 | { | 1300 | { |
1227 | currentServerConfig = index; | 1301 | currentServerConfig = index+1; |
1302 | qDebug("server combo selected %d", index+1); | ||
1228 | QString username, remoteServerStr, remotePathStr, password, port, temp; | 1303 | QString username, remoteServerStr, remotePathStr, password, port, temp; |
1229 | // remoteServerStr = ServerComboBox->text(index); | 1304 | // remoteServerStr = ServerComboBox->text(index); |
1305 | |||
1230 | Config cfg("opieftp"); | 1306 | Config cfg("opieftp"); |
@@ -1233,4 +1309,5 @@ void OpieFtp::serverComboSelected(int index) | |||
1233 | 1309 | ||
1234 | temp.setNum(index); | 1310 | temp.setNum(index+1); |
1235 | remoteServerStr = cfg.readEntry( temp,""); | 1311 | remoteServerStr = cfg.readEntry( temp,""); |
1312 | |||
1236 | qDebug("Group" +temp); | 1313 | qDebug("Group" +temp); |
@@ -1243,3 +1320,5 @@ void OpieFtp::serverComboSelected(int index) | |||
1243 | if( portInt == 0) portInt = 21; | 1320 | if( portInt == 0) portInt = 21; |
1244 | 1321 | ||
1322 | ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE))); | ||
1323 | |||
1245 | PortSpinBox->setValue( portInt); | 1324 | PortSpinBox->setValue( portInt); |
@@ -1258,10 +1337,10 @@ void OpieFtp::serverComboSelected(int index) | |||
1258 | temp.sprintf("%d",currentServerConfig); | 1337 | temp.sprintf("%d",currentServerConfig); |
1259 | cfg.writeEntry("currentServer", temp); | 1338 | cfg.writeEntry("currentServer", temp); |
1339 | |||
1340 | fuckeduphack = TRUE; | ||
1341 | serverListView->setCurrentItem( index); | ||
1342 | fuckeduphack=FALSE; | ||
1343 | qDebug("server list set selected %d",index); | ||
1260 | update(); | 1344 | update(); |
1261 | } | 1345 | } |
1262 | // UsernameComboBox->lineEdit()->setText("root"); | ||
1263 | // PasswordEdit->setText( tr( "" ) ); | ||
1264 | // ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); | ||
1265 | // remotePath->setText( currentRemoteDir = "/home/llornkcor/"); | ||
1266 | // PortSpinBox->setValue( 4242); | ||
1267 | 1346 | ||
@@ -1269,17 +1348,61 @@ void OpieFtp::deleteServer() | |||
1269 | { | 1348 | { |
1270 | QString username, remoteServerStr, remotePathStr, password, port, temp; | 1349 | QString username, remoteServerStr, remotePathStr, password, port, temp, servername; |
1271 | remoteServerStr = ServerComboBox->currentText( ); | 1350 | remoteServerStr = ServerComboBox->currentText( ); |
1272 | username = UsernameComboBox->currentText(); | 1351 | username = UsernameComboBox->currentText(); |
1352 | servername=serverListView->currentText(); | ||
1353 | |||
1273 | Config cfg("opieftp"); | 1354 | Config cfg("opieftp"); |
1274 | cfg.setGroup("Server"); | 1355 | cfg.setGroup("Server"); |
1356 | QString tempname; | ||
1275 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1357 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1276 | for (int i = 0; i <= numberOfEntries; i++) { | 1358 | |
1277 | temp.setNum(i+1); | 1359 | for (int i = 1; i <= numberOfEntries; i++) { |
1278 | cfg.setGroup("Server"); | 1360 | temp.setNum(i); |
1279 | if( cfg.readEntry( temp,"").find( remoteServerStr,0,TRUE) != -1 | 1361 | // cfg.setGroup("Server"); |
1280 | && cfg.readEntry(temp).find(username,0,TRUE) != -1 | 1362 | cfg.setGroup(QString::number(i)); |
1281 | && !remoteServerStr.isEmpty()) { | 1363 | tempname=cfg.readEntry( "ServerName",""); |
1282 | qDebug(temp); | 1364 | |
1365 | if( tempname.find( servername,0,TRUE) != -1 ) { | ||
1366 | // servername.find( cfg.readEntry("ServerName")) != -1 && | ||
1367 | // remoteServerStr.find( cfg.readEntry("RemotePath")) != -1 && | ||
1368 | // username.find( cfg.readEntry("Username")) != -1) { | ||
1369 | |||
1370 | serverListView->removeItem(i); | ||
1371 | |||
1372 | qDebug("OK DELETE "+tempname); | ||
1373 | cfg.removeEntry(QString::number(i)); | ||
1374 | for ( i; i <= numberOfEntries; i++) { | ||
1375 | cfg.setGroup("Server"); | ||
1376 | cfg.writeEntry("Server", QString::number(numberOfEntries + 1 )); | ||
1377 | |||
1378 | cfg.setGroup(QString::number(i+1)); //get next server config | ||
1379 | servername=cfg.readEntry("ServerName"); | ||
1380 | remoteServerStr=cfg.readEntry("RemotePath"); | ||
1381 | username=cfg.readEntry("Username"); | ||
1382 | password=cfg.readEntryCrypt( username); | ||
1383 | |||
1384 | cfg.setGroup(QString::number(i)); | ||
1385 | |||
1386 | cfg.writeEntry("RemotePath", remoteServerStr); | ||
1387 | cfg.writeEntry("ServerName", servername); | ||
1388 | cfg.writeEntry("Username", username); | ||
1389 | cfg.writeEntryCrypt( username, password); | ||
1390 | |||
1391 | } | ||
1392 | cfg.setGroup("Server"); | ||
1393 | cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries - 1 )); | ||
1283 | } | 1394 | } |
1284 | } | 1395 | } |
1396 | cfg.setGroup(QString::number(numberOfEntries)); | ||
1397 | cfg.removeEntry("Server"); | ||
1398 | cfg.removeEntry("RemotePath"); | ||
1399 | cfg.removeEntry("ServerName"); | ||
1400 | username=cfg.readEntry("Username"); | ||
1401 | cfg.removeEntry("Username"); | ||
1402 | cfg.removeEntry(username); | ||
1403 | |||
1404 | currentServerConfig=currentServerConfig-1; | ||
1405 | |||
1406 | fillCombos(); | ||
1407 | update(); | ||
1285 | } | 1408 | } |
@@ -1347 +1470,34 @@ void OpieFtp::doAbout() { | |||
1347 | } | 1470 | } |
1471 | |||
1472 | void OpieFtp::NewServer() { | ||
1473 | InputDialog *fileDlg; | ||
1474 | fileDlg = new InputDialog(this,tr("New Server name"),TRUE, 0); | ||
1475 | fileDlg->exec(); | ||
1476 | Config cfg("opieftp"); | ||
1477 | if( fileDlg->result() == 1 ) { | ||
1478 | newServerName = fileDlg->LineEdit1->text(); | ||
1479 | for(int i=1;i<serverListView->count();i++) { | ||
1480 | cfg.setGroup( QString::number(i)); | ||
1481 | if(cfg.readEntry("ServerName").find(newServerName,0,TRUE) != -1) { | ||
1482 | QMessageBox::message(tr("OpieFtp"),tr("Sorry name already taken")); | ||
1483 | return; | ||
1484 | } | ||
1485 | } | ||
1486 | currentServerConfig =-1; | ||
1487 | writeConfig(); | ||
1488 | serverListView->insertItem( newServerName ); | ||
1489 | serverListView->setCurrentItem( serverListView->count()); | ||
1490 | } | ||
1491 | } | ||
1492 | |||
1493 | void OpieFtp::serverListClicked( const QString &item) { | ||
1494 | if(item.isEmpty()) return; | ||
1495 | Config cfg("opieftp"); | ||
1496 | qDebug("highltined "+item); | ||
1497 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | ||
1498 | for (int i = 1; i <= numberOfEntries; i++) { | ||
1499 | cfg.setGroup(QString::number(i)); | ||
1500 | if(cfg.readEntry( "ServerName").find(item) != -1 && !fuckeduphack) | ||
1501 | serverComboSelected(i-1); | ||
1502 | } | ||
1503 | } | ||
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h index ad36b1d..2aa691a 100644 --- a/noncore/net/opieftp/opieftp.h +++ b/noncore/net/opieftp/opieftp.h | |||
@@ -26,3 +26,3 @@ class QComboBox; | |||
26 | class QListView; | 26 | class QListView; |
27 | class QListviewItem; | 27 | class QListViewItem; |
28 | class QLabel; | 28 | class QLabel; |
@@ -36,3 +36,2 @@ class QPopupMenu; | |||
36 | class QFile; | 36 | class QFile; |
37 | class QListViewItem; | ||
38 | class QLineEdit; | 37 | class QLineEdit; |
@@ -41,2 +40,3 @@ class QToolButton; | |||
41 | class QStringList; | 40 | class QStringList; |
41 | class QListBox; | ||
42 | 42 | ||
@@ -53,2 +53,3 @@ public: | |||
53 | QListView *Local_View, *Remote_View; | 53 | QListView *Local_View, *Remote_View; |
54 | QListBox *serverListView; | ||
54 | 55 | ||
@@ -63,3 +64,3 @@ public: | |||
63 | QListViewItem * item; | 64 | QListViewItem * item; |
64 | QPushButton *connectServerBtn;// | 65 | QPushButton *connectServerBtn, *newServerButton;// |
65 | QToolButton *cdUpButton, *homeButton, *docButton; | 66 | QToolButton *cdUpButton, *homeButton, *docButton; |
@@ -72,3 +73,7 @@ protected slots: | |||
72 | void doAbout(); | 73 | void doAbout(); |
74 | |||
73 | void serverComboEdited(const QString & ); | 75 | void serverComboEdited(const QString & ); |
76 | void UsernameComboBoxEdited(const QString & ); | ||
77 | void PasswordEditEdited(const QString & ); | ||
78 | |||
74 | void showLocalMenu( QListViewItem *); | 79 | void showLocalMenu( QListViewItem *); |
@@ -95,21 +100,32 @@ protected slots: | |||
95 | void remoteDelete(); | 100 | void remoteDelete(); |
101 | |||
96 | bool remoteDirList(const QString &); | 102 | bool remoteDirList(const QString &); |
97 | bool remoteChDir(const QString &); | 103 | bool remoteChDir(const QString &); |
104 | |||
98 | void tabChanged(QWidget*); | 105 | void tabChanged(QWidget*); |
99 | void cleanUp(); | 106 | void cleanUp(); |
107 | |||
100 | void remoteRename(); | 108 | void remoteRename(); |
101 | void localRename(); | 109 | void localRename(); |
110 | |||
102 | void currentPathComboChanged(); | 111 | void currentPathComboChanged(); |
103 | void currentPathComboActivated(const QString &); | 112 | void currentPathComboActivated(const QString &); |
104 | void switchToLocalTab(); | 113 | void switchToLocalTab(); |
105 | void switchToRemoteTab(); | 114 | void switchToRemoteTab(); |
106 | void switchToConfigTab(); | 115 | void switchToConfigTab(); |
107 | void fillCombos(); | 116 | |
108 | void fillRemoteCombo(const QString&); | 117 | void fillCombos(); |
109 | void fillCombo(const QString &); | 118 | void clearCombos(); |
110 | void serverComboSelected(int); | 119 | void fillRemoteCombo(const QString&); |
111 | void deleteServer(); | 120 | void fillCombo(const QString &); |
112 | void connectorBtnToggled(bool); | 121 | void serverComboSelected(int); |
122 | void deleteServer(); | ||
123 | void connectorBtnToggled(bool); | ||
124 | void NewServer(); | ||
125 | void serverListClicked( const QString &); | ||
126 | |||
113 | protected: | 127 | protected: |
128 | bool fuckeduphack; | ||
114 | QStringList remoteDirPathStringList, localDirPathStringList; | 129 | QStringList remoteDirPathStringList, localDirPathStringList; |
130 | QString newServerName; | ||
115 | void nullifyCallBack(); | 131 | void nullifyCallBack(); |