summaryrefslogtreecommitdiff
path: root/noncore/net/opieftp/opieftp.cpp
authorllornkcor <llornkcor>2002-03-27 05:25:47 (UTC)
committer llornkcor <llornkcor>2002-03-27 05:25:47 (UTC)
commit531e1365f5ae7ffcbfc9c9ebe92274282358025e (patch) (side-by-side diff)
treedc597d8bc5a5a2ada4acbe695f2e48604e9b85f2 /noncore/net/opieftp/opieftp.cpp
parent7d6828df281631bce0aaa2aaa229b69b9329e03c (diff)
downloadopie-531e1365f5ae7ffcbfc9c9ebe92274282358025e.zip
opie-531e1365f5ae7ffcbfc9c9ebe92274282358025e.tar.gz
opie-531e1365f5ae7ffcbfc9c9ebe92274282358025e.tar.bz2
added some icon handling code, and added combo (?), fixed some goofy thing.
Diffstat (limited to 'noncore/net/opieftp/opieftp.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp204
1 files changed, 108 insertions, 96 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 37e2134..fd6b028 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -23,2 +23,3 @@
#include <qpe/config.h>
+#include <qpe/mimetype.h>
@@ -204,2 +205,3 @@ OpieFtp::OpieFtp( )
+
remotePath = new QLineEdit( "/", tab_3, "remotePath" );
@@ -227,3 +229,2 @@ OpieFtp::OpieFtp( )
-
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
@@ -242,3 +243,3 @@ OpieFtp::OpieFtp( )
layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 3 );
-
+ currentPathCombo->setEditable(TRUE);
currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
@@ -246,3 +247,3 @@ OpieFtp::OpieFtp( )
connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
- this, SLOT( currentPathComboChanged()currentPathCombo( const QString & ) ) );
+ this, SLOT( currentPathComboActivated( const QString & ) ) );
@@ -267,2 +268,3 @@ OpieFtp::OpieFtp( )
#endif
+
filterStr="*";
@@ -328,3 +330,3 @@ void OpieFtp::serverComboEdited(const QString & edit) {
currentServerConfig = -1;
- qDebug("comboedited");
+// qDebug("comboedited");
}
@@ -552,10 +554,11 @@ void OpieFtp::populateLocalView()
}
- if(fileL !="./") {
- item= new QListViewItem( ListView,fileL,fileS , fileDate);
+ if(fileL !="./" && fi->exists()) {
+ item= new QListViewItem( Local_View,fileL,fileS , fileDate);
QPixmap pm;
- pm= Resource::loadPixmap( "folder" );
if(isDir || fileL.find("/",0,TRUE) != -1) {
- if( !QDir( fi->filePath() ).isReadable())
+ if( !QDir( fi->filePath() ).isReadable())
pm = Resource::loadPixmap( "lockedfolder" );
+ else
+ pm= Resource::loadPixmap( "folder" );
item->setPixmap( 0,pm );
@@ -564,5 +567,9 @@ void OpieFtp::populateLocalView()
pm = Resource::loadPixmap( "locked" );
- else
- pm = Resource::loadPixmap( "fileopen" );
- item->setPixmap( 0,pm);
+ else {
+ MimeType mt(fi->filePath());
+ pm=mt.pixmap();
+ if(pm.isNull())
+ pm = Resource::loadPixmap( "UnknownDocument-14" );
+ item->setPixmap( 0,pm);
+ }
}
@@ -570,2 +577,3 @@ void OpieFtp::populateLocalView()
// overlay link image
+ pm= Resource::loadPixmap( "folder" );
QPixmap lnk = Resource::loadPixmap( "symlink" );
@@ -642,53 +650,55 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
{
- QCopEnvelope ( "QPE/System", "busy()" );
- QString oldRemoteCurrentDir = currentRemoteDir;
- QString strItem=selectedItem->text(0);
- strItem=strItem.simplifyWhiteSpace();
- if(strItem == "../") { // the user wants to go ^
- if( FtpCDUp( conn) == 0) {
- QString msg;
- msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
- msg.replace(QRegExp(":"),"\n");
- QMessageBox::message(tr("Note"),msg);
- qDebug(msg);
- }
- char path[256];
- if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
- QString msg;
- msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn));
- msg.replace(QRegExp(":"),"\n");
- QMessageBox::message(tr("Note"),msg);
- qDebug(msg);
- }
- currentRemoteDir=path;
- } else {
- if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers
- strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 );
- strItem = strItem.stripWhiteSpace();
- currentRemoteDir = strItem;
- if( !remoteChDir( (const QString &)strItem)) {
- currentRemoteDir = oldRemoteCurrentDir;
- strItem="";
- qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
+ if(item) {
+ QCopEnvelope ( "QPE/System", "busy()" );
+ QString oldRemoteCurrentDir = currentRemoteDir;
+ QString strItem=selectedItem->text(0);
+ strItem=strItem.simplifyWhiteSpace();
+ if(strItem == "../") { // the user wants to go ^
+ if( FtpCDUp( conn) == 0) {
+ QString msg;
+ msg.sprintf(tr("Unable to cd up\n")+"%s",FtpLastResponse(conn));
+ msg.replace(QRegExp(":"),"\n");
+ QMessageBox::message(tr("Note"),msg);
+ qDebug(msg);
}
- } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory
- qDebug("trying directory");
- if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) {
- currentRemoteDir = oldRemoteCurrentDir;
- strItem="";
- qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
+ char path[256];
+ if( FtpPwd( path,sizeof(path),conn) == 0) { //this is easier than fudging the string
+ QString msg;
+ msg.sprintf(tr("Unable to get working dir\n")+"%s",FtpLastResponse(conn));
+ msg.replace(QRegExp(":"),"\n");
+ QMessageBox::message(tr("Note"),msg);
+ qDebug(msg);
+ }
+ currentRemoteDir=path;
+ } else {
+ if(strItem.find("->",0,TRUE) != -1) { //symlink on some servers
+ strItem=strItem.right( strItem.length() - strItem.find("->",0,TRUE) - 2 );
+ strItem = strItem.stripWhiteSpace();
+ currentRemoteDir = strItem;
+ if( !remoteChDir( (const QString &)strItem)) {
+ currentRemoteDir = oldRemoteCurrentDir;
+ strItem="";
+ qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
+ }
+ } else if(strItem.find("/",0,TRUE) != -1) { // this is a directory
+ qDebug("trying directory");
+ if( !remoteChDir( (const QString &)currentRemoteDir + strItem)) {
+ currentRemoteDir = oldRemoteCurrentDir;
+ strItem="";
+ qDebug("RemoteCurrentDir1 "+oldRemoteCurrentDir);
+ } else {
+ currentRemoteDir = currentRemoteDir+strItem;
+ }
} else {
- currentRemoteDir = currentRemoteDir+strItem;
+ qDebug("download "+strItem);
}
- } else {
- qDebug("download "+strItem);
}
+ remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
+ if(currentRemoteDir.right(1) !="/")
+ currentRemoteDir +="/";
+ currentPathCombo->lineEdit()->setText( currentRemoteDir );
+ fillRemoteCombo( (const QString &)currentDir);
+ QCopEnvelope ( "QPE/System", "notBusy()" );
}
- remoteDirList( (const QString &)currentRemoteDir); //this also calls populate
- if(currentRemoteDir.right(1) !="/")
- currentRemoteDir +="/";
- currentPathCombo->lineEdit()->setText( currentRemoteDir );
- fillRemoteCombo( (const QString &)currentDir);
- QCopEnvelope ( "QPE/System", "notBusy()" );
}
@@ -697,33 +707,35 @@ void OpieFtp::localListClicked(QListViewItem *selectedItem)
{
- QString strItem=selectedItem->text(0);
- QString strSize=selectedItem->text(1);
- strSize=strSize.stripWhiteSpace();
- if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
- // is symlink
- QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
- if(QDir(strItem2).exists() ) {
- currentDir.cd(strItem2, TRUE);
- populateLocalView();
- }
- } else { // not a symlink
- if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
- if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
- strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
- currentDir.cd(strItem,FALSE);
- populateLocalView();
- } else {
- currentDir.cdUp();
+ if(item) {
+ QString strItem=selectedItem->text(0);
+ QString strSize=selectedItem->text(1);
+ strSize=strSize.stripWhiteSpace();
+ if(strItem.find("@",0,TRUE) !=-1 || strItem.find("->",0,TRUE) !=-1 ) { //if symlink
+ // is symlink
+ QString strItem2 = strItem.right( (strItem.length() - strItem.find("->",0,TRUE)) - 4);
+ if(QDir(strItem2).exists() ) {
+ currentDir.cd(strItem2, TRUE);
populateLocalView();
}
- if(QDir(strItem).exists()){
- currentDir.cd(strItem, TRUE);
- populateLocalView();
- }
- } else {
- strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
- if( QFile::exists(strItem ) ) {
- qDebug("upload "+strItem);
- }
- } //end not symlink
- chdir(strItem.latin1());
+ } else { // not a symlink
+ if(strItem.find(". .",0,TRUE) && strItem.find("/",0,TRUE)!=-1 ) {
+ if(QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem)).exists() ) {
+ strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
+ currentDir.cd(strItem,FALSE);
+ populateLocalView();
+ } else {
+ currentDir.cdUp();
+ populateLocalView();
+ }
+ if(QDir(strItem).exists()){
+ currentDir.cd(strItem, TRUE);
+ populateLocalView();
+ }
+ } else {
+ strItem=QDir::cleanDirPath(currentDir.canonicalPath()+"/"+strItem);
+ if( QFile::exists(strItem ) ) {
+ qDebug("upload "+strItem);
+ }
+ } //end not symlink
+ chdir(strItem.latin1());
+ }
}
@@ -966,3 +978,3 @@ void OpieFtp::currentPathComboActivated(const QString & currentPath) {
currentDir.cd( currentPath, TRUE);
- populateLocalList();
+ populateLocalView();
update();
@@ -979,13 +991,13 @@ void OpieFtp::fillCombo(const QString &currentPath) {
- currentPathComboBox->lineEdit()->setText(currentPath);
+ currentPathCombo->lineEdit()->setText(currentPath);
if( localDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
- currentPathComboBox->clear();
+ currentPathCombo->clear();
localDirPathStringList.prepend(currentPath );
- currentPathComboBox->insertStringList( localDirPathStringList,-1);
+ currentPathCombo->insertStringList( localDirPathStringList,-1);
}
- currentPathComboBox->lineEdit()->setText(currentPath);
+ currentPathCombo->lineEdit()->setText(currentPath);
if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
- currentPathComboBox->clear();
+ currentPathCombo->clear();
remoteDirPathStringList.prepend(currentPath );
- currentPathComboBox->insertStringList( remoteDirPathStringList,-1);
+ currentPathCombo->insertStringList( remoteDirPathStringList,-1);
}
@@ -995,7 +1007,7 @@ void OpieFtp::fillRemoteCombo(const QString &currentPath) {
- dirPathCombo->lineEdit()->setText(currentPath);
+ currentPathCombo->lineEdit()->setText(currentPath);
if( remoteDirPathStringList.grep(currentPath,TRUE).isEmpty() ) {
- dirPathCombo->clear();
+ currentPathCombo->clear();
remoteDirPathStringList.prepend(currentPath );
- dirPathCombo->insertStringList( remoteDirPathStringList,-1);
+ currentPathCombo->insertStringList( remoteDirPathStringList,-1);
}
@@ -1129,3 +1141,3 @@ void OpieFtp::serverComboSelected(int index)
cfg.setGroup(temp);
- qDebug(temp);
+// qDebug(temp);
int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);