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

Gilles Caulier caulier.gilles at kdemail.net
Wed Jan 10 08:09:12 GMT 2007


------- 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  2007-01-10 09:09 -------
SVN commit 621996 by cgilles:

digikam from trunk : improve Comments edit widget Focus rule : this one is only set on when the Comments & Tab side bar is visible _and_ selected, else it is off.
CCBUGS: 131743, 131632

 M  +8 -3      imageproperties/imagedescedittab.cpp  
 M  +1 -1      imageproperties/imagedescedittab.h  
 M  +19 -11    imageproperties/imagepropertiessidebardb.cpp  
 M  +5 -3      imageproperties/imagepropertiessidebardb.h  
 M  +25 -23    widgets/common/sidebar.cpp  
 M  +11 -2     widgets/common/sidebar.h  


--- trunk/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.cpp #621995:621996
 @ -251,7 +251,7  @
     d->dateTimeEdit->installEventFilter(this);
     d->ratingWidget->installEventFilter(this);
     d->tagsView->installEventFilter(this);
-    setFocusToComments();
+    setFocusToComments(true);
     updateRecentTags();
 
     // Connect to album manager -----------------------------
 @ -553,9 +553,14  @
     d->revertBtn->setEnabled(true);
 }
 
-void ImageDescEditTab::setFocusToComments()
+void ImageDescEditTab::setFocusToComments(bool f)
 {
-    d->commentsEdit->setFocus();
+    DDebug() << "Comments focus = " << f << endl;
+
+    if (f)
+        d->commentsEdit->setFocus();
+    else
+        d->commentsEdit->clearFocus();
 }
 
 void ImageDescEditTab::assignRating(int rating)
--- trunk/extragear/graphics/digikam/libs/imageproperties/imagedescedittab.h #621995:621996
 @ -57,7 +57,7  @
     void assignRating(int rating);
     void setItem(ImageInfo *info=0);
     void populateTags();
-    void setFocusToComments();
+    void setFocusToComments(bool f);
 
 protected:
 
