author | llornkcor <llornkcor> | 2005-01-03 03:09:51 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2005-01-03 03:09:51 (UTC) |
commit | 0b3bbec6703c021a188c865e822f536bfa3045fc (patch) (unidiff) | |
tree | 3458531d039a111ba39ef2e0bed2e5bbbfedad46 /noncore/net/opieftp/opieftp.cpp | |
parent | 8ce8566bf038f0293a0690fce44df2bba9c4eb52 (diff) | |
download | opie-0b3bbec6703c021a188c865e822f536bfa3045fc.zip opie-0b3bbec6703c021a188c865e822f536bfa3045fc.tar.gz opie-0b3bbec6703c021a188c865e822f536bfa3045fc.tar.bz2 |
mess with things so this runs from launcher. not sure what was going on, but this seems to fix #1507
Diffstat (limited to 'noncore/net/opieftp/opieftp.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 64146cb..4f0ca29 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -20,12 +20,13 @@ extern "C" { | |||
20 | #include "inputDialog.h" | 20 | #include "inputDialog.h" |
21 | 21 | ||
22 | /* OPIE */ | 22 | /* OPIE */ |
23 | #include <opie2/odebug.h> | 23 | //#include <opie2/odebug.h> |
24 | //using namespace Opie::Core; | ||
25 | |||
24 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/resource.h> | 27 | #include <qpe/resource.h> |
26 | #include <qpe/config.h> | 28 | #include <qpe/config.h> |
27 | #include <qpe/mimetype.h> | 29 | #include <qpe/mimetype.h> |
28 | using namespace Opie::Core; | ||
29 | 30 | ||
30 | #include <qtextstream.h> | 31 | #include <qtextstream.h> |
31 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
@@ -62,11 +63,16 @@ static int log_progress(netbuf *, int xfered, void *) | |||
62 | return 1; | 63 | return 1; |
63 | } | 64 | } |
64 | 65 | ||
65 | OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl) | 66 | OpieFtp::OpieFtp( QWidget* , const char*, WFlags) |
66 | : QMainWindow( parent, name, fl ) | 67 | : QMainWindow( ) |
67 | { | 68 | { |
68 | odebug << "OpieFtp constructor" << oendl; | 69 | qDebug("OpieFtp constructor"); |
69 | setCaption( tr( "OpieFtp" ) ); | 70 | setCaption( tr( "OpieFtp" ) ); |
71 | // initializeGui(); | ||
72 | QTimer::singleShot( 50, this, SLOT(initializeGui() )); | ||
73 | } | ||
74 | |||
75 | void OpieFtp::initializeGui() { | ||
70 | fuckeduphack=FALSE; | 76 | fuckeduphack=FALSE; |
71 | 77 | ||
72 | QVBox* wrapperBox = new QVBox( this ); | 78 | QVBox* wrapperBox = new QVBox( this ); |
@@ -94,9 +100,7 @@ OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl) | |||
94 | remoteMenu = new QPopupMenu( this ); | 100 | remoteMenu = new QPopupMenu( this ); |
95 | tabMenu = new QPopupMenu( this ); | 101 | tabMenu = new QPopupMenu( this ); |
96 | 102 | ||
97 | //#if 0 | ||
98 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); | 103 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); |
99 | //#endif | ||
100 | 104 | ||
101 | menuBar->insertItem( tr( "Connection" ), connectionMenu); | 105 | menuBar->insertItem( tr( "Connection" ), connectionMenu); |
102 | // menuBar->insertItem( tr( "Local" ), localMenu); | 106 | // menuBar->insertItem( tr( "Local" ), localMenu); |
@@ -316,6 +320,7 @@ OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl) | |||
316 | 320 | ||
317 | currentPathCombo = new QComboBox( FALSE, view, "currentPathCombo" ); | 321 | currentPathCombo = new QComboBox( FALSE, view, "currentPathCombo" ); |
318 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); | 322 | layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 4); |
323 | |||
319 | currentPathCombo ->setFixedWidth(220); | 324 | currentPathCombo ->setFixedWidth(220); |
320 | currentPathCombo->setEditable(TRUE); | 325 | currentPathCombo->setEditable(TRUE); |
321 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 326 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
@@ -336,7 +341,8 @@ OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl) | |||
336 | // ServerComboBox->setCurrentItem(currentServerConfig); | 341 | // ServerComboBox->setCurrentItem(currentServerConfig); |
337 | 342 | ||
338 | TabWidget->setCurrentPage(2); | 343 | TabWidget->setCurrentPage(2); |
339 | odebug << "Constructor done" << oendl; | 344 | qDebug("XXXXXXXXXXXX Constructor done"); |
345 | |||
340 | } | 346 | } |
341 | 347 | ||
342 | OpieFtp::~OpieFtp() | 348 | OpieFtp::~OpieFtp() |
@@ -535,7 +541,7 @@ void OpieFtp::localUpload() | |||
535 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 541 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
536 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 542 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
537 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 543 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
538 | odebug << "Put: " << localFile.latin1() << ", " << remoteFile.latin1() << "" << oendl; | 544 | // odebug << "Put: " << localFile.latin1() << ", " << remoteFile.latin1() << "" << oendl; |
539 | 545 | ||
540 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 546 | if( !FtpPut( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
541 | QString msg; | 547 | QString msg; |
@@ -596,7 +602,7 @@ void OpieFtp::remoteDownload() | |||
596 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); | 602 | FtpOptions(FTPLIB_IDLETIME, (long) 1000, conn); |
597 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); | 603 | FtpOptions(FTPLIB_CALLBACKARG, (long) &fsz, conn); |
598 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); | 604 | FtpOptions(FTPLIB_CALLBACKBYTES, (long) fsz/10, conn); |
599 | odebug << "Get: " << localFile.latin1() << ", " << remoteFile.latin1() << "" << oendl; | 605 | // odebug << "Get: " << localFile.latin1() << ", " << remoteFile.latin1() << "" << oendl; |
600 | 606 | ||
601 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { | 607 | if(!FtpGet( localFile.latin1(), remoteFile.latin1(),FTPLIB_IMAGE, conn ) ) { |
602 | QString msg; | 608 | QString msg; |
@@ -775,8 +781,8 @@ bool OpieFtp::populateRemoteView( ) | |||
775 | file.close(); | 781 | file.close(); |
776 | if( file.exists()) | 782 | if( file.exists()) |
777 | file. remove(); | 783 | file. remove(); |
778 | } else | 784 | } |
779 | odebug << "temp file not opened successfully "+sfile << oendl; | 785 | // odebug << "temp file not opened successfully "+sfile << oendl; |
780 | Remote_View->setSorting( 4,TRUE); | 786 | Remote_View->setSorting( 4,TRUE); |
781 | return true; | 787 | return true; |
782 | } | 788 | } |
@@ -1234,7 +1240,7 @@ void OpieFtp::readConfig() | |||
1234 | 1240 | ||
1235 | void OpieFtp::writeConfig() | 1241 | void OpieFtp::writeConfig() |
1236 | { | 1242 | { |
1237 | odebug << "write config" << oendl; | 1243 | // odebug << "write config" << oendl; |
1238 | Config cfg("opieftp"); | 1244 | Config cfg("opieftp"); |
1239 | cfg.setGroup("Server"); | 1245 | cfg.setGroup("Server"); |
1240 | 1246 | ||
@@ -1265,7 +1271,7 @@ void OpieFtp::writeConfig() | |||
1265 | cfg.writeEntry("currentServer", numberOfEntries+1); | 1271 | cfg.writeEntry("currentServer", numberOfEntries+1); |
1266 | 1272 | ||
1267 | currentServerConfig = numberOfEntries+1; | 1273 | currentServerConfig = numberOfEntries+1; |
1268 | odebug << "setting currentserverconfig to " << currentServerConfig << "" << oendl; | 1274 | // odebug << "setting currentserverconfig to " << currentServerConfig << "" << oendl; |
1269 | 1275 | ||
1270 | cfg.setGroup(temp); | 1276 | cfg.setGroup(temp); |
1271 | if(!newServerName.isEmpty()) | 1277 | if(!newServerName.isEmpty()) |
@@ -1284,7 +1290,7 @@ void OpieFtp::writeConfig() | |||
1284 | } | 1290 | } |
1285 | 1291 | ||
1286 | void OpieFtp::clearCombos() { | 1292 | void OpieFtp::clearCombos() { |
1287 | odebug << "clearing" << oendl; | 1293 | // odebug << "clearing" << oendl; |
1288 | ServerComboBox->clear(); | 1294 | ServerComboBox->clear(); |
1289 | UsernameComboBox->clear(); | 1295 | UsernameComboBox->clear(); |
1290 | PasswordEdit->clear(); | 1296 | PasswordEdit->clear(); |
@@ -1304,10 +1310,10 @@ void OpieFtp::fillCombos() | |||
1304 | 1310 | ||
1305 | for (int i = 1; i <= numberOfEntries; i++) { | 1311 | for (int i = 1; i <= numberOfEntries; i++) { |
1306 | temp.setNum(i); | 1312 | temp.setNum(i); |
1307 | odebug << temp << oendl; | 1313 | // odebug << temp << oendl; |
1308 | cfg.setGroup("Server"); | 1314 | cfg.setGroup("Server"); |
1309 | remoteServerStr = cfg.readEntry( temp,""); | 1315 | remoteServerStr = cfg.readEntry( temp,""); |
1310 | odebug << remoteServerStr << oendl; | 1316 | // odebug << remoteServerStr << oendl; |
1311 | 1317 | ||
1312 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); | 1318 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); |
1313 | port = remoteServerStr.right( divider - 1); | 1319 | port = remoteServerStr.right( divider - 1); |
@@ -1315,7 +1321,7 @@ void OpieFtp::fillCombos() | |||
1315 | PortSpinBox->setValue( port.toInt(&ok,10)); | 1321 | PortSpinBox->setValue( port.toInt(&ok,10)); |
1316 | 1322 | ||
1317 | remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); | 1323 | remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); |
1318 | odebug << "remote server string "+remoteServerStr << oendl; | 1324 | // odebug << "remote server string "+remoteServerStr << oendl; |
1319 | ServerComboBox->insertItem( remoteServerStr ); | 1325 | ServerComboBox->insertItem( remoteServerStr ); |
1320 | 1326 | ||
1321 | cfg.setGroup(temp); | 1327 | cfg.setGroup(temp); |
@@ -1334,7 +1340,7 @@ void OpieFtp::serverComboSelected(int index) | |||
1334 | { | 1340 | { |
1335 | QString servername; | 1341 | QString servername; |
1336 | currentServerConfig = index+1; | 1342 | currentServerConfig = index+1; |
1337 | odebug << "server combo selected " << index + 1 << "" << oendl; | 1343 | // odebug << "server combo selected " << index + 1 << "" << oendl; |
1338 | QString username, remoteServerStr, remotePathStr, password, port, temp; | 1344 | QString username, remoteServerStr, remotePathStr, password, port, temp; |
1339 | servername = remoteServerStr = ServerComboBox->text(index); | 1345 | servername = remoteServerStr = ServerComboBox->text(index); |
1340 | qDebug("server text " + remoteServerStr); | 1346 | qDebug("server text " + remoteServerStr); |
@@ -1349,7 +1355,7 @@ void OpieFtp::serverComboSelected(int index) | |||
1349 | temp.setNum(index + 1); | 1355 | temp.setNum(index + 1); |
1350 | remoteServerStr = cfg.readEntry( temp,""); | 1356 | remoteServerStr = cfg.readEntry( temp,""); |
1351 | 1357 | ||
1352 | odebug << "Group " +temp << oendl; | 1358 | // odebug << "Group " +temp << oendl; |
1353 | cfg.setGroup(temp); | 1359 | cfg.setGroup(temp); |
1354 | 1360 | ||
1355 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); | 1361 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); |
@@ -1365,7 +1371,7 @@ void OpieFtp::serverComboSelected(int index) | |||
1365 | 1371 | ||
1366 | username = cfg.readEntry("Username", "anonymous"); | 1372 | username = cfg.readEntry("Username", "anonymous"); |
1367 | UsernameComboBox->lineEdit()->setText(username); | 1373 | UsernameComboBox->lineEdit()->setText(username); |
1368 | odebug << username << oendl; | 1374 | // odebug << username << oendl; |
1369 | // odebug << "Password is "+cfg.readEntryCrypt(username << oendl; | 1375 | // odebug << "Password is "+cfg.readEntryCrypt(username << oendl; |
1370 | PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org")); | 1376 | PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org")); |
1371 | // UsernameComboBox | 1377 | // UsernameComboBox |
@@ -1410,7 +1416,7 @@ void OpieFtp::deleteServer() | |||
1410 | 1416 | ||
1411 | serverListView->removeItem(i); | 1417 | serverListView->removeItem(i); |
1412 | 1418 | ||
1413 | odebug << "OK DELETE "+tempname << oendl; | 1419 | // odebug << "OK DELETE "+tempname << oendl; |
1414 | cfg.removeEntry(QString::number(i)); | 1420 | cfg.removeEntry(QString::number(i)); |
1415 | for ( ; i <= numberOfEntries; i++) { | 1421 | for ( ; i <= numberOfEntries; i++) { |
1416 | cfg.setGroup("Server"); | 1422 | cfg.setGroup("Server"); |
@@ -1534,7 +1540,7 @@ void OpieFtp::NewServer() { | |||
1534 | void OpieFtp::serverListClicked( const QString &item) { | 1540 | void OpieFtp::serverListClicked( const QString &item) { |
1535 | if(item.isEmpty()) return; | 1541 | if(item.isEmpty()) return; |
1536 | Config cfg("opieftp"); | 1542 | Config cfg("opieftp"); |
1537 | odebug << "highltined "+item << oendl; | 1543 | // odebug << "highltined "+item << oendl; |
1538 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1544 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1539 | for (int i = 1; i <= numberOfEntries; i++) { | 1545 | for (int i = 1; i <= numberOfEntries; i++) { |
1540 | cfg.setGroup(QString::number(i)); | 1546 | cfg.setGroup(QString::number(i)); |