Index: digikam/digikam/albumfolderview.cpp
===================================================================
--- digikam/digikam/albumfolderview.cpp	(revision 598352)
+++ digikam/digikam/albumfolderview.cpp	(working copy)
@@ -49,7 +49,7 @@
 #include "albumpropsedit.h"
 #include "album.h"
 #include "albummanager.h"
-#include "albummanager.h"
+#include "albumlister.h"
 #include "albumsettings.h"
 #include "thumbnailjob.h"
 #include "thumbnailsize.h"
@@ -59,6 +59,7 @@
 #include "dragobjects.h"
 #include "albumthumbnailloader.h"
 #include "deletedialog.h"
+#include "kipiinterface.h"
 
 // X11 C Ansi includes.
 
@@ -156,22 +157,48 @@
 
 int AlbumFolderViewItem::compare(QListViewItem *i, int col, bool ascending) const
 {
-    if (!m_groupItem || m_year == 0 || m_month == 0)
-        return QListViewItem::compare(i, col, ascending);
-
-    AlbumFolderViewItem* thatItem = dynamic_cast<AlbumFolderViewItem*>(i);
-    if (!thatItem)
-        return 0;
-
-    int myWeight  = m_year*100 + m_month;
-    int hisWeight = thatItem->m_year*100 + thatItem->m_month;
-
-    if (myWeight == hisWeight)
-        return 0;
-    else if (myWeight > hisWeight)
-        return 1;
+    if (!m_groupItem && col == 1) 
+    {
+        kdDebug() << "sort using col 1" << endl;
+        
+        QString myNr  = text (1);
+        QString hisNr = i->text (1);
+         
+        bool ok;
+        
+        uint myUIntNr = myNr.toUInt (&ok, 10);
+        if (!ok) return QListViewItem::compare(i, col, ascending);
+        
+        uint hisUIntNr = hisNr.toUInt (&ok, 10);
+        if (!ok) return QListViewItem::compare(i, col, ascending);
+        
+        if (myUIntNr == hisUIntNr)
+            return 0;
+        else if (myUIntNr > hisUIntNr)
+            return 1;
+        else
+            return -1;
+    }
     else
-        return -1;
+    {
+        if (!m_groupItem || m_year == 0 || m_month == 0)
+            return QListViewItem::compare(i, col, ascending);
+    
+              
+        AlbumFolderViewItem* thatItem = dynamic_cast<AlbumFolderViewItem*>(i);
+        if (!thatItem)
+            return 0;
+    
+        int myWeight  = m_year*100 + m_month;
+        int hisWeight = thatItem->m_year*100 + thatItem->m_month;
+    
+        if (myWeight == hisWeight)
+            return 0;
+        else if (myWeight > hisWeight)
+            return 1;
+        else
+            return -1;
+    }
 }
 
 
@@ -190,6 +217,7 @@
     }
     
     AlbumManager                     *albumMan;
+    AlbumLister                      *albumLis;
     ThumbnailJob                     *iconThumbJob;
     QValueList<AlbumFolderViewItem*>  groupItems;
 };
@@ -203,9 +231,12 @@
 {
     d = new AlbumFolderViewPriv();
     d->albumMan     = AlbumManager::instance();
+    d->albumLis     = AlbumLister::instance();
     d->iconThumbJob = 0;
 
     addColumn(i18n("My Albums"));
+    addColumn(i18n("Total"));
+    setColumnAlignment(1, Qt::AlignRight);
     setResizeMode(QListView::LastColumn);
     setRootIsDecorated(false);
     setAllColumnsShowFocus(true);
@@ -227,6 +258,9 @@
             
     connect(d->albumMan, SIGNAL(signalAlbumRenamed(Album*)),
             this, SLOT(slotAlbumRenamed(Album*)));
+                           
+    connect(d->albumLis, SIGNAL(signalAlbumsAffected(const AlbumList&)),
+            this, SLOT(slotAlbumsAffected(const AlbumList&)));
 
     AlbumThumbnailLoader *loader = AlbumThumbnailLoader::instance();
     
@@ -284,6 +318,7 @@
     }
 
     setAlbumThumbnail(palbum);
+    setAlbumItemCount(palbum); 
 }
 
 void AlbumFolderView::slotAlbumDeleted(Album *album)
@@ -350,6 +385,39 @@
     loader->getAlbumThumbnail(album);
 }
 
