2017-01-03 01:05:30 +03:00
/*
2021-05-27 18:01:00 +03:00
SPDX - FileCopyrightText : 2016 Smith AR < audoban @ openmailbox . org >
SPDX - FileCopyrightText : 2016 Michail Vourlakos < mvourlakos @ gmail . com >
SPDX - License - Identifier : GPL - 2.0 - or - later
2017-01-03 01:05:30 +03:00
*/
2018-12-06 14:32:21 +03:00
# include "lattepackage.h"
2016-12-31 00:26:38 +03:00
2018-12-02 03:05:52 +03:00
// Qt
2016-12-31 00:26:38 +03:00
# include <QDebug>
2021-05-22 01:00:42 +03:00
# include <QLatin1String>
2016-12-25 10:25:27 +03:00
2018-12-02 03:05:52 +03:00
// KDE
2016-12-25 10:25:27 +03:00
# include <KPackage/PackageLoader>
# include <KI18n/KLocalizedString>
2016-12-31 00:26:38 +03:00
namespace Latte {
2018-12-06 14:32:21 +03:00
Package : : Package ( QObject * parent , const QVariantList & args )
2016-12-25 10:25:27 +03:00
: KPackage : : PackageStructure ( parent , args )
{
}
2018-12-06 14:32:21 +03:00
Package : : ~ Package ( )
2016-12-25 10:25:27 +03:00
{
}
2018-12-06 14:32:21 +03:00
void Package : : initPackage ( KPackage : : Package * package )
2016-12-25 10:25:27 +03:00
{
auto fallback = KPackage : : PackageLoader : : self ( ) - > loadPackage ( " Plasma/Shell " , " org.kde.plasma.desktop " ) ;
package - > setDefaultPackageRoot ( QStringLiteral ( " plasma/shells/ " ) ) ;
2016-12-25 20:13:25 +03:00
package - > setPath ( " org.kde.latte.shell " ) ;
2018-02-03 19:44:08 +03:00
package - > addFileDefinition ( " defaults " , QStringLiteral ( " defaults " ) , i18n ( " Latte Dock defaults " ) ) ;
2016-12-31 00:26:38 +03:00
package - > addFileDefinition ( " lattedockui " , QStringLiteral ( " views/Panel.qml " ) , i18n ( " Latte Dock panel " ) ) ;
2021-01-16 20:12:42 +03:00
package - > addFileDefinition ( " widgetexplorerui " , QStringLiteral ( " views/WidgetExplorer.qml " ) , i18n ( " Widget Explorer " ) ) ;
2016-12-25 10:25:27 +03:00
//Configuration
2016-12-31 00:26:38 +03:00
package - > addFileDefinition ( " lattedockconfigurationui " , QStringLiteral ( " configuration/LatteDockConfiguration.qml " ) , i18n ( " Dock configuration UI " ) ) ;
2018-01-18 22:21:32 +03:00
package - > addFileDefinition ( " lattedocksecondaryconfigurationui " , QStringLiteral ( " configuration/LatteDockSecondaryConfiguration.qml " ) , i18n ( " Dock secondary configuration UI " ) ) ;
2020-07-09 16:43:57 +03:00
package - > addFileDefinition ( " canvasconfigurationui " , QStringLiteral ( " configuration/CanvasConfiguration.qml " ) , i18n ( " Dock canvas configuration UI " ) ) ;
2016-12-25 10:25:27 +03:00
package - > addFileDefinition ( " configmodel " , QStringLiteral ( " configuration/config.qml " ) , i18n ( " Config model " ) ) ;
2018-03-04 14:05:58 +03:00
package - > addFileDefinition ( " splitter " , QStringLiteral ( " images/splitter.svgz " ) , i18n ( " Splitter " ) ) ;
package - > addFileDefinition ( " trademark " , QStringLiteral ( " images/trademark.svgz " ) , i18n ( " Latte Trademark " ) ) ;
2020-07-04 18:44:51 +03:00
package - > addFileDefinition ( " trademarkicon " , QStringLiteral ( " images/trademarkicon.svgz " ) , i18n ( " Latte Trademark Icon " ) ) ;
2017-07-25 14:06:48 +03:00
package - > addFileDefinition ( " infoviewui " , QStringLiteral ( " views/InfoView.qml " ) , i18n ( " Info View Window " ) ) ;
2017-04-23 12:14:44 +03:00
package - > addFileDefinition ( " layout1 " , QStringLiteral ( " layouts/Default.latterc " ) , i18n ( " default layout file " ) ) ;
package - > addFileDefinition ( " layout2 " , QStringLiteral ( " layouts/Plasma.latterc " ) , i18n ( " plasma layout file " ) ) ;
package - > addFileDefinition ( " layout3 " , QStringLiteral ( " layouts/Unity.latterc " ) , i18n ( " unity layout file " ) ) ;
package - > addFileDefinition ( " layout4 " , QStringLiteral ( " layouts/Extended.latterc " ) , i18n ( " extended layout file " ) ) ;
2017-07-02 15:17:17 +03:00
2020-08-12 12:02:46 +03:00
package - > addFileDefinition ( " templates " , QStringLiteral ( " templates " ) , i18n ( " system templates directory " ) ) ;
2017-07-02 15:17:17 +03:00
package - > addFileDefinition ( " preset1 " , QStringLiteral ( " presets/Default.layout.latte " ) , i18n ( " default preset file " ) ) ;
package - > addFileDefinition ( " preset2 " , QStringLiteral ( " presets/Plasma.layout.latte " ) , i18n ( " plasma preset file " ) ) ;
package - > addFileDefinition ( " preset3 " , QStringLiteral ( " presets/Unity.layout.latte " ) , i18n ( " unity preset file " ) ) ;
package - > addFileDefinition ( " preset4 " , QStringLiteral ( " presets/Extended.layout.latte " ) , i18n ( " extended preset file " ) ) ;
2018-01-13 13:00:47 +03:00
package - > addFileDefinition ( " preset10 " , QStringLiteral ( " presets/multiple-layouts_hidden.layout.latte " ) , i18n ( " multiple layouts hidden file " ) ) ;
2017-07-25 14:06:48 +03:00
2021-04-27 11:24:52 +03:00
//! applets
package - > addFileDefinition ( " compactapplet " , QStringLiteral ( " applet/CompactApplet.qml " ) , i18n ( " QML component that shows an applet in a popup " ) ) ;
2016-12-25 10:25:27 +03:00
package - > setFallbackPackage ( fallback ) ;
qDebug ( ) < < " package is valid " < < package - > isValid ( ) ;
}
2018-12-06 14:32:21 +03:00
void Package : : pathChanged ( KPackage : : Package * package )
2016-12-25 10:25:27 +03:00
{
if ( ! package - > metadata ( ) . isValid ( ) )
return ;
2017-04-21 16:59:58 +03:00
2016-12-25 10:25:27 +03:00
const QString pluginName = package - > metadata ( ) . pluginId ( ) ;
2017-04-21 16:59:58 +03:00
2016-12-25 20:13:25 +03:00
if ( ! pluginName . isEmpty ( ) & & pluginName ! = " org.kde.latte.shell " ) {
2016-12-28 18:33:59 +03:00
auto fallback = KPackage : : PackageLoader : : self ( ) - > loadPackage ( " Plasma/Shell " , " org.kde.latte.shell " ) ;
2016-12-25 10:25:27 +03:00
package - > setFallbackPackage ( fallback ) ;
2021-05-22 01:00:42 +03:00
} else if ( pluginName . isEmpty ( ) | | pluginName = = QLatin1String ( " org.kde.latte.shell " ) ) {
2016-12-25 10:25:27 +03:00
package - > setFallbackPackage ( KPackage : : Package ( ) ) ;
}
}
2016-12-31 00:26:38 +03:00
}