[prev in list] [next in list] [prev in thread] [next in thread]
List: kfm-devel
Subject: Re: [Patch] Fixing the Access Key system
From: bj () altern ! org
Date: 2004-07-14 16:05:39
Message-ID: 200407141813.30636.bj () altern ! org
[Download RAW message or body]
On Wednesday 14 July 2004 11.26, Lubos Lunak wrote:
> The part of the statusbar text talking about showing all accesskeys
> shouldn't be shown as it's not true with this patch (I think having it in
> #if 0 should keep it included for translation in case this feature makes it
> in 3.3 - it'd be nice to have it). Also, I think the text should have
> higher statusbar priority, otherwise it's not shown if e.g. the page shows
> something in the statusbar.
Attached are 2 patches. First is the change in accesskey system with the
changes you mentionned. Second one is a change in the about: page of
konqueror to mention the accessibility system (a few changes also need to be
done to the html layout, but not involving i18n strings..).
Does anyone oppose or can I commit (there's only a few hours left before
freeze)?
AlI I want is to fix the current behaviour and give more visibility to the
accesskeys. If anybody has another idea for an accesskey shortcut, we can
always revert before the release...
> BTW, please use -p when creating diffs.
Sorry, my cvs complains about knowing nothing about -p, will investigate ASAP.
Jean-Baptiste
["accesskeys_accel_bis.diff" (text/x-diff)]
Index: khtmlview.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/khtmlview.cpp,v
retrieving revision 1.645
diff -u -3 -r1.645 khtmlview.cpp
--- khtmlview.cpp 13 Jul 2004 14:46:49 -0000 1.645
+++ khtmlview.cpp 14 Jul 2004 15:39:20 -0000
@@ -216,6 +218,8 @@
#ifndef KHTML_NO_TYPE_AHEAD_FIND
typeAheadActivated = false;
#endif // KHTML_NO_TYPE_AHEAD_FIND
+ accessKeysActivated = false;
+ accessKeysPreActivate = false;
}
void newScrollTimer(QWidget *view, int tid)
{
@@ -328,6 +332,9 @@
bool findLinksOnly;
bool typeAheadActivated;
#endif // KHTML_NO_TYPE_AHEAD_FIND
+ bool accessKeysActivated;
+ bool accessKeysPreActivate;
+ QTimer accessKeysTimer;
};
#ifndef QT_NO_TOOLTIP
@@ -381,6 +388,7 @@
#ifndef KHTML_NO_TYPE_AHEAD_FIND
connect(&d->timer, SIGNAL(timeout()), this, SLOT(findTimeout()));
#endif // KHTML_NO_TYPE_AHEAD_FIND
+ connect(&d->accessKeysTimer, SIGNAL(timeout()), this, \
SLOT(accessKeysTimeout()));
init();
@@ -1055,6 +1063,10 @@
}
#endif // KHTML_NO_CARET
+ // If CTRL was hit, be prepared for access keys
+ if (_ke->key() == Key_Control)
+ d->accessKeysPreActivate=true;
+
// accesskey handling needs to be done before dispatching, otherwise e.g. \
lineedits // may eat the event
if( handleAccessKey( _ke )) {
@@ -1137,7 +1149,7 @@
return;
}
#endif // KHTML_NO_TYPE_AHEAD_FIND
-
+
int offs = (clipper()->height() < 30) ? clipper()->height() : 30;
if (_ke->state() & Qt::ShiftButton)
switch(_ke->key())
@@ -1349,6 +1361,21 @@
_ke->accept();
return;
}
+ if (d->accessKeysPreActivate && _ke->key() != Key_Control) \
d->accessKeysPreActivate=false; + if (d->accessKeysActivated && (_ke->state() != \
Qt::NoButton || _ke->state() != Qt::ShiftButton)) accessKeysTimeout(); + if \
(_ke->key() == Key_Control && d->accessKeysPreActivate) + {
+ QString accessMsg=i18n("Access Keys activated");
+
+ #if 0 // added i18n string in case the feature makes it in KDE 3.3
+ accessMsg+=i18n(" -- press Ctrl again to display all available access keys");
+ #endif
+ m_part->setStatusBarText(accessMsg,KHTMLPart::BarHoverText);
+ d->accessKeysActivated = true;
+ d->accessKeysPreActivate = false;
+ d->accessKeysTimer.start(5000, true);
+ }
+
QScrollView::keyReleaseEvent(_ke);
}
@@ -1442,6 +1469,7 @@
bool KHTMLView::eventFilter(QObject *o, QEvent *e)
{
if ( e->type() == QEvent::AccelOverride ) {
+ d->accessKeysPreActivate=false;
QKeyEvent* ke = (QKeyEvent*) e;
//kdDebug(6200) << "QEvent::AccelOverride" << endl;
if (m_part->isEditable() || m_part->isCaretMode()
@@ -1802,12 +1830,19 @@
}
}
+
+void KHTMLView::accessKeysTimeout()
+{
+d->accessKeysActivated=false;
+d->accessKeysPreActivate = false;
+m_part->setStatusBarText(QString::null, KHTMLPart::BarHoverText);
+}
+
// Handling of the HTML accesskey attribute.
bool KHTMLView::handleAccessKey( const QKeyEvent* ev )
{
- const int mods = Qt::AltButton | Qt::ControlButton;
- if( ( ev->state() & mods ) != mods )
- return false;
+if (!d->accessKeysActivated) return false;
+
// Qt interprets the keyevent also with the modifiers, and ev->text() matches that,
// but this code must act as if the modifiers weren't pressed
QChar c;
@@ -1823,6 +1858,8 @@
}
if( c.isNull())
return false;
+ d->accessKeysActivated=false;
+ accessKeysTimeout();
return focusNodeWithAccessKey( c );
}
Index: khtmlview.h
===================================================================
RCS file: /home/kde/kdelibs/khtml/khtmlview.h,v
retrieving revision 1.209
diff -u -3 -r1.209 khtmlview.h
--- khtmlview.h 30 Jun 2004 16:20:34 -0000 1.209
+++ khtmlview.h 14 Jul 2004 15:39:21 -0000
@@ -194,7 +194,6 @@
void keyReleaseEvent ( QKeyEvent *_ke );
void contentsContextMenuEvent ( QContextMenuEvent *_ce );
void doAutoScroll();
-
void timerEvent ( QTimerEvent * );
protected slots:
@@ -206,7 +205,8 @@
#ifndef KHTML_NO_TYPE_AHEAD_FIND
void findTimeout();
#endif // KHTML_NO_TYPE_AHEAD_FIND
-
+ void accessKeysTimeout();
+
private:
void scheduleRelayout(khtml::RenderObject* clippedObj=0);
["about.diff" (text/x-diff)]
Index: konq_aboutpage.cc
===================================================================
RCS file: /home/kde/kdebase/konqueror/about/konq_aboutpage.cc,v
retrieving revision 1.59
diff -u -3 -r1.59 konq_aboutpage.cc
--- konq_aboutpage.cc 19 May 2004 14:32:14 -0000 1.59
+++ konq_aboutpage.cc 14 Jul 2004 15:51:43 -0000
@@ -120,6 +120,8 @@
"<IMG WIDTH=16 HEIGHT=16 SRC=\"%1\"> (\"Home\"). " \
).arg(gohome_icon_path) )
.arg( i18n( "For more detailed documentation on Konqueror click <A \
HREF=\"%1\">here</A>." )
.arg("exec:/khelpcenter") )
+ .arg( i18n( "<I>Accessibility:</I> To use access keys in a web page, press and \
release the <I>Ctrl</I> button. " + "Then, press the corresponding access key."))
.arg( i18n( "<I>Tuning Tip:</I> If you want the Konqueror web browser to \
start faster," " you can turn off this information screen by clicking <A \
HREF=\"%1\">here</A>. You can re-enable it" " by choosing the Help -> Konqueror \
Introduction menu option, and then pressing "
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic