diff --git a/digikam/albumsettings.cpp b/digikam/albumsettings.cpp
index 1283337..6ca194b 100644
--- a/digikam/albumsettings.cpp
+++ b/digikam/albumsettings.cpp
@@ -133,6 +133,9 @@ public:
 
     bool                                showFolderTreeViewItemsCount;
 
+    bool                                autoGenerateAlbumThumbnails;
+    int                                 autoGenerateAlbumType;
+
     // tree-view settings
     int                                 treeThumbnailSize;
     QFont                               treeviewFont;
@@ -274,7 +277,8 @@ void AlbumSettings::init()
     d->recursiveTags                = true;
 
     d->showFolderTreeViewItemsCount = false;
-
+    d->autoGenerateAlbumThumbnails  = false;
+    
     d->syncToDigikam                = false;
     d->syncToNepomuk                = false;
 }
@@ -358,6 +362,8 @@ 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);
+    d->autoGenerateAlbumType        = group.readEntry("Auto Generate Album Thumbnails Type",    0);
 
     // ---------------------------------------------------------------------
 
@@ -463,7 +469,9 @@ void AlbumSettings::saveSettings()
     group.writeEntry("Preview Load Full Image Size", d->previewLoadFullImageSize);
     group.writeEntry("Show Thumbbar",                d->showThumbbar);
 
-    group.writeEntry("Show Folder Tree View Items Count", d->showFolderTreeViewItemsCount);
+    group.writeEntry("Show Folder Tree View Items Count",      d->showFolderTreeViewItemsCount);
+    group.writeEntry("Auto Generate Album Thumbnails",         d->autoGenerateAlbumThumbnails);
+    group.writeEntry("Auto Generate Album Thumbnails Type",    d->autoGenerateAlbumType);
 
     // ---------------------------------------------------------------------
 
@@ -1251,6 +1259,26 @@ bool AlbumSettings::getShowFolderTreeViewItemsCount() const
     return d->showFolderTreeViewItemsCount;
 }
 
+void AlbumSettings::setAutoGenerateAlbumThumbnails(bool val)
+{
+    d->autoGenerateAlbumThumbnails = val;
+}
+
+bool AlbumSettings::getAutoGenerateAlbumThumbnails() const
+{
+    return d->autoGenerateAlbumThumbnails;
+}
+
+void AlbumSettings::setAutoGenerateAlbumType(int val)
+{
+    d->autoGenerateAlbumType = val;
+}
+
+int AlbumSettings::getAutoGenerateAlbumType() const
+{
+    return d->autoGenerateAlbumType;
+}
+
 void AlbumSettings::setShowThumbbar(bool val)
 {
     d->showThumbbar = val;
diff --git a/digikam/albumsettings.h b/digikam/albumsettings.h
index 6b09991..897ee0a 100644
--- a/digikam/albumsettings.h
+++ b/digikam/albumsettings.h
@@ -278,6 +278,12 @@ public:
     void setShowFolderTreeViewItemsCount(bool val);
     bool getShowFolderTreeViewItemsCount() const;
 
+    void setAutoGenerateAlbumThumbnails(bool val);
+    bool getAutoGenerateAlbumThumbnails() const;
+
+    void setAutoGenerateAlbumType(int val);
+    int  getAutoGenerateAlbumType() const;
+
     void setRecurseAlbums(bool val);
     bool getRecurseAlbums() const;
 
diff --git a/digikam/albumthumbnailloader.cpp b/digikam/albumthumbnailloader.cpp
index b246d82..7c60612 100644
--- a/digikam/albumthumbnailloader.cpp
+++ b/digikam/albumthumbnailloader.cpp
@@ -35,6 +35,7 @@
 #include <QMap>
 #include <QPainter>
 #include <QPixmap>
+#include <QTime>
 
 // KDE includes
 
@@ -45,10 +46,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 +65,16 @@ 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();
+        autoGenerateAlbumType   = AlbumSettings::instance()->getAutoGenerateAlbumType();
     }
 
+    bool                    autoGenerateAlbumThumb;
+    int                     autoGenerateAlbumType;
     int                     iconSize;
     int                     minBlendSize;
 
@@ -144,6 +151,31 @@ QPixmap AlbumThumbnailLoader::getStandardAlbumRootIcon(RelativeSize relativeSize
     return loadIcon("folder-image", computeIconSize(relativeSize));
 }
 
+bool AlbumThumbnailLoader::setAutoAlbumIcon(PAlbum *album)
+{
+    QList<qlonglong> imageIds;
+    imageIds = DatabaseAccess().db()->getItemIDsInAlbum(album->id());
+
+    if (!imageIds.isEmpty())
+    {
+        // use first item by default
+        int id = 0;
+
+        if (d->autoGenerateAlbumType == 1)  // use random item
+        {
+            QTime time(0,0,0);
+            srand(time.secsTo(QTime::currentTime()));
+            id = qrand() % imageIds.count();
+        }
+
+        ImageInfo info(imageIds.at(id));
+        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())
@@ -249,6 +281,10 @@ bool AlbumThumbnailLoader::getAlbumThumbnail(PAlbum *album)
     {
         addUrl(album, album->iconKURL());
     }
+    else if (d->autoGenerateAlbumThumb)
+    {
+        return setAutoAlbumIcon(album);
+    }
     else
     {
         return false;
diff --git a/digikam/albumthumbnailloader.h b/digikam/albumthumbnailloader.h
index 61ffcc7..2430232 100644
--- a/digikam/albumthumbnailloader.h
+++ b/digikam/albumthumbnailloader.h
@@ -144,6 +144,8 @@ public:
     QPixmap getStandardAlbumRootIcon(RelativeSize size = NormalSize);
     QPixmap getStandardAlbumIcon(PAlbum *album, RelativeSize size = NormalSize);
 
+    bool    setAutoAlbumIcon(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..0da7383 100644
--- a/utilities/setup/setupalbumview.cpp
+++ b/utilities/setup/setupalbumview.cpp
@@ -56,21 +56,23 @@ public:
 
     SetupAlbumViewPriv()
     {
-        iconTreeThumbSize            = 0;
-        iconTreeThumbLabel           = 0;
-        iconShowNameBox              = 0;
-        iconShowSizeBox              = 0;
-        iconShowDateBox              = 0;
-        iconShowModDateBox           = 0;
-        iconShowResolutionBox        = 0;
-        iconShowCommentsBox          = 0;
-        iconShowTagsBox              = 0;
-        iconShowRatingBox            = 0;
-        rightClickActionComboBox     = 0;
-        previewLoadFullImageSize     = 0;
-        showFolderTreeViewItemsCount = 0;
-        treeViewFontSelect           = 0;
-        iconViewFontSelect           = 0;
+        iconTreeThumbSize             = 0;
+        iconTreeThumbLabel            = 0;
+        iconShowNameBox               = 0;
+        iconShowSizeBox               = 0;
+        iconShowDateBox               = 0;
+        iconShowModDateBox            = 0;
+        iconShowResolutionBox         = 0;
+        iconShowCommentsBox           = 0;
+        iconShowTagsBox               = 0;
+        iconShowRatingBox             = 0;
+        rightClickActionComboBox      = 0;
+        previewLoadFullImageSize      = 0;
+        showFolderTreeViewItemsCount  = 0;
+        treeViewFontSelect            = 0;
+        iconViewFontSelect            = 0;
+        autoGenerateAlbumThumbnails   = 0;
+        autoGenerateAlbumTypeBox      = 0;
     }
 
     QLabel      *iconTreeThumbLabel;
@@ -85,9 +87,11 @@ public:
     QCheckBox   *iconShowRatingBox;
     QCheckBox   *previewLoadFullImageSize;
     QCheckBox   *showFolderTreeViewItemsCount;
+    QCheckBox   *autoGenerateAlbumThumbnails;
 
     KComboBox   *iconTreeThumbSize;
     KComboBox   *rightClickActionComboBox;
+    KComboBox   *autoGenerateAlbumTypeBox;
 
     DFontSelect *iconViewFontSelect;
     DFontSelect *treeViewFontSelect;
@@ -166,10 +170,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 +182,27 @@ 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);
-
-    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());
+    d->showFolderTreeViewItemsCount = new QCheckBox(i18n("Show a count of items in Tree Views"));
+
+    d->autoGenerateAlbumThumbnails  = new QCheckBox(i18n("Generate album thumbnails:"));
+    d->autoGenerateAlbumThumbnails->setToolTip(i18n("Set this option to automatically create missing album "
+                                                    "thumbnails"));
+    d->autoGenerateAlbumTypeBox = new KComboBox();
+    d->autoGenerateAlbumTypeBox->addItem(i18n("Use first item"));
+    d->autoGenerateAlbumTypeBox->addItem(i18n("Use random item"));
+    d->autoGenerateAlbumTypeBox->setToolTip(i18n("Select what type of item should be used to generate the "
+                                                 "album thumbnail"));
+
+    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->addWidget(d->autoGenerateAlbumTypeBox,     3, 1, 1,-1);
+    folderViewGroupLayout->setMargin(KDialog::spacingHint());
+    folderViewGroupLayout->setSpacing(KDialog::spacingHint());
+    folderViewGroup->setLayout(folderViewGroupLayout);
 
     // --------------------------------------------------------
 
@@ -245,6 +260,8 @@ void SetupAlbumView::applySettings()
 
     settings->setPreviewLoadFullImageSize(d->previewLoadFullImageSize->isChecked());
     settings->setShowFolderTreeViewItemsCount(d->showFolderTreeViewItemsCount->isChecked());
+    settings->setAutoGenerateAlbumThumbnails(d->autoGenerateAlbumThumbnails->isChecked());
+    settings->setAutoGenerateAlbumType(d->autoGenerateAlbumTypeBox->currentIndex());
     settings->saveSettings();
 }
 
@@ -262,6 +279,7 @@ void SetupAlbumView::readSettings()
     else
         d->iconTreeThumbSize->setCurrentIndex(3);
 
+
     d->treeViewFontSelect->setFont(settings->getTreeViewFont());
     d->iconShowNameBox->setChecked(settings->getIconShowName());
     d->iconShowTagsBox->setChecked(settings->getIconShowTags());
@@ -277,6 +295,8 @@ void SetupAlbumView::readSettings()
 
     d->previewLoadFullImageSize->setChecked(settings->getPreviewLoadFullImageSize());
     d->showFolderTreeViewItemsCount->setChecked(settings->getShowFolderTreeViewItemsCount());
+    d->autoGenerateAlbumThumbnails->setChecked(settings->getAutoGenerateAlbumThumbnails());
+    d->autoGenerateAlbumTypeBox->setCurrentIndex(settings->getAutoGenerateAlbumType());
 }
 
 }  // namespace Digikam
