-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 @@ -47,2 +47,3 @@ + QProgressBar *ProgressBar; @@ -96,3 +97,4 @@ OpieFtp::OpieFtp( ) localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); - + localMenu->setCheckable(TRUE); + remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); @@ -203,4 +205,4 @@ OpieFtp::OpieFtp( ) remotePath->setText( currentRemoteDir = "/"); - tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); // remotePath->setText( currentRemoteDir = "/home/llornkcor/"); + tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); @@ -238,2 +240,3 @@ OpieFtp::OpieFtp( ) filterStr="*"; + b=FALSE; populateLocalView(); @@ -331,3 +334,6 @@ void OpieFtp::remoteDownload() 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; @@ -458,2 +464,3 @@ void OpieFtp::populateLocalView() QString fileL, fileS, fileDate; + bool isDir=FALSE; const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); @@ -476,2 +483,3 @@ void OpieFtp::populateLocalView() fileL+="/"; + isDir=TRUE; // qDebug( fileL); @@ -479,3 +487,10 @@ void OpieFtp::populateLocalView() } - 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; @@ -497,4 +512,4 @@ bool OpieFtp::populateRemoteView( ) QString s, File_Name; + QListViewItem *itemDir=NULL, *itemFile=NULL; QString fileL, fileS, fileDate; - new QListViewItem( Remote_View, "../"); if ( file.open(IO_ReadOnly)) { @@ -505,4 +520,5 @@ bool OpieFtp::populateRemoteView( ) fileL = fileL.stripWhiteSpace(); - if(s.left(1) == "d") + if(s.left(1) == "d") fileL = fileL+"/"; +// fileL = "/"+fileL+"/"; fileS = s.mid( 30, 42-30); @@ -511,5 +527,19 @@ bool OpieFtp::populateRemoteView( ) 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(); @@ -519,2 +549,3 @@ bool OpieFtp::populateRemoteView( ) qDebug("temp file not opened successfullly "+sfile); + Remote_View->setSorting( 4,TRUE); @@ -628,2 +659,3 @@ void OpieFtp::showHidden() currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); + localMenu->setItemChecked(localMenu->idAt(0),TRUE); // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); @@ -633,2 +665,3 @@ void OpieFtp::showHidden() currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); + localMenu->setItemChecked(localMenu->idAt(0),FALSE); // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); @@ -688,2 +721,8 @@ void OpieFtp::showLocalMenu(QListViewItem * item) 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() ); @@ -839,3 +878,3 @@ void OpieFtp::currentPathEditChanged() QString oldRemoteCurrentDir = currentRemoteDir; - qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); +// qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); if (TabWidget->currentPageIndex() == 0) { |