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) (show whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp52
1 files changed, 32 insertions, 20 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
@@ -21,6 +21,7 @@
#include <qpe/resource.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/config.h>
+#include <qpe/mimetype.h>
#include <qstringlist.h>
#include <qtextstream.h>
@@ -202,6 +203,7 @@ OpieFtp::OpieFtp( )
TextLabel5->setText( tr( "Remote path" ) );
tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 );
+
remotePath = new QLineEdit( "/", tab_3, "remotePath" );
tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 );
@@ -225,7 +227,6 @@ OpieFtp::OpieFtp( )
connectServerBtn->setToggleButton(TRUE);
connect(connectServerBtn,SIGNAL( toggled( bool)),SLOT( connectorBtnToggled(bool) ));
-
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
tabLayout_3->addItem( spacer, 5, 0 );
@@ -240,11 +241,11 @@ OpieFtp::OpieFtp( )
currentPathCombo = new QComboBox( FALSE, this, "currentPathCombo" );
layout->addMultiCellWidget( currentPathCombo, 3, 3, 0, 3 );
-
+ currentPathCombo->setEditable(TRUE);
currentPathCombo->lineEdit()->setText( currentDir.canonicalPath());
connect( currentPathCombo, SIGNAL( activated( const QString & ) ),
- this, SLOT( currentPathComboChanged()currentPathCombo( const QString & ) ) );
+ this, SLOT( currentPathComboActivated( const QString & ) ) );
connect( currentPathCombo->lineEdit(),SIGNAL(returnPressed()),
this,SLOT(currentPathComboChanged()));
@@ -265,6 +266,7 @@ OpieFtp::OpieFtp( )
// remotePath->setText( currentRemoteDir = "/home/llornkcor");
PasswordEdit->setText( tr( "" ) );
#endif
+
filterStr="*";
b=FALSE;
populateLocalView();
@@ -326,7 +328,7 @@ void OpieFtp::newConnection()
void OpieFtp::serverComboEdited(const QString & edit) {
if( !edit.isEmpty() ) {
currentServerConfig = -1;
- qDebug("comboedited");
+// qDebug("comboedited");
}
}
@@ -550,24 +552,30 @@ void OpieFtp::populateLocalView()
// qDebug( fileL);
}
}
- 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())
pm = Resource::loadPixmap( "lockedfolder" );
+ else
+ pm= Resource::loadPixmap( "folder" );
item->setPixmap( 0,pm );
} else {
if( !fi->isReadable() )
pm = Resource::loadPixmap( "locked" );
- else
- pm = Resource::loadPixmap( "fileopen" );
+ else {
+ MimeType mt(fi->filePath());
+ pm=mt.pixmap();
+ if(pm.isNull())
+ pm = Resource::loadPixmap( "UnknownDocument-14" );
item->setPixmap( 0,pm);
}
+ }
if( fileL.find("->",0,TRUE) != -1) {
// overlay link image
+ pm= Resource::loadPixmap( "folder" );
QPixmap lnk = Resource::loadPixmap( "symlink" );
QPainter painter( &pm );
painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
@@ -640,6 +648,7 @@ bool OpieFtp::populateRemoteView( )
void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
{
+ if(item) {
QCopEnvelope ( "QPE/System", "busy()" );
QString oldRemoteCurrentDir = currentRemoteDir;
QString strItem=selectedItem->text(0);
@@ -692,9 +701,11 @@ void OpieFtp::remoteListClicked(QListViewItem *selectedItem)
fillRemoteCombo( (const QString &)currentDir);
QCopEnvelope ( "QPE/System", "notBusy()" );
}
+}
void OpieFtp::localListClicked(QListViewItem *selectedItem)
{
+ if(item) {
QString strItem=selectedItem->text(0);
QString strSize=selectedItem->text(1);
strSize=strSize.stripWhiteSpace();
@@ -728,6 +739,7 @@ void OpieFtp::localListClicked(QListViewItem *selectedItem)
chdir(strItem.latin1());
}
}
+}
void OpieFtp::doLocalCd()
{
@@ -964,7 +976,7 @@ void OpieFtp::currentPathComboActivated(const QString & currentPath) {
if (TabWidget->currentPageIndex() == 0) {
chdir( currentPath.latin1() );
currentDir.cd( currentPath, TRUE);
- populateLocalList();
+ populateLocalView();
update();
} else {
// chdir( currentPath.latin1() );
@@ -977,27 +989,27 @@ void OpieFtp::currentPathComboActivated(const QString & currentPath) {
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);
}
}
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);
}
}
@@ -1127,7 +1139,7 @@ void OpieFtp::serverComboSelected(int index)
temp.setNum(index+1);
remoteServerStr = cfg.readEntry( temp,"");
cfg.setGroup(temp);
- qDebug(temp);
+// qDebug(temp);
int divider = remoteServerStr.length() - remoteServerStr.find(":",0,TRUE);
port = remoteServerStr.right( divider - 1);
bool ok;