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

List:       kde-core-devel
Subject:    PATCH: Fix broken behavior of Konqueror's combobox
From:       <kdelists () cox ! net>
Date:       2003-11-17 19:36:50
[Download RAW message or body]

Hi,   
   
The following patch basically reverts rev. 1.31 to fix the   
broken behavior of konqueror's combobox history handling   
capability. Revision 1.31 attempted to fix the CTRL+Enter   
does not create a new tab problem by consuming the enter   
event without properly dealing with all the consequences of 
doing that. 
 
The actual solution should have been to only store the 
button states when the enter key was pressed and emitting 
the signals we want in slotReturnPressed. 
 

["konqcombofix.diff" (text/x-diff)]

Index: konq_combo.cc
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_combo.cc,v
retrieving revision 1.38
diff -u -3 -p -r1.38 konq_combo.cc
--- konq_combo.cc	4 Sep 2003 11:05:21 -0000	1.38
+++ konq_combo.cc	17 Nov 2003 19:15:01 -0000
@@ -36,7 +36,8 @@ const int KonqCombo::temporary = 0;
 KonqCombo::KonqCombo( QWidget *parent, const char *name )
     : KHistoryCombo( parent, name ),
       m_returnPressed( false ),
-      m_permanent( false )
+      m_permanent( false ),
+      m_buttonState(NoButton)
 {
     setInsertionPolicy( NoInsertion );
     setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ));
@@ -58,8 +59,6 @@ KonqCombo::KonqCombo( QWidget *parent, c
     completionBox()->setTabHandling( true );
 
     connect( this, SIGNAL( returnPressed()), SLOT( slotReturnPressed() ));
-    connect( completionBox(), SIGNAL( activated(const QString&)),
-             this, SLOT( slotReturnPressed() ));
     connect( this, SIGNAL( cleared() ), SLOT( slotCleared() ));
     connect( this, SIGNAL( highlighted( int )), SLOT( slotSetIcon( int )));
 
@@ -280,6 +279,7 @@ void KonqCombo::slotReturnPressed()
 {
     applyPermanent();
     m_returnPressed = true;
+    emit activated( currentText(), m_buttonState );
 }
 
 void KonqCombo::clearTemporary( bool makeCurrent )
@@ -301,12 +301,9 @@ bool KonqCombo::eventFilter( QObject *o,
             QKeyEvent *e = static_cast<QKeyEvent *>( ev );
 
             if ( e->key() == Key_Return || e->key() == Key_Enter ) {
-                emit activated( currentText(), e->state() );
-                e->accept();
-                return true;
+                m_buttonState = e->state();
             }
-
-            if ( KKey( e ) == KKey( int( KStdAccel::deleteWordBack() ) ) ||
+            else if ( KKey( e ) == KKey( int( KStdAccel::deleteWordBack() ) ) ||
                  KKey( e ) == KKey( int( KStdAccel::deleteWordForward() ) ) ||
                  ((e->state() & ControlButton) &&
                    (e->key() == Key_Left || e->key() == Key_Right) ) ) {
Index: konq_combo.h
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_combo.h,v
retrieving revision 1.15
diff -u -3 -p -r1.15 konq_combo.h
--- konq_combo.h	13 Jun 2003 09:40:57 -0000	1.15
+++ konq_combo.h	17 Nov 2003 19:15:01 -0000
@@ -69,7 +69,7 @@ protected:
 signals:
     // note: listen to this signal, not activated( const QString& )!
     // The latter is not emitted reliably.
-    void activated( const QString &, ButtonState );
+    void activated( const QString &, int );
 
 private slots:
     void slotReturnPressed();
@@ -89,6 +89,7 @@ private:
     bool m_permanent;
     int m_cursorPos;
     int m_currentIndex;
+    int m_buttonState;
     QString m_currentText;
     QPoint m_dragStart;
 
Index: konq_mainwindow.cc
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_mainwindow.cc,v
retrieving revision 1.1260
diff -u -3 -p -r1.1260 konq_mainwindow.cc
--- konq_mainwindow.cc	16 Nov 2003 09:18:59 -0000	1.1260
+++ konq_mainwindow.cc	17 Nov 2003 19:15:02 -0000
@@ -2212,7 +2212,7 @@ void KonqMainWindow::updateLocalPropsAct
     m_paRemoveLocalProperties->setEnabled( canWrite );
 }
 
-void KonqMainWindow::slotURLEntered( const QString &text, ButtonState state )
+void KonqMainWindow::slotURLEntered( const QString &text, int state )
 {
   if ( m_bURLEnterLock || text.isEmpty() )
     return;
@@ -2669,8 +2669,8 @@ void KonqMainWindow::initCombo()
 
   m_combo->init( s_pCompletion );
 
-  connect( m_combo, SIGNAL(activated(const QString&,ButtonState)),
-           this, SLOT(slotURLEntered(const QString&,ButtonState)) );
+  connect( m_combo, SIGNAL(activated(const QString&,int)),
+           this, SLOT(slotURLEntered(const QString&,int)) );
 
   m_pURLCompletion = new KURLCompletion();
   m_pURLCompletion->setCompletionMode( s_pCompletion->completionMode() );
Index: konq_mainwindow.h
===================================================================
RCS file: /home/kde/kdebase/konqueror/konq_mainwindow.h,v
retrieving revision 1.421
diff -u -3 -p -r1.421 konq_mainwindow.h
--- konq_mainwindow.h	15 Nov 2003 06:48:36 -0000	1.421
+++ konq_mainwindow.h	17 Nov 2003 19:15:02 -0000
@@ -389,7 +389,7 @@ public slots:
 protected slots:
   void slotViewCompleted( KonqView * view );
 
-  void slotURLEntered( const QString &text, ButtonState state );
+  void slotURLEntered( const QString &text, int );
 
   void slotFileNewAboutToShow();
   void slotLocationLabelActivated();


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

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