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

List:       kde-commits
Subject:    branches/KDE/4.0/kdelibs/kdeui/widgets
From:       David Faure <faure () kde ! org>
Date:       2008-06-02 13:29:45
Message-ID: 1212413385.096686.10733.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 815660 by dfaure:

Backport SVN commit 814173 by dfaure:
Fix KHistoryComboBox emitting activated twice when pressing Return (which \
made Ctrl+Return open two tabs in konq). This is because \
KHistoryComboBox::slotSimulateActivated was called before QComboBox had a \
chance to emit activated, so it didn't find the item in the list, and \
-thought- that QComboBox wouldn't emit activated...


 M  +16 -9     khistorycombobox.cpp  


--- branches/KDE/4.0/kdelibs/kdeui/widgets/khistorycombobox.cpp \
#815659:815660 @@ -98,11 +98,13 @@
     if ( histControl == "ignoredups" || histControl == "ignoreboth" )
         setDuplicatesEnabled( false );
 
-    connect( this, SIGNAL(aboutToShowContextMenu(QMenu*)),
-             SLOT(addContextMenuItems(QMenu*)) );
-    connect( this, SIGNAL( activated(int) ), SLOT( slotReset() ));
-    connect( this, SIGNAL( returnPressed(const QString&) ), \
                SLOT(slotReset()));
-    connect( this, SIGNAL( returnPressed(const QString&) ), SLOT( \
slotSimulateActivated(const QString&) ) ); +    connect(this, \
SIGNAL(aboutToShowContextMenu(QMenu*)), SLOT(addContextMenuItems(QMenu*))); \
+    connect(this, SIGNAL(activated(int)), SLOT(slotReset())); +    \
connect(this, SIGNAL(returnPressed(QString)), SLOT(slotReset())); +    // \
We want slotSimulateActivated to be called _after_ \
QComboBoxPrivate::_q_returnPressed +    // otherwise there's a risk of \
emitting activated twice (slotSimulateActivated will find +    // the item, \
after some app's slotActivated inserted the item into the combo). +    \
connect(this, SIGNAL(returnPressed(QString)), \
SLOT(slotSimulateActivated(QString)), Qt::QueuedConnection);  }
 
 KHistoryComboBox::~KHistoryComboBox()
@@ -314,7 +316,7 @@
         }
         else { // bottom of history
             if ( d->myIterateIndex == -2 ) {
-                KNotification::event( KNotification::Notification , 
+                KNotification::event( KNotification::Notification ,
                                       i18n("No further item in the \
history."),  QPixmap() , this);
             }
@@ -417,13 +419,18 @@
     /* With the insertion policy NoInsert, which we use by default,
        Qt doesn't emit activated on typed text if the item is not already \
                there,
        which is perhaps reasonable. Generate the signal ourselves if \
that's the case. +    */
+    if ((insertPolicy() == NoInsert && findText(text, \
Qt::MatchFixedString|Qt::MatchCaseSensitive) == -1)) { +        emit \
activated(text); +    }
 
-       Qt also doesn't emit it if the box is full, and policy is not 
+    /*
+       Qt also doesn't emit it if the box is full, and policy is not
        InsertAtCurrent
     */
-    if ((insertPolicy() == NoInsert && findText(text) == -1) ||
-        (insertPolicy() != InsertAtCurrent && count() >= maxCount()))
+    else if (insertPolicy() != InsertAtCurrent && count() >= maxCount()) {
         emit activated(text);
+    }
 }
 
 KPixmapProvider *KHistoryComboBox::pixmapProvider() const


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

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