-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index e15bbef..d78b7d1 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -1,47 +1,51 @@ | |||
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 |
5 | copyright : (C) 2002 by ljp | 5 | copyright : (C) 2002 by ljp |
6 | email : ljp@llornkcor.com | 6 | email : ljp@llornkcor.com |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * | 9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * | 10 | * (at your option) any later version. * |
11 | ***************************************************************************/ | 11 | ***************************************************************************/ |
12 | //#define DEVELOPERS_VERSION | 12 | //#define DEVELOPERS_VERSION |
13 | 13 | ||
14 | #include "opieftp.h" | 14 | #include "opieftp.h" |
15 | |||
16 | extern "C" { | ||
15 | #include "ftplib.h" | 17 | #include "ftplib.h" |
18 | } | ||
19 | |||
16 | #include "inputDialog.h" | 20 | #include "inputDialog.h" |
17 | 21 | ||
18 | #include <qpe/qpemenubar.h> | 22 | #include <qpe/qpemenubar.h> |
19 | #include <qpe/qpetoolbar.h> | 23 | #include <qpe/qpetoolbar.h> |
20 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 26 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
24 | #include <qpe/mimetype.h> | 28 | #include <qpe/mimetype.h> |
25 | #include <qpe/qpemessagebox.h> | 29 | #include <qpe/qpemessagebox.h> |
26 | 30 | ||
27 | #include <qstringlist.h> | 31 | #include <qstringlist.h> |
28 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
29 | #include <qpushbutton.h> | 33 | #include <qpushbutton.h> |
30 | #include <qtoolbutton.h> | 34 | #include <qtoolbutton.h> |
31 | #include <qdatetime.h> | 35 | #include <qdatetime.h> |
32 | #include <qdir.h> | 36 | #include <qdir.h> |
33 | #include <qfile.h> | 37 | #include <qfile.h> |
34 | #include <qstring.h> | 38 | #include <qstring.h> |
35 | #include <qcombobox.h> | 39 | #include <qcombobox.h> |
36 | #include <qpopupmenu.h> | 40 | #include <qpopupmenu.h> |
37 | #include <qlistview.h> | 41 | #include <qlistview.h> |
38 | #include <qmainwindow.h> | 42 | #include <qmainwindow.h> |
39 | #include <qlabel.h> | 43 | #include <qlabel.h> |
40 | #include <qprogressbar.h> | 44 | #include <qprogressbar.h> |
41 | #include <qspinbox.h> | 45 | #include <qspinbox.h> |
42 | #include <qtabwidget.h> | 46 | #include <qtabwidget.h> |
43 | #include <qwidget.h> | 47 | #include <qwidget.h> |
44 | #include <qlayout.h> | 48 | #include <qlayout.h> |
45 | #include <qimage.h> | 49 | #include <qimage.h> |
46 | #include <qpixmap.h> | 50 | #include <qpixmap.h> |
47 | #include <qmessagebox.h> | 51 | #include <qmessagebox.h> |
@@ -1203,64 +1207,66 @@ void OpieFtp::fillCombos() | |||
1203 | // UsernameComboBox->insertItem(username); | 1207 | // UsernameComboBox->insertItem(username); |
1204 | // password = cfg.readEntryCrypt(username,""); | 1208 | // password = cfg.readEntryCrypt(username,""); |
1205 | // PasswordEdit->setText(password); | 1209 | // PasswordEdit->setText(password); |
1206 | } | 1210 | } |
1207 | } | 1211 | } |
1208 | 1212 | ||
1209 | 1213 | ||
1210 | void OpieFtp::serverComboSelected(int index) | 1214 | void OpieFtp::serverComboSelected(int index) |
1211 | { | 1215 | { |
1212 | currentServerConfig = index; | 1216 | currentServerConfig = index; |
1213 | QString username, remoteServerStr, remotePathStr, password, port, temp; | 1217 | QString username, remoteServerStr, remotePathStr, password, port, temp; |
1214 | // remoteServerStr = ServerComboBox->text(index); | 1218 | // remoteServerStr = ServerComboBox->text(index); |
1215 | Config cfg("opieftp"); | 1219 | Config cfg("opieftp"); |
1216 | cfg.setGroup("Server"); | 1220 | cfg.setGroup("Server"); |
1217 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1221 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1218 | 1222 | ||
1219 | temp.setNum(index+1); | 1223 | temp.setNum(index+1); |
1220 | remoteServerStr = cfg.readEntry( temp,""); | 1224 | remoteServerStr = cfg.readEntry( temp,""); |
1221 | cfg.setGroup(temp); | 1225 | cfg.setGroup(temp); |
1222 | // qDebug(temp); | 1226 | // qDebug(temp); |
1223 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); | 1227 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); |
1224 | port = remoteServerStr.right( divider - 1); | 1228 | port = remoteServerStr.right( divider - 1); |
1225 | bool ok; | 1229 | bool ok; |
1226 | int portInt = port.toInt(&ok,10); | 1230 | int portInt = port.toInt(&ok,10); |
1227 | if( portInt == 0) portInt = 21; | 1231 | if( portInt == 0) portInt = 21; |
1228 | 1232 | ||
1229 | PortSpinBox->setValue( portInt); | 1233 | PortSpinBox->setValue( portInt); |
1230 | 1234 | ||
1231 | remotePath->setText(cfg.readEntry("RemotePath", "/")); | 1235 | remotePath->setText(cfg.readEntry("RemotePath", "/")); |
1232 | 1236 | ||
1233 | username = cfg.readEntry("Username", "anonymous"); | 1237 | username = cfg.readEntry("Username", "anonymous"); |
1234 | UsernameComboBox->lineEdit()->setText(username); | 1238 | UsernameComboBox->lineEdit()->setText(username); |
1239 | |||
1240 | // qDebug("Password is "+cfg.readEntryCrypt(username, "me@opieftp.org")); | ||
1235 | PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org")); | 1241 | PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org")); |
1236 | 1242 | ||
1237 | cfg.setGroup("Server"); | 1243 | cfg.setGroup("Server"); |
1238 | temp.sprintf("%d",currentServerConfig); | 1244 | temp.sprintf("%d",currentServerConfig); |
1239 | cfg.writeEntry("currentServer", temp); | 1245 | cfg.writeEntry("currentServer", temp); |
1240 | update(); | 1246 | update(); |
1241 | } | 1247 | } |
1242 | // UsernameComboBox->lineEdit()->setText("root"); | 1248 | // UsernameComboBox->lineEdit()->setText("root"); |
1243 | // PasswordEdit->setText( tr( "" ) ); | 1249 | // PasswordEdit->setText( tr( "" ) ); |
1244 | // ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); | 1250 | // ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); |
1245 | // remotePath->setText( currentRemoteDir = "/home/llornkcor/"); | 1251 | // remotePath->setText( currentRemoteDir = "/home/llornkcor/"); |
1246 | // PortSpinBox->setValue( 4242); | 1252 | // PortSpinBox->setValue( 4242); |
1247 | 1253 | ||
1248 | void OpieFtp::deleteServer() | 1254 | void OpieFtp::deleteServer() |
1249 | { | 1255 | { |
1250 | QString username, remoteServerStr, remotePathStr, password, port, temp; | 1256 | QString username, remoteServerStr, remotePathStr, password, port, temp; |
1251 | remoteServerStr = ServerComboBox->currentText( ); | 1257 | remoteServerStr = ServerComboBox->currentText( ); |
1252 | username = UsernameComboBox->currentText(); | 1258 | username = UsernameComboBox->currentText(); |
1253 | Config cfg("opieftp"); | 1259 | Config cfg("opieftp"); |
1254 | cfg.setGroup("Server"); | 1260 | cfg.setGroup("Server"); |
1255 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1261 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1256 | for (int i = 0; i <= numberOfEntries; i++) { | 1262 | for (int i = 0; i <= numberOfEntries; i++) { |
1257 | temp.setNum(i+1); | 1263 | temp.setNum(i+1); |
1258 | cfg.setGroup("Server"); | 1264 | cfg.setGroup("Server"); |
1259 | if( cfg.readEntry( temp,"").find( remoteServerStr,0,TRUE) != -1 | 1265 | if( cfg.readEntry( temp,"").find( remoteServerStr,0,TRUE) != -1 |
1260 | && cfg.readEntry(temp).find(username,0,TRUE) != -1 | 1266 | && cfg.readEntry(temp).find(username,0,TRUE) != -1 |
1261 | && !remoteServerStr.isEmpty()) { | 1267 | && !remoteServerStr.isEmpty()) { |
1262 | qDebug(temp); | 1268 | qDebug(temp); |
1263 | } | 1269 | } |
1264 | } | 1270 | } |
1265 | } | 1271 | } |
1266 | 1272 | ||