author | llornkcor <llornkcor> | 2002-03-24 14:14:49 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-03-24 14:14:49 (UTC) |
commit | 807ea39f3ccfbc26e769fc16a79d459327e13437 (patch) (unidiff) | |
tree | fa25defd4f0d6f6630cecad2f7eb274dcac30db6 | |
parent | 5c17e8b168cf27ac2922e7c118cb886b116eab42 (diff) | |
download | opie-807ea39f3ccfbc26e769fc16a79d459327e13437.zip opie-807ea39f3ccfbc26e769fc16a79d459327e13437.tar.gz opie-807ea39f3ccfbc26e769fc16a79d459327e13437.tar.bz2 |
radnom fixes
-rw-r--r-- | noncore/net/opieftp/ftplib.c | 2 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 278 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.h | 9 |
3 files changed, 168 insertions, 121 deletions
diff --git a/noncore/net/opieftp/ftplib.c b/noncore/net/opieftp/ftplib.c index b9ca746..5116170 100644 --- a/noncore/net/opieftp/ftplib.c +++ b/noncore/net/opieftp/ftplib.c | |||
@@ -59,5 +59,5 @@ | |||
59 | 59 | ||
60 | #define FTPLIB_BUFSIZ 8192 | 60 | #define FTPLIB_BUFSIZ 8192 |
61 | #define ACCEPT_TIMEOUT 30 | 61 | #define ACCEPT_TIMEOUT 15 |
62 | 62 | ||
63 | #define FTPLIB_CONTROL 0 | 63 | #define FTPLIB_CONTROL 0 |
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index eed133e..d74c55b 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -1,4 +1,4 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | opieftp.cpp | 2 | opieftp.cpp |
3 | ------------------- | 3 | ------------------- |
4 | ** Created: Sat Mar 9 23:33:09 2002 | 4 | ** Created: Sat Mar 9 23:33:09 2002 |
@@ -10,5 +10,5 @@ | |||
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | //#define DEVELOPER_VERSION | 12 | #define DEVELOPERS_VERSION |
13 | 13 | ||
14 | #include "opieftp.h" | 14 | #include "opieftp.h" |
@@ -134,5 +134,5 @@ OpieFtp::OpieFtp( ) | |||
134 | tabLayout->addWidget( Local_View, 0, 0 ); | 134 | tabLayout->addWidget( Local_View, 0, 0 ); |
135 | 135 | ||
136 | connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)), | 136 | connect( Local_View, SIGNAL( clicked( QListViewItem*)), |
137 | this,SLOT( localListClicked(QListViewItem *)) ); | 137 | this,SLOT( localListClicked(QListViewItem *)) ); |
138 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 138 | connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
@@ -155,5 +155,5 @@ OpieFtp::OpieFtp( ) | |||
155 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); | 155 | QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold); |
156 | 156 | ||
157 | connect( Remote_View, SIGNAL( doubleClicked( QListViewItem*)), | 157 | connect( Remote_View, SIGNAL( clicked( QListViewItem*)), |
158 | this,SLOT( remoteListClicked(QListViewItem *)) ); | 158 | this,SLOT( remoteListClicked(QListViewItem *)) ); |
159 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 159 | connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
@@ -175,5 +175,4 @@ OpieFtp::OpieFtp( ) | |||
175 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); | 175 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); |
176 | UsernameComboBox->setEditable(TRUE); | 176 | UsernameComboBox->setEditable(TRUE); |
177 | // UsernameComboBox->lineEdit()->setText("anonymous"); | ||
178 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); | 177 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); |
179 | 178 | ||
@@ -184,5 +183,4 @@ OpieFtp::OpieFtp( ) | |||
184 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); | 183 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); |
185 | PasswordEdit->setEchoMode(QLineEdit::Password); | 184 | PasswordEdit->setEchoMode(QLineEdit::Password); |
186 | // PasswordEdit->setText( tr( "me@opieftp.org" ) ); | ||
187 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); | 185 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); |
188 | 186 | ||
@@ -193,8 +191,8 @@ OpieFtp::OpieFtp( ) | |||
193 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); | 191 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); |
194 | ServerComboBox->setEditable(TRUE); | 192 | ServerComboBox->setEditable(TRUE); |
195 | // ServerComboBox->lineEdit()->setText( tr( "" ) ); | ||
196 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); | 193 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); |
197 | 194 | ||
198 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); | 195 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); |
196 | connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,SLOT(serverComboEdited(const QString & ) )); | ||
199 | 197 | ||
200 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); | 198 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); |
@@ -203,5 +201,4 @@ OpieFtp::OpieFtp( ) | |||
203 | 201 | ||
204 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); | 202 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); |
205 | remotePath->setText( currentRemoteDir = "/"); | ||
206 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); | 203 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); |
207 | 204 | ||
@@ -213,17 +210,16 @@ OpieFtp::OpieFtp( ) | |||
213 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); | 210 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); |
214 | PortSpinBox->setMaxValue(32786); | 211 | PortSpinBox->setMaxValue(32786); |
215 | PortSpinBox->setValue( 21); | ||
216 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); | 212 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); |
217 | 213 | ||
218 | QPushButton *deleteServerBtn; | 214 | QPushButton *deleteServerBtn; |
219 | deleteServerBtn = new QPushButton( "Delete Server",this, "OpenButton" ); | 215 | deleteServerBtn = new QPushButton( "Delete Server", tab_3 , "OpenButton" ); |
220 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 5, 5, 2, 3); | 216 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 5, 5, 2, 3); |
221 | 217 | ||
222 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); | 218 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); |
223 | 219 | ||
224 | QPushButton *connectServerBtn; | 220 | connectServerBtn = new QPushButton( "Connect", tab_3 , "ConnectButton" ); |
225 | connectServerBtn = new QPushButton( "Connect",this, "ConnectButton" ); | ||
226 | tabLayout_3->addMultiCellWidget( connectServerBtn, 5, 5, 0, 1); | 221 | tabLayout_3->addMultiCellWidget( connectServerBtn, 5, 5, 0, 1); |
227 | connect(connectServerBtn,SIGNAL( clicked()),SLOT( connector() )); | 222 | connectServerBtn->setToggleButton(TRUE); |
223 | connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) )); | ||
228 | 224 | ||
229 | 225 | ||
@@ -249,15 +245,17 @@ OpieFtp::OpieFtp( ) | |||
249 | 245 | ||
250 | serverComboSelected(0); | 246 | serverComboSelected(0); |
251 | #ifdef DEVELOPER_VERSION | 247 | fillCombos(); |
252 | // ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) ); | 248 | |
249 | #ifdef DEVELOPERS_VERSION | ||
253 | ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); | 250 | ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); |
254 | UsernameComboBox->lineEdit()->setText("root"); | 251 | UsernameComboBox->lineEdit()->setText("root"); |
255 | // UsernameComboBox->lineEdit()->setText("llornkcor"); | ||
256 | PortSpinBox->setValue( 4242); | 252 | PortSpinBox->setValue( 4242); |
257 | remotePath->setText( currentRemoteDir = "/"); | 253 | remotePath->setText( currentRemoteDir = "/"); |
254 | // ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) ); | ||
255 | // UsernameComboBox->lineEdit()->setText("llornkcor"); | ||
256 | // PortSpinBox->setValue( 21); | ||
257 | // remotePath->setText( currentRemoteDir = "/home/llornkcor"); | ||
258 | PasswordEdit->setText( tr( "" ) ); | 258 | PasswordEdit->setText( tr( "" ) ); |
259 | 259 | #endif | |
260 | #endif | ||
261 | fillCombos(); | ||
262 | filterStr="*"; | 260 | filterStr="*"; |
263 | b=FALSE; | 261 | b=FALSE; |
@@ -305,4 +303,92 @@ void OpieFtp::tabChanged(QWidget *w) | |||
305 | } | 303 | } |
306 | 304 | ||
305 | void OpieFtp::newConnection() | ||
306 | { | ||
307 | UsernameComboBox->lineEdit()->setText(""); | ||
308 | PasswordEdit->setText( "" ); | ||
309 | ServerComboBox->lineEdit()->setText( ""); | ||
310 | remotePath->setText( currentRemoteDir = "/"); | ||
311 | PortSpinBox->setValue( 21); | ||
312 | TabWidget->setCurrentPage(2); | ||
313 | currentServerConfig = -1; | ||
314 | } | ||
315 | |||
316 | void OpieFtp::serverComboEdited(const QString & edit) { | ||
317 | if( !edit.isEmpty() ) { | ||
318 | currentServerConfig = -1; | ||
319 | qDebug("comboedited"); | ||
320 | } | ||
321 | } | ||
322 | |||
323 | void OpieFtp::connectorBtnToggled(bool On) | ||
324 | { | ||
325 | if(On) { | ||
326 | connector(); | ||
327 | } else { | ||
328 | disConnector(); | ||
329 | } | ||
330 | |||
331 | } | ||
332 | |||
333 | void OpieFtp::connector() | ||
334 | { | ||
335 | QCopEnvelope ( "QPE/System", "busy()" ); | ||
336 | qApp->processEvents(); | ||
337 | currentRemoteDir=remotePath->text(); | ||
338 | if(ServerComboBox->currentText().isEmpty()) { | ||
339 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); | ||
340 | TabWidget->setCurrentPage(2); | ||
341 | ServerComboBox->setFocus(); | ||
342 | connectServerBtn->setOn(FALSE); | ||
343 | connectServerBtn->setText( tr("Connect")); | ||
344 | return; | ||
345 | } | ||
346 | FtpInit(); | ||
347 | TabWidget->setCurrentPage(1); | ||
348 | QString ftp_host = ServerComboBox->currentText(); | ||
349 | QString ftp_user = UsernameComboBox->currentText(); | ||
350 | QString ftp_pass = PasswordEdit->text(); | ||
351 | QString port=PortSpinBox->cleanText(); | ||
352 | port.stripWhiteSpace(); | ||
353 | |||
354 | if(ftp_host.find("ftp://",0, TRUE) != -1 ) | ||
355 | ftp_host=ftp_host.right(ftp_host.length()-6); | ||
356 | ftp_host+=":"+port; | ||
357 | if (!FtpConnect( ftp_host.latin1(), &conn)) { | ||
358 | QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); | ||
359 | connectServerBtn->setOn(FALSE); | ||
360 | connectServerBtn->setText( tr("Connect")); | ||
361 | return ; | ||
362 | } | ||
363 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { | ||
364 | QString msg; | ||
365 | msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); | ||
366 | msg.replace(QRegExp(":"),"\n"); | ||
367 | QMessageBox::message(tr("Note"),msg); | ||
368 | if(conn) | ||
369 | FtpQuit(conn); | ||
370 | connectServerBtn->setOn(FALSE); | ||
371 | connectServerBtn->setText( tr("Connect")); | ||
372 | return ; | ||
373 | } | ||
374 | remoteDirList("/") ; | ||
375 | setCaption(ftp_host); | ||
376 | writeConfig(); | ||
377 | connectServerBtn->setText( tr("Disconnect")); | ||
378 | QCopEnvelope ( "QPE/System", "notBusy()" ); | ||
379 | } | ||
380 | |||
381 | void OpieFtp::disConnector() | ||
382 | { | ||
383 | if(conn) | ||
384 | FtpQuit(conn); | ||
385 | setCaption("OpieFtp"); | ||
386 | currentRemoteDir="/"; | ||
387 | Remote_View->clear(); | ||
388 | connectServerBtn->setText( tr("Connect")); | ||
389 | connectServerBtn->setOn(FALSE); | ||
390 | |||
391 | } | ||
392 | |||
307 | void OpieFtp::localUpload() | 393 | void OpieFtp::localUpload() |
308 | { | 394 | { |
@@ -329,5 +415,4 @@ void OpieFtp::localUpload() | |||
329 | msg.replace(QRegExp(":"),"\n"); | 415 | msg.replace(QRegExp(":"),"\n"); |
330 | QMessageBox::message(tr("Note"),msg); | 416 | QMessageBox::message(tr("Note"),msg); |
331 | // FtpQuit(conn); | ||
332 | } | 417 | } |
333 | ProgressBar->reset(); | 418 | ProgressBar->reset(); |
@@ -381,5 +466,4 @@ void OpieFtp::remoteDownload() | |||
381 | msg.replace(QRegExp(":"),"\n"); | 466 | msg.replace(QRegExp(":"),"\n"); |
382 | QMessageBox::message(tr("Note"),msg); | 467 | QMessageBox::message(tr("Note"),msg); |
383 | // FtpQuit(conn); | ||
384 | } | 468 | } |
385 | ProgressBar->reset(); | 469 | ProgressBar->reset(); |
@@ -390,64 +474,4 @@ void OpieFtp::remoteDownload() | |||
390 | } | 474 | } |
391 | 475 | ||
392 | |||
393 | void OpieFtp::newConnection() | ||
394 | { | ||
395 | UsernameComboBox->lineEdit()->setText(""); | ||
396 | PasswordEdit->setText( "" ); | ||
397 | ServerComboBox->lineEdit()->setText( ""); | ||
398 | remotePath->setText( currentRemoteDir = "/"); | ||
399 | PortSpinBox->setValue( 21); | ||
400 | TabWidget->setCurrentPage(2); | ||
401 | |||
402 | } | ||
403 | |||
404 | void OpieFtp::connector() | ||
405 | { | ||
406 | QCopEnvelope ( "QPE/System", "busy()" ); | ||
407 | qApp->processEvents(); | ||
408 | currentRemoteDir=remotePath->text(); | ||
409 | if(ServerComboBox->currentText().isEmpty()) { | ||
410 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); | ||
411 | TabWidget->setCurrentPage(2); | ||
412 | ServerComboBox->setFocus(); | ||
413 | return; | ||
414 | } | ||
415 | FtpInit(); | ||
416 | TabWidget->setCurrentPage(1); | ||
417 | QString ftp_host = ServerComboBox->currentText(); | ||
418 | QString ftp_user = UsernameComboBox->currentText(); | ||
419 | QString ftp_pass = PasswordEdit->text(); | ||
420 | QString port=PortSpinBox->cleanText(); | ||
421 | port.stripWhiteSpace(); | ||
422 | |||
423 | if(ftp_host.find("ftp://",0, TRUE) != -1 ) | ||
424 | ftp_host=ftp_host.right(ftp_host.length()-6); | ||
425 | ftp_host+=":"+port; | ||
426 | if (!FtpConnect( ftp_host.latin1(), &conn)) { | ||
427 | QMessageBox::message(tr("Note"),tr("Unable to connect to\n")+ftp_host); | ||
428 | return ; | ||
429 | } | ||
430 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { | ||
431 | QString msg; | ||
432 | msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); | ||
433 | msg.replace(QRegExp(":"),"\n"); | ||
434 | QMessageBox::message(tr("Note"),msg); | ||
435 | FtpQuit(conn); | ||
436 | return ; | ||
437 | } | ||
438 | remoteDirList("/") ; | ||
439 | setCaption(ftp_host); | ||
440 | writeConfig(); | ||
441 | QCopEnvelope ( "QPE/System", "notBusy()" ); | ||
442 | } | ||
443 | |||
444 | void OpieFtp::disConnector() | ||
445 | { | ||
446 | FtpQuit(conn); | ||
447 | setCaption("OpieFtp"); | ||
448 | currentRemoteDir="/"; | ||
449 | Remote_View->clear(); | ||
450 | } | ||
451 | |||
452 | bool OpieFtp::remoteDirList(const QString &dir) | 476 | bool OpieFtp::remoteDirList(const QString &dir) |
453 | { | 477 | { |
@@ -464,5 +488,4 @@ bool OpieFtp::remoteDirList(const QString &dir) | |||
464 | msg.replace(QRegExp(":"),"\n"); | 488 | msg.replace(QRegExp(":"),"\n"); |
465 | QMessageBox::message(tr("Note"),msg); | 489 | QMessageBox::message(tr("Note"),msg); |
466 | // FtpQuit(conn); | ||
467 | return false; | 490 | return false; |
468 | } | 491 | } |
@@ -481,5 +504,4 @@ bool OpieFtp::remoteChDir(const QString &dir) | |||
481 | QMessageBox::message(tr("Note"),msg); | 504 | QMessageBox::message(tr("Note"),msg); |
482 | qDebug(msg); | 505 | qDebug(msg); |
483 | // FtpQuit(conn); | ||
484 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 506 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
485 | return FALSE; | 507 | return FALSE; |
@@ -582,5 +604,5 @@ bool OpieFtp::populateRemoteView( ) | |||
582 | qDebug("temp file not opened successfullly "+sfile); | 604 | qDebug("temp file not opened successfullly "+sfile); |
583 | Remote_View->setSorting( 4,TRUE); | 605 | Remote_View->setSorting( 4,TRUE); |
584 | 606 | ||
585 | return true; | 607 | return true; |
586 | } | 608 | } |
@@ -787,5 +809,5 @@ void OpieFtp::localDelete() | |||
787 | } | 809 | } |
788 | break; | 810 | break; |
789 | case 1: | 811 | case 1: |
790 | // exit | 812 | // exit |
791 | break; | 813 | break; |
@@ -846,5 +868,5 @@ void OpieFtp::remoteDelete() | |||
846 | } | 868 | } |
847 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 869 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
848 | 870 | ||
849 | } | 871 | } |
850 | break; | 872 | break; |
@@ -949,5 +971,6 @@ void OpieFtp::switchToConfigTab() | |||
949 | } | 971 | } |
950 | 972 | ||
951 | void OpieFtp::readConfig() { | 973 | void OpieFtp::readConfig() |
974 | { | ||
952 | 975 | ||
953 | Config cfg("opieftp"); | 976 | Config cfg("opieftp"); |
@@ -974,15 +997,22 @@ void OpieFtp::readConfig() { | |||
974 | password = cfg.readEntryCrypt(username,""); | 997 | password = cfg.readEntryCrypt(username,""); |
975 | PasswordEdit->setText(password); | 998 | PasswordEdit->setText(password); |
976 | |||
977 | } | 999 | } |
978 | |||
979 | } | 1000 | } |
980 | 1001 | ||
981 | void OpieFtp::writeConfig() { | 1002 | void OpieFtp::writeConfig() |
1003 | { | ||
982 | 1004 | ||
983 | Config cfg("opieftp"); | 1005 | Config cfg("opieftp"); |
984 | cfg.setGroup("Server"); | 1006 | cfg.setGroup("Server"); |
985 | QString temp; | 1007 | QString username, remoteServerStr, remotePathStr, password, port, temp; |
986 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1008 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1009 | if( currentServerConfig == -1) { | ||
1010 | |||
1011 | temp.setNum( numberOfEntries + 1); | ||
1012 | cfg.setGroup("Server"); | ||
1013 | remoteServerStr = cfg.readEntry( temp,""); | ||
1014 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); | ||
1015 | remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); | ||
1016 | |||
987 | temp.setNum(numberOfEntries+1); | 1017 | temp.setNum(numberOfEntries+1); |
988 | cfg.setGroup("Server"); | 1018 | cfg.setGroup("Server"); |
@@ -994,9 +1024,11 @@ void OpieFtp::writeConfig() { | |||
994 | cfg.setGroup("Server"); | 1024 | cfg.setGroup("Server"); |
995 | cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); | 1025 | cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); |
996 | 1026 | ||
1027 | } | ||
997 | } | 1028 | } |
998 | 1029 | ||
999 | void OpieFtp::fillCombos() { | 1030 | void OpieFtp::fillCombos() |
1000 | Config cfg("opieftp"); | 1031 | { |
1032 | Config cfg("opieftp"); | ||
1001 | cfg.setGroup("Server"); | 1033 | cfg.setGroup("Server"); |
1002 | QString username, remoteServerStr, remotePathStr, password, port, temp; | 1034 | QString username, remoteServerStr, remotePathStr, password, port, temp; |
@@ -1027,12 +1059,11 @@ void OpieFtp::fillCombos() { | |||
1027 | // password = cfg.readEntryCrypt(username,""); | 1059 | // password = cfg.readEntryCrypt(username,""); |
1028 | // PasswordEdit->setText(password); | 1060 | // PasswordEdit->setText(password); |
1029 | |||
1030 | } | 1061 | } |
1031 | |||
1032 | } | 1062 | } |
1033 | 1063 | ||
1034 | 1064 | ||
1035 | void OpieFtp::serverComboSelected(int index) { | 1065 | void OpieFtp::serverComboSelected(int index) |
1036 | 1066 | { | |
1067 | currentServerConfig = index; | ||
1037 | QString username, remoteServerStr, remotePathStr, password, port, temp; | 1068 | QString username, remoteServerStr, remotePathStr, password, port, temp; |
1038 | // remoteServerStr = ServerComboBox->text(index); | 1069 | // remoteServerStr = ServerComboBox->text(index); |
@@ -1041,24 +1072,22 @@ void OpieFtp::serverComboSelected(int index) { | |||
1041 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1072 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1042 | 1073 | ||
1043 | // for (int i = 0; i <= numberOfEntries; i++) { | 1074 | temp.setNum(index+1); |
1044 | temp.setNum(index+1); | 1075 | remoteServerStr = cfg.readEntry( temp,""); |
1045 | remoteServerStr = cfg.readEntry( temp,""); | 1076 | cfg.setGroup(temp); |
1046 | // if( remoteServerStr.find( ServerComboBox->text(index),0,TRUE) != -1 ) { | 1077 | qDebug(temp); |
1047 | cfg.setGroup(temp); | 1078 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); |
1048 | qDebug(temp); | 1079 | port = remoteServerStr.right( divider - 1); |
1049 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); | 1080 | bool ok; |
1050 | port = remoteServerStr.right( divider - 1); | 1081 | int portInt = port.toInt(&ok,10); |
1051 | bool ok; | 1082 | if( portInt == 0) portInt = 21; |
1052 | PortSpinBox->setValue( port.toInt(&ok,10)); | ||
1053 | 1083 | ||
1054 | remotePath->setText(cfg.readEntry("RemotePath", "")); | 1084 | PortSpinBox->setValue( portInt); |
1055 | username = cfg.readEntry("Username", ""); | ||
1056 | UsernameComboBox->lineEdit()->setText(username); | ||
1057 | PasswordEdit->setText(cfg.readEntryCrypt(username, "")); | ||
1058 | 1085 | ||
1059 | // } | 1086 | remotePath->setText(cfg.readEntry("RemotePath", "/")); |
1060 | 1087 | ||
1061 | // } | 1088 | username = cfg.readEntry("Username", "anonymous"); |
1062 | update(); | 1089 | UsernameComboBox->lineEdit()->setText(username); |
1090 | PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org")); | ||
1091 | update(); | ||
1063 | } | 1092 | } |
1064 | // UsernameComboBox->lineEdit()->setText("root"); | 1093 | // UsernameComboBox->lineEdit()->setText("root"); |
@@ -1068,5 +1097,20 @@ void OpieFtp::serverComboSelected(int index) { | |||
1068 | // PortSpinBox->setValue( 4242); | 1097 | // PortSpinBox->setValue( 4242); |
1069 | 1098 | ||
1070 | void OpieFtp::deleteServer() { | 1099 | void OpieFtp::deleteServer() |
1071 | 1100 | { | |
1101 | QString username, remoteServerStr, remotePathStr, password, port, temp; | ||
1102 | remoteServerStr = ServerComboBox->currentText( ); | ||
1103 | username = UsernameComboBox->currentText(); | ||
1104 | Config cfg("opieftp"); | ||
1105 | cfg.setGroup("Server"); | ||
1106 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | ||
1107 | for (int i = 0; i <= numberOfEntries; i++) { | ||
1108 | temp.setNum(i+1); | ||
1109 | cfg.setGroup("Server"); | ||
1110 | if( cfg.readEntry( temp,"").find( remoteServerStr,0,TRUE) != -1 | ||
1111 | && cfg.readEntry(temp).find(username,0,TRUE) != -1 | ||
1112 | && !remoteServerStr.isEmpty()) { | ||
1113 | qDebug(temp); | ||
1114 | } | ||
1115 | } | ||
1072 | } | 1116 | } |
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h index c88a15b..52ed885 100644 --- a/noncore/net/opieftp/opieftp.h +++ b/noncore/net/opieftp/opieftp.h | |||
@@ -37,7 +37,8 @@ class QFile; | |||
37 | class QListViewItem; | 37 | class QListViewItem; |
38 | class QLineEdit; | 38 | class QLineEdit; |
39 | class QPushButton; | ||
39 | 40 | ||
40 | class OpieFtp : public QMainWindow | 41 | class OpieFtp : public QMainWindow |
41 | { | 42 | { |
42 | Q_OBJECT | 43 | Q_OBJECT |
43 | 44 | ||
@@ -59,7 +60,9 @@ public: | |||
59 | QString filterStr; | 60 | QString filterStr; |
60 | QListViewItem * item; | 61 | QListViewItem * item; |
62 | QPushButton *connectServerBtn; | ||
61 | bool b; | 63 | bool b; |
62 | 64 | int currentServerConfig; | |
63 | protected slots: | 65 | protected slots: |
66 | void serverComboEdited(const QString & ); | ||
64 | void showLocalMenu( QListViewItem *); | 67 | void showLocalMenu( QListViewItem *); |
65 | void showRemoteMenu( QListViewItem *); | 68 | void showRemoteMenu( QListViewItem *); |
@@ -97,5 +100,5 @@ protected slots: | |||
97 | void serverComboSelected(int); | 100 | void serverComboSelected(int); |
98 | void deleteServer(); | 101 | void deleteServer(); |
99 | 102 | void connectorBtnToggled(bool); | |
100 | protected: | 103 | protected: |
101 | void nullifyCallBack(); | 104 | void nullifyCallBack(); |