[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE
From:       David Faure <faure () kde ! org>
Date:       2009-11-28 21:44:49
Message-ID: 1259444689.738169.31903.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1055858 by dfaure:

Forwardport 1055856: Fix wrong initial focus in CategorySelectDialog -- made me lose \
a few seconds for each event I created :-)

Apparently the re-creation of the layout in KDialog loses the focuswidget; so fixing \
the bug there, and removing the enterEvent workaround in CategorySelectDialog itself \
(IMHO, better have correct focus upfront, without moving the mouse into the widget).


 M  +8 -0      kdelibs/kdeui/dialogs/kdialog.cpp  
 M  +1 -7      kdepim/libkdepim/categoryselectdialog.cpp  
 M  +0 -3      kdepim/libkdepim/categoryselectdialog.h  


--- trunk/KDE/kdelibs/kdeui/dialogs/kdialog.cpp #1055857:1055858
@@ -69,6 +69,10 @@
 
   Q_Q(KDialog);
 
+    // Don't lose the focus widget when re-creating the layout.
+    // Testcase: KOrganizer's "Select Categories" dialog
+    QPointer<QWidget> focusWidget = mMainWidget ? mMainWidget->focusWidget() : 0;
+
   if (q->layout() && q->layout() != mTopLayout) {
       kWarning(240) << q->metaObject()->className() << "created with a layout; don't \
do that, KDialog takes care of it, use mainWidget or setMainWidget instead";  delete \
q->layout(); @@ -97,6 +101,10 @@
     mButtonBox->setOrientation( mButtonOrientation );
     mTopLayout->addWidget( mButtonBox );
   }
+
+    if (focusWidget) {
+        focusWidget->setFocus();
+    }
 }
 
 void KDialogPrivate::setButtonFocus(QPushButton *button, bool isDefault, bool \
                isFocus)
--- trunk/KDE/kdepim/libkdepim/categoryselectdialog.cpp #1055857:1055858
@@ -188,7 +188,7 @@
   lay->addWidget( mWidgets );
 
   mWidgets->setCategories();
-  mWidgets->setFocus();
+  mWidgets->listView()->setFocus();
 
   connect( mWidgets, SIGNAL(editCategories()), SIGNAL(editCategories()) );
 
@@ -243,10 +243,4 @@
   mWidgets->setSelected( selList );
 }
 
-void CategorySelectDialog::enterEvent( QEvent *event )
-{
-  Q_UNUSED( event );
-  mWidgets->listView()->setFocus();
-}
-
 #include "categoryselectdialog.moc"
--- trunk/KDE/kdepim/libkdepim/categoryselectdialog.h #1055857:1055858
@@ -88,9 +88,6 @@
     void categoriesSelected( const QStringList & );
     void editCategories();
 
-  protected:
-    /*reimp*/void enterEvent( QEvent * );
-
   private:
     CategorySelectWidget *mWidgets;
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic