Use shift+PageUp instead of Shift+Home to go to the first page or results: Shift+Home is useful to select the search entry text

This commit is contained in:
Jean-Francois Dockes 2012-03-06 13:54:34 +01:00
parent 2c6b023a88
commit 03b3bd4ac8
3 changed files with 18 additions and 18 deletions

View File

@ -350,7 +350,7 @@
<string>Go to first page of results</string>
</property>
<property name="shortcut">
<string>Shift+Home</string>
<string>Shift+PgUp</string>
</property>
<property name="name" stdset="0">
<cstring>firstPageAction</cstring>

View File

@ -1796,17 +1796,9 @@ bool RclMain::eventFilter(QObject *, QEvent *event)
{
if (event->type() == QEvent::KeyPress) {
LOGDEB2(("RclMain::eventFilter: keypress\n"));
QKeyEvent *ke = (QKeyEvent *)event;
// Shift-Home is the shortcut for the 1st result page action, but it is
// filtered by the search entry to mean "select all line". We prefer to
// keep it for the action as it's easy to find another combination to
// select all (ie: home, then shift-end)
if (ke->key() == Qt::Key_Home &&
(ke->modifiers() & Qt::ShiftModifier)) {
// Shift-Home -> first page of results
reslist->resultPageFirst();
return true;
}
// We used to map shift-home to reslist "goto first page"
// here but we now use shift-pageUp because shift-home is
// useful to select all inside the search entry
} else if (event->type() == QEvent::Show) {
LOGDEB2(("RclMain::eventFilter: Show\n"));
// move the focus to the search entry on show

View File

@ -507,12 +507,20 @@ bool ResList::getDoc(int docnum, Rcl::Doc &doc)
void ResList::keyPressEvent(QKeyEvent * e)
{
if (e->key() == Qt::Key_PageUp || e->key() == Qt::Key_Backspace) {
resPageUpOrBack();
return;
} else if (e->key() == Qt::Key_PageDown || e->key() == Qt::Key_Space) {
resPageDownOrNext();
return;
if ((e->modifiers() & Qt::ShiftModifier)) {
if (e->key() == Qt::Key_PageUp) {
// Shift-PageUp -> first page of results
resultPageFirst();
return;
}
} else {
if (e->key() == Qt::Key_PageUp || e->key() == Qt::Key_Backspace) {
resPageUpOrBack();
return;
} else if (e->key() == Qt::Key_PageDown || e->key() == Qt::Key_Space) {
resPageDownOrNext();
return;
}
}
RESLIST_PARENTCLASS::keyPressEvent(e);
}