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

List:       kde-commits
Subject:    branches/work/akonadi-ports/kdepim/korganizer
From:       Frank Osterfeld <frank.osterfeld () kdemail ! net>
Date:       2009-11-13 15:19:57
Message-ID: 1258125597.268727.31855.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1048581 by osterfeld:

make the typeahead work again. for some reason, the widget gets the focusInEvent way \
before the global focus widget is updated, thus keyevents went to the wrong widget \
triggering a new event dialog for each keystroke.



 M  +0 -2      kodialogmanager.cpp  
 M  +16 -0     koeventview.cpp  
 M  +9 -7      koeventview.h  


--- branches/work/akonadi-ports/kdepim/korganizer/kodialogmanager.cpp \
#1048580:1048581 @@ -240,8 +240,6 @@
 {
   if ( editor && view ) {
     view->setTypeAheadReceiver( editor->typeAheadReceiver() );
-    connect( editor, SIGNAL(focusReceivedSignal()),
-             view, SLOT(finishTypeAhead()) );
   }
 }
 
--- branches/work/akonadi-ports/kdepim/korganizer/koeventview.cpp #1048580:1048581
@@ -51,6 +51,11 @@
   mReturnPressed = false;
   mTypeAhead = false;
   mTypeAheadReceiver = 0;
+
+  //AKONADI_PORT review: the FocusLineEdit in the editor emits \
focusReceivedSignal(), which triggered finishTypeAhead. +  //But the global focus \
widget in QApplication is changed later, thus subsequent keyevents still went to this \
view, triggering another editor, for each keypress +  //Thus listen to the global \
focusChanged() signal (seen with Qt 4.6-stable-patched 20091112 -Frank) +  connect( \
QApplication::instance(), SIGNAL(focusChanged(QWidget*,QWidget*)), this, \
SLOT(focusChanged(QWidget*,QWidget*)) );  }
 
 //---------------------------------------------------------------------------
@@ -269,6 +274,17 @@
   return false;
 }
 
+void KOEventView::setTypeAheadReceiver( QObject *o )
+{
+  mTypeAheadReceiver = o;
+}
+
+void KOEventView::focusChanged( QWidget*, QWidget* now )
+{
+  if ( mTypeAhead && now && now == mTypeAheadReceiver )
+    finishTypeAhead();
+}
+
 void KOEventView::finishTypeAhead()
 {
   if ( mTypeAheadReceiver ) {
--- branches/work/akonadi-ports/kdepim/korganizer/koeventview.h #1048580:1048581
@@ -102,7 +102,7 @@
      * Sets the QObject that will receive key events that were made
      * while the new event dialog was still being created.
      */
-    void setTypeAheadReceiver( QObject *o ) { mTypeAheadReceiver = o; }
+    void setTypeAheadReceiver( QObject *o );
 
     /*
      * Returns true if the view item, that represents a to-do, should use the \
"completed" @@ -118,12 +118,7 @@
 
   public slots:
 
-    /*
-     * This is called when the new event dialog is shown. It sends
-     * all events in mTypeAheadEvents to the receiver.
-     */
-    void finishTypeAhead();
-
+    void focusChanged( QWidget*, QWidget* );
     /**
      Perform the default action for an incidence, e.g. open the event editor,
      when double-clicking an event in the agenda view.
@@ -159,7 +154,14 @@
     Akonadi::Item mCurrentIncidence;  // Incidence selected e.g. for a context menu
 
   private:
+    /*
+     * This is called when the new event dialog is shown. It sends
+     * all events in mTypeAheadEvents to the receiver.
+     */
+    void finishTypeAhead();
 
+  private:
+
     /* When we receive a QEvent with a key_Return release
      * we will only show a new event dialog if we previously received a
      * key_Return press, otherwise a new event dialog appears when


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

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