summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-03-21 13:59:50 (UTC)
committer llornkcor <llornkcor>2002-03-21 13:59:50 (UTC)
commit60c9126183ea72c08ad5cb77b8939812627aae17 (patch) (unidiff)
tree60852886d3352fbca6a52bc5c0fb88e521d08145
parent9030459d54a67bd2e6201e0c1641c1f23d9af0ec (diff)
downloadopie-60c9126183ea72c08ad5cb77b8939812627aae17.zip
opie-60c9126183ea72c08ad5cb77b8939812627aae17.tar.gz
opie-60c9126183ea72c08ad5cb77b8939812627aae17.tar.bz2
added some combo stuff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp175
-rw-r--r--noncore/net/opieftp/opieftp.h7
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
@@ -11,2 +11,3 @@
11 ***************************************************************************/ 11 ***************************************************************************/
12//#define DEVELOPER_VERSION
12 13
@@ -21,4 +22,6 @@
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>
@@ -173,5 +176,3 @@ OpieFtp::OpieFtp( )
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 );
@@ -184,4 +185,3 @@ OpieFtp::OpieFtp( )
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 );
@@ -194,6 +194,6 @@ OpieFtp::OpieFtp( )
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
@@ -205,3 +205,2 @@ OpieFtp::OpieFtp( )
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 );
@@ -215,3 +214,2 @@ OpieFtp::OpieFtp( )
215 PortSpinBox->setMaxValue(32786); 214 PortSpinBox->setMaxValue(32786);
216// PortSpinBox->setValue( 4242);
217 PortSpinBox->setValue( 21); 215 PortSpinBox->setValue( 21);
@@ -219,2 +217,14 @@ OpieFtp::OpieFtp( )
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 );
@@ -239,2 +249,14 @@ OpieFtp::OpieFtp( )
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="*";
@@ -242,2 +264,3 @@ OpieFtp::OpieFtp( )
242 populateLocalView(); 264 populateLocalView();
265 TabWidget->setCurrentPage(2);
243} 266}
@@ -371,3 +394,9 @@ 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}
@@ -410,2 +439,3 @@ void OpieFtp::connector()
410 setCaption(ftp_host); 439 setCaption(ftp_host);
440 writeConfig();
411 QCopEnvelope ( "QPE/System", "notBusy()" ); 441 QCopEnvelope ( "QPE/System", "notBusy()" );
@@ -919 +949,124 @@ void OpieFtp::switchToConfigTab()
919} 949}
950
951void 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
981void 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
999void 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
1035void 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
1070void 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
@@ -75,3 +75,4 @@ protected slots:
75 void showHidden(); 75 void showHidden();
76 76 void writeConfig();
77 void readConfig();
77 void localListClicked(QListViewItem *); 78 void localListClicked(QListViewItem *);
@@ -94,2 +95,6 @@ protected slots:
94 void switchToConfigTab(); 95 void switchToConfigTab();
96 void fillCombos();
97 void serverComboSelected(int);
98 void deleteServer();
99
95protected: 100protected: