Index: ThumbnailView/ThumbnailWidget.cpp
===================================================================
--- ThumbnailView/ThumbnailWidget.cpp	(revision 600142)
+++ ThumbnailView/ThumbnailWidget.cpp	(working copy)
@@ -14,6 +14,7 @@
 #include <kmessagebox.h>
 #include <qfontmetrics.h>
 #include "ThumbnailWidget.moc"
+#include "MainWindow/DirtyIndicator.h"
 
 /**
  * \namespace ThumbnailView
@@ -108,24 +109,64 @@
 }
 
 /**
+ * Returns the text under the thumbnails
+ */
+QString ThumbnailView::ThumbnailWidget::thumbnailText( const QString& fileName ) const
+{
+  QString text;
+
+  if ( Settings::SettingsData::instance()->displayLabels()) {
+    text += DB::ImageDB::instance()->info( fileName )->label();;
+    text += QString::fromLatin1("\n");
+  }
+
+  if ( Settings::SettingsData::instance()->displayCategories()) {
+    QStringList grps = DB::ImageDB::instance()->info( fileName )->availableCategories();
+    for( QStringList::Iterator it = grps.begin(); it != grps.end(); ++it ) {
+      QString category = *it;
+      if ( category != QString::fromLatin1( "Folder" ) && category != QString::fromLatin1( "Media Type" ) ) {
+        StringSet items = DB::ImageDB::instance()->info( fileName )->itemsOfCategory( category );
+        if (items.count() != 0 ) {
+          text += QString::fromLatin1( "%1: " )
+              .arg( category );
+          bool first = true;
+          for( StringSet::Iterator it2 = items.begin(); it2 != items.end(); ++it2 ) {
+            QString item = *it2;
+            if ( first )
+              first = false;
+            else
+              text += QString::fromLatin1( ", " );
+            text += item;
+          }
+          text += QString::fromLatin1( "\n" );
+        }
+      }
+    }
+  }
+
+  if(text.isEmpty())
+    text = QString::fromLatin1( "" );
+
+  return text;
+}
+
+/**
  * Draw the title under the thumbnail
  */
 void ThumbnailView::ThumbnailWidget::paintCellText( QPainter* painter, int row, int col )
 {
-    if ( !Settings::SettingsData::instance()->displayLabels() )
-        return;
-
     QString fileName = fileNameInCell( row, col );
     if ( fileName.isNull() )
         return;
 
-    QString title = DB::ImageDB::instance()->info( fileName )->label();
+    QString title = thumbnailText( fileName );
     QRect rect = cellTextGeometry( row, col );
     painter->setPen( palette().active().text() );
 
-    int align = (QFontMetrics( font() ).width( title ) > rect.width()) ? Qt::AlignLeft : Qt::AlignCenter;
+    //int align = (QFontMetrics( font() ).width( title ) > rect.width()) ? Qt::AlignLeft : Qt::AlignCenter;
 
-    painter->drawText( rect, align, title );
+    //painter->drawText( rect, align, title );
+    painter->drawText( rect, Qt::AlignCenter | Qt::WordBreak, title );
 }
 
 
@@ -204,14 +245,14 @@
 
     int xoff = 1 + (size - pix->width())/2; // 1 is for the border at the left
     int yoff = (size - pix->height() );
