author | llornkcor <llornkcor> | 2002-03-17 04:00:20 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-03-17 04:00:20 (UTC) |
commit | 578725ca25862c0b06b1991a7bc8ffc2ad8ae13e (patch) (unidiff) | |
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 @@ | |||
46 | #include <stdlib.h> | 46 | #include <stdlib.h> |
47 | 47 | ||
48 | |||
48 | QProgressBar *ProgressBar; | 49 | QProgressBar *ProgressBar; |
49 | static netbuf *conn=NULL; | 50 | static netbuf *conn=NULL; |
@@ -95,5 +96,6 @@ OpieFtp::OpieFtp( ) | |||
95 | localMenu->insertSeparator(); | 96 | localMenu->insertSeparator(); |
96 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 97 | localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
97 | 98 | localMenu->setCheckable(TRUE); | |
99 | |||
98 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); | 100 | remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() )); |
99 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); | 101 | remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() )); |
@@ -202,6 +204,6 @@ OpieFtp::OpieFtp( ) | |||
202 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); | 204 | remotePath = new QLineEdit( "/", tab_3, "remotePath" ); |
203 | remotePath->setText( currentRemoteDir = "/"); | 205 | remotePath->setText( currentRemoteDir = "/"); |
204 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); | ||
205 | // remotePath->setText( currentRemoteDir = "/home/llornkcor/"); | 206 | // remotePath->setText( currentRemoteDir = "/home/llornkcor/"); |
207 | tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 ); | ||
206 | 208 | ||
207 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); | 209 | TextLabel4 = new QLabel( tab_3, "TextLabel4" ); |
@@ -237,4 +239,5 @@ OpieFtp::OpieFtp( ) | |||
237 | 239 | ||
238 | filterStr="*"; | 240 | filterStr="*"; |
241 | b=FALSE; | ||
239 | populateLocalView(); | 242 | populateLocalView(); |
240 | } | 243 | } |
@@ -330,5 +333,8 @@ void OpieFtp::remoteDownload() | |||
330 | qApp->processEvents(); | 333 | qApp->processEvents(); |
331 | QString strItem = Remote_View->currentItem()->text(0); | 334 | QString strItem = Remote_View->currentItem()->text(0); |
332 | QString localFile = currentDir.canonicalPath()+"/"+strItem; | 335 | // strItem=strItem.right(strItem.length()-1); |
336 | |||
337 | QString localFile = currentDir.canonicalPath()+strItem; | ||
338 | // QString localFile = currentDir.canonicalPath()+"/"+strItem; | ||
333 | QString remoteFile= currentRemoteDir+strItem; | 339 | QString remoteFile= currentRemoteDir+strItem; |
334 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) | 340 | if (!FtpSize( remoteFile.latin1(), &fsz, FTPLIB_ASCII, conn)) |
@@ -457,4 +463,5 @@ void OpieFtp::populateLocalView() | |||
457 | currentDir.setNameFilter(filterStr); | 463 | currentDir.setNameFilter(filterStr); |
458 | QString fileL, fileS, fileDate; | 464 | QString fileL, fileS, fileDate; |
465 | bool isDir=FALSE; | ||
459 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); | 466 | const QFileInfoList *list = currentDir.entryInfoList( /*QDir::All*/ /*, QDir::SortByMask*/); |
460 | QFileInfoListIterator it(*list); | 467 | QFileInfoListIterator it(*list); |
@@ -475,8 +482,16 @@ void OpieFtp::populateLocalView() | |||
475 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { | 482 | if( QDir(QDir::cleanDirPath(currentDir.canonicalPath()+"/"+fileL)).exists() ) { |
476 | fileL+="/"; | 483 | fileL+="/"; |
484 | isDir=TRUE; | ||
477 | // qDebug( fileL); | 485 | // qDebug( fileL); |
478 | } | 486 | } |
479 | } | 487 | } |
480 | item= new QListViewItem( Local_View,fileL,fileS, fileDate); | 488 | if(fileL !="./") { |
489 | item = new QListViewItem( Local_View,fileL,fileS, fileDate); | ||
490 | if(isDir) | ||
491 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); | ||
492 | else | ||
493 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); | ||
494 | } | ||
495 | isDir=FALSE; | ||
481 | ++it; | 496 | ++it; |
482 | } | 497 | } |
@@ -496,6 +511,6 @@ bool OpieFtp::populateRemoteView( ) | |||
496 | Remote_View->clear(); | 511 | Remote_View->clear(); |
497 | QString s, File_Name; | 512 | QString s, File_Name; |
513 | QListViewItem *itemDir=NULL, *itemFile=NULL; | ||
498 | QString fileL, fileS, fileDate; | 514 | QString fileL, fileS, fileDate; |
499 | new QListViewItem( Remote_View, "../"); | ||
500 | if ( file.open(IO_ReadOnly)) { | 515 | if ( file.open(IO_ReadOnly)) { |
501 | QTextStream t( &file ); // use a text stream | 516 | QTextStream t( &file ); // use a text stream |
@@ -504,13 +519,28 @@ bool OpieFtp::populateRemoteView( ) | |||
504 | fileL = s.right(s.length()-55); | 519 | fileL = s.right(s.length()-55); |
505 | fileL = fileL.stripWhiteSpace(); | 520 | fileL = fileL.stripWhiteSpace(); |
506 | if(s.left(1) == "d") | 521 | if(s.left(1) == "d") |
507 | fileL = fileL+"/"; | 522 | fileL = fileL+"/"; |
523 | // fileL = "/"+fileL+"/"; | ||
508 | fileS = s.mid( 30, 42-30); | 524 | fileS = s.mid( 30, 42-30); |
509 | fileS = fileS.stripWhiteSpace(); | 525 | fileS = fileS.stripWhiteSpace(); |
510 | fileDate = s.mid( 42, 55-42); | 526 | fileDate = s.mid( 42, 55-42); |
511 | fileDate = fileDate.stripWhiteSpace(); | 527 | fileDate = fileDate.stripWhiteSpace(); |
512 | if(fileL.find("total",0,TRUE) == -1) | 528 | if(fileL.find("total",0,TRUE) == -1) { |
513 | new QListViewItem( Remote_View, fileL, fileS, fileDate); | 529 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileS, fileDate); |
530 | if(s.left(1) == "d") { | ||
531 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); | ||
532 | if(itemDir) | ||
533 | item->moveItem(itemDir); | ||
534 | itemDir=item; | ||
535 | } else { | ||
536 | item->setPixmap( 0, Resource::loadPixmap( "fileopen" )); | ||
537 | if(itemFile) | ||
538 | item->moveItem(itemFile); | ||
539 | itemFile=item; | ||
540 | } | ||
541 | } | ||
514 | } | 542 | } |
543 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); | ||
544 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); | ||
515 | file.close(); | 545 | file.close(); |
516 | if( file.exists()) | 546 | if( file.exists()) |
@@ -518,4 +548,5 @@ bool OpieFtp::populateRemoteView( ) | |||
518 | } else | 548 | } else |
519 | qDebug("temp file not opened successfullly "+sfile); | 549 | qDebug("temp file not opened successfullly "+sfile); |
550 | Remote_View->setSorting( 4,TRUE); | ||
520 | 551 | ||
521 | return true; | 552 | return true; |
@@ -627,4 +658,5 @@ void OpieFtp::showHidden() | |||
627 | if (!b) { | 658 | if (!b) { |
628 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); | 659 | currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All); |
660 | localMenu->setItemChecked(localMenu->idAt(0),TRUE); | ||
629 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 661 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
630 | b=TRUE; | 662 | b=TRUE; |
@@ -632,4 +664,5 @@ void OpieFtp::showHidden() | |||
632 | } else { | 664 | } else { |
633 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); | 665 | currentDir.setFilter( QDir::Files | QDir::Dirs/* | QDir::Hidden*/ | QDir::All); |
666 | localMenu->setItemChecked(localMenu->idAt(0),FALSE); | ||
634 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); | 667 | // currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); |
635 | b=FALSE; | 668 | b=FALSE; |
@@ -687,4 +720,10 @@ void OpieFtp::showLocalMenu(QListViewItem * item) | |||
687 | m.insertSeparator(); | 720 | m.insertSeparator(); |
688 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); | 721 | m.insertItem( tr( "Delete" ), this, SLOT( localDelete() )); |
722 | m.setCheckable(TRUE); | ||
723 | if (b) | ||
724 | m.setItemChecked(m.idAt(0),TRUE); | ||
725 | else | ||
726 | m.setItemChecked(m.idAt(0),FALSE); | ||
727 | |||
689 | m.exec( QCursor::pos() ); | 728 | m.exec( QCursor::pos() ); |
690 | } | 729 | } |
@@ -838,5 +877,5 @@ void OpieFtp::currentPathEditChanged() | |||
838 | { | 877 | { |
839 | QString oldRemoteCurrentDir = currentRemoteDir; | 878 | QString oldRemoteCurrentDir = currentRemoteDir; |
840 | qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); | 879 | // qDebug("oldRemoteCurrentDir "+oldRemoteCurrentDir); |
841 | if (TabWidget->currentPageIndex() == 0) { | 880 | if (TabWidget->currentPageIndex() == 0) { |
842 | if(QDir( currentPathEdit->text()).exists()) { | 881 | if(QDir( currentPathEdit->text()).exists()) { |