[Digikam-devel] extragear/graphics/digikam

Tom Albers tomalbers at kde.nl
Wed Jul 27 15:35:45 BST 2005


SVN commit 439265 by toma:

Adds the possibility to change the database date and time in the commentseditor. Couple of things left:
- the view should be refresh, because the date can be changed the order can shift. Howto do that?
- The widget used is not the perfect widget imho, but there is no other one available.
- The place of the widget can move. I think this is the best place though.
- Should the date be written back in the exif-headers?

CCMAIL:digikam-devel at kde.org


 M  +0 -2      TODO  
 M  +12 -2     digikam/imagedescedit.cpp  
 M  +2 -0      digikam/imagedescedit.h  
 M  +7 -0      digikam/imageinfo.cpp  
 M  +6 -0      digikam/imageinfo.h  


--- trunk/extragear/graphics/digikam/TODO #439264:439265
@@ -1,8 +1,6 @@
 
 * Copy/Paste [JA]
 
-* allow user to edit dates (maybe through comments tag editor) [TA]
-
 * Tina's Tag Usability Recommendations:
 (http://www.uni-koblenz.de/~trilliti/digikam_tagging/main.html). 
 Following items have been agreed on (rest are in dispute):
--- trunk/extragear/graphics/digikam/digikam/imagedescedit.cpp #439264:439265
@@ -29,6 +29,7 @@
 #include <kconfig.h>
 #include <kfilemetainfo.h>
 #include <klineedit.h>
+#include <kdatetimewidget.h>
 
 #include <qframe.h>
 #include <qlabel.h>
@@ -110,14 +111,20 @@
     thumbBoxLayout->addWidget(m_nameLabel, 0, Qt::AlignCenter);
     topLayout->addWidget(thumbBox, 0, 0);
 
+    QHGroupBox* dateTimeBox = new QHGroupBox(i18n("Date and Time"), plainPage());
+    m_dateTimeEdit = new KDateTimeWidget( dateTimeBox,"datepicker");
+    topLayout->addWidget(dateTimeBox, 1, 0);
+    
     QVGroupBox* commentsBox = new QVGroupBox(i18n("Comments"), plainPage());
     m_commentsEdit = new KTextEdit(commentsBox);
     m_commentsEdit->setTextFormat(QTextEdit::PlainText);
     m_commentsEdit->setCheckSpellingEnabled(true);
-    topLayout->addWidget(commentsBox, 1, 0);
+    topLayout->addWidget(commentsBox, 2, 0);
 
     connect(m_commentsEdit, SIGNAL(textChanged()),
             SLOT(slotModified()));
+    connect(m_dateTimeEdit, SIGNAL(valueChanged()),
+            SLOT(slotModified()));
 
     
     // Tags view ---------------------------------------------------
@@ -147,7 +154,7 @@
     m_recentTagsBtn = new QPushButton(i18n("Recent Tags"), tagsBox);
     tagsBoxLayout->addWidget(m_recentTagsBtn);
 
-    topLayout->addMultiCellWidget(tagsBox, 0, 1, 1, 1);
+    topLayout->addMultiCellWidget(tagsBox, 0, 2, 1, 1);
 
     m_tagsView->addColumn(i18n( "Tags" ));
     m_tagsView->header()->hide();
@@ -174,6 +181,7 @@
     resize(configDialogSize("Image Description Dialog"));
 
     m_commentsEdit->installEventFilter(this);
+    m_dateTimeEdit->installEventFilter(this);
     m_tagsView->installEventFilter(this);
 
     m_commentsEdit->setFocus();
@@ -330,6 +338,7 @@
     if (m_modified)
     {
         info->setCaption(m_commentsEdit->text());
+        info->setDateTime(m_dateTimeEdit->dateTime());
 
         if (AlbumSettings::instance() &&
             AlbumSettings::instance()->getSaveExifComments())
@@ -415,6 +424,7 @@
     m_nameLabel->setText(info->name());
     m_thumbLabel->setPixmap(QPixmap());
     m_commentsEdit->setText(info->caption());
+    m_dateTimeEdit->setDateTime(info->dateTime());
 
     QValueList<int> tagIDs = info->tagIDs();
 
--- trunk/extragear/graphics/digikam/digikam/imagedescedit.h #439264:439265
@@ -40,6 +40,7 @@
 
 class KTextEdit;
 class KLineEdit;
+class KDateTimeWidget;
 
 class AlbumIconView;
 class AlbumIconItem;
@@ -74,6 +75,7 @@
     QPushButton   *m_recentTagsBtn;
     KLineEdit     *m_tagsSearchEdit;
     QToolButton   *m_tagsSearchClearBtn;
+    KDateTimeWidget *m_dateTimeEdit;
     bool           m_modified;
 
     void tagNew(TAlbum* parAlbum);
--- trunk/extragear/graphics/digikam/digikam/imageinfo.cpp #439264:439265
@@ -163,6 +163,13 @@
     return m_viewitem;
 }
 
+void ImageInfo::setDateTime(const QDateTime dateTime)
+{
+    AlbumDB* db  = m_man->albumDB();
+    db->setItemDate(m_ID, dateTime);
+    m_datetime = dateTime;
+}
+
 void ImageInfo::setCaption(const QString& caption)
 {
     AlbumDB* db  = m_man->albumDB();
--- trunk/extragear/graphics/digikam/digikam/imageinfo.h #439264:439265
@@ -144,6 +144,12 @@
     void  setCaption(const QString& caption);
 
     /**
+     * Set the date and time (write it to database)
+     * @param dateTime the new date and time.
+     */
+    void setDateTime(const QDateTime dateTime);
+
+    /**
      * @return a list of names of all tags assigned to this item
      * @see tagPaths
      */



More information about the Digikam-devel mailing list