author | llornkcor <llornkcor> | 2002-03-24 17:03:37 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-03-24 17:03:37 (UTC) |
commit | 6ce8bbff9eb16e0d731755010bda63e7fb43f70b (patch) (side-by-side diff) | |
tree | 0f3cf5476398743f86fa6d884d86751a7251df3e | |
parent | 368d5032f4ff4566dea1e99aa2bb782300e0bfd5 (diff) | |
download | opie-6ce8bbff9eb16e0d731755010bda63e7fb43f70b.zip opie-6ce8bbff9eb16e0d731755010bda63e7fb43f70b.tar.gz opie-6ce8bbff9eb16e0d731755010bda63e7fb43f70b.tar.bz2 |
config last server on startup
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 46 |
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 @@ -148,12 +148,14 @@ OpieFtp::OpieFtp( ) Remote_View = new QListView( tab_2, "Remote_View" ); Remote_View->addColumn( tr("File"),120); 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*)), this,SLOT( remoteListClicked(QListViewItem *)) ); connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), @@ -240,14 +242,13 @@ OpieFtp::OpieFtp( ) currentPathEdit->setText( currentDir.canonicalPath()); connect( currentPathEdit,SIGNAL(returnPressed()),this,SLOT(currentPathEditChanged())); 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"); PortSpinBox->setValue( 4242); remotePath->setText( currentRemoteDir = "/"); @@ -257,12 +258,14 @@ OpieFtp::OpieFtp( ) // remotePath->setText( currentRemoteDir = "/home/llornkcor"); PasswordEdit->setText( tr( "" ) ); #endif filterStr="*"; b=FALSE; populateLocalView(); + readConfig(); + ServerComboBox->setCurrentItem(currentServerConfig); TabWidget->setCurrentPage(2); } OpieFtp::~OpieFtp() { } @@ -578,21 +581,23 @@ bool OpieFtp::populateRemoteView( ) // fileL = "/"+fileL+"/"; fileS = s.mid( 30, 42-30); 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; } } } QListViewItem * item1 = new QListViewItem( Remote_View, "../"); @@ -600,13 +605,12 @@ bool OpieFtp::populateRemoteView( ) file.close(); if( file.exists()) file. remove(); } else qDebug("temp file not opened successfullly "+sfile); Remote_View->setSorting( 4,TRUE); - return true; } void OpieFtp::remoteListClicked(QListViewItem *selectedItem) { QCopEnvelope ( "QPE/System", "busy()" ); @@ -969,37 +973,17 @@ void OpieFtp::switchToConfigTab() { TabWidget->setCurrentPage(2); } 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() { Config cfg("opieftp"); @@ -1085,12 +1069,16 @@ void OpieFtp::serverComboSelected(int index) remotePath->setText(cfg.readEntry("RemotePath", "/")); 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( "" ) ); // ServerComboBox->lineEdit()->setText( tr( "192.168.129.201" ) ); // remotePath->setText( currentRemoteDir = "/home/llornkcor/"); |