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

List:       kde-commits
Subject:    branches/kdepim/enterprise/kdepim/korganizer
From:       Sergio Luis Martins <iamsergio () gmail ! com>
Date:       2010-12-13 13:30:17
Message-ID: 20101213133017.0A232AC8A7 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1206125 by smartins:

Distlist expansion was only working when pressing return.

kolab/issue4660,issue4119

 M  +19 -0     koattendeeeditor.cpp  
 M  +4 -1      koattendeeeditor.h  


--- branches/kdepim/enterprise/kdepim/korganizer/koattendeeeditor.cpp #1206124:1206125
@@ -55,6 +55,10 @@
 
 using namespace KCal;
 
+enum {
+  EXPAND_DISTLIST_TIMEOUT = 2000 // milisecs
+};
+
 KOAttendeeEditor::KOAttendeeEditor( QWidget * parent, const char *name ) :
     QWidget( parent, name ),
     mDisableItemUpdate( true )
@@ -200,6 +204,8 @@
 #ifdef KORG_NOKABC
   mAddressBookButton->hide();
 #endif
+
+  connect( &mExpandDistListTimer, SIGNAL(timeout()), SLOT(expandAttendee()) );
 }
 
 void KOAttendeeEditor::openAddressBook()
@@ -377,6 +383,8 @@
 
 void KOAttendeeEditor::expandAttendee()
 {
+  mExpandDistListTimer.stop();
+
   /* When return is pressed mNameEdit emits returnPressed() and then a textChanged() signal.
    * The textChanged() signal triggers the updateAttendee() slot to be called which will
    * change the wrong Attendee, because after expandAttendee() is executed, the currentItem()
@@ -401,6 +409,8 @@
 
 void KOAttendeeEditor::updateAttendee()
 {
+  mExpandDistListTimer.stop();
+
   Attendee *a = currentAttendee();
   if ( !a || mDisableItemUpdate )
     return;
@@ -445,6 +455,15 @@
   a->setRSVP( mRsvpButton->isChecked() );
 
   updateCurrentItem();
+
+  /*
+   * This editor has dynamic insertion, we don't know when the user finished writting
+   * the attendee's name. He doesn't press any button when he's done. So how can we
+   * know when to expand the distlist?
+   *
+   * After a 2 seconds without typing, we expand it.
+   */
+  mExpandDistListTimer.start( EXPAND_DISTLIST_TIMEOUT, true );
 }
 
 void KOAttendeeEditor::fillAttendeeInput( KCal::Attendee *a )
--- branches/kdepim/enterprise/kdepim/korganizer/koattendeeeditor.h #1206124:1206125
@@ -21,10 +21,12 @@
 #ifndef KOATTENDEEEDITOR_H
 #define KOATTENDEEEDITOR_H
 
-#include <qwidget.h>
 #include <libkcal/attendee.h>
 #include <kabc/addressee.h>
 
+#include <qwidget.h>
+#include <qtimer.h>
+
 class QBoxLayout;
 class QComboBox;
 class QCheckBox;
@@ -123,6 +125,7 @@
   private:
     KABC::Addressee::List expandDistList( const QString &text ) const;
     bool mDisableItemUpdate;
+    QTimer mExpandDistListTimer;
 };
 
 #endif
[prev in list] [next in list] [prev in thread] [next in thread] 

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