diff --git a/digikam/albumsettings.cpp b/digikam/albumsettings.cpp
index 8896e63..fcbd539 100644
--- a/digikam/albumsettings.cpp
+++ b/digikam/albumsettings.cpp
@@ -133,6 +133,7 @@ public:
     bool                                showThumbbar;
 
     bool                                showFolderTreeViewItemsCount;
+    bool                                autoGenerateAlbumThumbnails;
 
     QString                             author;
     QString                             authorTitle;
@@ -278,6 +279,7 @@ void AlbumSettings::init()
     d->recursiveTags                = true;
 
     d->showFolderTreeViewItemsCount = false;
+    d->autoGenerateAlbumThumbnails  = false;
 }
 
 void AlbumSettings::readSettings()
@@ -359,6 +361,7 @@ void AlbumSettings::readSettings()
     d->showThumbbar                 = group.readEntry("Show Thumbbar",                true);
 
     d->showFolderTreeViewItemsCount = group.readEntry("Show Folder Tree View Items Count", false);
+    d->autoGenerateAlbumThumbnails  = group.readEntry("Auto Generate Album Thumbnails",    false);
 
     // ---------------------------------------------------------------------
 
@@ -464,6 +467,7 @@ void AlbumSettings::saveSettings()
     group.writeEntry("Show Thumbbar",                d->showThumbbar);
 
     group.writeEntry("Show Folder Tree View Items Count", d->showFolderTreeViewItemsCount);
+    group.writeEntry("Auto Generate Album Thumbnails",    d->autoGenerateAlbumThumbnails);
 
     // ---------------------------------------------------------------------
 
@@ -1311,6 +1315,16 @@ bool AlbumSettings::getShowFolderTreeViewItemsCount() const
     return d->showFolderTreeViewItemsCount;
 }
 