+void AlbumFolderView::setAlbumItemCount(PAlbum *album)
+{
+    QString extensions;
+    AlbumSettings* s;
+    DigikamImageCollection* collection;
+    QString format;
+
+    if(!album)
+        return;
+        
+    AlbumFolderViewItem* item = (AlbumFolderViewItem*) album->extraData(this);
+    
+    if(!item)
+        return;
+        
+    /* prepare file extensions */
+    s = AlbumSettings::instance();
+    extensions = s->getImageFileFilter() + ' ' +
+                 s->getMovieFileFilter() + ' ' +
+                 s->getAudioFileFilter() + ' ' +
+                 s->getRawFileFilter();
+                 
+    /* create image collection */
+    collection = new DigikamImageCollection (DigikamImageCollection::AllItems, album, extensions);
+    QTextOStream(&format) << collection->images().size();
+        
+    /* set text of second column */
+    item->setText (1, format);
+    
+    /* free memory */
+    delete collection;
+}
+
 void AlbumFolderView::slotGotThumbnailFromIcon(Album *album,
                                                const QPixmap& thumbnail)
 {
@@ -1311,6 +1379,15 @@
     }
 }
 
+void AlbumFolderView::slotAlbumsAffected(const AlbumList& albums) 
+{
+    for (AlbumList::const_iterator it = albums.begin(); it != albums.end(); ++it)
+    {
+        PAlbum* album = (PAlbum*)(*it);
+        setAlbumItemCount(album);
+    }
+}
+
 }  // namespace Digikam
 
 #include "albumfolderview.moc"
Index: digikam/digikam/albumlister.h
===================================================================
--- digikam/digikam/albumlister.h	(revision 598352)
+++ digikam/digikam/albumlister.h	(working copy)
@@ -31,6 +31,7 @@
 // Local includes.
 
 #include "imageinfo.h"
+#include "albummanager.h"
 
 namespace KIO
 {
@@ -98,6 +99,7 @@
     void signalDeleteFilteredItem(ImageInfo* item);
     void signalClear();
     void signalCompleted();
+    void signalAlbumsAffected(const AlbumList& albums);
 
 private slots:
 
Index: digikam/digikam/albumlister.cpp
===================================================================
--- digikam/digikam/albumlister.cpp	(revision 598352)
+++ digikam/digikam/albumlister.cpp	(working copy)
@@ -91,6 +91,8 @@
     Album                          *currAlbum;
 
     AlbumLister::MatchingCondition matchingCond;
+    
+    AlbumList                       affectedAlbumsList;
 };
 
 AlbumLister* AlbumLister::m_instance = 0;
@@ -184,6 +186,8 @@
     ds << d->currAlbum->kurl();
     ds << d->filter;
     ds << AlbumSettings::instance()->getIconShowResolution();
+    
+    d->affectedAlbumsList.clear ();
 
     d->job = new KIO::TransferJob(d->currAlbum->kurl(), KIO::CMD_SPECIAL,
                                   ba, QByteArray(), false);
@@ -366,6 +370,7 @@
 
     d->itemMap.clear();
 
+    emit signalAlbumsAffected(d->affectedAlbumsList);
     emit signalCompleted();
 }
 
@@ -400,6 +405,9 @@
             ImageInfo* info = d->itemMap[imageID];
             if (!matchesFilter(info))
             {
+                if (!d->affectedAlbumsList.contains(info->album())) {
+                    d->affectedAlbumsList.append(info->album());
+                }
                 emit signalDeleteFilteredItem(info);
             }
             
@@ -413,6 +421,10 @@
 
         if (matchesFilter(info))
             newFilteredItemsList.append(info);
+            
+        if (!d->affectedAlbumsList.contains(info->album())) {
+            d->affectedAlbumsList.append(info->album());
+        }
 
         newItemsList.append(info);
         d->itemList.append(info);
Index: digikam/digikam/albumfolderview.h
===================================================================
--- digikam/digikam/albumfolderview.h	(revision 598352)
+++ digikam/digikam/albumfolderview.h	(working copy)
@@ -30,6 +30,8 @@
 // Local includes.
 
 #include "folderview.h"
+#include "imageinfo.h"
+#include "albummanager.h"
 
 class QPixmap;
 
@@ -60,6 +62,7 @@
     void albumEdit();
 
     void setAlbumThumbnail(PAlbum *album);
+    void setAlbumItemCount(PAlbum *album);
 
 signals:
     
@@ -80,6 +83,8 @@
     void slotContextMenu(QListViewItem*, const QPoint&, int);
 
     void slotDIOResult(KIO::Job* job);
+    
+    void slotAlbumsAffected(const AlbumList& albums);
 
 protected:
 