--- trunk/extragear/graphics/digikam/libs/imageproperties/imagepropertiessidebardb.cpp #621995:621996
 @ -1,10 +1,12  @
 /* ============================================================
- * Author: Caulier Gilles <caulier dot gilles at kdemail dot net>
- * Date  : 2004-11-17
+ * Authors: Caulier Gilles <caulier dot gilles at kdemail dot net>
+ *         Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
+ * Date   : 2004-11-17
  * Description : image properties side bar using data from 
  *               digiKam database.
  *
  * Copyright 2004-2006 by Gilles Caulier
+ * Copyright 2007 by Gilles Caulier and Marcel Wiesweg
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
 @ -94,6 +96,9  @
     connectTab(m_colorTab);
     connectTab(d->desceditTab);
 
+    connect(this, SIGNAL(signalViewChanged()),
+            this, SLOT(slotSetFocus()));
+
     connect(this, SIGNAL(signalChangedTab(QWidget*)),
             this, SLOT(slotChangedTab(QWidget*)));
 
 @ -177,9 +182,7  @
 
     NavigateBarTab *navtab = dynamic_cast<NavigateBarTab *>(getActiveTab());
     if (navtab)
-    {
         navtab->setNavigateBarState(d->hasPrevious, d->hasNext);
-    }
 }
 
 void ImagePropertiesSideBarDB::slotChangedTab(QWidget* tab)
 @ -255,16 +258,22  @
         navtab->setNavigateBarFileName(m_currentURL.filename());
     }
 
-    if (tab == d->desceditTab)
-    {
-        // 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();
-    }
+    slotSetFocus();
 
     unsetCursor();
 }
 
+void ImagePropertiesSideBarDB::slotSetFocus()
+{
+    // See B.K.O #131632 and #131743 : always give focus to Comments widget 
+    // when we toogle between tab and when we change current item.
+
+    if (getActiveTab() == d->desceditTab && isExpanded())
+        d->desceditTab->setFocusToComments(true);
+    else
+        d->desceditTab->setFocusToComments(false);
+}
+
 void ImagePropertiesSideBarDB::slotFileMetadataChanged(const KURL &url)
 {
     if (url == m_currentURL)
 @ -321,4 +330,3  @
 }
 
 }  // NameSpace Digikam
-
--- trunk/extragear/graphics/digikam/libs/imageproperties/imagepropertiessidebardb.h #621995:621996
 @ -1,10 +1,12  @
 /* ============================================================
- * Author: Caulier Gilles <caulier dot gilles at kdemail dot net>
- * Date  : 2004-11-17
+ * Authors: Caulier Gilles <caulier dot gilles at kdemail dot net>
+ *         Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
+ * Date   : 2004-11-17
  * Description : image properties side bar using data from 
  *               digiKam database.
  *
  * Copyright 2004-2006 by Gilles Caulier
+ * Copyright 2007 by Gilles Caulier and Marcel Wiesweg
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
 @ -85,6 +87,7  @
 
 private slots:
 
+    void slotSetFocus();
     void slotChangedTab(QWidget* tab);
     void slotThemeChanged();
     void slotFileMetadataChanged(const KURL &url);
 @ -98,7 +101,6  @
 private:
 
     ImagePropertiesSideBarDBPriv* d;
-
 };
 
 }  // NameSpace Digikam
--- trunk/extragear/graphics/digikam/libs/widgets/common/sidebar.cpp #621995:621996
 @ -5,7 +5,7  @
  * Description : a widget to manage sidebar in gui.
  *
  * Copyright 2005-2006 by Joern Ahrens
- * Copyright 2006 by Gilles Caulier  
+ * Copyright 2006-2007 by Gilles Caulier  
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
 @ -39,6 +39,7  @
 // Local includes.
 
 #include "sidebar.h"
+#include "sidebar.moc"
 
 namespace Digikam
 {
 @ -56,20 +57,20  @
         minimized = false;
     }
 
-    bool          minimizedDefault;
-    bool          minimized;
-    bool          isMinimized;         
+    bool           minimizedDefault;
+    bool           minimized;
+    bool           isMinimized;      // Backup of minimized status (used with Fullscreen)
 
-    int           tabs;
-    int           activeTab;
-    int           minSize;
-    int           maxSize;
+    int            tabs;
+    int            activeTab;
+    int            minSize;
+    int            maxSize;
         
-    QWidgetStack *stack;
-    QSplitter    *splitter;
-    QSize         bigSize;
+    QWidgetStack  *stack;
+    QSplitter     *splitter;
+    QSize          bigSize;
 
-    Sidebar::Side side;
+    Sidebar::Side  side;
 };
 
 Sidebar::Sidebar(QWidget *parent, const char *name, Side side, bool minimizedDefault)
 @ -77,7 +78,7  @
 {
     d = new SidebarPriv;
     d->minimizedDefault = minimizedDefault;
-    d->side = side;
+    d->side             = side;
 }
 
 Sidebar::~Sidebar()
 @ -131,7 +132,6  @
 {
     KConfig *config = kapp->config();
     config->setGroup(QString("%1").arg(name()));
-    
     config->writeEntry("ActiveTab", d->activeTab);
     config->writeEntry("Minimized", d->minimized);
     config->sync();
 @ -232,21 +232,19  @
 void Sidebar::shrink()
 {
     d->minimized = true;
-    d->bigSize = size();
-    d->minSize = minimumWidth();
-    d->maxSize = maximumWidth();
+    d->bigSize   = size();
+    d->minSize   = minimumWidth();
+    d->maxSize   = maximumWidth();
             
     d->stack->hide();
 
     KMultiTabBarTab* tab = tabs()->first();
     if (tab)
-    {
         setFixedWidth(tab->width());
-    }
     else
-    {
         setFixedWidth(width());
-    }
+
+    emit signalViewChanged();
 }
 
 void Sidebar::expand()
 @ -256,8 +254,12  @
     resize(d->bigSize);
     setMinimumWidth(d->minSize);
     setMaximumWidth(d->maxSize);
+    emit signalViewChanged();
 }
 
+bool Sidebar::isExpanded()
+{
+    return !d->minimized; 
+}
+
 }  // namespace Digikam
-
-#include "sidebar.moc"
--- trunk/extragear/graphics/digikam/libs/widgets/common/sidebar.h #621995:621996
 @ -5,7 +5,7  @
  * Description : a widget to manage sidebar in gui.
  *
  * Copyright 2005-2006 by Joern Ahrens
- * Copyright 2006 by Gilles Caulier  
+ * Copyright 2006-2007 by Gilles Caulier  
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
 @ -129,6 +129,11  @
      */ 
     void restore();
 
+    /**
+     * return the visible status of current sidebar tab.
+     */ 
+    bool isExpanded();
+
 private:
     
     
 @ -151,10 +156,14  @
      */
     void signalChangedTab(QWidget *w);
 
+    /**
+     * is emitted, when tab is shrink or expanded
+     */
+    void signalViewChanged();
+
 private:
     
     SidebarPriv* d;
-
 };
 
 }  // namespace Digikam



More information about the Digikam-devel mailing list