Commit c761c604 authored by Julius Künzel's avatar Julius Künzel 💬
Browse files

Simplify code for keyboard scheme download with KF 5.98

This is already available in KF 5.97, but crashes. In KF 5.98 it will
work as expected
parent d9512b9a
Pipeline #222707 failed with stage
in 10 minutes and 29 seconds
......@@ -2341,6 +2341,16 @@ void MainWindow::connectDocument()
void MainWindow::slotEditKeys()
{
KShortcutsDialog dialog(KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsAllowed, this);
#if KXMLGUI_VERSION >= QT_VERSION_CHECK(5, 98, 0)
QAction *downloadKeybordSchemes = new QAction(QIcon::fromTheme(QStringLiteral("download")), i18n("Download New Keyboard Schemes…"), &dialog);
connect(downloadKeybordSchemes, &QAction::triggered, this, [&]() {
if (getNewStuff(QStringLiteral(":data/kdenlive_keyboardschemes.knsrc")) > 0) {
dialog.refreshSchemes();
}
});
dialog.addActionToSchemesMoreButton(downloadKeybordSchemes);
#else
// Find the combobox inside KShortcutsDialog for choosing keyboard scheme
QComboBox *schemesList = nullptr;
foreach (QLabel *label, dialog.findChildren<QLabel *>()) {
......@@ -2365,6 +2375,7 @@ void MainWindow::slotEditKeys()
} else {
qWarning() << "Could not get list of schemes. Downloading new schemes is not available.";
}
#endif
dialog.addCollection(actionCollection(), i18nc("general keyboard shortcuts", "General"));
dialog.configure();
}
......@@ -3382,6 +3393,7 @@ int MainWindow::getNewStuff(const QString &configFile)
#endif
}
#if KXMLGUI_VERSION < QT_VERSION_CHECK(5, 98, 0)
void MainWindow::slotGetNewKeyboardStuff(QComboBox *schemesList)
{
if (getNewStuff(QStringLiteral(":data/kdenlive_keyboardschemes.knsrc")) > 0) {
......@@ -3402,6 +3414,7 @@ void MainWindow::slotGetNewKeyboardStuff(QComboBox *schemesList)
schemesList->addItems(schemes);
}
}
#endif
void MainWindow::slotAutoTransition()
{
......
......@@ -460,7 +460,9 @@ private slots:
/** @brief Select all clips in timeline. */
void slotSelectAllTracks();
void slotUnselectAllTracks();
#if KXMLGUI_VERSION < QT_VERSION_CHECK(5, 98, 0)
void slotGetNewKeyboardStuff(QComboBox *schemesList);
#endif
void slotAutoTransition();
void slotRunWizard();
void slotGroupClips();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment