author | llornkcor <llornkcor> | 2002-10-18 00:07:20 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-10-18 00:07:20 (UTC) |
commit | e7e36afd3685c7fab146ebd0078d7f1a60f8c5e6 (patch) (unidiff) | |
tree | 4c8e6cec21577de93127658b730d3685d5f62b90 | |
parent | e688f02fa2d750eca01c92435d8793ba17aa050a (diff) | |
download | opie-e7e36afd3685c7fab146ebd0078d7f1a60f8c5e6.zip opie-e7e36afd3685c7fab146ebd0078d7f1a60f8c5e6.tar.gz opie-e7e36afd3685c7fab146ebd0078d7f1a60f8c5e6.tar.bz2 |
patch by Ben Jackson, and changed listview alignment
-rw-r--r-- | noncore/net/opieftp/opieftp.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp index 4e14946..3d97ecb 100644 --- a/noncore/net/opieftp/opieftp.cpp +++ b/noncore/net/opieftp/opieftp.cpp | |||
@@ -189,11 +189,12 @@ OpieFtp::OpieFtp( ) | |||
189 | 189 | ||
190 | Remote_View = new QListView( tab_2, "Remote_View" ); | 190 | Remote_View = new QListView( tab_2, "Remote_View" ); |
191 | Remote_View->addColumn( tr("File"),150); | 191 | Remote_View->addColumn( tr("File"),150); |
192 | Remote_View->addColumn( tr("Date"),-1); | 192 | Remote_View->addColumn( tr("Date"),-1); |
193 | Remote_View->setColumnAlignment(1,QListView::AlignRight); | 193 | // Remote_View->setColumnAlignment(1,QListView::AlignRight); |
194 | Remote_View->addColumn( tr("Size"),-1); | 194 | Remote_View->addColumn( tr("Size"),-1); |
195 | Remote_View->setColumnAlignment(2,QListView::AlignRight); | 195 | Remote_View->setColumnAlignment(2,QListView::AlignRight); |
196 | Remote_View->setColumnAlignment(3,QListView::AlignCenter); | ||
196 | Remote_View->addColumn( tr("Dir"),-1); | 197 | Remote_View->addColumn( tr("Dir"),-1); |
197 | Remote_View->setColumnAlignment(4,QListView::AlignRight); | 198 | Remote_View->setColumnAlignment(4,QListView::AlignRight); |
198 | Remote_View->setAllColumnsShowFocus(TRUE); | 199 | Remote_View->setAllColumnsShowFocus(TRUE); |
199 | 200 | ||
@@ -720,23 +721,26 @@ bool OpieFtp::populateRemoteView( ) | |||
720 | QFile file( sfile); | 721 | QFile file( sfile); |
721 | Remote_View->clear(); | 722 | Remote_View->clear(); |
722 | QString s, File_Name; | 723 | QString s, File_Name; |
723 | QListViewItem *itemDir=NULL, *itemFile=NULL; | 724 | QListViewItem *itemDir=NULL, *itemFile=NULL; |
725 | QRegExp monthRe(" [JFMASOND][eapuecoe][brynlgptvc] [ 0-9][0-9] [ 0-9][0-9][:0-9][0-9][0-9] "); | ||
724 | QString fileL, fileS, fileDate; | 726 | QString fileL, fileS, fileDate; |
725 | if ( file.open(IO_ReadOnly)) { | 727 | if ( file.open(IO_ReadOnly)) { |
726 | QTextStream t( &file ); // use a text stream | 728 | QTextStream t( &file ); // use a text stream |
727 | while ( !t.eof()) { | 729 | while ( !t.eof()) { |
728 | s = t.readLine(); | 730 | s = t.readLine(); |
729 | fileL = s.right(s.length()-55); | 731 | |
730 | fileL = fileL.stripWhiteSpace(); | 732 | if(s.find("total",0,TRUE) == 0) |
733 | continue; | ||
734 | |||
735 | int len, month = monthRe.match(s, 0, &len); | ||
736 | fileDate = s.mid(month + 1, len - 2); // minus spaces | ||
737 | fileL = s.right(s.length() - month - len); | ||
731 | if(s.left(1) == "d") | 738 | if(s.left(1) == "d") |
732 | fileL = fileL+"/"; | 739 | fileL = fileL+"/"; |
733 | // fileL = "/"+fileL+"/"; | 740 | fileS = s.mid(month - 8, 8); // FIXME |
734 | fileS = s.mid( 30, 42-30); | ||
735 | fileS = fileS.stripWhiteSpace(); | 741 | fileS = fileS.stripWhiteSpace(); |
736 | fileDate = s.mid( 42, 55-42); | 742 | |
737 | fileDate = fileDate.stripWhiteSpace(); | ||
738 | if(fileL.find("total",0,TRUE) == -1) { | ||
739 | if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { | 743 | if(s.left(1) == "d" || fileL.find("/",0,TRUE) != -1) { |
740 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); | 744 | QListViewItem * item = new QListViewItem( Remote_View, fileL, fileDate, fileS,"d"); |
741 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); | 745 | item->setPixmap( 0, Resource::loadPixmap( "folder" )); |
742 | // if(itemDir) | 746 | // if(itemDir) |
@@ -750,9 +754,8 @@ bool OpieFtp::populateRemoteView( ) | |||
750 | item->moveItem(itemFile); | 754 | item->moveItem(itemFile); |
751 | itemFile=item; | 755 | itemFile=item; |
752 | } | 756 | } |
753 | } | 757 | } |
754 | } | ||
755 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); | 758 | QListViewItem * item1 = new QListViewItem( Remote_View, "../"); |
756 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); | 759 | item1->setPixmap( 0, Resource::loadPixmap( "folder" )); |
757 | file.close(); | 760 | file.close(); |
758 | if( file.exists()) | 761 | if( file.exists()) |