diff --git a/CMakeLists.txt b/CMakeLists.txt index d814d7afb..69559e653 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,7 +137,6 @@ option(ENABLE_PLUGIN_SSHMANAGER "Build the SSHManager plugin" ON) option(ENABLE_PLUGIN_QUICKCOMMANDS "Build the Quick Commands plugin" ON) add_subdirectory( src ) -add_subdirectory( data ) add_subdirectory( desktop ) if (HAVE_DBUS) diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt deleted file mode 100644 index 9fa030fe5..000000000 --- a/data/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ - -add_subdirectory( color-schemes ) -add_subdirectory( keyboard-layouts ) -add_subdirectory( layouts ) - -install( FILES konsole.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR}) -install(FILES konsolerc DESTINATION ${KDE_INSTALL_CONFDIR}) diff --git a/data/color-schemes/CMakeLists.txt b/data/color-schemes/CMakeLists.txt deleted file mode 100644 index 0f4f4d3ba..000000000 --- a/data/color-schemes/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -# Note some color schemes are deliberately not installed -# at present - -install( FILES - BlackOnLightYellow.colorscheme - BlackOnRandomLight.colorscheme - BlackOnWhite.colorscheme - BlueOnBlack.colorscheme - Breeze.colorscheme - GreenOnBlack.colorscheme - WhiteOnBlack.colorscheme - Linux.colorscheme - DarkPastels.colorscheme - RedOnBlack.colorscheme - Solarized.colorscheme - SolarizedLight.colorscheme - DESTINATION - ${KDE_INSTALL_DATADIR}/konsole ) diff --git a/data/data.qrc b/data/data.qrc new file mode 100644 index 000000000..ac42b5893 --- /dev/null +++ b/data/data.qrc @@ -0,0 +1,28 @@ + + + + konsolerc + + + konsole.knsrc + color-schemes/BlackOnLightYellow.colorscheme + color-schemes/BlackOnRandomLight.colorscheme + color-schemes/BlackOnWhite.colorscheme + color-schemes/BlueOnBlack.colorscheme + color-schemes/Breeze.colorscheme + color-schemes/GreenOnBlack.colorscheme + color-schemes/WhiteOnBlack.colorscheme + color-schemes/Linux.colorscheme + color-schemes/DarkPastels.colorscheme + color-schemes/RedOnBlack.colorscheme + color-schemes/Solarized.colorscheme + color-schemes/SolarizedLight.colorscheme + keyboard-layouts/default.keytab + keyboard-layouts/linux.keytab + keyboard-layouts/macos.keytab + keyboard-layouts/solaris.keytab + layouts/1x2-terminals.json + layouts/2x1-terminals.json + layouts/2x2-terminals.json + + diff --git a/data/keyboard-layouts/CMakeLists.txt b/data/keyboard-layouts/CMakeLists.txt deleted file mode 100644 index 38ada2d3a..000000000 --- a/data/keyboard-layouts/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -install( FILES - default.keytab - linux.keytab - macos.keytab - solaris.keytab - DESTINATION - ${KDE_INSTALL_DATADIR}/konsole ) diff --git a/data/layouts/CMakeLists.txt b/data/layouts/CMakeLists.txt deleted file mode 100644 index 3d912dd05..000000000 --- a/data/layouts/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -install (FILES - 1x2-terminals.json - 2x1-terminals.json - 2x2-terminals.json - DESTINATION - ${KDE_INSTALL_DATADIR}/konsole) diff --git a/kconf_update/CMakeLists.txt b/kconf_update/CMakeLists.txt index bc77bfbfc..1ce6db6f3 100644 --- a/kconf_update/CMakeLists.txt +++ b/kconf_update/CMakeLists.txt @@ -8,18 +8,13 @@ target_link_libraries(konsole_globalaccel PRIVATE KF6::Service ) - -set(konsole_show_menubar_SRCS konsole_show_menubar.cpp) -qt_add_resources(konsole_show_menubar_SRCS ../desktop/konsole.qrc) - -add_executable(konsole_show_menubar ${konsole_show_menubar_SRCS}) +add_executable(konsole_show_menubar konsole_show_menubar.cpp ../data/data.qrc ../desktop/konsole.qrc) target_link_libraries(konsole_show_menubar KF6::XmlGui KF6::CoreAddons ) - install(FILES konsole.upd DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR}) install(PROGRAMS konsole_add_hamburgermenu_to_toolbar.sh DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR}) install(TARGETS konsole_globalaccel konsole_show_menubar DESTINATION ${KDE_INSTALL_LIBDIR}/kconf_update_bin) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4f8d890f1..05c278fb6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -235,7 +235,11 @@ set(konsoleprivate_SRCS ${windowadaptors_SRCS} widgets/ViewContainer.cpp widgets/ViewSplitter.cpp widgets/KonsolePrintManager.cpp - ${dbus_xml_srcs}) + + ${dbus_xml_srcs} + + ../data/data.qrc + ../desktop/konsole.qrc) kconfig_add_kcfg_files(konsoleprivate_SRCS settings/KonsoleSettings.kcfgc) @@ -265,9 +269,6 @@ ki18n_wrap_ui(konsoleprivate_SRCS widgets/RenameTabWidget.ui ) -# add the resource files for the ui files -qt_add_resources( konsoleprivate_SRCS ../desktop/konsole.qrc) - add_library(konsoleprivate ${konsoleprivate_SRCS}) generate_export_header(konsoleprivate BASE_NAME konsoleprivate) diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp index 08d8d4dba..924a96c77 100644 --- a/src/ViewManager.cpp +++ b/src/ViewManager.cpp @@ -12,7 +12,6 @@ // Qt #include #include -#include #include #include @@ -179,7 +178,7 @@ void ViewManager::setupActions() action->setIcon(QIcon::fromTheme(QStringLiteral("view-split-top-bottom"))); action->setText(i18nc("@action:inmenu", "Load a new tab with layout 2x2 terminals")); connect(action, &QAction::triggered, this, [this]() { - this->loadLayout(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/2x2-terminals.json"))); + this->loadLayout(QStringLiteral(":/konsole/layouts/2x2-terminals.json")); }); collection->addAction(QStringLiteral("load-terminals-layout-2x2"), action); splitViewActions->addAction(action); @@ -188,7 +187,7 @@ void ViewManager::setupActions() action->setIcon(QIcon::fromTheme(QStringLiteral("view-split-left-right"))); action->setText(i18nc("@action:inmenu", "Load a new tab with layout 2x1 terminals")); connect(action, &QAction::triggered, this, [this]() { - this->loadLayout(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/2x1-terminals.json"))); + this->loadLayout(QStringLiteral(":/konsole/layouts/2x1-terminals.json")); }); collection->addAction(QStringLiteral("load-terminals-layout-2x1"), action); splitViewActions->addAction(action); @@ -197,7 +196,7 @@ void ViewManager::setupActions() action->setIcon(QIcon::fromTheme(QStringLiteral("view-split-top-bottom"))); action->setText(i18nc("@action:inmenu", "Load a new tab with layout 1x2 terminals")); connect(action, &QAction::triggered, this, [this]() { - this->loadLayout(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/1x2-terminals.json"))); + this->loadLayout(QStringLiteral(":/konsole/layouts/1x2-terminals.json")); }); collection->addAction(QStringLiteral("load-terminals-layout-1x2"), action); splitViewActions->addAction(action); diff --git a/src/colorscheme/ColorSchemeManager.cpp b/src/colorscheme/ColorSchemeManager.cpp index 1cb4a8d53..48ff8ec97 100644 --- a/src/colorscheme/ColorSchemeManager.cpp +++ b/src/colorscheme/ColorSchemeManager.cpp @@ -103,11 +103,11 @@ QString ColorSchemeManager::colorSchemeNameFromPath(const QString &path) QStringList ColorSchemeManager::listColorSchemes() { - QStringList colorschemes; - const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("konsole"), QStandardPaths::LocateDirectory); - colorschemes.reserve(dirs.size()); + QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("konsole"), QStandardPaths::LocateDirectory); + dirs.append(QStringLiteral(":/konsole/color-schemes")); // fallback to bundled ones - for (const QString &dir : dirs) { + QStringList colorschemes; + for (const QString &dir : std::as_const(dirs)) { const QStringList fileNames = QDir(dir).entryList(QStringList() << QStringLiteral("*.colorscheme")); for (const QString &file : fileNames) { colorschemes.append(dir + QLatin1Char('/') + file); diff --git a/src/keyboardtranslator/KeyboardTranslatorManager.cpp b/src/keyboardtranslator/KeyboardTranslatorManager.cpp index 74c728dbc..293843b83 100644 --- a/src/keyboardtranslator/KeyboardTranslatorManager.cpp +++ b/src/keyboardtranslator/KeyboardTranslatorManager.cpp @@ -72,23 +72,32 @@ bool KeyboardTranslatorManager::isTranslatorDeletable(const QString &name) const bool KeyboardTranslatorManager::isTranslatorResettable(const QString &name) const { - const QStringList &paths = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/") + name + QStringLiteral(".keytab")); - - return (paths.count() > 1); + auto foundFiles = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/") + name + QStringLiteral(".keytab")).count(); + if (QFile::exists(QStringLiteral(":/konsole/keyboard-layouts/") + name + QStringLiteral(".keytab"))) { + ++foundFiles; + } + return (foundFiles > 1); } const QString KeyboardTranslatorManager::findTranslatorPath(const QString &name) const { - return QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/") + name + QStringLiteral(".keytab")); + auto file = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/") + name + QStringLiteral(".keytab")); + + // fallback to bundled ones + if (file.isEmpty() && QFile::exists(QStringLiteral(":/konsole/keyboard-layouts/") + name + QStringLiteral(".keytab"))) { + file = QStringLiteral(":/konsole/keyboard-layouts/") + name + QStringLiteral(".keytab"); + } + + return file; } void KeyboardTranslatorManager::findTranslators() { - QStringList list; - const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("konsole"), QStandardPaths::LocateDirectory); - list.reserve(dirs.size()); + QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("konsole"), QStandardPaths::LocateDirectory); + dirs.append(QStringLiteral(":/konsole/keyboard-layouts")); // fallback to bundled ones - for (const QString &dir : dirs) { + QStringList list; + for (const QString &dir : std::as_const(dirs)) { const QStringList fileNames = QDir(dir).entryList(QStringList() << QStringLiteral("*.keytab")); for (const QString &file : fileNames) { list.append(dir + QLatin1Char('/') + file); diff --git a/src/widgets/EditProfileDialog.cpp b/src/widgets/EditProfileDialog.cpp index 29282705b..359721e76 100644 --- a/src/widgets/EditProfileDialog.cpp +++ b/src/widgets/EditProfileDialog.cpp @@ -944,7 +944,7 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr &profile) connect(getNewButton, &KNSWidgets::Button::dialogFinished, this, &Konsole::EditProfileDialog::gotNewColorSchemes); getNewButton->setText(i18n("Get New...")); - getNewButton->setConfigFile(QStringLiteral("konsole.knsrc")); + getNewButton->setConfigFile(QStringLiteral(":/konsole/konsole.knsrc")); _appearanceUi->colorSchemesBtnLayout->addWidget(getNewButton); _appearanceUi->enableBidiRenderingButton->setChecked(profile->bidiRenderingEnabled());