Bug 135060 - Folders without pictures in it cannot be assigned icons
Summary: Folders without pictures in it cannot be assigned icons
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Thumbs-Album (show other bugs)
Version: 0.9.0
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-03 21:09 UTC by Dieter Jurzitza
Modified: 2017-07-29 05:28 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 0.9.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dieter Jurzitza 2006-10-03 21:09:24 UTC
Version:           0.9.0-beta2 (using KDE KDE 3.5.4)
Installed from:    Compiled From Sources
OS:                Linux

If you have a folder in the picture database that only contains subfolders but no pictures, no icons may be assigned to it.
Let me visualize through an example:
<Holiday-travel> 
                 |- <Location one>-(picture1, picture2 ,,,,,)
                 |- <Location two>-(picture1, picture2 .....)

you can assign icons to <Location one> and <Location two>, but you can't assign one to <Holiday-travel> as long as there are no pictures within <Holiday-travel>.

Would be nice if that would be changed - make an icon an aribitrary property of the folder without reference to it's actual contents.

Thank you for all your work in advance,
take care


Dieter Jurzitza
Comment 1 Marcel Wiesweg 2006-10-04 16:20:15 UTC
Currently it is only possible to set images of the same album as thumbnails.

- leave it as is?
- allow from subalbums as well?
- no restriction, allow from any album?
Comment 2 Dieter Jurzitza 2006-10-05 22:28:14 UTC
My two cents here: make the preview image a generic attribute of the album. Why restrict it to pictures out of the current one? Any choice would become possible - whatever the user likes most.

Take care


Dieter Jurzitza
Comment 3 Marcel Wiesweg 2006-10-12 13:39:17 UTC
SVN commit 594810 by mwiesweg:

Allow the freedom to assign albums thumbnails from any other album.
Backport functionality from Tags icons.

BUG: 135060


 M  +2 -1      NEWS  
 M  +20 -10    digikam/albumdb.cpp  
 M  +7 -0      digikam/albumfolderview.cpp  


--- trunk/extragear/graphics/digikam/NEWS #594809:594810
@@ -301,6 +301,7 @@
 180 ==> 135145 : Raw image converter fails on my raw files (cr2, crw, dng).
 181 ==> 125727 : digiKam open with of raw file only shows application for octet-stream.
 182 ==> 135430 : Typo automaticly should be automatically in raw image converter.
-183 ==> 
+183 ==> 135060 : Folders without pictures in it cannot be assigned icons
+184 ==> 
 
 ----------------------------------------------------------------------------------------------------
--- trunk/extragear/graphics/digikam/digikam/albumdb.cpp #594809:594810
@@ -306,10 +306,13 @@
     QString basePath(AlbumManager::instance()->getLibraryPath());
 
     QStringList values;
-    execSql( "SELECT A.id, A.url, A.date, A.caption, A.collection, I.name \n "
-             "FROM Albums AS A LEFT OUTER JOIN Images AS I \n "
-             "ON A.icon=I.id;", &values);
+    execSql( "SELECT A.id, A.url, A.date, A.caption, A.collection, B.url, I.name \n "
+             "FROM Albums AS A \n "
+             "  LEFT OUTER JOIN Images AS I ON A.icon=I.id \n"
+             "  LEFT OUTER JOIN Albums AS B ON B.id=I.dirid;", &values);
 
+    QString iconAlbumUrl, iconName;
+
     for (QStringList::iterator it = values.begin(); it != values.end();)
     {
         AlbumInfo info;
@@ -324,11 +327,15 @@
         ++it;
         info.collection = *it;
         ++it;
-        if (!(*it).isEmpty())
+        iconAlbumUrl = *it;
+        ++it;
+        iconName = *it;
+        ++it;
+
+        if (!iconName.isEmpty())
         {
-            info.icon = basePath + info.url + '/' + *it;
+            info.icon = basePath + iconAlbumUrl + '/' + iconName;
         }
-        ++it;
 
         aList.append(info);
     }
@@ -464,9 +471,11 @@
 QString AlbumDB::getAlbumIcon(int albumID)
 {
     QStringList values;
-    execSql( QString("SELECT Albums.url, Images.name FROM Albums "
-                     "LEFT OUTER JOIN Images ON Albums.icon=Images.id "
-                     "WHERE Albums.id=%1;")
+    execSql( QString("SELECT B.url, I.name \n "
+                     "FROM Albums AS A \n "
+                     "  LEFT OUTER JOIN Images AS I ON I.id=T.icon \n "
+                     "  LEFT OUTER JOIN Albums AS B ON B.id=I.dirid \n "
+                     "WHERE T.id=%1;")
              .arg(albumID), &values );
     if (values.isEmpty())
         return QString();
@@ -549,7 +558,8 @@
 {
     QStringList values;
     execSql( QString("SELECT A.url, I.name, T.iconkde \n "
-                     "FROM Tags AS T LEFT OUTER JOIN Images AS I ON I.id=T.icon \n "
+                     "FROM Tags AS T \n "
+                     "  LEFT OUTER JOIN Images AS I ON I.id=T.icon \n "
                      "  LEFT OUTER JOIN Albums AS A ON A.id=I.dirid \n "
                      "WHERE T.id=%1;")
              .arg(tagID), &values );
--- trunk/extragear/graphics/digikam/digikam/albumfolderview.cpp #594809:594810
@@ -958,6 +958,8 @@
             popMenu.insertTitle(SmallIcon("digikam"), i18n("My Albums"));
             popMenu.insertItem( SmallIcon("goto"), i18n("&Move Here"), 10 );
             popMenu.insertItem( SmallIcon("editcopy"), i18n("&Copy Here"), 11 );
+            if (imageIDs.count() == 1)
+                popMenu.insertItem(i18n("Set as Album Thumbnail"), 12);
             popMenu.insertSeparator(-1);
             popMenu.insertItem( SmallIcon("cancel"), i18n("C&ancel") );
             popMenu.setMouseTracking(true);
@@ -980,6 +982,11 @@
                         SLOT(slotDIOResult(KIO::Job*)));
                 break;
             }
+            case 12:
+            {
+                QString errMsg;
+                AlbumManager::instance()->updatePAlbumIcon(destAlbum, imageIDs.first(), errMsg);
+            }
             default:
                 break;
         }