author | llornkcor <llornkcor> | 2002-03-17 04:00:20 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-03-17 04:00:20 (UTC) |
commit | 578725ca25862c0b06b1991a7bc8ffc2ad8ae13e (patch) (side-by-side diff) | |
tree | 2217cff7ce86563ea688fc8138835230ea95c5c0 | |
parent | 624a283591094628425c94fedfdd62941ad7c853 (diff) | |
download | opie-578725ca25862c0b06b1991a7bc8ffc2ad8ae13e.zip opie-578725ca25862c0b06b1991a7bc8ffc2ad8ae13e.tar.gz opie-578725ca25862c0b06b1991a7bc8ffc2ad8ae13e.tar.bz2 |
added icons, and fixed remote dir list sorting
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 57 |
1 files changed, 48 insertions, 9 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,5 +96,6 @@ OpieFtp::OpieFtp( ) localMenu->insertSeparator(); localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); - + localMenu->setCheckable(TRUE); + remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); @@ -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); } } - item= new QListViewItem( Local_View,fileL,fileS, fileDate); + 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 @@ -504,13 +519,28 @@ bool OpieFtp::populateRemoteView( ) fileL = s.right(s.length()-55); fileL = fileL.stripWhiteSpace(); - if(s.left(1) == "d") + 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()) { |