summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-03-24 17:03:37 (UTC)
committer llornkcor <llornkcor>2002-03-24 17:03:37 (UTC)
commit6ce8bbff9eb16e0d731755010bda63e7fb43f70b (patch) (side-by-side diff)
tree0f3cf5476398743f86fa6d884d86751a7251df3e
parent368d5032f4ff4566dea1e99aa2bb782300e0bfd5 (diff)
downloadopie-6ce8bbff9eb16e0d731755010bda63e7fb43f70b.zip
opie-6ce8bbff9eb16e0d731755010bda63e7fb43f70b.tar.gz
opie-6ce8bbff9eb16e0d731755010bda63e7fb43f70b.tar.bz2
config last server on startup
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp46
1 files changed, 17 insertions, 29 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index e2a6cad..e97a9bf 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -150,8 +150,10 @@ OpieFtp::OpieFtp( )
Remote_View->addColumn( tr("Size"),-1);
Remote_View->setColumnAlignment(1,QListView::AlignRight);
Remote_View->addColumn( tr("Date"),-1);
Remote_View->setColumnAlignment(2,QListView::AlignRight);
+ Remote_View->addColumn( tr("Dir"),-1);
+ Remote_View->setColumnAlignment(4,QListView::AlignRight);
Remote_View->setAllColumnsShowFocus(TRUE);
QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
connect( Remote_View, SIGNAL( clicked( QListViewItem*)),
@@ -242,10 +244,9 @@ OpieFtp::OpieFtp( )
ProgressBar = new QProgressBar( this, "ProgressBar" );
layout->addMultiCellWidget( ProgressBar, 4, 4, 0, 3 );
- serverComboSelected(0);
- fillCombos();
+// fillCombos();
#ifdef DEVELOPERS_VERSION
ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) );
UsernameComboBox->lineEdit()->setText("root");
@@ -259,8 +260,10 @@ OpieFtp::OpieFtp( )
#endif
filterStr="*";
b=FALSE;
populateLocalView();
+ readConfig();
+ ServerComboBox->setCurrentItem(currentServerConfig);
TabWidget->setCurrentPage(2);
}
OpieFtp::~OpieFtp()
@@ -580,17 +583,19 @@ bool OpieFtp::populateRemoteView( )
fileS = fileS.stripWhiteSpace();
fileDate = s.mid( 42, 55-42);
fileDate = fileDate.stripWhiteSpace();
if(fileL.find("total",0,TRUE) == -1) {
- QListViewItem * item = new QListViewItem( Remote_View, fileL, fileS, fileDate);
if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) {
+ QListViewItem * item = new QListViewItem( Remote_View, fileL, fileS, fileDate,"d");
item->setPixmap( 0, Resource::loadPixmap( "folder" ));
- if(itemDir)
+// if(itemDir)
item->moveItem(itemDir);
itemDir=item;
} else {
+ QListViewItem * item = new QListViewItem( Remote_View, fileL, fileS, fileDate,"f");
item->setPixmap( 0, Resource::loadPixmap( "fileopen" ));
- if(itemFile)
+// if(itemFile)
+ item->moveItem(itemDir);
item->moveItem(itemFile);
itemFile=item;
}
}
@@ -602,9 +607,8 @@ bool OpieFtp::populateRemoteView( )
file. remove();
} else
qDebug("temp file not opened successfullly "+sfile);
Remote_View->setSorting( 4,TRUE);
-
return true;
}
void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
@@ -971,33 +975,13 @@ void OpieFtp::switchToConfigTab()
}
void OpieFtp::readConfig()
{
-
+ fillCombos();
Config cfg("opieftp");
cfg.setGroup("Server");
- QString username, remoteServer, remotePathStr, password, port, temp;
- int numberOfEntries = cfg.readNumEntry("numberOfEntries",0);
- for (int i = 0; i <= numberOfEntries; i++) {
- temp.setNum(i+1);
- cfg.setGroup("Server");
- remoteServer = cfg.readEntry( temp,"");
- ServerComboBox->insertItem( remoteServer );
- cfg.setGroup(temp);
-
- remotePathStr = cfg.readEntry(remoteServer,"");
- int divider = remoteServer.length() - remoteServer.find(":",0,TRUE);
- port = remoteServer.right( divider+1);
- bool ok;
- PortSpinBox->setValue( port.toInt(&ok,10));
-
- remoteServer = remoteServer.left(divider - 1);
- remotePath->setText( remotePathStr);
- username = cfg.readEntry(temp);
- UsernameComboBox->insertItem(username);
- password = cfg.readEntryCrypt(username,"");
- PasswordEdit->setText(password);
- }
+ currentServerConfig = cfg.readNumEntry("currentServer", -1);
+ serverComboSelected( currentServerConfig);
}
void OpieFtp::writeConfig()
{
@@ -1087,8 +1071,12 @@ void OpieFtp::serverComboSelected(int index)
username = cfg.readEntry("Username", "anonymous");
UsernameComboBox->lineEdit()->setText(username);
PasswordEdit->setText(cfg.readEntryCrypt(username, "me@opieftp.org"));
+
+ cfg.setGroup("Server");
+ temp.sprintf("%d",currentServerConfig);
+ cfg.writeEntry("currentServer", temp);
update();
}
// UsernameComboBox->lineEdit()->setText("root");
// PasswordEdit->setText( tr( "" ) );