[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdebase/kcontrol/kfontinst/kcmfontinst
From:       Craig Drummond <craig () kde ! org>
Date:       2004-04-30 21:42:46
Message-ID: 20040430214246.28BCF927B () office ! kde ! org
[Download RAW message or body]

CVS commit by craig: 

Show file sizes


  M +13 -3     KFileFontView.cpp   1.10


--- kdebase/kcontrol/kfontinst/kcmfontinst/KFileFontView.cpp  #1.9:1.10
@@ -55,4 +55,5 @@
 #define COL_NAME 0
 #define COL_FILE 1
+#define COL_SIZE 2
 
 class CKFileFontView::CKFileFontViewPrivate
@@ -77,4 +78,5 @@ CKFileFontView::CKFileFontView(QWidget *
     addColumn(i18n("Name"));
     addColumn(i18n("File"));
+    addColumn(i18n("Size"));
     setShowSortIndicator(true);
     setAllColumnsShowFocus(true);
@@ -320,4 +322,7 @@ void CKFileFontView::slotSortingChanged(
             sortSpec = (sort & ~QDir::SortByMask);// | QDir::Unsorted;
             break;
+        case COL_SIZE:
+            sortSpec = (sort & ~QDir::SortByMask | QDir::Size);
+            break;
         default:
             break;
@@ -357,4 +362,9 @@ void CKFileFontView::slotSortingChanged(
 void CKFileFontView::setSorting(QDir::SortSpec spec)
 {
+    if (spec & QDir::Size)
+        itsSortingCol=COL_SIZE;
+    else
+        itsSortingCol=COL_NAME;
+
     // inversed, because slotSortingChanged will reverse it
     if (spec & QDir::Reversed)
@@ -363,10 +373,9 @@ void CKFileFontView::setSorting(QDir::So
         spec = (QDir::SortSpec) (spec | QDir::Reversed);
 
-    itsSortingCol = COL_NAME;
     KFileView::setSorting((QDir::SortSpec) spec);
 
     // don't emit sortingChanged() when called via setSorting()
     itsBlockSortingSignal = true; // can't use blockSignals()
-    slotSortingChanged(COL_NAME);
+    slotSortingChanged(itsSortingCol);
     itsBlockSortingSignal = false;
 }
@@ -618,4 +627,5 @@ void CFontListViewItem::init()
     setText(COL_NAME, itsInf->text());
     setText(COL_FILE, itsInf->isDir() ? "" : itsInf->url().filename());
+    setText(COL_SIZE, itsInf->isDir() ? "" : KGlobal::locale()->formatNumber(itsInf->size(), 0));
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic