[Digikam-devel] [Bug 131743] Comments and tag edit widgets should retain focus when changing image

Gilles Caulier caulier.gilles at kdemail.net
Fri Dec 22 13:16:01 GMT 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=131743         




------- Additional Comments From caulier.gilles kdemail net  2006-12-22 14:16 -------
SVN commit 615731 by cgilles:

digikam from trunk : Always give the keyboard focus to the Comments text edit widget from Comments & Tags when we change the active sidebar tab.
CCBUGS: 131743




 M  +61 -59    imagedescedittab.cpp  
 M  +1 -0      imagedescedittab.h  
 M  +9 -5      imagepropertiessidebardb.cpp  


--- trunk/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.cpp #615730:615731
 @ -251,7 +251,7  @
     d->dateTimeEdit->installEventFilter(this);
     d->ratingWidget->installEventFilter(this);
     d->tagsView->installEventFilter(this);
-    d->commentsEdit->setFocus();
+    setFocusToComments();
     updateRecentTags();
 
     // Connect to album manager -----------------------------
 @ -317,53 +317,6  @
     delete d;
 }
 
-bool ImageDescEditTab::eventFilter(QObject *, QEvent *e)
-{
-    if ( e->type() == QEvent::KeyPress )
-    {
-        QKeyEvent *k = (QKeyEvent *)e;
-        if (k->state() == Qt::ControlButton &&
-            (k->key() == Qt::Key_Enter || k->key() == Qt::Key_Return))
-        {
-            emit signalNextItem();
-            return true;
-        }
-        else if (k->state() == Qt::ShiftButton &&
-                 (k->key() == Qt::Key_Enter || k->key() == Qt::Key_Return))
-        {
-            emit signalPrevItem();
-            return true;
-        }
-
-        return false;
-    }
-    
-    return false;
-}
-
-void ImageDescEditTab::populateTags()
-{
-    d->tagsView->clear();
-
-    AlbumList tList = AlbumManager::instance()->allTAlbums();
-    for (AlbumList::iterator it = tList.begin(); it != tList.end(); ++it)
-    {
-        TAlbum *tag = (TAlbum*)(*it);
-        slotAlbumAdded(tag);
-    }
-}
-
-void ImageDescEditTab::slotModified()
-{
-    d->modified = true;
-    d->applyBtn->setEnabled(true);
-}
-
-void ImageDescEditTab::assignRating(int rating)
-{
-    d->ratingWidget->setRating(rating);
-}
-
 void ImageDescEditTab::slotApplyAllChanges()
 {
     if (!d->modified)
 @ -401,28 +354,28  @
 
     if (AlbumSettings::instance())
     {
-	bool dirty = false;
+        bool dirty = false;
         DMetadata metadata(d->currInfo->filePath());
 
         if (AlbumSettings::instance()->getSaveComments())
         {
             // Store comments in image as JFIF comments, Exif comments, and Iptc Comments.
             metadata.setImageComment(d->commentsEdit->text());
-	    dirty = true;
+            dirty = true;
         }
 
         if (AlbumSettings::instance()->getSaveDateTime())
         {
             // Store Image Date & Time as Exif and Iptc tags.
             metadata.setImageDateTime(d->dateTimeEdit->dateTime(), false);
-	    dirty = true;
+            dirty = true;
         }
 
         if (AlbumSettings::instance()->getSaveIptcRating())
         {
             // Store Image rating as Iptc tag.
             metadata.setImageRating(d->ratingWidget->rating());
-	    dirty = true;
+            dirty = true;
         }
 
         if (AlbumSettings::instance()->getSaveIptcTags())
 @ -433,7 +386,7  @
                 (*it).remove(0, 1);
     
             metadata.setImageKeywords(oldKeywords, tagPaths);
-	    dirty = true;
+            dirty = true;
         }
 
         if (AlbumSettings::instance()->getSaveIptcPhotographerId())
 @ -441,7 +394,7  @
             // Store Photograph indentity into Iptc tags.
             metadata.setImagePhotographerId(AlbumSettings::instance()->getIptcAuthor(),
                                             AlbumSettings::instance()->getIptcAuthorTitle());
-	    dirty = true;
+            dirty = true;
         }
 
         if (AlbumSettings::instance()->getSaveIptcCredits())
 @ -450,14 +403,14  @
             metadata.setImageCredits(AlbumSettings::instance()->getIptcCredit(),
                                      AlbumSettings::instance()->getIptcSource(),
                                      AlbumSettings::instance()->getIptcCopyright());
-	    dirty = true;
+            dirty = true;
         }
 
-	if (dirty)
-	{
+        if (dirty)
+        {
             metadata.applyChanges();
             ImageAttributesWatch::instance()->fileMetadataChanged(d->currInfo->kurl());
-	}
+        }
     }
 
     d->modified = false;
 @ -502,11 +455,60  @
     updateDate();
     updateTagsView();
     update();
+}
 
-    // See B.K.O #131632 and #131743 : always give focus to Comments widget.
+bool ImageDescEditTab::eventFilter(QObject *, QEvent *e)
+{
+    if ( e->type() == QEvent::KeyPress )
+    {
+        QKeyEvent *k = (QKeyEvent *)e;
+        if (k->state() == Qt::ControlButton &&
+            (k->key() == Qt::Key_Enter || k->key() == Qt::Key_Return))
+        {
+            emit signalNextItem();
+            return true;
+        }
+        else if (k->state() == Qt::ShiftButton &&
+                 (k->key() == Qt::Key_Enter || k->key() == Qt::Key_Return))
+        {
+            emit signalPrevItem();
+            return true;
+        }
+
+        return false;
+    }
+    
+    return false;
+}
+
+void ImageDescEditTab::populateTags()
+{
+    d->tagsView->clear();
+
+    AlbumList tList = AlbumManager::instance()->allTAlbums();
+    for (AlbumList::iterator it = tList.begin(); it != tList.end(); ++it)
+    {
+        TAlbum *tag = (TAlbum*)(*it);
+        slotAlbumAdded(tag);
+    }
+}
+
+void ImageDescEditTab::slotModified()
+{
+    d->modified = true;
+    d->applyBtn->setEnabled(true);
+}
+
+void ImageDescEditTab::setFocusToComments()
+{
     d->commentsEdit->setFocus();
 }
 
+void ImageDescEditTab::assignRating(int rating)
+{
+    d->ratingWidget->setRating(rating);
+}
+
 void ImageDescEditTab::updateTagsView()
 {
     d->tagsView->blockSignals(true);
--- trunk/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.h #615730:615731
 @ -56,6 +56,7  @
     void assignRating(int rating);
     void setItem(ImageInfo *info=0, int itemType=0);
     void populateTags();
+    void setFocusToComments();
 
 signals:
 
--- trunk/extragear/graphics/digikam/libs/imageproperties/imagepropertiessidebardb.cpp #615730:615731
 @ -41,13 +41,14  @
 #include "themeengine.h"
 #include "albumiconitem.h"
 #include "albumiconview.h"
+#include "navigatebarwidget.h"
+#include "imagedescedittab.h"
+#include "imageattributeswatch.h"
 #include "imagepropertiestab.h"
 #include "imagepropertiesmetadatatab.h"
 #include "imagepropertiescolorstab.h"
-#include "imagedescedittab.h"
-#include "navigatebarwidget.h"
 #include "imagepropertiessidebardb.h"
-#include "imageattributeswatch.h"
+#include "imagepropertiessidebardb.moc"
 
 namespace Digikam
 {
 @ -225,7 +226,7  @
     setCursor(KCursor::waitCursor());
 
     // No database data available, for example in the case of image editor is 
-    // launched from camera GUI.
+    // started from camera GUI.
     if (!d->currentInfo)
     {
         if (tab == m_propertiesTab && !m_dirtyPropertiesTab)
 @ -285,6 +286,10  @
         }
     }
 
+    // See B.K.O #131632 and #131743 : always give focus to Comments widget 
+    // when we toogle between tab and when we change current item.
+    d->desceditTab->setFocusToComments();
+
     unsetCursor();
 }
 
 @ -345,4 +350,3  @
 
 }  // NameSpace Digikam
 
-#include "imagepropertiessidebardb.moc"



More information about the Digikam-devel mailing list