+void AlbumSettings::setAutoGenerateAlbumThumbnails(bool val)
+{
+    d->autoGenerateAlbumThumbnails = val;
+}
+
+bool AlbumSettings::getAutoGenerateAlbumThumbnails() const
+{
+    return d->autoGenerateAlbumThumbnails;
+}
+
 void AlbumSettings::setShowThumbbar(bool val)
 {
     d->showThumbbar = val;
diff --git a/digikam/albumsettings.h b/digikam/albumsettings.h
index 09ee83b..05f0295 100644
--- a/digikam/albumsettings.h
+++ b/digikam/albumsettings.h
@@ -295,6 +295,9 @@ public:
     void setShowFolderTreeViewItemsCount(bool val);
     bool getShowFolderTreeViewItemsCount() const;
 
+    void setAutoGenerateAlbumThumbnails(bool val);
+    bool getAutoGenerateAlbumThumbnails() const;
+
     void setRecurseAlbums(bool val);
     bool getRecurseAlbums() const;
 
diff --git a/digikam/albumthumbnailloader.cpp b/digikam/albumthumbnailloader.cpp
index 0d6e4c3..6f78b10 100644
--- a/digikam/albumthumbnailloader.cpp
+++ b/digikam/albumthumbnailloader.cpp
@@ -45,10 +45,12 @@
 // Local includes
 
 #include "album.h"
+#include "albumdb.h"
 #include "albummanager.h"
 #include "albumsettings.h"
 #include "thumbnailloadthread.h"
 #include "thumbnailsize.h"
+#include "imageinfo.h"
 
 namespace Digikam
 {
@@ -62,12 +64,14 @@ public:
 
     AlbumThumbnailLoaderPrivate()
     {
-        iconSize             = AlbumSettings::instance()->getTreeViewIconSize();
-        minBlendSize         = 20;
-        iconAlbumThumbThread = 0;
-        iconTagThumbThread   = 0;
+        iconSize                = AlbumSettings::instance()->getTreeViewIconSize();
+        minBlendSize            = 20;
+        iconAlbumThumbThread    = 0;
+        iconTagThumbThread      = 0;
+        autoGenerateAlbumThumb  = AlbumSettings::instance()->getAutoGenerateAlbumThumbnails();
     }
 
+    bool                    autoGenerateAlbumThumb;
     int                     iconSize;
     int                     minBlendSize;
 
@@ -136,6 +140,21 @@ QPixmap AlbumThumbnailLoader::getStandardAlbumRootIcon(RelativeSize relativeSize
     return loadIcon("folder-image", computeIconSize(relativeSize));
 }
 
+bool AlbumThumbnailLoader::setFirstItemAsAlbumIcon(PAlbum *album)
+{
+    QList<qlonglong> imageIds;
+    imageIds = DatabaseAccess().db()->getItemIDsInAlbum(album->id());
+
+    if (!imageIds.isEmpty())
+    {
+        ImageInfo info(imageIds.first());
+        QString err;
+        AlbumManager::instance()->updatePAlbumIcon(album, info.id(), err);
+    }
+
+    return (!album->icon().isEmpty());
+}
+
 QPixmap AlbumThumbnailLoader::getStandardAlbumIcon(PAlbum *album, RelativeSize relativeSize)
 {
     if (album->isRoot() || album->isAlbumRoot())
@@ -241,6 +260,10 @@ bool AlbumThumbnailLoader::getAlbumThumbnail(PAlbum *album)
     {
         addUrl(album, album->iconKURL());
     }
+    else if (d->autoGenerateAlbumThumb)
+    {
+        return setFirstItemAsAlbumIcon(album);
+    }
     else
     {
         return false;
@@ -261,6 +284,13 @@ QPixmap AlbumThumbnailLoader::getAlbumThumbnailDirectly(PAlbum *album)
         // schedule for loading
         addUrl(album, album->iconKURL());
     }
+    /*
+    FIXME: not sure about this one?
+    else if (d->autoGenerateAlbumThumb)
+    {
+        setFirstItemAsAlbumIcon(album);
+    }
+     */
 
     return getStandardAlbumIcon(album);
 }
diff --git a/digikam/albumthumbnailloader.h b/digikam/albumthumbnailloader.h
index 223057a..6587a97 100644
--- a/digikam/albumthumbnailloader.h
+++ b/digikam/albumthumbnailloader.h
@@ -142,6 +142,8 @@ public:
     QPixmap getStandardAlbumRootIcon(RelativeSize size = NormalSize);
     QPixmap getStandardAlbumIcon(PAlbum *album, RelativeSize size = NormalSize);
 
+    bool setFirstItemAsAlbumIcon(PAlbum* album);
+
     /**
      * Blend tagIcon centered on dstIcon, where dstIcon is a standard
      * icon of variable size and tagIcon is 12 pixels smaller.
diff --git a/utilities/setup/setupalbumview.cpp b/utilities/setup/setupalbumview.cpp
index 1cd8340..7f7521e 100644
--- a/utilities/setup/setupalbumview.cpp
+++ b/utilities/setup/setupalbumview.cpp
@@ -71,6 +71,7 @@ public:
         showFolderTreeViewItemsCount = 0;
         treeViewFontSelect           = 0;
         iconViewFontSelect           = 0;
+        autoGenerateAlbumThumbnails  = 0;
     }
 
     QLabel      *iconTreeThumbLabel;
@@ -85,6 +86,7 @@ public:
     QCheckBox   *iconShowRatingBox;
     QCheckBox   *previewLoadFullImageSize;
     QCheckBox   *showFolderTreeViewItemsCount;
+    QCheckBox   *autoGenerateAlbumThumbnails;
 
     KComboBox   *iconTreeThumbSize;
     KComboBox   *rightClickActionComboBox;
@@ -166,10 +168,8 @@ SetupAlbumView::SetupAlbumView(QWidget* parent)
     // --------------------------------------------------------
 
     QGroupBox *folderViewGroup = new QGroupBox(i18n("Folder View Options"), panel);
-    QGridLayout* grid2         = new QGridLayout(folderViewGroup);
-
-    d->iconTreeThumbLabel      = new QLabel(i18n("Tree View thumbnail size:"), folderViewGroup);
-    d->iconTreeThumbSize       = new KComboBox(folderViewGroup);
+    d->iconTreeThumbLabel      = new QLabel(i18n("Tree View thumbnail size:"));
+    d->iconTreeThumbSize       = new KComboBox();
     d->iconTreeThumbSize->addItem(QString("16"));
     d->iconTreeThumbSize->addItem(QString("22"));
     d->iconTreeThumbSize->addItem(QString("32"));
@@ -180,14 +180,18 @@ SetupAlbumView::SetupAlbumView(QWidget* parent)
     d->treeViewFontSelect = new DFontSelect(i18n("Tree View font:"), folderViewGroup);
     d->treeViewFontSelect->setToolTip(i18n("Select here the font used to display text in Tree Views."));
 
-    d->showFolderTreeViewItemsCount = new QCheckBox(i18n("Show a count of items in Tree Views"), folderViewGroup);
+    d->showFolderTreeViewItemsCount = new QCheckBox(i18n("Show a count of items in Tree Views"));
+    d->autoGenerateAlbumThumbnails  = new QCheckBox(i18n("Generate missing album thumbnails"));
 
-    grid2->addWidget(d->iconTreeThumbLabel,           0, 0, 1, 1);
-    grid2->addWidget(d->iconTreeThumbSize,            0, 1, 1, 1);
-    grid2->addWidget(d->treeViewFontSelect,           1, 0, 1, 2);
-    grid2->addWidget(d->showFolderTreeViewItemsCount, 2, 0, 1, 2);
-    grid2->setMargin(KDialog::spacingHint());
-    grid2->setSpacing(KDialog::spacingHint());
+    QGridLayout* folderViewGroupLayout = new QGridLayout();
+    folderViewGroupLayout->addWidget(d->iconTreeThumbLabel,           0, 0, 1, 1);
+    folderViewGroupLayout->addWidget(d->iconTreeThumbSize,            0, 1, 1,-1);
+    folderViewGroupLayout->addWidget(d->treeViewFontSelect,           1, 0, 1, 2);
+    folderViewGroupLayout->addWidget(d->showFolderTreeViewItemsCount, 2, 0, 1,-1);
+    folderViewGroupLayout->addWidget(d->autoGenerateAlbumThumbnails,  3, 0, 1,-1);
+    folderViewGroupLayout->setMargin(KDialog::spacingHint());
+    folderViewGroupLayout->setSpacing(KDialog::spacingHint());
+    folderViewGroup->setLayout(folderViewGroupLayout);
 
     // --------------------------------------------------------
 
@@ -245,6 +249,7 @@ void SetupAlbumView::applySettings()
 
     settings->setPreviewLoadFullImageSize(d->previewLoadFullImageSize->isChecked());
     settings->setShowFolderTreeViewItemsCount(d->showFolderTreeViewItemsCount->isChecked());
+    settings->setAutoGenerateAlbumThumbnails(d->autoGenerateAlbumThumbnails->isChecked());
     settings->saveSettings();
 }
 
@@ -277,6 +282,7 @@ void SetupAlbumView::readSettings()
 
     d->previewLoadFullImageSize->setChecked(settings->getPreviewLoadFullImageSize());
     d->showFolderTreeViewItemsCount->setChecked(settings->getShowFolderTreeViewItemsCount());
+    d->autoGenerateAlbumThumbnails->setChecked(settings->getAutoGenerateAlbumThumbnails());
 }
 
 }  // namespace Digikam
