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

List:       kde-commits
Subject:    branches/KDE/4.0/kdelibs/khtml
From:       Maks Orlovich <maksim () kde ! org>
Date:       2008-04-06 19:35:13
Message-ID: 1207510513.183714.11841.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 794169 by orlovich:

Fix access keys, and autoscroll suspension. (I will leave it to someone else to
ponder the issue of fallbacks showing up):
1) The key events actually do show the modifier state after the event
these days
2) Use QLinkedList and not QList for the candidates list in fallback
computation as we need iterators to remain valid through removal of other
entries; QList's don't.
3) Adjust positioning code to deal with the latest incarnation of the scroll
widget
4) Give the accesskey tooltips a background so at least one is readable
if they overlap.


 M  +13 -15    khtmlview.cpp  


--- branches/KDE/4.0/kdelibs/khtml/khtmlview.cpp #794168:794169
@@ -1685,14 +1685,14 @@
 #endif // KHTML_NO_CARET
 
     // If CTRL was hit, be prepared for access keys
-    if (d->accessKeysEnabled && _ke->key() == Qt::Key_Control && _ke->modifiers()==0 \
&& !d->accessKeysActivated) +    if (d->accessKeysEnabled && _ke->key() == \
Qt::Key_Control && !(_ke->modifiers() & ~Qt::ControlModifier) && \
!d->accessKeysActivated)  {
         d->accessKeysPreActivate=true;
         _ke->accept();
         return;
     }
 
-    if (_ke->key() == Qt::Key_Shift && _ke->modifiers()==0)
+    if (_ke->key() == Qt::Key_Shift && !(_ke->modifiers() & ~Qt::ShiftModifier))
 	    d->scrollSuspendPreActivate=true;
 
     // accesskey handling needs to be done before dispatching, otherwise e.g. \
lineedits @@ -1923,8 +1923,7 @@
 
     if( d->scrollSuspendPreActivate && _ke->key() != Qt::Key_Shift )
         d->scrollSuspendPreActivate = false;
-    if( _ke->key() == Qt::Key_Shift && d->scrollSuspendPreActivate && \
                _ke->modifiers() == Qt::ShiftModifier
-        && !(QApplication::keyboardModifiers() & Qt::ShiftModifier))
+    if( _ke->key() == Qt::Key_Shift && d->scrollSuspendPreActivate && \
!(_ke->modifiers() & Qt::ShiftModifier))  if (d->scrollTimerId)
                 d->scrollSuspended = !d->scrollSuspended;
 
@@ -1932,8 +1931,7 @@
     {
         if (d->accessKeysPreActivate && _ke->key() != Qt::Key_Control)
             d->accessKeysPreActivate=false;
-        if (d->accessKeysPreActivate && _ke->modifiers() == Qt::ControlModifier &&
-            !(QApplication::keyboardModifiers() & Qt::ControlModifier))
+        if (d->accessKeysPreActivate && !(_ke->modifiers() & Qt::ControlModifier))
         {
 	    displayAccessKeys();
 	    m_part->setStatusBarText(i18n("Access Keys \
activated"),KHTMLPart::BarOverrideText); @@ -2596,10 +2594,11 @@
 	        lab->setFrameStyle(QFrame::Box | QFrame::Plain);
 	        lab->setMargin(3);
 	        lab->adjustSize();
-                lab->setParent( widget() );
+	        lab->setParent( widget() );
+		lab->setAutoFillBackground(true);
 	        lab->move(
-                    qMin(rec.left()+rec.width()/2, contentsWidth() - lab->width()),
-                    qMin(rec.top()+rec.height()/2, contentsHeight() - \
lab->height())); +			qMin(rec.left()+rec.width()/2 - contentsX(), contentsWidth() - \
lab->width()), +			qMin(rec.top()+rec.height()/2 - contentsY(), contentsHeight() - \
lab->height()));  lab->show();
                 taken.append( accesskey[ 0 ] );
 	    }
@@ -2834,7 +2833,8 @@
 QMap< ElementImpl*, QChar > KHTMLView::buildFallbackAccessKeys() const
 {
     // build a list of all possible candidate elements that could use an accesskey
-    QList< AccessKeyData > data;
+    QLinkedList< AccessKeyData > data; // Note: this has to be a list type that keep \
iterators valid +                                       // when other entries are \
                removed
     QMap< NodeImpl*, QString > labels = buildLabels( m_part->xmlDocImpl());
     for( NodeImpl* n = m_part->xmlDocImpl();
          n != NULL;
@@ -2975,10 +2975,8 @@
     }
 
     QMap< ElementImpl*, QChar > ret;
-    for( int priority = 10;
-         priority >= 0;
-         --priority ) {
-        for( QList< AccessKeyData >::Iterator it = data.begin();
+    for( int priority = 10; priority >= 0; --priority ) {
+        for( QLinkedList< AccessKeyData >::Iterator it = data.begin();
              it != data.end();
              ) {
             if( (*it).priority != priority ) {
@@ -3030,7 +3028,7 @@
             it = data.erase( it );
             // assign the same accesskey also to other elements pointing to the same \
                url
             if( !url.isEmpty() && !url.startsWith( "javascript:", \
                Qt::CaseInsensitive )) {
-                for( QList< AccessKeyData >::Iterator it2 = data.begin();
+                for( QLinkedList< AccessKeyData >::Iterator it2 = data.begin();
                      it2 != data.end();
                      ) {
                     if( (*it2).url == url ) {


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

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