Maintain quick annotation shortcut compatibility with Okular < 1.11.0

During the upgrade to Okular 1.11.0 the shortcuts for the quick annotations have been changed from the keys 1, 2, 3,... to Alt + 1, 2, 3,... making some users unhappy.

CCBUG: 426009
remotes/origin/release/20.08
Simone Gaiarin 6 years ago committed by Albert Astals Cid
parent 4b9e50a1ed
commit cd96735ae2
  1. 8
      autotests/annotationtoolbartest.cpp
  2. 22
      ui/annotationactionhandler.cpp

@ -179,11 +179,11 @@ void AnnotationToolBarTest::testAnnotationToolBar()
toggleAnnotationToolBar->setChecked(false);
QTRY_VERIFY(!annToolBar->isVisible());
QTest::keyClick(part->widget(), Qt::Key_1);
QTest::keyClick(part->widget(), Qt::Key_1, Qt::AltModifier);
QTRY_VERIFY2(annToolBar->isVisible(), "ToolBar not shown when triggering annotation using shortcut.");
toggleAnnotationToolBar->setChecked(false);
QTRY_VERIFY(!annToolBar->isVisible());
QTest::keyClick(part->widget(), Qt::Key_3, Qt::AltModifier);
QTest::keyClick(part->widget(), Qt::Key_3);
QTRY_VERIFY2(annToolBar->isVisible(), "ToolBar not shown when triggering quick annotation using shortcut.");
// Click an annotation action to enable it
@ -202,7 +202,7 @@ void AnnotationToolBarTest::testAnnotationToolBar()
QCOMPARE(simulateAddPopupAnnotation(part, mouseX, mouseY), false);
// Trigger the action using a shortcut
QTest::keyClick(part->widget(), Qt::Key_7);
QTest::keyClick(part->widget(), Qt::Key_7, Qt::AltModifier);
mouseY = 200;
QTRY_COMPARE(Okular::Settings::mouseMode(), static_cast<int>(Okular::Settings::EnumMouseMode::Browse));
QCOMPARE(simulateAddPopupAnnotation(part, mouseX, mouseY), true);
@ -214,7 +214,7 @@ void AnnotationToolBarTest::testAnnotationToolBar()
QCOMPARE(simulateAddPopupAnnotation(part, mouseX, mouseY), false);
// Trigger the action using a quick annotation shortcut
QTest::keyClick(part->widget(), Qt::Key_6, Qt::AltModifier);
QTest::keyClick(part->widget(), Qt::Key_6);
QTRY_COMPARE(Okular::Settings::mouseMode(), static_cast<int>(Okular::Settings::EnumMouseMode::Browse));
QCOMPARE(simulateAddPopupAnnotation(part, mouseX, mouseY), true);

@ -359,7 +359,7 @@ void AnnotationActionHandlerPrivate::populateQuickAnnotations()
QAction *annFav = new QAction(toolIcon, itemText, q);
aQuickTools->addAction(annFav);
if (shortcutNumber != numberKeys.end())
annFav->setShortcut(QKeySequence(Qt::ALT + *(shortcutNumber++)));
annFav->setShortcut(QKeySequence(*(shortcutNumber++)));
QObject::connect(annFav, &QAction::triggered, q, [this, favToolId]() { slotQuickToolSelected(favToolId); });
QDomElement engineElement = favToolElement.firstChildElement(QStringLiteral("engine"));
@ -738,16 +738,16 @@ AnnotationActionHandler::AnnotationActionHandler(PageViewAnnotator *parent, KAct
ac->addAction(QStringLiteral("annotation_settings_advanced"), d->aAdvancedSettings);
ac->setDefaultShortcut(d->aShowToolBar, Qt::Key_F6);
ac->setDefaultShortcut(aHighlighter, Qt::Key_1);
ac->setDefaultShortcut(aUnderline, Qt::Key_2);
ac->setDefaultShortcut(aSquiggle, Qt::Key_3);
ac->setDefaultShortcut(aStrikeout, Qt::Key_4);
ac->setDefaultShortcut(aTypewriter, Qt::Key_5);
ac->setDefaultShortcut(aInlineNote, Qt::Key_6);
ac->setDefaultShortcut(aPopupNote, Qt::Key_7);
ac->setDefaultShortcut(aFreehandLine, Qt::Key_8);
ac->setDefaultShortcut(aArrow, Qt::Key_9);
ac->setDefaultShortcut(aRectangle, Qt::Key_0);
ac->setDefaultShortcut(aHighlighter, Qt::ALT + Qt::Key_1);
ac->setDefaultShortcut(aUnderline, Qt::ALT + Qt::Key_2);
ac->setDefaultShortcut(aSquiggle, Qt::ALT + Qt::Key_3);
ac->setDefaultShortcut(aStrikeout, Qt::ALT + Qt::Key_4);
ac->setDefaultShortcut(aTypewriter, Qt::ALT + Qt::Key_5);
ac->setDefaultShortcut(aInlineNote, Qt::ALT + Qt::Key_6);
ac->setDefaultShortcut(aPopupNote, Qt::ALT + Qt::Key_7);
ac->setDefaultShortcut(aFreehandLine, Qt::ALT + Qt::Key_8);
ac->setDefaultShortcut(aArrow, Qt::ALT + Qt::Key_9);
ac->setDefaultShortcut(aRectangle, Qt::ALT + Qt::Key_0);
ac->setDefaultShortcut(d->aAddToQuickTools, QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_B));
d->updateConfigActions();
}

Loading…
Cancel
Save