[Digikam-devel] [Bug 176654] New: Buttons for setting album date in album properties not working

David Eriksson meldavid at acc.umu.se
Mon Dec 1 21:35:06 GMT 2008


http://bugs.kde.org/show_bug.cgi?id=176654

           Summary: Buttons for setting album date in album properties not
                    working
           Product: digikam
           Version: 0.10.0-svn
          Platform: Ubuntu Packages
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
        AssignedTo: digikam-devel at kde.org
        ReportedBy: meldavid at acc.umu.se


Version:           0.10.0-svn (using KDE 4.1.3)
Compiler:          gcc 4.3.2 cmake 2.6 
OS:                Linux
Installed from:    Ubuntu Packages

When clicking the Oldest or Newest buttons does nothing and clicking Average
gives a error message. I look in the code and it looks like these functions use
the old 0.9 database schema.
Here is a possible patch to solve the problem:

Index: digikam/libs/database/albumdb.cpp
===================================================================
--- digikam/libs/database/albumdb.cpp   (revision 891372)
+++ digikam/libs/database/albumdb.cpp   (working copy)
@@ -2700,8 +2700,9 @@
 QDate AlbumDB::getAlbumLowestDate(int albumID)
 {
     QList<QVariant> values;
-    d->db->execSql( QString("SELECT MIN(datetime) FROM Images "
-                            "WHERE album=? GROUP BY album"),
+    d->db->execSql( "SELECT MIN(creationDate) FROM ImageInformation "
+                    " LEFT JOIN Images ON Images.id=ImageInformation.imageid "
+                    " WHERE Images.album=? GROUP BY Images.album;",
                     albumID, &values );
     if (!values.isEmpty())
         return QDate::fromString( values.first().toString(), Qt::ISODate );
@@ -2712,8 +2713,9 @@
 QDate AlbumDB::getAlbumHighestDate(int albumID)
 {
     QList<QVariant> values;
-    d->db->execSql( QString("SELECT MAX(datetime) FROM Images "
-                            "WHERE album=? GROUP BY album"),
+    d->db->execSql( "SELECT MAX(creationDate) FROM ImageInformation "
+                    " LEFT JOIN Images ON Images.id=ImageInformation.imageid "
+                    " WHERE Images.album=? GROUP BY Images.album;",
                     albumID , &values );
     if (!values.isEmpty())
         return QDate::fromString( values.first().toString(), Qt::ISODate );
@@ -2724,7 +2726,9 @@
 QDate AlbumDB::getAlbumAverageDate(int albumID)
 {
     QList<QVariant> values;
-    d->db->execSql( QString("SELECT datetime FROM Images WHERE album=?"),
+    d->db->execSql( "SELECT creationDate FROM ImageInformation "
+                    " LEFT JOIN Images ON Images.id=ImageInformation.imageid "
+                    " WHERE Images.album=?;",
                     albumID , &values);

     int differenceInSecs = 0;


-- 
Configure bugmail: http://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the Digikam-devel mailing list