Bug 118526

Summary: make it possible to remove an album's thumbnail
Product: [Applications] digikam Reporter: Michał Kosmulski <michal>
Component: Tags-EngineAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: 0.8.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 0.9.0
Sentry Crash Report:

Description Michał Kosmulski 2005-12-17 18:17:20 UTC
Version:           0.8.0 (using KDE KDE 3.5.0)
Installed from:    Compiled From Sources
OS:                Linux

It is currently possible to make one of the images in an album this album's thumbnail, which is a very nice feature. However, I miss an option to revert the album back to the default icon (in other words, to make the album thumbnail-less). Of course, this can be done manually by creating a new empty folder and moving the images over there, but its far from intuitive and makes it necessary to manually copy the album's other metadata (description, date) to the new folder.
Having a thumbnail-less album can be quite a good thing. For example, I keep images which I don't want to show to most people (e.g. snapshots of important documents) in a separate folder and want to keep it thumbnail-less (since the images are not to be accidentally displayed). And since a new album doesn't have a thumbnail by default until you set one (as od digikam 0.8.0), being able to get back to this thumbnail-less state after you accidentally set some thumbnail is also a good thing for the UI's consistency.
Comment 1 caulier.gilles 2006-09-01 13:01:45 UTC
SVN commit 579586 by cgilles:

digikam from trunk: new popup menu options to reset album/tag thumbs
BUG: 118526

 M  +95 -82    albumfolderview.cpp  
 M  +8 -4      albumfolderview.h  
 M  +60 -39    tagfolderview.cpp  
 M  +6 -7      tagfolderview.h  
Comment 2 caulier.gilles 2006-09-01 13:19:15 UTC
SVN commit 579591 by cgilles:

digikam from trunk: new popup menu options to reset album/tag thumbs in tag filter view
CCBUGS: 118526

 M  +53 -43    tagfilterview.cpp  
 M  +9 -4      tagfilterview.h  


--- trunk/extragear/graphics/digikam/digikam/tagfilterview.cpp #579590:579591
@@ -1,11 +1,12 @@
 /* ============================================================
- * File  : tagfilterview.cpp
- * Author: Renchi Raju <renchi@pooh.tam.uiuc.edu>
- * Date  : 2005-05-05
- * Description :
+ * Authors: Renchi Raju <renchi@pooh.tam.uiuc.edu>
+ *          Caulier Gilles <caulier dot gilles at kdemail dot net>
+ * Date   : 2005-05-05
+ * Description : tags filter view
  *
  * Copyright 2005 by Renchi Raju
-
+ * Copyright 2006 by Gilles Caulier
+ *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
  * Public License as published by the Free Software Foundation;
@@ -136,13 +137,14 @@
 
 class TagFilterViewPriv
 {
+
 public:
 
-    QTimer*                     timer;
+    QTimer *timer;
 };
 
 TagFilterView::TagFilterView(QWidget* parent)
-    : FolderView(parent)
+             : FolderView(parent)
 {
     d = new TagFilterViewPriv;
     d->timer = new QTimer(this);
@@ -159,29 +161,36 @@
     notTaggedItem->setPixmap(0, AlbumThumbnailLoader::instance()->getStandardTagIcon());
 
     connect(AlbumManager::instance(), SIGNAL(signalAlbumAdded(Album*)),
-            SLOT(slotTagAdded(Album*)));
+            this, SLOT(slotTagAdded(Album*)));
+            
     connect(AlbumManager::instance(), SIGNAL(signalAlbumDeleted(Album*)),
-            SLOT(slotTagDeleted(Album*)));
+            this, SLOT(slotTagDeleted(Album*)));
+            
     connect(AlbumManager::instance(), SIGNAL(signalAlbumRenamed(Album*)),
-            SLOT(slotTagRenamed(Album*)));
+            this, SLOT(slotTagRenamed(Album*)));
+            
     connect(AlbumManager::instance(), SIGNAL(signalAlbumsCleared()),
-            SLOT(slotClear()));
+            this, SLOT(slotClear()));
+            
     connect(AlbumManager::instance(), SIGNAL(signalAlbumIconChanged(Album*)),
-            SLOT(slotAlbumIconChanged(Album*)));
+            this, SLOT(slotAlbumIconChanged(Album*)));
+            
     connect(AlbumManager::instance(), SIGNAL(signalTAlbumMoved(TAlbum*, TAlbum*)),
-            SLOT(slotTagMoved(TAlbum*, TAlbum*)));
+            this, SLOT(slotTagMoved(TAlbum*, TAlbum*)));
 
     AlbumThumbnailLoader *loader = AlbumThumbnailLoader::instance();
+    
     connect(loader, SIGNAL(signalThumbnail(Album *, const QPixmap&)),
-            SLOT(slotGotThumbnailFromIcon(Album *, const QPixmap&)));
+            this, SLOT(slotGotThumbnailFromIcon(Album *, const QPixmap&)));
+            
     connect(loader, SIGNAL(signalFailed(Album *)),
-            SLOT(slotThumbnailLost(Album *)));
+            this, SLOT(slotThumbnailLost(Album *)));
 
     connect(this, SIGNAL(contextMenuRequested(QListViewItem*, const QPoint&, int)),
-            SLOT(slotContextMenu(QListViewItem*, const QPoint&, int)));
+            this, SLOT(slotContextMenu(QListViewItem*, const QPoint&, int)));
 
     connect(d->timer, SIGNAL(timeout()),
-            SLOT(slotTimeOut()));
+            this, SLOT(slotTimeOut()));
 }
 
 TagFilterView::~TagFilterView()
@@ -280,8 +289,7 @@
         else
         {
             QPopupMenu popMenu(this);
-            popMenu.insertItem( SmallIcon("tag"),
-                                i18n("Assign Tag '%1' to Dropped Items")
+            popMenu.insertItem( SmallIcon("tag"), i18n("Assign Tag '%1' to Dropped Items")
                                 .arg(destAlbum->prettyURL()), 10) ;
             popMenu.insertSeparator(-1);
             popMenu.insertItem( SmallIcon("cancel"), i18n("C&ancel") );
@@ -359,8 +367,7 @@
     if (!tag || !newParent)
         return;
 
-    TagFilterViewItem* item =
-        (TagFilterViewItem*)(tag->extraData(this));
+    TagFilterViewItem* item = (TagFilterViewItem*)(tag->extraData(this));
     if (!item)
         return;
 
@@ -369,8 +376,7 @@
         QListViewItem* oldPItem = item->parent();
         oldPItem->takeItem(item);
 
-        TagFilterViewItem* newPItem =
-            (TagFilterViewItem*)(newParent->extraData(this));
+        TagFilterViewItem* newPItem = (TagFilterViewItem*)(newParent->extraData(this));
         if (newPItem)
             newPItem->insertItem(item);
         else
@@ -380,8 +386,7 @@
     {
         takeItem(item);
 
-        TagFilterViewItem* newPItem =
-            (TagFilterViewItem*)(newParent->extraData(this));
+        TagFilterViewItem* newPItem = (TagFilterViewItem*)(newParent->extraData(this));
 
         if (newPItem)
             newPItem->insertItem(item);
@@ -399,8 +404,7 @@
     if (!tag)
         return;
 
-    TagFilterViewItem* item =
-        (TagFilterViewItem*)(album->extraData(this));
+    TagFilterViewItem* item = (TagFilterViewItem*)(album->extraData(this));
     if (!item)
         return;
 
@@ -504,6 +508,7 @@
     if (item)
     {
         popmenu.insertItem(SmallIcon("pencil"), i18n("Edit Tag Properties..."), 11);
+        popmenu.insertItem(SmallIcon("reload_page"), i18n("Reset Tag Icon"), 13);
         popmenu.insertItem(SmallIcon("edittrash"), i18n("Delete Tag"), 12);
     }
 
@@ -525,6 +530,12 @@
             tagDelete(item);
             break;
         }
+        case 13:
+        {
+            QString errMsg;
+            AlbumManager::instance()->updateTAlbumIcon(item->m_tag, QString(), 0, errMsg);
+            break;
+        }        
         default:
             break;
     }
@@ -623,19 +634,18 @@
 
     if (children)
     {
-        int result =
-            KMessageBox::warningContinueCancel(this, 
-                i18n("Tag '%1' has one subtag. "
-                     "Deleting this will also delete "
-                     "the subtag. "
-                     "Are you sure you want to continue?",
-                     "Tag '%1' has %n subtags. "
-                     "Deleting this will also delete "
-                     "the subtags. "
-                     "Are you sure you want to continue?",
-                     children).arg(tag->title()),
-                i18n("Delete Tag"),
-                KGuiItem(i18n("Delete"),"editdelete"));
+        int result = KMessageBox::warningContinueCancel(this,
+                     i18n("Tag '%1' has one subtag. "
+                          "Deleting this will also delete "
+                          "the subtag. "
+                          "Are you sure you want to continue?",
+                          "Tag '%1' has %n subtags. "
+                          "Deleting this will also delete "
+                          "the subtags. "
+                          "Are you sure you want to continue?",
+                          children).arg(tag->title()),
+                          i18n("Delete Tag"),
+                          KGuiItem(i18n("Delete"),"editdelete"));
 
         if(result == KMessageBox::Continue)
         {
@@ -646,9 +656,9 @@
     }
     else
     {
-        int result =
-            KMessageBox::warningContinueCancel(0, i18n("Delete '%1' tag?")
-                                       .arg(tag->title()),i18n("Delete Tag"), KGuiItem(i18n("Delete"),"editdelete"));
+        int result = KMessageBox::warningContinueCancel(0, i18n("Delete '%1' tag?")
+                                                        .arg(tag->title()),i18n("Delete Tag"),
+                                                        KGuiItem(i18n("Delete"), "editdelete"));
 
         if (result == KMessageBox::Continue)
         {
--- trunk/extragear/graphics/digikam/digikam/tagfilterview.h #579590:579591
@@ -1,7 +1,11 @@
 /* ============================================================
- * Author: Renchi Raju <renchi@pooh.tam.uiuc.edu>
- * Date  : 2005-05-05
+ * Authors: Renchi Raju <renchi@pooh.tam.uiuc.edu>
+ *          Caulier Gilles <caulier dot gilles at kdemail dot net>
+ * Date   : 2005-05-05
+ * Description : tags filter view
+ *
  * Copyright 2005 by Renchi Raju
+ * Copyright 2006 by Gilles Caulier
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -57,8 +61,7 @@
     void slotAlbumIconChanged(Album* album);
     void slotTimeOut();
     void slotContextMenu(QListViewItem*, const QPoint&, int);
-    void slotGotThumbnailFromIcon(Album *album,
-                                  const QPixmap& thumbnail);
+    void slotGotThumbnailFromIcon(Album *album, const QPixmap& thumbnail);
     void slotThumbnailLost(Album *album);
 
 private:
@@ -68,6 +71,8 @@
     void tagDelete(TagFilterViewItem* item);
     void setTagThumbnail(TAlbum *album);
 
+private:
+    
     TagFilterViewPriv *d;
 };
 
Comment 3 caulier.gilles 2006-09-01 14:39:39 UTC
SVN commit 579689 by cgilles:

digikam from trunk: set tag dile name to "tag" (default)
CCBUGS: 118526

 M  +1 -1      tagfilterview.cpp  
 M  +1 -1      tagfolderview.cpp  


--- trunk/extragear/graphics/digikam/digikam/tagfilterview.cpp #579688:579689
@@ -533,7 +533,7 @@
         case 13:
         {
             QString errMsg;
-            AlbumManager::instance()->updateTAlbumIcon(item->m_tag, QString(), 0, errMsg);
+            AlbumManager::instance()->updateTAlbumIcon(item->m_tag, QString("tag"), 0, errMsg);
             break;
         }        
         default:
--- trunk/extragear/graphics/digikam/digikam/tagfolderview.cpp #579688:579689
@@ -408,7 +408,7 @@
         case 13:
         {
             QString errMsg;
-            AlbumManager::instance()->updateTAlbumIcon(tag->getTag(), QString(), 0, errMsg);
+            AlbumManager::instance()->updateTAlbumIcon(tag->getTag(), QString("tag"), 0, errMsg);
             break;
         }
         default:
Comment 4 caulier.gilles 2006-09-01 14:47:19 UTC
SVN commit 579693 by cgilles:

digikam from trunk: new popup menu options to reset album/tag thumbs in comments & tags side bar tab
CCBUGS: 118526

 M  +28 -21    imagedescedittab.cpp  


--- trunk/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.cpp #579692:579693
@@ -571,32 +571,39 @@
     popmenu.insertItem(SmallIcon("tag"), i18n("New Tag..."), 10);
     if (!album->isRoot())
     {
-        popmenu.insertItem(SmallIcon("pencil"),    i18n("Edit Tag Properties..."), 11);
-        popmenu.insertItem(SmallIcon("edittrash"), i18n("Delete Tag"),             12);
+        popmenu.insertItem(SmallIcon("pencil"),      i18n("Edit Tag Properties..."), 11);
+        popmenu.insertItem(SmallIcon("reload_page"), i18n("Reset Tag Icon"),         13);        
+        popmenu.insertItem(SmallIcon("edittrash"),   i18n("Delete Tag"),             12);
     }
 
     switch (popmenu.exec(QCursor::pos()))
     {
-    case 10:
-    {
-        tagNew(album);
-        break;
+        case 10:
+        {
+            tagNew(album);
+            break;
+        }
+        case 11:
+        {
+            if (!album->isRoot())
+                tagEdit(album);
+            break;
+        }
+        case 12:
+        {
+            if (!album->isRoot())
+                tagDelete(album);
+            break;
+        }
+        case 13:
+        {
+            QString errMsg;
+            AlbumManager::instance()->updateTAlbumIcon(album, QString("tag"), 0, errMsg);
+            break;
+        }
+        default:
+            break;
     }
-    case 11:
-    {
-        if (!album->isRoot())
-            tagEdit(album);
-        break;
-    }
-    case 12:
-    {
-        if (!album->isRoot())
-            tagDelete(album);
-        break;
-    }
-    default:
-        break;
-    }
 }
 
 void ImageDescEditTab::tagNew(TAlbum* parAlbum)
Comment 5 caulier.gilles 2006-09-01 15:29:28 UTC
SVN commit 579716 by cgilles:

digikam from trunk: new button to reset tag thumb in tag properties dialog
CCBUGS: 118526

 M  +24 -10    tagcreatedlg.cpp  
 M  +1 -0      tagcreatedlg.h  


--- trunk/extragear/graphics/digikam/digikam/tagcreatedlg.cpp #579715:579716
@@ -204,8 +204,9 @@
 
     TagEditDlgPriv()
     {
-        titleEdit  = 0;
-        iconButton = 0;
+        titleEdit       = 0;
+        iconButton      = 0;
+        resetIconButton = 0;
     }
 
     KLineEdit   *titleEdit;
@@ -213,6 +214,7 @@
     QString      icon;
 
     QPushButton *iconButton;
+    QPushButton *resetIconButton;
 };
 
 TagEditDlg::TagEditDlg(QWidget *parent, TAlbum* album)
@@ -248,28 +250,31 @@
 
     QLabel *titleLabel = new QLabel(plainPage());
     titleLabel->setText(i18n("&Title:"));
-    gl->addWidget(titleLabel, 0, 0);
 
     d->titleEdit = new KLineEdit(plainPage());
     d->titleEdit->setText(album->title());
     titleLabel->setBuddy(d->titleEdit);
-    gl->addWidget(d->titleEdit, 0, 1);
-
     setFocusProxy(d->titleEdit);
 
     QLabel *iconTextLabel = new QLabel(plainPage());
     iconTextLabel->setText(i18n("&Icon:"));
-    gl->addWidget(iconTextLabel, 1, 0);
 
     d->iconButton = new QPushButton(plainPage());
     d->iconButton->setFixedSize(40, 40);
     iconTextLabel->setBuddy(d->iconButton);
-    gl->addWidget(d->iconButton, 1, 1);
+    
+    d->resetIconButton = new QPushButton(i18n("Reset"), plainPage());
 
     QSpacerItem* spacer = new QSpacerItem(0, 0, QSizePolicy::Minimum,
-                                          QSizePolicy::Expanding);
-    gl->addItem(spacer, 2, 1);
-
+                                           QSizePolicy::Expanding);
+    
+    gl->addWidget(titleLabel, 0, 0);
+    gl->addMultiCellWidget(d->titleEdit, 0, 0, 1, 3);
+    gl->addWidget(iconTextLabel, 1, 0);
+    gl->addWidget(d->iconButton, 1, 1);
+    gl->addWidget(d->resetIconButton, 1, 2);
+    gl->addItem(spacer, 1, 3);
+    
     grid->addMultiCellWidget(logo, 0, 0, 0, 0);
     grid->addMultiCellLayout(topLayout, 0, 1, 1, 1);
     grid->setRowStretch(1, 10);
@@ -279,6 +284,9 @@
     connect(d->iconButton, SIGNAL(clicked()),
             this, SLOT(slotIconChange()));
 
+    connect(d->resetIconButton, SIGNAL(clicked()),
+            this, SLOT(slotIconResetClicked()));
+            
     connect(d->titleEdit, SIGNAL(textChanged(const QString&)),
             this, SLOT(slotTitleChanged(const QString&)));
 
@@ -306,6 +314,12 @@
     return d->icon;
 }
 
+void TagEditDlg::slotIconResetClicked()
+{
+    d->icon = QString("tag");
+    d->iconButton->setIconSet(SyncJob::getTagThumbnail(d->icon, 20));
+}
+    
 void TagEditDlg::slotIconChange()
 {
 #if KDE_IS_VERSION(3,3,0)
--- trunk/extragear/graphics/digikam/digikam/tagcreatedlg.h #579715:579716
@@ -85,6 +85,7 @@
 private slots:
 
     void slotIconChange();
+    void slotIconResetClicked();
     void slotTitleChanged(const QString& newtitle);
     
 private: