~ubuntu-branches/ubuntu/edgy/digikam/edgy-proposed

« back to all changes in this revision

Viewing changes to debian/patches/11_kdesvn_r508791_add_more_options_to_albumproperties.diff

  • Committer: Bazaar Package Importer
  • Author(s): Achim Bohnet
  • Date: 2006-05-15 01:15:02 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515011502-kpyuz7766hpbuia8
Tags: 0.8.2~rc1-0ubuntu1
* sync with debian (UVF see #44102)
  0.8.2~rc1-0ubuntu1 is identical to debian's 0.8.1+0.8.2-rc1-1.
  Version was changed due to latest 0.8.1.ubuntu-0ubuntu1 upload.
  This version is unfortunately bigger than debian's 0.8.1+0.8.2-rc1-1
* Merge in ubuntu changelog

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Index: digikam/digikam/albumpropsedit.cpp
2
 
===================================================================
3
 
--- digikam/digikam/albumpropsedit.cpp  (revision 508790)
4
 
+++ digikam/digikam/albumpropsedit.cpp  (revision 508791)
5
 
@@ -33,6 +33,7 @@
6
 
 #include <qlistview.h>
7
 
 #include <qframe.h>
8
 
 #include <qheader.h>
9
 
+#include <qhbox.h>
10
 
 #include <qpushbutton.h>
11
 
 
12
 
 // KDE includes.
13
 
@@ -129,11 +130,22 @@
14
 
     topLayout->addWidget( datePicker_, 5, 1 );
15
 
     dateLabel->setBuddy( datePicker_ );
16
 
 
17
 
-    QPushButton *avgButton = new QPushButton( 
18
 
-                                i18n("This is a button which calculates "
19
 
-                                     "the average date",
20
 
-                                     "&Average" ), plainPage( ) );
21
 
-    topLayout->addWidget( avgButton, 6, 1);
22
 
+    QHBox *buttonRow = new QHBox( plainPage( ) );
23
 
+    QPushButton *dateLowButton = new QPushButton( 
24
 
+            i18n("Button to select the date of the first image", 
25
 
+                 "&Lowest" ), 
26
 
+            buttonRow );
27
 
+    QPushButton *dateAvgButton = new QPushButton( 
28
 
+            i18n("This is a button which calculates the average date",
29
 
+                 "&Average" ), 
30
 
+            buttonRow );
31
 
+    QPushButton *dateHighButton = new QPushButton( 
32
 
+            i18n("Button to select the date of the last image", 
33
 
+                 "&Highest" ), 
34
 
+    buttonRow );
35
 
+    
36
 
+    
37
 
+    topLayout->addWidget( buttonRow, 6, 1);
38
 
 
39
 
     setTabOrder(titleEdit_, collectionCombo_);
40
 
     setTabOrder(collectionCombo_, commentsEdit_);
41
 
@@ -174,8 +186,12 @@
42
 
 
43
 
     connect(titleEdit_, SIGNAL(textChanged(const QString&)),
44
 
             SLOT(slotTitleChanged(const QString&)));
45
 
-    connect(avgButton, SIGNAL( clicked() ),
46
 
-            SLOT( slotAverageButtonClicked()));
47
 
+    connect(dateLowButton, SIGNAL( clicked() ),
48
 
+            SLOT( slotDateLowButtonClicked()));
49
 
+    connect(dateAvgButton, SIGNAL( clicked() ),
50
 
+            SLOT( slotDateAverageButtonClicked()));
51
 
+    connect(dateHighButton, SIGNAL( clicked() ),
52
 
+            SLOT( slotDateHighButtonClicked()));
53
 
     
54
 
     adjustSize();
55
 
 }
56
 
@@ -272,11 +288,35 @@
57
 
     enableButtonOK(!newtitle.isEmpty());    
58
 
 }
59
 
 
60
 
-void AlbumPropsEdit::slotAverageButtonClicked()
61
 
+void AlbumPropsEdit::slotDateLowButtonClicked()
62
 
 {
63
 
     setCursor( KCursor::waitCursor() );
64
 
 
65
 
     AlbumDB* db = AlbumManager::instance()->albumDB();
66
 
+    QDate avDate = db->getAlbumLowestDate( album_->id() );
67
 
+    setCursor( KCursor::arrowCursor() );
68
 
+
69
 
+    if ( avDate.isValid() )
70
 
+        datePicker_->setDate( avDate );
71
 
+}
72
 
+
73
 
+void AlbumPropsEdit::slotDateHighButtonClicked()
74
 
+{
75
 
+    setCursor( KCursor::waitCursor() );
76
 
+
77
 
+    AlbumDB* db = AlbumManager::instance()->albumDB();
78
 
+    QDate avDate = db->getAlbumHighestDate( album_->id() );
79
 
+    setCursor( KCursor::arrowCursor() );
80
 
+
81
 
+    if ( avDate.isValid() )
82
 
+        datePicker_->setDate( avDate );
83
 
+}
84
 
+
85
 
+void AlbumPropsEdit::slotDateAverageButtonClicked()
86
 
+{
87
 
+    setCursor( KCursor::waitCursor() );
88
 
+
89
 
+    AlbumDB* db = AlbumManager::instance()->albumDB();
90
 
     QDate avDate = db->getAlbumAverageDate( album_->id() );
91
 
     setCursor( KCursor::arrowCursor() );
92
 
 
93
 
Index: digikam/digikam/albumdb.cpp
94
 
===================================================================
95
 
--- digikam/digikam/albumdb.cpp (revision 508790)
96
 
+++ digikam/digikam/albumdb.cpp (revision 508791)
97
 
@@ -1060,6 +1060,26 @@
98
 
     return values[0];
99
 
 }
100
 
 
101
 
+QDate AlbumDB::getAlbumLowestDate(int albumID)
102
 
+{
103
 
+    QStringList values;
104
 
+    execSql( QString("SELECT MIN(datetime) FROM Images "
105
 
+                     "WHERE dirid=%1 GROUP BY dirid")
106
 
+            .arg( albumID ), &values);
107
 
+    QDate itemDate = QDate::fromString( values[0], Qt::ISODate );
108
 
+    return itemDate;
109
 
+}
110
 
+
111
 
+QDate AlbumDB::getAlbumHighestDate(int albumID)
112
 
+{
113
 
+    QStringList values;
114
 
+    execSql( QString("SELECT MAX(datetime) FROM Images "
115
 
+                     "WHERE dirid=%1 GROUP BY dirid")
116
 
+            .arg( albumID ), &values);
117
 
+    QDate itemDate = QDate::fromString( values[0], Qt::ISODate );
118
 
+    return itemDate;
119
 
+}
120
 
+
121
 
 QDate AlbumDB::getAlbumAverageDate(int albumID)
122
 
 {
123
 
     QStringList values;
124
 
Index: digikam/digikam/albumpropsedit.h
125
 
===================================================================
126
 
--- digikam/digikam/albumpropsedit.h    (revision 508790)
127
 
+++ digikam/digikam/albumpropsedit.h    (revision 508791)
128
 
@@ -84,7 +84,9 @@
129
 
 
130
 
 private slots:
131
 
    void slotTitleChanged(const QString& newtitle);
132
 
-   void slotAverageButtonClicked();
133
 
+   void slotDateLowButtonClicked();
134
 
+   void slotDateAverageButtonClicked();
135
 
+   void slotDateHighButtonClicked();
136
 
 };
137
 
 
138
 
 #endif /* ALBUMPROPSEDIT_H */
139
 
Index: digikam/digikam/albumdb.h
140
 
===================================================================
141
 
--- digikam/digikam/albumdb.h   (revision 508790)
142
 
+++ digikam/digikam/albumdb.h   (revision 508791)
143
 
@@ -442,9 +442,23 @@
144
 
     QString getAlbumURL(int albumID);
145
 
 
146
 
     /**
147
 
+     * Returns the lowest/oldest date of all images for that album.
148
 
+     * @param albumID the id of the album to calculate
149
 
+     * @return the date.
150
 
+     */
151
 
+    QDate getAlbumLowestDate(int albumID);
152
 
+    
153
 
+    /**
154
 
+     * Returns the highest/newest date of all images for that album.
155
 
+     * @param albumID the id of the album to calculate
156
 
+     * @return the date.
157
 
+     */
158
 
+    QDate getAlbumHighestDate(int albumID);
159
 
+
160
 
+    /**
161
 
      * Returns the average date of all images for that album.
162
 
-     * @param albumID the id of the album to calculate the average in
163
 
-     * @return the average date.
164
 
+     * @param albumID the id of the album to calculate
165
 
+     * @return the date.
166
 
      */
167
 
     QDate getAlbumAverageDate(int albumID);
168