-    if ( !Settings::SettingsData::instance()->displayLabels() )
+    if ( !Settings::SettingsData::instance()->displayLabels() && !Settings::SettingsData::instance()->displayCategories())
         yoff /= 2; // we wil center the images if we do not show the label, otherwise we will align it to the bottom
     return QRect( xoff, yoff, pix->width(), pix->height() );
 }
 
 QRect ThumbnailView::ThumbnailWidget::cellTextGeometry( int row, int col ) const
 {
-    if ( !Settings::SettingsData::instance()->displayLabels() )
+  if ( !Settings::SettingsData::instance()->displayLabels() && !Settings::SettingsData::instance()->displayCategories() )
         return QRect();
 
     QString fileName = fileNameInCell( row, col );
@@ -219,7 +260,13 @@
         return QRect();
 
 
-    int h = QFontMetrics(font()).height();
+    int h = 0;
+    if ( Settings::SettingsData::instance()->displayLabels() )
+        h += QFontMetrics( font() ).height() +2;
+    if ( Settings::SettingsData::instance()->displayCategories()) {
+      h += QFontMetrics( font() ).height() * ( DB::ImageDB::instance()->categoryCollection()->categoryNames().count() - 2 ) +2;
+    }
+
     QRect iconRect = iconGeometry( row, col );
     QRect cellRect = const_cast<ThumbnailWidget*>(this)->cellGeometry( row, col );
 
@@ -315,6 +362,29 @@
 
 void ThumbnailView::ThumbnailWidget::keyPressEvent( QKeyEvent* event )
 {
+    if ( event->stateAfter() == 0 && event->state() == 0 && ( event->key() >= Key_A && event->key() <= Key_Z ) ) {
+      QString token = event->text().upper().left(1);
+      bool firstHasToken = false;
+      bool firstTime     = true;
+
+      for( Set<QString>::Iterator it = _selectedFiles.begin(); it != _selectedFiles.end(); ++it ) {
+        if ( firstTime ) {
+          firstHasToken = DB::ImageDB::instance()->info( *it )->hasCategoryInfo( QString::fromLatin1("Tokens"), token );
+          firstTime = false;
+        }
+
+        if ( firstHasToken )
+          DB::ImageDB::instance()->info( *it )->removeCategoryInfo( QString::fromLatin1("Tokens"), token );
+        else
+          DB::ImageDB::instance()->info( *it )->addCategoryInfo( QString::fromLatin1("Tokens"), token );
+
+        updateCell( *it );
+      }
+
+      DB::ImageDB::instance()->categoryCollection()->categoryForName( QString::fromLatin1("Tokens") )->addItem( token );
+      MainWindow::DirtyIndicator::markDirty();
+    }
+
     if ( isMovementKey( event->key() ) )
         keyboardMoveEvent( event );
 
@@ -930,6 +1000,9 @@
     int h = size +2;
     if ( Settings::SettingsData::instance()->displayLabels() )
         h += QFontMetrics( font() ).height() +2;
+    if ( Settings::SettingsData::instance()->displayCategories()) {
+      h += QFontMetrics( font() ).height() * ( DB::ImageDB::instance()->categoryCollection()->categoryNames().count() - 2 ) +2;
+    }
     setCellHeight( h );
     updateGridSize();
 }
Index: ThumbnailView/ThumbnailWidget.h
===================================================================
--- ThumbnailView/ThumbnailWidget.h	(revision 600142)
+++ ThumbnailView/ThumbnailWidget.h	(working copy)
@@ -64,6 +64,7 @@
     void updateCell( int row, int col );
     void paintCellBackground( QPainter*, int row, int col );
     void paintCellPixmap( QPainter*, int row, int col );
+    QString thumbnailText( const QString& fileName ) const;
     void paintCellText( QPainter*, int row, int col );
     virtual void viewportPaintEvent( QPaintEvent* );
Index: Settings/SettingsData.h
===================================================================
--- Settings/SettingsData.h	(revision 600142)
+++ Settings/SettingsData.h	(working copy)
@@ -91,6 +91,7 @@
     // -------------------------------------------------- Thumbnails
     intProperty( Thumbnails, previewSize, setPreviewSize, 256 );
     boolProperty( Thumbnails, displayLabels, setDisplayLabels, true );
+    boolProperty( Thumbnails, displayCategories, setDisplayCategories, false );
     intProperty( Thumbnails, autoShowThumbnailView, setAutoShowThumbnailView, 0 );
     boolProperty( Thumbnails, showNewestThumbnailFirst, setShowNewestFirst, false );
 
Index: Settings/SettingsDialog.cpp
===================================================================
--- Settings/SettingsDialog.cpp	(revision 600142)
+++ Settings/SettingsDialog.cpp	(working copy)
@@ -227,6 +227,11 @@
     _displayLabels = new QCheckBox( i18n("Display labels in thumbnail view" ), top, "displayLabels" );
     lay->addMultiCellWidget( _displayLabels, row, row, 0, 1 );
 
+    // Display Categories
+    ++row;
+    _displayCategories = new QCheckBox( i18n("Display categories in thumbnail view" ), top, "displayCategories" );
+    lay->addMultiCellWidget( _displayCategories, row, row, 0, 1 );
+
     // Auto Show Thumbnail view
     ++row;
     QLabel* autoShowLabel = new QLabel( i18n("Auto display limit: "), top );
@@ -265,6 +270,10 @@
                "thumbnails in the thumbnail view</qt>");
     QWhatsThis::add( _displayLabels, txt );
 
+    txt = i18n("<qt>Checking this option will show the Categories for the file under "
+        "thumbnails in the thumbnail view</qt>");
+    QWhatsThis::add( _displayCategories, txt );
+
     txt = i18n("<qt><p>When you are browsing the images, and the count gets below the value specified here, "
                "the thumbnails will be shown automatically. The alternative is to continue showing the "
                "browser until you press <i>Show Images</i>.<p>"
@@ -378,6 +387,7 @@
     _albumCategory->setCurrentText( cat->text() );
 
     _displayLabels->setChecked( opt->displayLabels() );
+    _displayCategories->setChecked( opt->displayCategories() );
     _viewImageSetup->setSize( opt->viewerSize() );
     _viewImageSetup->setLaunchFullScreen( opt->launchViewerFullScreen() );
     _slideShowSetup->setSize( opt->slideShowSize() );
@@ -457,6 +467,7 @@
 
     opt->setAlbumCategory( name );
     opt->setDisplayLabels( _displayLabels->isChecked() );
+    opt->setDisplayCategories( _displayCategories->isChecked() );
     opt->setViewerSize( _viewImageSetup->size() );
     opt->setLaunchViewerFullScreen( _viewImageSetup->launchFullScreen() );
     opt->setSlideShowInterval( _slideShowInterval->value() );
Index: Settings/SettingsDialog.h
===================================================================
--- Settings/SettingsDialog.h	(revision 600142)
+++ Settings/SettingsDialog.h	(working copy)
@@ -104,6 +104,7 @@
     QSpinBox* _thumbnailSize;
     QComboBox* _albumCategory;
     QCheckBox* _displayLabels;
+    QCheckBox* _displayCategories;
     QCheckBox* _searchForImagesOnStartup;
     QCheckBox* _dontReadRawFilesWithOtherMatchingFile;
     QSpinBox* _thumbnailCache;
