-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,111 +1,115 @@ | |||
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> |
48 | #include <qlineedit.h> | 52 | #include <qlineedit.h> |
49 | #include <qregexp.h> | 53 | #include <qregexp.h> |
50 | 54 | ||
51 | #include <unistd.h> | 55 | #include <unistd.h> |
52 | #include <stdlib.h> | 56 | #include <stdlib.h> |
53 | 57 | ||
54 | 58 | ||
55 | QProgressBar *ProgressBar; | 59 | QProgressBar *ProgressBar; |
56 | static netbuf *conn=NULL; | 60 | static netbuf *conn=NULL; |
57 | 61 | ||
58 | static int log_progress(netbuf *ctl, int xfered, void *arg) | 62 | static int log_progress(netbuf *ctl, int xfered, void *arg) |
59 | { | 63 | { |
60 | int fsz = *(int *)arg; | 64 | int fsz = *(int *)arg; |
61 | int pct = (xfered * 100) / fsz; | 65 | int pct = (xfered * 100) / fsz; |
62 | // printf("%3d%%\r", pct); | 66 | // printf("%3d%%\r", pct); |
63 | // fflush(stdout); | 67 | // fflush(stdout); |
64 | ProgressBar->setProgress(xfered); | 68 | ProgressBar->setProgress(xfered); |
65 | qApp->processEvents(); | 69 | qApp->processEvents(); |
66 | return 1; | 70 | return 1; |
67 | } | 71 | } |
68 | 72 | ||
69 | OpieFtp::OpieFtp( ) | 73 | OpieFtp::OpieFtp( ) |
70 | : QMainWindow( ) | 74 | : QMainWindow( ) |
71 | { | 75 | { |
72 | setCaption( tr( "OpieFtp" ) ); | 76 | setCaption( tr( "OpieFtp" ) ); |
73 | 77 | ||
74 | QGridLayout *layout = new QGridLayout( this ); | 78 | QGridLayout *layout = new QGridLayout( this ); |
75 | layout->setSpacing( 2); | 79 | layout->setSpacing( 2); |
76 | layout->setMargin( 2); | 80 | layout->setMargin( 2); |
77 | 81 | ||
78 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 82 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
79 | 83 | ||
80 | QPEMenuBar *menuBar = new QPEMenuBar(this); | 84 | QPEMenuBar *menuBar = new QPEMenuBar(this); |
81 | // QPEToolBar *menuBar = new QPEToolBar(this); | 85 | // QPEToolBar *menuBar = new QPEToolBar(this); |
82 | // menuBar->setHorizontalStretchable( TRUE ); | 86 | // menuBar->setHorizontalStretchable( TRUE ); |
83 | 87 | ||
84 | connectionMenu = new QPopupMenu( this ); | 88 | connectionMenu = new QPopupMenu( this ); |
85 | localMenu = new QPopupMenu( this ); | 89 | localMenu = new QPopupMenu( this ); |
86 | remoteMenu = new QPopupMenu( this ); | 90 | remoteMenu = new QPopupMenu( this ); |
87 | tabMenu = new QPopupMenu( this ); | 91 | tabMenu = new QPopupMenu( this ); |
88 | 92 | ||
89 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); | 93 | layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 ); |
90 | 94 | ||
91 | menuBar->insertItem( tr( "Connection" ), connectionMenu); | 95 | menuBar->insertItem( tr( "Connection" ), connectionMenu); |
92 | menuBar->insertItem( tr( "Local" ), localMenu); | 96 | menuBar->insertItem( tr( "Local" ), localMenu); |
93 | menuBar->insertItem( tr( "Remote" ), remoteMenu); | 97 | menuBar->insertItem( tr( "Remote" ), remoteMenu); |
94 | menuBar->insertItem( tr( "View" ), tabMenu); | 98 | menuBar->insertItem( tr( "View" ), tabMenu); |
95 | 99 | ||
96 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); | 100 | connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() )); |
97 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); | 101 | connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() )); |
98 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); | 102 | connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() )); |
99 | 103 | ||
100 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); | 104 | localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() )); |
101 | localMenu->insertSeparator(); | 105 | localMenu->insertSeparator(); |
102 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); | 106 | localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() )); |
103 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); | 107 | localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() )); |
104 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); | 108 | localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() )); |
105 | localMenu->insertSeparator(); | 109 | localMenu->insertSeparator(); |
106 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 110 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
107 | localMenu->setCheckable(TRUE); | 111 | localMenu->setCheckable(TRUE); |
108 | 112 | ||
109 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 113 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
110 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 114 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
111 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); | 115 | remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() )); |
@@ -1139,189 +1143,191 @@ void OpieFtp::readConfig() | |||
1139 | cfg.setGroup("Server"); | 1143 | cfg.setGroup("Server"); |
1140 | currentServerConfig = cfg.readNumEntry("currentServer", -1); | 1144 | currentServerConfig = cfg.readNumEntry("currentServer", -1); |
1141 | // qDebug("Reading %d", currentServerConfig); | 1145 | // qDebug("Reading %d", currentServerConfig); |
1142 | serverComboSelected( currentServerConfig); | 1146 | serverComboSelected( currentServerConfig); |
1143 | } | 1147 | } |
1144 | 1148 | ||
1145 | void OpieFtp::writeConfig() | 1149 | void OpieFtp::writeConfig() |
1146 | { | 1150 | { |
1147 | Config cfg("opieftp"); | 1151 | Config cfg("opieftp"); |
1148 | cfg.setGroup("Server"); | 1152 | cfg.setGroup("Server"); |
1149 | QString username, remoteServerStr, remotePathStr, password, port, temp; | 1153 | QString username, remoteServerStr, remotePathStr, password, port, temp; |
1150 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1154 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1151 | if( currentServerConfig == -1) { | 1155 | if( currentServerConfig == -1) { |
1152 | for (int i = 1; i <= numberOfEntries; i++) { | 1156 | for (int i = 1; i <= numberOfEntries; i++) { |
1153 | temp.setNum(i); | 1157 | temp.setNum(i); |
1154 | cfg.setGroup("Server"); | 1158 | cfg.setGroup("Server"); |
1155 | QString tempStr = cfg.readEntry( temp,""); | 1159 | QString tempStr = cfg.readEntry( temp,""); |
1156 | } | 1160 | } |
1157 | temp.setNum( numberOfEntries + 1); | 1161 | temp.setNum( numberOfEntries + 1); |
1158 | cfg.setGroup("Server"); | 1162 | cfg.setGroup("Server"); |
1159 | remoteServerStr = cfg.readEntry( temp,""); | 1163 | remoteServerStr = cfg.readEntry( temp,""); |
1160 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); | 1164 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); |
1161 | remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); | 1165 | remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); |
1162 | 1166 | ||
1163 | temp.setNum(numberOfEntries+1); | 1167 | temp.setNum(numberOfEntries+1); |
1164 | cfg.setGroup("Server"); | 1168 | cfg.setGroup("Server"); |
1165 | cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() ); | 1169 | cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() ); |
1166 | cfg.setGroup(temp); | 1170 | cfg.setGroup(temp); |
1167 | cfg.writeEntry("RemotePath", remotePath->text()); | 1171 | cfg.writeEntry("RemotePath", remotePath->text()); |
1168 | cfg.writeEntry("Username", UsernameComboBox->currentText()); | 1172 | cfg.writeEntry("Username", UsernameComboBox->currentText()); |
1169 | cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text()); | 1173 | cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text()); |
1170 | cfg.setGroup("Server"); | 1174 | cfg.setGroup("Server"); |
1171 | cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); | 1175 | cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); |
1172 | } | 1176 | } |
1173 | } | 1177 | } |
1174 | 1178 | ||
1175 | void OpieFtp::fillCombos() | 1179 | void OpieFtp::fillCombos() |
1176 | { | 1180 | { |
1177 | Config cfg("opieftp"); | 1181 | Config cfg("opieftp"); |
1178 | cfg.setGroup("Server"); | 1182 | cfg.setGroup("Server"); |
1179 | QString username, remoteServerStr, remotePathStr, password, port, temp; | 1183 | QString username, remoteServerStr, remotePathStr, password, port, temp; |
1180 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | 1184 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); |
1181 | for (int i = 1; i <= numberOfEntries; i++) { | 1185 | for (int i = 1; i <= numberOfEntries; i++) { |
1182 | temp.setNum(i); | 1186 | temp.setNum(i); |
1183 | cfg.setGroup("Server"); | 1187 | cfg.setGroup("Server"); |
1184 | remoteServerStr = cfg.readEntry( temp,""); | 1188 | remoteServerStr = cfg.readEntry( temp,""); |
1185 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); | 1189 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); |
1186 | port = remoteServerStr.right( divider - 1); | 1190 | port = remoteServerStr.right( divider - 1); |
1187 | bool ok; | 1191 | bool ok; |
1188 | PortSpinBox->setValue( port.toInt(&ok,10)); | 1192 | PortSpinBox->setValue( port.toInt(&ok,10)); |
1189 | 1193 | ||
1190 | remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); | 1194 | remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); |
1191 | ServerComboBox->insertItem( remoteServerStr ); | 1195 | ServerComboBox->insertItem( remoteServerStr ); |
1192 | // cfg.setGroup(temp); | 1196 | // cfg.setGroup(temp); |
1193 | 1197 | ||
1194 | // remotePathStr = cfg.readEntry(remoteServer,""); | 1198 | // remotePathStr = cfg.readEntry(remoteServer,""); |
1195 | // int divider = remoteServer.length() - remoteServer.find(":",0,TRUE); | 1199 | // int divider = remoteServer.length() - remoteServer.find(":",0,TRUE); |
1196 | // port = remoteServer.right( divider+1); | 1200 | // port = remoteServer.right( divider+1); |
1197 | // PortSpinBox->setValue( port); | 1201 | // PortSpinBox->setValue( port); |
1198 | 1202 | ||
1199 | // remoteServer = remoteServer.left(divider - 1); | 1203 | // remoteServer = remoteServer.left(divider - 1); |
1200 | // remotePath->setText( remotePathStr); | 1204 | // remotePath->setText( remotePathStr); |
1201 | 1205 | ||
1202 | // username = cfg.readEntry(temp); | 1206 | // username = cfg.readEntry(temp); |
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 | ||
1267 | void OpieFtp::upDir() | 1273 | void OpieFtp::upDir() |
1268 | { | 1274 | { |
1269 | if (TabWidget->currentPageIndex() == 0) { | 1275 | if (TabWidget->currentPageIndex() == 0) { |
1270 | QString current = currentDir.canonicalPath(); | 1276 | QString current = currentDir.canonicalPath(); |
1271 | QDir dir(current); | 1277 | QDir dir(current); |
1272 | dir.cdUp(); | 1278 | dir.cdUp(); |
1273 | current = dir.canonicalPath(); | 1279 | current = dir.canonicalPath(); |
1274 | chdir( current.latin1() ); | 1280 | chdir( current.latin1() ); |
1275 | currentDir.cd( current, TRUE); | 1281 | currentDir.cd( current, TRUE); |
1276 | populateLocalView(); | 1282 | populateLocalView(); |
1277 | update(); | 1283 | update(); |
1278 | } else { | 1284 | } else { |
1279 | if( FtpCDUp( conn) == 0) { | 1285 | if( FtpCDUp( conn) == 0) { |
1280 | QString msg; | 1286 | QString msg; |
1281 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); | 1287 | msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn)); |
1282 | msg.replace(QRegExp(":"),"\n"); | 1288 | msg.replace(QRegExp(":"),"\n"); |
1283 | QMessageBox::message(tr("Note"),msg); | 1289 | QMessageBox::message(tr("Note"),msg); |
1284 | // qDebug(msg); | 1290 | // qDebug(msg); |
1285 | } | 1291 | } |
1286 | char path[256]; | 1292 | char path[256]; |
1287 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string | 1293 | if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string |
1288 | QString msg; | 1294 | QString msg; |
1289 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); | 1295 | msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn)); |
1290 | msg.replace(QRegExp(":"),"\n"); | 1296 | msg.replace(QRegExp(":"),"\n"); |
1291 | QMessageBox::message(tr("Note"),msg); | 1297 | QMessageBox::message(tr("Note"),msg); |
1292 | // qDebug(msg); | 1298 | // qDebug(msg); |
1293 | } | 1299 | } |
1294 | currentRemoteDir=path; | 1300 | currentRemoteDir=path; |
1295 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate | 1301 | remoteDirList( (const QString &)currentRemoteDir); //this also calls populate |
1296 | if(currentRemoteDir.right(1) !="/") | 1302 | if(currentRemoteDir.right(1) !="/") |
1297 | currentRemoteDir +="/"; | 1303 | currentRemoteDir +="/"; |
1298 | currentPathCombo->lineEdit()->setText( currentRemoteDir); | 1304 | currentPathCombo->lineEdit()->setText( currentRemoteDir); |
1299 | fillRemoteCombo( (const QString &)currentRemoteDir); | 1305 | fillRemoteCombo( (const QString &)currentRemoteDir); |
1300 | 1306 | ||
1301 | } | 1307 | } |
1302 | } | 1308 | } |
1303 | 1309 | ||
1304 | void OpieFtp::docButtonPushed() { | 1310 | void OpieFtp::docButtonPushed() { |
1305 | QString current = QPEApplication::documentDir(); | 1311 | QString current = QPEApplication::documentDir(); |
1306 | chdir( current.latin1() ); | 1312 | chdir( current.latin1() ); |
1307 | currentDir.cd( current, TRUE); | 1313 | currentDir.cd( current, TRUE); |
1308 | populateLocalView(); | 1314 | populateLocalView(); |
1309 | update(); | 1315 | update(); |
1310 | 1316 | ||
1311 | } | 1317 | } |
1312 | 1318 | ||
1313 | void OpieFtp::homeButtonPushed() { | 1319 | void OpieFtp::homeButtonPushed() { |
1314 | QString current = QDir::homeDirPath(); | 1320 | QString current = QDir::homeDirPath(); |
1315 | chdir( current.latin1() ); | 1321 | chdir( current.latin1() ); |
1316 | currentDir.cd( current, TRUE); | 1322 | currentDir.cd( current, TRUE); |
1317 | populateLocalView(); | 1323 | populateLocalView(); |
1318 | update(); | 1324 | update(); |
1319 | } | 1325 | } |
1320 | 1326 | ||
1321 | void OpieFtp::doAbout() { | 1327 | void OpieFtp::doAbout() { |
1322 | QMessageBox::message("OpieFtp","Opie ftp client is copyright 2002 by\n" | 1328 | QMessageBox::message("OpieFtp","Opie ftp client is copyright 2002 by\n" |
1323 | "L.J.Potter<llornkcor@handhelds.org>\n" | 1329 | "L.J.Potter<llornkcor@handhelds.org>\n" |
1324 | "and uses ftplib copyright 1996-2000\n" | 1330 | "and uses ftplib copyright 1996-2000\n" |
1325 | "by Thomas Pfau, pfau@cnj.digex.net\n\n" | 1331 | "by Thomas Pfau, pfau@cnj.digex.net\n\n" |
1326 | "and is licensed by the GPL"); | 1332 | "and is licensed by the GPL"); |
1327 | } | 1333 | } |