-rw-r--r-- | noncore/net/opieftp/main.cpp | 6 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 62 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.h | 6 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.pro | 3 |
4 files changed, 44 insertions, 33 deletions
diff --git a/noncore/net/opieftp/main.cpp b/noncore/net/opieftp/main.cpp index 330ca52..763ffb4 100644 --- a/noncore/net/opieftp/main.cpp +++ b/noncore/net/opieftp/main.cpp | |||
@@ -6,13 +6,15 @@ | |||
6 | begin : March 10, 2002 | 6 | begin : March 10, 2002 |
7 | copyright : (C) 2002 by llornkcor | 7 | copyright : (C) 2002 by llornkcor |
8 | email : ljp@llornkcor.com | 8 | email : ljp@llornkcor.com |
9 | * This program is free software; you can redistribute it and/or modify * | 9 | * This program is free software; you can redistribute it and/or modify * |
10 | * it under the terms of the GNU General Public License as published by * | 10 | * it under the terms of the GNU General Public License as published by * |
11 | * the Free Software Foundation; either version 2 of the License, or * | 11 | * the Free Software Foundation; either version 2 of the License, or * |
12 | * (at your option) any later version. * | 12 | * (at your option) any later version. * |
13 | ***************************************************************************/ | 13 | ***************************************************************************/ |
14 | #include <opie2/oapplicationfactory.h> | ||
15 | #include "opieftp.h" | 14 | #include "opieftp.h" |
16 | 15 | #include <opie2/oapplicationfactory.h> | |
16 | //#include <qtopia/qpeapplication.h> | ||
17 | using namespace Opie::Core; | 17 | using namespace Opie::Core; |
18 | OPIE_EXPORT_APP( OApplicationFactory<OpieFtp> ) | 18 | OPIE_EXPORT_APP( OApplicationFactory<OpieFtp> ) |
19 | |||
20 | |||
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 | |||
@@ -15,22 +15,23 @@ | |||
15 | 15 | ||
16 | extern "C" { | 16 | extern "C" { |
17 | #include <ftplib.h> | 17 | #include <ftplib.h> |
18 | } | 18 | } |
19 | 19 | ||
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> |
32 | #include <qtoolbutton.h> | 33 | #include <qtoolbutton.h> |
33 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
34 | #include <qlistview.h> | 35 | #include <qlistview.h> |
35 | #include <qlabel.h> | 36 | #include <qlabel.h> |
36 | #include <qprogressbar.h> | 37 | #include <qprogressbar.h> |
@@ -44,34 +45,39 @@ using namespace Opie::Core; | |||
44 | #include <qlineedit.h> | 45 | #include <qlineedit.h> |
45 | #include <qlistbox.h> | 46 | #include <qlistbox.h> |
46 | #include <qvbox.h> | 47 | #include <qvbox.h> |
47 | /* STD */ | 48 | /* STD */ |
48 | #include <unistd.h> | 49 | #include <unistd.h> |
49 | #include <stdlib.h> | 50 | #include <stdlib.h> |
50 | 51 | ||
51 | QProgressBar *ProgressBar; | 52 | QProgressBar *ProgressBar; |
52 | static netbuf *conn=NULL; | 53 | static netbuf *conn = NULL; |
53 | 54 | ||
54 | static int log_progress(netbuf *, int xfered, void *) | 55 | static int log_progress(netbuf *, int xfered, void *) |
55 | { | 56 | { |
56 | // int fsz = *(int *)arg; | 57 | // int fsz = *(int *)arg; |
57 | // int pct = (xfered * 100) / fsz; | 58 | // int pct = (xfered * 100) / fsz; |
58 | // printf("%3d%%\r", pct); | 59 | // printf("%3d%%\r", pct); |
59 | // fflush(stdout); | 60 | // fflush(stdout); |
60 | ProgressBar->setProgress(xfered); | 61 | ProgressBar->setProgress(xfered); |
61 | qApp->processEvents(); | 62 | qApp->processEvents(); |
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 ); |
73 | setCentralWidget( wrapperBox ); | 79 | setCentralWidget( wrapperBox ); |
74 | 80 | ||
75 | QWidget *view = new QWidget( wrapperBox ); | 81 | QWidget *view = new QWidget( wrapperBox ); |
76 | 82 | ||
77 | QGridLayout *layout = new QGridLayout( view ); | 83 | QGridLayout *layout = new QGridLayout( view ); |
@@ -89,19 +95,17 @@ OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl) | |||
89 | matrix.scale( .4, .4); | 95 | matrix.scale( .4, .4); |
90 | unknownXpm = pix.xForm(matrix); | 96 | unknownXpm = pix.xForm(matrix); |
91 | 97 | ||
92 | connectionMenu = new QPopupMenu( this ); | 98 | connectionMenu = new QPopupMenu( this ); |
93 | localMenu = new QPopupMenu( this ); | 99 | localMenu = new QPopupMenu( this ); |
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); |
103 | // menuBar->insertItem( tr( "Remote" ), remoteMenu); | 107 | // menuBar->insertItem( tr( "Remote" ), remoteMenu); |
104 | menuBar->insertItem( tr( "View" ), tabMenu); | 108 | menuBar->insertItem( tr( "View" ), tabMenu); |
105 | 109 | ||
106 | tabMenu->insertItem( tr( "Local" ), localMenu); | 110 | tabMenu->insertItem( tr( "Local" ), localMenu); |
107 | tabMenu->insertItem( tr( "Remote" ), remoteMenu); | 111 | tabMenu->insertItem( tr( "Remote" ), remoteMenu); |
@@ -311,37 +315,39 @@ OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl) | |||
311 | this,SLOT(tabChanged(QWidget*))); | 315 | this,SLOT(tabChanged(QWidget*))); |
312 | 316 | ||
313 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 317 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
314 | currentDir.setPath( QDir::currentDirPath()); | 318 | currentDir.setPath( QDir::currentDirPath()); |
315 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 319 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
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); |
319 | currentPathCombo ->setFixedWidth(220); | 323 | |
324 | currentPathCombo ->setFixedWidth(220); | ||
320 | currentPathCombo->setEditable(TRUE); | 325 | currentPathCombo->setEditable(TRUE); |
321 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); | 326 | currentPathCombo->lineEdit()->setText( currentDir.canonicalPath()); |
322 | 327 | ||
323 | connect( currentPathCombo, SIGNAL( activated(const QString&) ), | 328 | connect( currentPathCombo, SIGNAL( activated(const QString&) ), |
324 | this, SLOT( currentPathComboActivated(const QString&) ) ); | 329 | this, SLOT( currentPathComboActivated(const QString&) ) ); |
325 | 330 | ||
326 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), | 331 | connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()), |
327 | this,SLOT(currentPathComboChanged())); | 332 | this,SLOT(currentPathComboChanged())); |
328 | ProgressBar = new QProgressBar( view, "ProgressBar" ); | 333 | ProgressBar = new QProgressBar( view, "ProgressBar" ); |
329 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); | 334 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 4); |
330 | ProgressBar->setMaximumHeight(10); | 335 | ProgressBar->setMaximumHeight(10); |
331 | filterStr="*"; | 336 | filterStr="*"; |
332 | b=FALSE; | 337 | b=FALSE; |
333 | populateLocalView(); | 338 | populateLocalView(); |
334 | readConfig(); | 339 | readConfig(); |
335 | 340 | ||
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() |
343 | { | 349 | { |
344 | } | 350 | } |
345 | 351 | ||
346 | void OpieFtp::cleanUp() | 352 | void OpieFtp::cleanUp() |
347 | { | 353 | { |
@@ -530,17 +536,17 @@ void OpieFtp::localUpload() | |||
530 | if( !fi.isDir()) { | 536 | if( !fi.isDir()) { |
531 | fsz=fi.size(); | 537 | fsz=fi.size(); |
532 | ProgressBar->setTotalSteps(fsz); | 538 | ProgressBar->setTotalSteps(fsz); |
533 | 539 | ||
534 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 540 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
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; |
542 | msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); | 548 | msg.sprintf(tr("Unable to upload\n")+"%s",FtpLastResponse(conn)); |
543 | msg.replace(QRegExp(":"),"\n"); | 549 | msg.replace(QRegExp(":"),"\n"); |
544 | QMessageBox::message(tr("Note"),msg); | 550 | QMessageBox::message(tr("Note"),msg); |
545 | } | 551 | } |
546 | } else { | 552 | } else { |
@@ -591,17 +597,17 @@ void OpieFtp::remoteDownload() | |||
591 | QString temp; | 597 | QString temp; |
592 | temp.sprintf( remoteFile+" "+" %dkb", fsz); | 598 | temp.sprintf( remoteFile+" "+" %dkb", fsz); |
593 | 599 | ||
594 | ProgressBar->setTotalSteps(fsz); | 600 | ProgressBar->setTotalSteps(fsz); |
595 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); | 601 | FtpOptions(FTPLIB_CALLBACK, (long) log_progress, conn); |
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; |
603 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); | 609 | msg.sprintf(tr("Unable to download \n")+"%s",FtpLastResponse(conn)); |
604 | msg.replace(QRegExp(":"),"\n"); | 610 | msg.replace(QRegExp(":"),"\n"); |
605 | QMessageBox::message(tr("Note"),msg); | 611 | QMessageBox::message(tr("Note"),msg); |
606 | } | 612 | } |
607 | ProgressBar->reset(); | 613 | ProgressBar->reset(); |
@@ -770,18 +776,18 @@ bool OpieFtp::populateRemoteView( ) | |||
770 | itemFile=item; | 776 | itemFile=item; |
771 | } | 777 | } |
772 | } | 778 | } |
773 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); | 779 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); |
774 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); | 780 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); |
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 | } |
783 | 789 | ||
784 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) | 790 | void OpieFtp::remoteListClicked(QListViewItem *selectedItem) |
785 | { | 791 | { |
786 | if( selectedItem) { | 792 | if( selectedItem) { |
787 | // if(selectedItem!= NULL) { | 793 | // if(selectedItem!= NULL) { |
@@ -1229,17 +1235,17 @@ void OpieFtp::readConfig() | |||
1229 | 1235 | ||
1230 | // odebug << "Reading " << currentServerConfig << "" << oendl; | 1236 | // odebug << "Reading " << currentServerConfig << "" << oendl; |
1231 | serverComboSelected( currentServerConfig-1); | 1237 | serverComboSelected( currentServerConfig-1); |
1232 | 1238 | ||
1233 | } | 1239 | } |
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 | ||
1241 | QString username, remoteServerStr, remotePathStr, password, port, temp; | 1247 | QString username, remoteServerStr, remotePathStr, password, port, temp; |
1242 | 1248 | ||
1243 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1249 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1244 | 1250 | ||
1245 | if( currentServerConfig == -1) { | 1251 | if( currentServerConfig == -1) { |
@@ -1260,17 +1266,17 @@ void OpieFtp::writeConfig() | |||
1260 | 1266 | ||
1261 | temp.setNum(numberOfEntries+1); | 1267 | temp.setNum(numberOfEntries+1); |
1262 | cfg.setGroup("Server"); | 1268 | cfg.setGroup("Server"); |
1263 | 1269 | ||
1264 | cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() ); | 1270 | cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() ); |
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()) |
1272 | cfg.writeEntry("ServerName", newServerName); | 1278 | cfg.writeEntry("ServerName", newServerName); |
1273 | 1279 | ||
1274 | cfg.writeEntry("RemotePath", remotePath->text()); | 1280 | cfg.writeEntry("RemotePath", remotePath->text()); |
1275 | 1281 | ||
1276 | cfg.writeEntry("Username", UsernameComboBox->currentText()); | 1282 | cfg.writeEntry("Username", UsernameComboBox->currentText()); |
@@ -1279,17 +1285,17 @@ void OpieFtp::writeConfig() | |||
1279 | cfg.setGroup("Server"); | 1285 | cfg.setGroup("Server"); |
1280 | 1286 | ||
1281 | cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); | 1287 | cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); |
1282 | 1288 | ||
1283 | } | 1289 | } |
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(); |
1291 | serverListView->clear(); | 1297 | serverListView->clear(); |
1292 | } | 1298 | } |
1293 | 1299 | ||
1294 | 1300 | ||
1295 | void OpieFtp::fillCombos() | 1301 | void OpieFtp::fillCombos() |
@@ -1299,28 +1305,28 @@ void OpieFtp::fillCombos() | |||
1299 | 1305 | ||
1300 | Config cfg("opieftp"); | 1306 | Config cfg("opieftp"); |
1301 | cfg.setGroup("Server"); | 1307 | cfg.setGroup("Server"); |
1302 | QString username, remoteServerStr, remotePathStr, password, port, temp; | 1308 | QString username, remoteServerStr, remotePathStr, password, port, temp; |
1303 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1309 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
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); |
1314 | bool ok; | 1320 | bool ok; |
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); |
1322 | 1328 | ||
1323 | username = cfg.readEntry(temp); | 1329 | username = cfg.readEntry(temp); |
1324 | UsernameComboBox->insertItem(username); | 1330 | UsernameComboBox->insertItem(username); |
1325 | password = cfg.readEntryCrypt(username,""); | 1331 | password = cfg.readEntryCrypt(username,""); |
1326 | PasswordEdit->setText(password); | 1332 | PasswordEdit->setText(password); |
@@ -1329,48 +1335,48 @@ void OpieFtp::fillCombos() | |||
1329 | } | 1335 | } |
1330 | } | 1336 | } |
1331 | 1337 | ||
1332 | 1338 | ||
1333 | void OpieFtp::serverComboSelected(int index) | 1339 | 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); |
1341 | 1347 | ||
1342 | Config cfg("opieftp"); | 1348 | Config cfg("opieftp"); |
1343 | cfg.setGroup("Server"); | 1349 | cfg.setGroup("Server"); |
1344 | // int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1350 | // int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1345 | 1351 | ||
1346 | // for (int i = 1; i <= numberOfEntries; i++) { | 1352 | // for (int i = 1; i <= numberOfEntries; i++) { |
1347 | // int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1353 | // int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1348 | 1354 | ||
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); |
1356 | port = remoteServerStr.right( divider - 1); | 1362 | port = remoteServerStr.right( divider - 1); |
1357 | bool ok; | 1363 | bool ok; |
1358 | int portInt = port.toInt(&ok,10); | 1364 | int portInt = port.toInt(&ok,10); |
1359 | if( portInt == 0) portInt = 21; | 1365 | if( portInt == 0) portInt = 21; |
1360 | ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE))); | 1366 | ServerComboBox->lineEdit()->setText(remoteServerStr.left( remoteServerStr.find(":",0,TRUE))); |
1361 | 1367 | ||
1362 | PortSpinBox->setValue( portInt); | 1368 | PortSpinBox->setValue( portInt); |
1363 | 1369 | ||
1364 | remotePath->setText(cfg.readEntry("RemotePath", "/")); | 1370 | remotePath->setText(cfg.readEntry("RemotePath", "/")); |
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 |
1372 | // PasswordEdit | 1378 | // PasswordEdit |
1373 | 1379 | ||
1374 | cfg.setGroup("Server"); | 1380 | cfg.setGroup("Server"); |
1375 | temp.sprintf("%d", currentServerConfig); | 1381 | temp.sprintf("%d", currentServerConfig); |
1376 | cfg.writeEntry("currentServer", temp); | 1382 | cfg.writeEntry("currentServer", temp); |
@@ -1405,17 +1411,17 @@ void OpieFtp::deleteServer() | |||
1405 | 1411 | ||
1406 | if( tempname.find( servername,0,TRUE) != -1 ) { | 1412 | if( tempname.find( servername,0,TRUE) != -1 ) { |
1407 | // servername.find( cfg.readEntry("ServerName")) != -1 && | 1413 | // servername.find( cfg.readEntry("ServerName")) != -1 && |
1408 | // remoteServerStr.find( cfg.readEntry("RemotePath")) != -1 && | 1414 | // remoteServerStr.find( cfg.readEntry("RemotePath")) != -1 && |
1409 | // username.find( cfg.readEntry("Username")) != -1) { | 1415 | // username.find( cfg.readEntry("Username")) != -1) { |
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"); |
1417 | cfg.writeEntry("Server", QString::number(numberOfEntries + 1 )); | 1423 | cfg.writeEntry("Server", QString::number(numberOfEntries + 1 )); |
1418 | 1424 | ||
1419 | cfg.setGroup(QString::number(i+1)); //get next server config | 1425 | cfg.setGroup(QString::number(i+1)); //get next server config |
1420 | servername=cfg.readEntry("ServerName"); | 1426 | servername=cfg.readEntry("ServerName"); |
1421 | remoteServerStr=cfg.readEntry("RemotePath"); | 1427 | remoteServerStr=cfg.readEntry("RemotePath"); |
@@ -1529,17 +1535,17 @@ void OpieFtp::NewServer() { | |||
1529 | serverListView->insertItem( newServerName ); | 1535 | serverListView->insertItem( newServerName ); |
1530 | serverListView->setCurrentItem( serverListView->count()); | 1536 | serverListView->setCurrentItem( serverListView->count()); |
1531 | } | 1537 | } |
1532 | } | 1538 | } |
1533 | 1539 | ||
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)); |
1541 | if(cfg.readEntry( "ServerName").find(item) != -1 && !fuckeduphack) | 1547 | if(cfg.readEntry( "ServerName").find(item) != -1 && !fuckeduphack) |
1542 | serverComboSelected(i-1); | 1548 | serverComboSelected(i-1); |
1543 | } | 1549 | } |
1544 | } | 1550 | } |
1545 | 1551 | ||
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h index 076a906..ba2ddf9 100644 --- a/noncore/net/opieftp/opieftp.h +++ b/noncore/net/opieftp/opieftp.h | |||
@@ -42,39 +42,41 @@ class QStringList; | |||
42 | class QListBox; | 42 | class QListBox; |
43 | class QTimer; | 43 | class QTimer; |
44 | 44 | ||
45 | class OpieFtp : public QMainWindow | 45 | class OpieFtp : public QMainWindow |
46 | { | 46 | { |
47 | Q_OBJECT | 47 | Q_OBJECT |
48 | 48 | ||
49 | public: | 49 | public: |
50 | static QString appName() { return QString::fromLatin1("opieftp"); } | ||
50 | OpieFtp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 51 | OpieFtp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
51 | ~OpieFtp(); | 52 | ~OpieFtp(); |
52 | 53 | ||
53 | static QString appName() { return QString::fromLatin1("opieftp"); } | ||
54 | QTabWidget *TabWidget; | 54 | QTabWidget *TabWidget; |
55 | QWidget *tab, *tab_2, *tab_3; | 55 | QWidget *tab, *tab_2, *tab_3; |
56 | QListView *Local_View, *Remote_View; | 56 | QListView *Local_View, *Remote_View; |
57 | QListBox *serverListView; | 57 | QListBox *serverListView; |
58 | 58 | ||
59 | QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo; | 59 | QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo; |
60 | QLineEdit *PasswordEdit, *remotePath; | 60 | QLineEdit *PasswordEdit, *remotePath; |
61 | QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; | 61 | QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;; |
62 | QSpinBox* PortSpinBox; | 62 | QSpinBox* PortSpinBox; |
63 | QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu, *aboutMenu; | 63 | QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu, *aboutMenu; |
64 | QDir currentDir; | 64 | QDir currentDir; |
65 | QString currentRemoteDir; | 65 | QString currentRemoteDir; |
66 | QString filterStr; | 66 | QString filterStr; |
67 | QListViewItem * item; | 67 | QListViewItem * item; |
68 | QPushButton *connectServerBtn, *newServerButton;// | 68 | QPushButton *connectServerBtn, *newServerButton; |
69 | QToolButton *cdUpButton, *homeButton, *docButton; | 69 | QToolButton *cdUpButton, *homeButton, *docButton; |
70 | bool b; | 70 | bool b; |
71 | |||
71 | int currentServerConfig; | 72 | int currentServerConfig; |
72 | protected slots: | 73 | protected slots: |
74 | void initializeGui(); | ||
73 | void timerOut(); | 75 | void timerOut(); |
74 | void upDir(); | 76 | void upDir(); |
75 | void homeButtonPushed(); | 77 | void homeButtonPushed(); |
76 | void docButtonPushed(); | 78 | void docButtonPushed(); |
77 | void doAbout(); | 79 | void doAbout(); |
78 | 80 | ||
79 | void serverComboEdited(const QString & ); | 81 | void serverComboEdited(const QString & ); |
80 | void UsernameComboBoxEdited(const QString & ); | 82 | void UsernameComboBoxEdited(const QString & ); |
diff --git a/noncore/net/opieftp/opieftp.pro b/noncore/net/opieftp/opieftp.pro index fe69e15..835b6e0 100644 --- a/noncore/net/opieftp/opieftp.pro +++ b/noncore/net/opieftp/opieftp.pro | |||
@@ -1,9 +1,10 @@ | |||
1 | CONFIG += qt quick-app | 1 | TEMPLATE = app |
2 | CONFIG += qte quick-app warn_on | ||
2 | HEADERS = opieftp.h inputDialog.h | 3 | HEADERS = opieftp.h inputDialog.h |
3 | SOURCES = opieftp.cpp inputDialog.cpp main.cpp | 4 | SOURCES = opieftp.cpp inputDialog.cpp main.cpp |
4 | TARGET = opieftp | 5 | TARGET = opieftp |
5 | INCLUDEPATH += $(OPIEDIR)/include | 6 | INCLUDEPATH += $(OPIEDIR)/include |
6 | DEPENDPATH += $(OPIEDIR)/include | 7 | DEPENDPATH += $(OPIEDIR)/include |
7 | LIBS += -lqpe -lopiecore2 -lftplib | 8 | LIBS += -lqpe -lopiecore2 -lftplib |
8 | 9 | ||
9 | include( $(OPIEDIR)/include.pro ) | 10 | include( $(OPIEDIR)/include.pro ) |