[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:39:38 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit a1d50358762f15f7b699ee07c3d429b7b8c78d23
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Apr 30 23:50:46 2003 +0000

            Reviewed by Maciej.
    
    	- fixed 3233819 -- MALLORY: onChange handler being called on SELECT even if selected item does not change
    
            * kwq/KWQComboBox.h: Added _currentItem variable, updateCurrentItem function, and replaced
            activated function with itemSelected function.
    
            * kwq/KWQComboBox.mm:
            (QComboBox::QComboBox): Call updateCurrentItem so _currentItem is up to date.
            (QComboBox::insertItem): Ditto.
            (QComboBox::clear): Ditto.
            (QComboBox::setCurrentItem): Ditto.
            (QComboBox::updateCurrentItem): Added. Returns true if current item has changed since the last time
            the function was called.
            (QComboBox::itemSelected): Only send the activate method if updateCurrentItem returns true.
            (-[KWQComboBoxAdapter action:]): Call itemSelected instead of calling activated directly.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4229 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index ad8b6bd..561770c 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,22 @@
+2003-04-30  Darin Adler  <darin at apple.com>
+
+        Reviewed by Maciej.
+
+	- fixed 3233819 -- MALLORY: onChange handler being called on SELECT even if selected item does not change
+
+        * kwq/KWQComboBox.h: Added _currentItem variable, updateCurrentItem function, and replaced
+        activated function with itemSelected function.
+        
+        * kwq/KWQComboBox.mm:
+        (QComboBox::QComboBox): Call updateCurrentItem so _currentItem is up to date.
+        (QComboBox::insertItem): Ditto.
+        (QComboBox::clear): Ditto.
+        (QComboBox::setCurrentItem): Ditto.
+        (QComboBox::updateCurrentItem): Added. Returns true if current item has changed since the last time
+        the function was called.
+        (QComboBox::itemSelected): Only send the activate method if updateCurrentItem returns true.
+        (-[KWQComboBoxAdapter action:]): Call itemSelected instead of calling activated directly.
+
 2003-04-29  David Hyatt  <hyatt at apple.com>
 
 	Fix for the Adam Rice float/padding test on diveintomark's list
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index ad8b6bd..561770c 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,22 @@
+2003-04-30  Darin Adler  <darin at apple.com>
+
+        Reviewed by Maciej.
+
+	- fixed 3233819 -- MALLORY: onChange handler being called on SELECT even if selected item does not change
+
+        * kwq/KWQComboBox.h: Added _currentItem variable, updateCurrentItem function, and replaced
+        activated function with itemSelected function.
+        
+        * kwq/KWQComboBox.mm:
+        (QComboBox::QComboBox): Call updateCurrentItem so _currentItem is up to date.
+        (QComboBox::insertItem): Ditto.
+        (QComboBox::clear): Ditto.
+        (QComboBox::setCurrentItem): Ditto.
+        (QComboBox::updateCurrentItem): Added. Returns true if current item has changed since the last time
+        the function was called.
+        (QComboBox::itemSelected): Only send the activate method if updateCurrentItem returns true.
+        (-[KWQComboBoxAdapter action:]): Call itemSelected instead of calling activated directly.
+
 2003-04-29  David Hyatt  <hyatt at apple.com>
 
 	Fix for the Adam Rice float/padding test on diveintomark's list
diff --git a/WebCore/kwq/KWQComboBox.h b/WebCore/kwq/KWQComboBox.h
index 95a0a5e..66600d0 100644
--- a/WebCore/kwq/KWQComboBox.h
+++ b/WebCore/kwq/KWQComboBox.h
@@ -43,7 +43,7 @@ public:
     void clear();
     void insertItem(const QString &text, int index=-1);
 
-    int currentItem() const;
+    int currentItem() const { return _currentItem; }
     void setCurrentItem(int);
 
     QListBox *listBox() const { return 0; }
@@ -54,12 +54,15 @@ public:
     void setFrameGeometry(const QRect &);
     int baselinePosition() const;
 
-    void activated() { _activated.call(currentItem()); }
+    void itemSelected();
 
 private:
+    bool updateCurrentItem() const;
+    
     KWQComboBoxAdapter *_adapter;
     mutable float _width;
     mutable bool _widthGood;
+    mutable int _currentItem;
 
     KWQSignal _activated;
 };
diff --git a/WebCore/kwq/KWQComboBox.mm b/WebCore/kwq/KWQComboBox.mm
index 9e5c6ea..5869928 100644
--- a/WebCore/kwq/KWQComboBox.mm
+++ b/WebCore/kwq/KWQComboBox.mm
@@ -93,6 +93,8 @@ QComboBox::QComboBox()
     setView(button);
 
     [button release];
+
+    updateCurrentItem();
 }
 
 QComboBox::~QComboBox()
@@ -118,6 +120,8 @@ void QComboBox::insertItem(const QString &text, int index)
     // same title. But this way, we can have such duplicate items.
     [[button itemAtIndex:index] setTitle:text.getNSString()];
     _widthGood = false;
+
+    updateCurrentItem();
 }
 
 QSize QComboBox::sizeHint() const 
@@ -175,20 +179,33 @@ void QComboBox::clear()
     KWQPopUpButton *button = (KWQPopUpButton *)getView();
     [button removeAllItems];
     _widthGood = false;
+    updateCurrentItem();
 }
 
 void QComboBox::setCurrentItem(int index)
 {
     KWQPopUpButton *button = (KWQPopUpButton *)getView();
     [button selectItemAtIndex:index];
+    updateCurrentItem();
 }
 
-int QComboBox::currentItem() const
+bool QComboBox::updateCurrentItem() const
 {
-    KWQPopUpButton *button = (KWQPopUpButton *)getView();
-    return [button indexOfSelectedItem];
+    int i = [(KWQPopUpButton *)getView() indexOfSelectedItem];
+    if (_currentItem == i) {
+        return false;
+    }
+    _currentItem = i;
+    return true;
 }
 
+void QComboBox::itemSelected()
+{
+    if (updateCurrentItem()) {
+        _activated.call(_currentItem);
+    }
+}
+ 
 @implementation KWQComboBoxAdapter
 
 - initWithQComboBox:(QComboBox *)b
@@ -199,7 +216,7 @@ int QComboBox::currentItem() const
 
 - (void)action:(id)sender
 {
-    box->activated();
+    box->itemSelected();
 }
 
 @end

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list