diff --git a/ksplash/ksplashqml/splashwindow.cpp b/ksplash/ksplashqml/splashwindow.cpp --- a/ksplash/ksplashqml/splashwindow.cpp +++ b/ksplash/ksplashqml/splashwindow.cpp @@ -120,20 +120,34 @@ KQuickAddons::QuickViewSharedEngine::setGeometry(rect); if (oldGeometryEmpty) { - - KPackage::Package package = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel")); - KConfigGroup cg(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), "KDE"); - const QString packageName = cg.readEntry("LookAndFeelPackage", QString()); - if (!packageName.isEmpty()) { - package.setPath(packageName); - } - + bool loaded = false; if (!m_theme.isEmpty()) { - package.setPath(m_theme); + KPackage::Package splashPackage = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/SplashScreen")); + splashPackage.setPath(m_theme); + if (splashPackage.isValid()) { + setSource(QUrl::fromLocalFile(splashPackage.filePath("splashmainscript"))); + loaded = splashPackage.isValid(); + } } - Q_ASSERT(package.isValid()); - setSource(QUrl::fromLocalFile(package.filePath("splashmainscript"))); + if (!loaded) { + KPackage::Package lnfPackage = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("Plasma/LookAndFeel")); + + if (!m_theme.isEmpty()) { + lnfPackage.setPath(m_theme); + } + + if (!lnfPackage.isValid()) { + KConfigGroup cg(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), "KDE"); + const QString packageName = cg.readEntry("LookAndFeelPackage", QString()); + if (!packageName.isEmpty()) { + lnfPackage.setPath(packageName); + } + } + + Q_ASSERT(lnfPackage.isValid()); + setSource(QUrl::fromLocalFile(lnfPackage.filePath("splashmainscript"))); + } } if (m_shellSurface) { diff --git a/shell/packageplugins/CMakeLists.txt b/shell/packageplugins/CMakeLists.txt --- a/shell/packageplugins/CMakeLists.txt +++ b/shell/packageplugins/CMakeLists.txt @@ -1,5 +1,6 @@ add_subdirectory(layouttemplate) add_subdirectory(lookandfeel) +add_subdirectory(splashscreen) add_subdirectory(shell) add_subdirectory(qmlWallpaper) add_subdirectory(wallpaperimages) diff --git a/shell/packageplugins/splashscreen/CMakeLists.txt b/shell/packageplugins/splashscreen/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/shell/packageplugins/splashscreen/CMakeLists.txt @@ -0,0 +1,15 @@ +add_definitions(-DTRANSLATION_DOMAIN=\"plasma_package_splashscreen\") + +set(splashscreen_SRCS + splashscreen.cpp +) + +add_library(plasma_packagestructure_splashscreen MODULE ${splashscreen_SRCS}) +kcoreaddons_desktop_to_json(plasma_packagestructure_splashscreen plasma-packagestructure-splashscreen.desktop) + +target_link_libraries(plasma_packagestructure_splashscreen + KF5::I18n + KF5::Package +) + +install(TARGETS plasma_packagestructure_splashscreen DESTINATION ${KDE_INSTALL_PLUGINDIR}/kpackage/packagestructure) diff --git a/shell/packageplugins/splashscreen/plasma-packagestructure-splashscreen.desktop b/shell/packageplugins/splashscreen/plasma-packagestructure-splashscreen.desktop new file mode 100644 --- /dev/null +++ b/shell/packageplugins/splashscreen/plasma-packagestructure-splashscreen.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=Splash Screen +Type=Service +X-KDE-ServiceTypes=KPackage/PackageStructure +X-KDE-Library=plasma_packagestructure_splashscreen + +X-KDE-PluginInfo-Author=Marco Martin +X-KDE-PluginInfo-Email=notmart@gmail.com +X-KDE-PluginInfo-Name=Plasma/SplashScreen +X-KDE-PluginInfo-Version=1 +X-KDE-ParentApp=org.kde.plasmashell diff --git a/shell/packageplugins/splashscreen/splashscreen.h b/shell/packageplugins/splashscreen/splashscreen.h new file mode 100644 --- /dev/null +++ b/shell/packageplugins/splashscreen/splashscreen.h @@ -0,0 +1,32 @@ +/****************************************************************************** +* Copyright 2018 by Marco Martin * +* * +* This library is free software; you can redistribute it and/or * +* modify it under the terms of the GNU Library General Public * +* License as published by the Free Software Foundation; either * +* version 2 of the License, or (at your option) any later version. * +* * +* This library is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * +* Library General Public License for more details. * +* * +* You should have received a copy of the GNU Library General Public License * +* along with this library; see the file COPYING.LIB. If not, write to * +* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * +* Boston, MA 02110-1301, USA. * +*******************************************************************************/ + +#ifndef SPLASHSCREEN_H +#define SPLASHSCREEN_H + +#include + +class SplashScreenPackage : public KPackage::PackageStructure +{ +public: + SplashScreenPackage(QObject*, const QVariantList &) {} + void initPackage(KPackage::Package *package) override; +}; + +#endif diff --git a/shell/packageplugins/splashscreen/splashscreen.cpp b/shell/packageplugins/splashscreen/splashscreen.cpp new file mode 100644 --- /dev/null +++ b/shell/packageplugins/splashscreen/splashscreen.cpp @@ -0,0 +1,42 @@ +/****************************************************************************** +* Copyright 2007-2009 by Aaron Seigo * +* Copyright 2013 by Sebastian Kügler * +* * +* This library is free software; you can redistribute it and/or * +* modify it under the terms of the GNU Library General Public * +* License as published by the Free Software Foundation; either * +* version 2 of the License, or (at your option) any later version. * +* * +* This library is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * +* Library General Public License for more details. * +* * +* You should have received a copy of the GNU Library General Public License * +* along with this library; see the file COPYING.LIB. If not, write to * +* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * +* Boston, MA 02110-1301, USA. * +*******************************************************************************/ + +#include "splashscreen.h" + +#include +#include + +void SplashScreenPackage::initPackage(KPackage::Package *package) +{ + // http://community.kde.org/Plasma/SplashScreenPackage# + package->setDefaultPackageRoot(QStringLiteral("plasma/splashscreens/")); + + //Directories + package->addDirectoryDefinition("previews", QStringLiteral("previews"), i18n("Preview Images")); + package->addFileDefinition("splashpreview", QStringLiteral("previews/splash.png"), i18n("Preview for Splash Screen")); + + package->addDirectoryDefinition("splash", QStringLiteral("splash"), i18n("Splash Screen")); + package->addFileDefinition("splashmainscript", QStringLiteral("splash/Splash.qml"), i18n("Main Script for Splash Screen")); +} + + +K_EXPORT_KPACKAGE_PACKAGE_WITH_JSON(SplashScreenPackage, "plasma-packagestructure-splashscreen.json") + +#include "splashscreen.moc"