-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 175 | ||||
-rw-r--r-- | noncore/net/opieftp/opieftp.h | 7 |
2 files changed, 170 insertions, 12 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 82776d0..eed133e 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -1,35 +1,38 @@ | |||
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 DEVELOPER_VERSION | ||
12 | 13 | ||
13 | #include "opieftp.h" | 14 | #include "opieftp.h" |
14 | #include "ftplib.h" | 15 | #include "ftplib.h" |
15 | #include "inputDialog.h" | 16 | #include "inputDialog.h" |
16 | 17 | ||
17 | #include <qpe/qpemenubar.h> | 18 | #include <qpe/qpemenubar.h> |
18 | #include <qpe/qpetoolbar.h> | 19 | #include <qpe/qpetoolbar.h> |
19 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
20 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
21 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/config.h> | ||
22 | 24 | ||
23 | #include <qtextstream.h> | 25 | #include <qtextstream.h> |
26 | #include <qpushbutton.h> | ||
24 | #include <qtoolbutton.h> | 27 | #include <qtoolbutton.h> |
25 | #include <qdatetime.h> | 28 | #include <qdatetime.h> |
26 | #include <qdir.h> | 29 | #include <qdir.h> |
27 | #include <qfile.h> | 30 | #include <qfile.h> |
28 | #include <qstring.h> | 31 | #include <qstring.h> |
29 | #include <qcombobox.h> | 32 | #include <qcombobox.h> |
30 | #include <qpopupmenu.h> | 33 | #include <qpopupmenu.h> |
31 | #include <qlistview.h> | 34 | #include <qlistview.h> |
32 | #include <qmainwindow.h> | 35 | #include <qmainwindow.h> |
33 | #include <qlabel.h> | 36 | #include <qlabel.h> |
34 | #include <qprogressbar.h> | 37 | #include <qprogressbar.h> |
35 | #include <qspinbox.h> | 38 | #include <qspinbox.h> |
@@ -162,93 +165,113 @@ OpieFtp::OpieFtp( ) | |||
162 | 165 | ||
163 | tab_3 = new QWidget( TabWidget, "tab_3" ); | 166 | tab_3 = new QWidget( TabWidget, "tab_3" ); |
164 | tabLayout_3 = new QGridLayout( tab_3 ); | 167 | tabLayout_3 = new QGridLayout( tab_3 ); |
165 | tabLayout_3->setSpacing( 2); | 168 | tabLayout_3->setSpacing( 2); |
166 | tabLayout_3->setMargin( 2); | 169 | tabLayout_3->setMargin( 2); |
167 | 170 | ||
168 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); | 171 | TextLabel1 = new QLabel( tab_3, "TextLabel1" ); |
169 | TextLabel1->setText( tr( "Username" ) ); | 172 | TextLabel1->setText( tr( "Username" ) ); |
170 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); | 173 | tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 ); |
171 | 174 | ||
172 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); | 175 | UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" ); |
173 | UsernameComboBox->setEditable(TRUE); | 176 | UsernameComboBox->setEditable(TRUE); |
174 | UsernameComboBox->lineEdit()->setText("anonymous"); | 177 | // UsernameComboBox->lineEdit()->setText("anonymous"); |
175 | // UsernameComboBox->lineEdit()->setText("root"); | ||
176 | // UsernameComboBox->lineEdit()->setText("llornkcor"); | ||
177 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); | 178 | tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 ); |
178 | 179 | ||
179 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); | 180 | TextLabel2 = new QLabel( tab_3, "TextLabel2" ); |
180 | TextLabel2->setText( tr( "Password" ) ); | 181 | TextLabel2->setText( tr( "Password" ) ); |
181 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); | 182 | tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 ); |
182 | 183 | ||
183 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); | 184 | PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" ); |
184 | PasswordEdit->setEchoMode(QLineEdit::Password); | 185 | PasswordEdit->setEchoMode(QLineEdit::Password); |
185 | PasswordEdit->setText( tr( "me@opieftp.org" ) ); | 186 | // PasswordEdit->setText( tr( "me@opieftp.org" ) ); |
186 | // PasswordEdit->setText( tr( "" ) ); | ||
187 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); | 187 | tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 ); |
188 | 188 | ||
189 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); | 189 | TextLabel3 = new QLabel( tab_3, "TextLabel3" ); |
190 | TextLabel3->setText( tr( "Remote server" ) ); | 190 | TextLabel3->setText( tr( "Remote server" ) ); |
191 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); | 191 | tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 ); |
192 | 192 | ||
193 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); | 193 | ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" ); |
194 | ServerComboBox->setEditable(TRUE); | 194 | ServerComboBox->setEditable(TRUE); |
195 | ServerComboBox->lineEdit()->setText( tr( "" ) ); | 195 | // ServerComboBox->lineEdit()->setText( tr( "" ) ); |
196 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); | 196 | tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 ); |
197 | // ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) ); | 197 | |
198 | // ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); | 198 | connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) )); |
199 | 199 | ||
200 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); | 200 | QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" ); |
201 | TextLabel5->setText( tr( "Remote path" ) ); | 201 | TextLabel5->setText( tr( "Remote path" ) ); |
202 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); | 202 | tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 ); |
203 | 203 | ||
204 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); | 204 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); |
205 | remotePath->setText( currentRemoteDir = "/"); | 205 | remotePath->setText( currentRemoteDir = "/"); |
206 | // remotePath->setText( currentRemoteDir = "/home/llornkcor/"); | ||
207 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); | 206 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); |
208 | 207 | ||
209 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); | 208 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); |
210 | TextLabel4->setText( tr( "Port" ) ); | 209 | TextLabel4->setText( tr( "Port" ) ); |
211 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); | 210 | tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 ); |
212 | 211 | ||
213 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); | 212 | PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" ); |
214 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); | 213 | PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows ); |
215 | PortSpinBox->setMaxValue(32786); | 214 | PortSpinBox->setMaxValue(32786); |
216 | // PortSpinBox->setValue( 4242); | ||
217 | PortSpinBox->setValue( 21); | 215 | PortSpinBox->setValue( 21); |
218 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); | 216 | tabLayout_3->addMultiCellWidget( PortSpinBox, 4, 4, 1, 1); |
219 | 217 | ||
218 | QPushButton *deleteServerBtn; | ||
219 | deleteServerBtn = new QPushButton( "Delete Server",this, "OpenButton" ); | ||
220 | tabLayout_3->addMultiCellWidget( deleteServerBtn, 5, 5, 2, 3); | ||
221 | |||
222 | connect(deleteServerBtn,SIGNAL(clicked()),SLOT(deleteServer())); | ||
223 | |||
224 | QPushButton *connectServerBtn; | ||
225 | connectServerBtn = new QPushButton( "Connect",this, "ConnectButton" ); | ||
226 | tabLayout_3->addMultiCellWidget( connectServerBtn, 5, 5, 0, 1); | ||
227 | connect(connectServerBtn,SIGNAL( clicked()),SLOT( connector() )); | ||
228 | |||
229 | |||
220 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 230 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
221 | tabLayout_3->addItem( spacer, 5, 0 ); | 231 | tabLayout_3->addItem( spacer, 5, 0 ); |
222 | 232 | ||
223 | TabWidget->insertTab( tab_3, tr( "Config" ) ); | 233 | TabWidget->insertTab( tab_3, tr( "Config" ) ); |
224 | 234 | ||
225 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), | 235 | connect(TabWidget,SIGNAL(currentChanged(QWidget *)), |
226 | this,SLOT(tabChanged(QWidget*))); | 236 | this,SLOT(tabChanged(QWidget*))); |
227 | 237 | ||
228 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 238 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
229 | currentDir.setPath( QDir::currentDirPath()); | 239 | currentDir.setPath( QDir::currentDirPath()); |
230 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 240 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
231 | currentPathEdit = new QLineEdit( "/", this, "currentPathEdit" ); | 241 | currentPathEdit = new QLineEdit( "/", this, "currentPathEdit" ); |
232 | layout->addMultiCellWidget( currentPathEdit, 3, 3, 0, 3 ); | 242 | layout->addMultiCellWidget( currentPathEdit, 3, 3, 0, 3 ); |
233 | 243 | ||
234 | currentPathEdit->setText( currentDir.canonicalPath()); | 244 | currentPathEdit->setText( currentDir.canonicalPath()); |
235 | connect( currentPathEdit,SIGNAL(returnPressed()),this,SLOT(currentPathEditChanged())); | 245 | connect( currentPathEdit,SIGNAL(returnPressed()),this,SLOT(currentPathEditChanged())); |
236 | 246 | ||
237 | ProgressBar = new QProgressBar( this, "ProgressBar" ); | 247 | ProgressBar = new QProgressBar( this, "ProgressBar" ); |
238 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 ); | 248 | layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 ); |
239 | 249 | ||
250 | serverComboSelected(0); | ||
251 | #ifdef DEVELOPER_VERSION | ||
252 | // ServerComboBox->lineEdit()->setText( tr( "llornkcor.com" ) ); | ||
253 | ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); | ||
254 | UsernameComboBox->lineEdit()->setText("root"); | ||
255 | // UsernameComboBox->lineEdit()->setText("llornkcor"); | ||
256 | PortSpinBox->setValue( 4242); | ||
257 | remotePath->setText( currentRemoteDir = "/"); | ||
258 | PasswordEdit->setText( tr( "" ) ); | ||
259 | |||
260 | #endif | ||
261 | fillCombos(); | ||
240 | filterStr="*"; | 262 | filterStr="*"; |
241 | b=FALSE; | 263 | b=FALSE; |
242 | populateLocalView(); | 264 | populateLocalView(); |
265 | TabWidget->setCurrentPage(2); | ||
243 | } | 266 | } |
244 | 267 | ||
245 | OpieFtp::~OpieFtp() | 268 | OpieFtp::~OpieFtp() |
246 | { | 269 | { |
247 | } | 270 | } |
248 | 271 | ||
249 | void OpieFtp::cleanUp() | 272 | void OpieFtp::cleanUp() |
250 | { | 273 | { |
251 | if(conn) | 274 | if(conn) |
252 | FtpQuit(conn); | 275 | FtpQuit(conn); |
253 | QString sfile=QDir::homeDirPath(); | 276 | QString sfile=QDir::homeDirPath(); |
254 | if(sfile.right(1) != "/") | 277 | if(sfile.right(1) != "/") |
@@ -360,25 +383,31 @@ void OpieFtp::remoteDownload() | |||
360 | // FtpQuit(conn); | 383 | // FtpQuit(conn); |
361 | } | 384 | } |
362 | ProgressBar->reset(); | 385 | ProgressBar->reset(); |
363 | nullifyCallBack(); | 386 | nullifyCallBack(); |
364 | TabWidget->setCurrentPage(0); | 387 | TabWidget->setCurrentPage(0); |
365 | populateLocalView(); | 388 | populateLocalView(); |
366 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 389 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
367 | } | 390 | } |
368 | 391 | ||
369 | 392 | ||
370 | void OpieFtp::newConnection() | 393 | void OpieFtp::newConnection() |
371 | { | 394 | { |
372 | TabWidget->setCurrentPage(2); | 395 | UsernameComboBox->lineEdit()->setText(""); |
396 | PasswordEdit->setText( "" ); | ||
397 | ServerComboBox->lineEdit()->setText( ""); | ||
398 | remotePath->setText( currentRemoteDir = "/"); | ||
399 | PortSpinBox->setValue( 21); | ||
400 | TabWidget->setCurrentPage(2); | ||
401 | |||
373 | } | 402 | } |
374 | 403 | ||
375 | void OpieFtp::connector() | 404 | void OpieFtp::connector() |
376 | { | 405 | { |
377 | QCopEnvelope ( "QPE/System", "busy()" ); | 406 | QCopEnvelope ( "QPE/System", "busy()" ); |
378 | qApp->processEvents(); | 407 | qApp->processEvents(); |
379 | currentRemoteDir=remotePath->text(); | 408 | currentRemoteDir=remotePath->text(); |
380 | if(ServerComboBox->currentText().isEmpty()) { | 409 | if(ServerComboBox->currentText().isEmpty()) { |
381 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); | 410 | QMessageBox::warning(this,tr("Ftp"),tr("Please set the server info"),tr("Ok"),0,0); |
382 | TabWidget->setCurrentPage(2); | 411 | TabWidget->setCurrentPage(2); |
383 | ServerComboBox->setFocus(); | 412 | ServerComboBox->setFocus(); |
384 | return; | 413 | return; |
@@ -399,24 +428,25 @@ void OpieFtp::connector() | |||
399 | return ; | 428 | return ; |
400 | } | 429 | } |
401 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { | 430 | if (!FtpLogin( ftp_user.latin1(), ftp_pass.latin1(),conn )) { |
402 | QString msg; | 431 | QString msg; |
403 | msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); | 432 | msg.sprintf(tr("Unable to log in\n")+"%s",FtpLastResponse(conn)); |
404 | msg.replace(QRegExp(":"),"\n"); | 433 | msg.replace(QRegExp(":"),"\n"); |
405 | QMessageBox::message(tr("Note"),msg); | 434 | QMessageBox::message(tr("Note"),msg); |
406 | FtpQuit(conn); | 435 | FtpQuit(conn); |
407 | return ; | 436 | return ; |
408 | } | 437 | } |
409 | remoteDirList("/") ; | 438 | remoteDirList("/") ; |
410 | setCaption(ftp_host); | 439 | setCaption(ftp_host); |
440 | writeConfig(); | ||
411 | QCopEnvelope ( "QPE/System", "notBusy()" ); | 441 | QCopEnvelope ( "QPE/System", "notBusy()" ); |
412 | } | 442 | } |
413 | 443 | ||
414 | void OpieFtp::disConnector() | 444 | void OpieFtp::disConnector() |
415 | { | 445 | { |
416 | FtpQuit(conn); | 446 | FtpQuit(conn); |
417 | setCaption("OpieFtp"); | 447 | setCaption("OpieFtp"); |
418 | currentRemoteDir="/"; | 448 | currentRemoteDir="/"; |
419 | Remote_View->clear(); | 449 | Remote_View->clear(); |
420 | } | 450 | } |
421 | 451 | ||
422 | bool OpieFtp::remoteDirList(const QString &dir) | 452 | bool OpieFtp::remoteDirList(const QString &dir) |
@@ -908,12 +938,135 @@ void OpieFtp::switchToLocalTab() | |||
908 | TabWidget->setCurrentPage(0); | 938 | TabWidget->setCurrentPage(0); |
909 | } | 939 | } |
910 | 940 | ||
911 | void OpieFtp::switchToRemoteTab() | 941 | void OpieFtp::switchToRemoteTab() |
912 | { | 942 | { |
913 | TabWidget->setCurrentPage(1); | 943 | TabWidget->setCurrentPage(1); |
914 | } | 944 | } |
915 | 945 | ||
916 | void OpieFtp::switchToConfigTab() | 946 | void OpieFtp::switchToConfigTab() |
917 | { | 947 | { |
918 | TabWidget->setCurrentPage(2); | 948 | TabWidget->setCurrentPage(2); |
919 | } | 949 | } |
950 | |||
951 | void OpieFtp::readConfig() { | ||
952 | |||
953 | Config cfg("opieftp"); | ||
954 | cfg.setGroup("Server"); | ||
955 | QString username, remoteServer, remotePathStr, password, port, temp; | ||
956 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | ||
957 | for (int i = 0; i <= numberOfEntries; i++) { | ||
958 | temp.setNum(i+1); | ||
959 | cfg.setGroup("Server"); | ||
960 | remoteServer = cfg.readEntry( temp,""); | ||
961 | ServerComboBox->insertItem( remoteServer ); | ||
962 | cfg.setGroup(temp); | ||
963 | |||
964 | remotePathStr = cfg.readEntry(remoteServer,""); | ||
965 | int divider = remoteServer.length() - remoteServer.find(":",0,TRUE); | ||
966 | port = remoteServer.right( divider+1); | ||
967 | bool ok; | ||
968 | PortSpinBox->setValue( port.toInt(&ok,10)); | ||
969 | |||
970 | remoteServer = remoteServer.left(divider - 1); | ||
971 | remotePath->setText( remotePathStr); | ||
972 | username = cfg.readEntry(temp); | ||
973 | UsernameComboBox->insertItem(username); | ||
974 | password = cfg.readEntryCrypt(username,""); | ||
975 | PasswordEdit->setText(password); | ||
976 | |||
977 | } | ||
978 | |||
979 | } | ||
980 | |||
981 | void OpieFtp::writeConfig() { | ||
982 | |||
983 | Config cfg("opieftp"); | ||
984 | cfg.setGroup("Server"); | ||
985 | QString temp; | ||
986 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | ||
987 | temp.setNum(numberOfEntries+1); | ||
988 | cfg.setGroup("Server"); | ||
989 | cfg.writeEntry( temp, ServerComboBox->currentText() +":"+PortSpinBox->cleanText() ); | ||
990 | cfg.setGroup(temp); | ||
991 | cfg.writeEntry("RemotePath", remotePath->text()); | ||
992 | cfg.writeEntry("Username", UsernameComboBox->currentText()); | ||
993 | cfg.writeEntryCrypt( UsernameComboBox->currentText(), PasswordEdit->text()); | ||
994 | cfg.setGroup("Server"); | ||
995 | cfg.writeEntry("numberOfEntries", QString::number(numberOfEntries + 1 )); | ||
996 | |||
997 | } | ||
998 | |||
999 | void OpieFtp::fillCombos() { | ||
1000 | Config cfg("opieftp"); | ||
1001 | cfg.setGroup("Server"); | ||
1002 | QString username, remoteServerStr, remotePathStr, password, port, temp; | ||
1003 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | ||
1004 | for (int i = 1; i <= numberOfEntries; i++) { | ||
1005 | temp.setNum(i); | ||
1006 | cfg.setGroup("Server"); | ||
1007 | remoteServerStr = cfg.readEntry( temp,""); | ||
1008 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); | ||
1009 | port = remoteServerStr.right( divider - 1); | ||
1010 | bool ok; | ||
1011 | PortSpinBox->setValue( port.toInt(&ok,10)); | ||
1012 | |||
1013 | remoteServerStr = remoteServerStr.left(remoteServerStr.length()-divider); | ||
1014 | ServerComboBox->insertItem( remoteServerStr ); | ||
1015 | // cfg.setGroup(temp); | ||
1016 | |||
1017 | // remotePathStr = cfg.readEntry(remoteServer,""); | ||
1018 | // int divider = remoteServer.length() - remoteServer.find(":",0,TRUE); | ||
1019 | // port = remoteServer.right( divider+1); | ||
1020 | // PortSpinBox->setValue( port); | ||
1021 | |||
1022 | // remoteServer = remoteServer.left(divider - 1); | ||
1023 | // remotePath->setText( remotePathStr); | ||
1024 | |||
1025 | // username = cfg.readEntry(temp); | ||
1026 | // UsernameComboBox->insertItem(username); | ||
1027 | // password = cfg.readEntryCrypt(username,""); | ||
1028 | // PasswordEdit->setText(password); | ||
1029 | |||
1030 | } | ||
1031 | |||
1032 | } | ||
1033 | |||
1034 | |||
1035 | void OpieFtp::serverComboSelected(int index) { | ||
1036 | |||
1037 | QString username, remoteServerStr, remotePathStr, password, port, temp; | ||
1038 | // remoteServerStr = ServerComboBox->text(index); | ||
1039 | Config cfg("opieftp"); | ||
1040 | cfg.setGroup("Server"); | ||
1041 | int numberOfEntries = cfg.readNumEntry("numberOfEntries",0); | ||
1042 | |||
1043 | // for (int i = 0; i <= numberOfEntries; i++) { | ||
1044 | temp.setNum(index+1); | ||
1045 | remoteServerStr = cfg.readEntry( temp,""); | ||
1046 | // if( remoteServerStr.find( ServerComboBox->text(index),0,TRUE) != -1 ) { | ||
1047 | cfg.setGroup(temp); | ||
1048 | qDebug(temp); | ||
1049 | int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE); | ||
1050 | port = remoteServerStr.right( divider - 1); | ||
1051 | bool ok; | ||
1052 | PortSpinBox->setValue( port.toInt(&ok,10)); | ||
1053 | |||
1054 | remotePath->setText(cfg.readEntry("RemotePath", "")); | ||
1055 | username = cfg.readEntry("Username", ""); | ||
1056 | UsernameComboBox->lineEdit()->setText(username); | ||
1057 | PasswordEdit->setText(cfg.readEntryCrypt(username, "")); | ||
1058 | |||
1059 | // } | ||
1060 | |||
1061 | // } | ||
1062 | update(); | ||
1063 | } | ||
1064 | // UsernameComboBox->lineEdit()->setText("root"); | ||
1065 | // PasswordEdit->setText( tr( "" ) ); | ||
1066 | // ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); | ||
1067 | // remotePath->setText( currentRemoteDir = "/home/llornkcor/"); | ||
1068 | // PortSpinBox->setValue( 4242); | ||
1069 | |||
1070 | void OpieFtp::deleteServer() { | ||
1071 | |||
1072 | } | ||
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h index 1e5fffa..c88a15b 100644 --- a/noncore/net/opieftp/opieftp.h +++ b/noncore/net/opieftp/opieftp.h | |||
@@ -64,40 +64,45 @@ protected slots: | |||
64 | void showLocalMenu( QListViewItem *); | 64 | void showLocalMenu( QListViewItem *); |
65 | void showRemoteMenu( QListViewItem *); | 65 | void showRemoteMenu( QListViewItem *); |
66 | void doLocalCd(); | 66 | void doLocalCd(); |
67 | void doRemoteCd(); | 67 | void doRemoteCd(); |
68 | void localUpload(); | 68 | void localUpload(); |
69 | void remoteDownload(); | 69 | void remoteDownload(); |
70 | void newConnection(); | 70 | void newConnection(); |
71 | void connector(); | 71 | void connector(); |
72 | void disConnector(); | 72 | void disConnector(); |
73 | void populateLocalView(); | 73 | void populateLocalView(); |
74 | bool populateRemoteView(); | 74 | bool populateRemoteView(); |
75 | void showHidden(); | 75 | void showHidden(); |
76 | 76 | void writeConfig(); | |
77 | void readConfig(); | ||
77 | void localListClicked(QListViewItem *); | 78 | void localListClicked(QListViewItem *); |
78 | void remoteListClicked(QListViewItem *); | 79 | void remoteListClicked(QListViewItem *); |
79 | void ListPressed( int, QListViewItem *, const QPoint&, int); | 80 | void ListPressed( int, QListViewItem *, const QPoint&, int); |
80 | void RemoteListPressed( int, QListViewItem *, const QPoint&, int); | 81 | void RemoteListPressed( int, QListViewItem *, const QPoint&, int); |
81 | void localMakDir(); | 82 | void localMakDir(); |
82 | void localDelete(); | 83 | void localDelete(); |
83 | void remoteMakDir(); | 84 | void remoteMakDir(); |
84 | void remoteDelete(); | 85 | void remoteDelete(); |
85 | bool remoteDirList(const QString &); | 86 | bool remoteDirList(const QString &); |
86 | bool remoteChDir(const QString &); | 87 | bool remoteChDir(const QString &); |
87 | void tabChanged(QWidget*); | 88 | void tabChanged(QWidget*); |
88 | void cleanUp(); | 89 | void cleanUp(); |
89 | void remoteRename(); | 90 | void remoteRename(); |
90 | void localRename(); | 91 | void localRename(); |
91 | void currentPathEditChanged(); | 92 | void currentPathEditChanged(); |
92 | void switchToLocalTab(); | 93 | void switchToLocalTab(); |
93 | void switchToRemoteTab(); | 94 | void switchToRemoteTab(); |
94 | void switchToConfigTab(); | 95 | void switchToConfigTab(); |
96 | void fillCombos(); | ||
97 | void serverComboSelected(int); | ||
98 | void deleteServer(); | ||
99 | |||
95 | protected: | 100 | protected: |
96 | void nullifyCallBack(); | 101 | void nullifyCallBack(); |
97 | QGridLayout* tabLayout; | 102 | QGridLayout* tabLayout; |
98 | QGridLayout* tabLayout_2; | 103 | QGridLayout* tabLayout_2; |
99 | QGridLayout* tabLayout_3; | 104 | QGridLayout* tabLayout_3; |
100 | 105 | ||
101 | }; | 106 | }; |
102 | 107 | ||
103 | #endif // OPIEFTP_H | 108 | #endif // OPIEFTP_H |