summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-03-17 04:00:20 (UTC)
committer llornkcor <llornkcor>2002-03-17 04:00:20 (UTC)
commit578725ca25862c0b06b1991a7bc8ffc2ad8ae13e (patch) (side-by-side diff)
tree2217cff7ce86563ea688fc8138835230ea95c5c0
parent624a283591094628425c94fedfdd62941ad7c853 (diff)
downloadopie-578725ca25862c0b06b1991a7bc8ffc2ad8ae13e.zip
opie-578725ca25862c0b06b1991a7bc8ffc2ad8ae13e.tar.gz
opie-578725ca25862c0b06b1991a7bc8ffc2ad8ae13e.tar.bz2
added icons, and fixed remote dir list sorting
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opieftp/opieftp.cpp51
1 files changed, 45 insertions, 6 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index 118275b..a3b29a1 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -46,4 +46,5 @@
#include <stdlib.h>
+
QProgressBar *ProgressBar;
static netbuf *conn=NULL;
@@ -95,4 +96,5 @@ OpieFtp::OpieFtp( )
localMenu->insertSeparator();
localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
+ localMenu->setCheckable(TRUE);
remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() ));
@@ -202,6 +204,6 @@ OpieFtp::OpieFtp( )
remotePath = new QLineEdit( "/", tab_3, "remotePath" );
remotePath->setText( currentRemoteDir = "/");
- tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 );
// remotePath->setText( currentRemoteDir = "/home/llornkcor/");
+ tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 );
TextLabel4 = new QLabel( tab_3, "TextLabel4" );
@@ -237,4 +239,5 @@ OpieFtp::OpieFtp( )
filterStr="*";
+ b=FALSE;
populateLocalView();
}
@@ -330,5 +333,8 @@ void OpieFtp::remoteDownload()
qApp->processEvents();
QString strItem = Remote_View->currentItem()->text(0);
- QString localFile = currentDir.canonicalPath()+"/"+strItem;
+// strItem=strItem.right(strItem.length()-1);
+
+ QString localFile = currentDir.canonicalPath()+strItem;
+// QString localFile = currentDir.canonicalPath()+"/"+strItem;
QString remoteFile= currentRemoteDir+strItem;
if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn))
@@ -457,4 +463,5 @@ void OpieFtp::populateLocalView()
currentDir.setNameFilter(filterStr);
QString fileL, fileS, fileDate;
+ bool isDir=FALSE;
const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/);
QFileInfoListIterator it(*list);
@@ -475,8 +482,16 @@ void OpieFtp::populateLocalView()
if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) {
fileL+="/";
+ isDir=TRUE;
// qDebug( fileL);
}
}
+ if(fileL !="./") {
item= new QListViewItem( Local_View,fileL,fileS, fileDate);
+ if(isDir)
+ item->setPixmap( 0, Resource::loadPixmap( "folder" ));
+ else
+ item->setPixmap( 0, Resource::loadPixmap( "fileopen" ));
+ }
+ isDir=FALSE;
++it;
}
@@ -496,6 +511,6 @@ bool OpieFtp::populateRemoteView( )
Remote_View->clear();
QString s, File_Name;
+ QListViewItem *itemDir=NULL, *itemFile=NULL;
QString fileL, fileS, fileDate;
- new QListViewItem( Remote_View, "../");
if ( file.open(IO_ReadOnly)) {
QTextStream t( &file ); // use a text stream
@@ -506,11 +521,26 @@ bool OpieFtp::populateRemoteView( )
if(s.left(1) == "d")
fileL = fileL+"/";
+// 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)
- new QListViewItem( Remote_View, fileL, fileS, fileDate);
+ if(fileL.find("total",0,TRUE) == -1) {
+ QListViewItem * item = new QListViewItem( Remote_View, fileL, fileS, fileDate);
+ if(s.left(1) == "d") {
+ item->setPixmap( 0, Resource::loadPixmap( "folder" ));
+ if(itemDir)
+ item->moveItem(itemDir);
+ itemDir=item;
+ } else {
+ item->setPixmap( 0, Resource::loadPixmap( "fileopen" ));
+ if(itemFile)
+ item->moveItem(itemFile);
+ itemFile=item;
+ }
}
+ }
+ QListViewItem * item1 = new QListViewItem( Remote_View, "../");
+ item1->setPixmap( 0, Resource::loadPixmap( "folder" ));
file.close();
if( file.exists())
@@ -518,4 +548,5 @@ bool OpieFtp::populateRemoteView( )
} else
qDebug("temp file not opened successfullly "+sfile);
+ Remote_View->setSorting( 4,TRUE);
return true;
@@ -627,4 +658,5 @@ void OpieFtp::showHidden()
if (!b) {
currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All);
+ localMenu->setItemChecked(localMenu->idAt(0),TRUE);
// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
b=TRUE;
@@ -632,4 +664,5 @@ void OpieFtp::showHidden()
} else {
currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All);
+ localMenu->setItemChecked(localMenu->idAt(0),FALSE);
// currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst);
b=FALSE;
@@ -687,4 +720,10 @@ void OpieFtp::showLocalMenu(QListViewItem * item)
m.insertSeparator();
m.insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
+ m.setCheckable(TRUE);
+ if (b)
+ m.setItemChecked(m.idAt(0),TRUE);
+ else
+ m.setItemChecked(m.idAt(0),FALSE);
+
m.exec( QCursor::pos() );
}
@@ -838,5 +877,5 @@ void OpieFtp::currentPathEditChanged()
{
QString oldRemoteCurrentDir = currentRemoteDir;
- qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir);
+// qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir);
if (TabWidget->currentPageIndex() == 0) {
if(QDir( currentPathEdit->text()).exists()) {