diff --git a/kcms/CMakeLists.txt b/kcms/CMakeLists.txt --- a/kcms/CMakeLists.txt +++ b/kcms/CMakeLists.txt @@ -22,7 +22,7 @@ add_subdirectory( dateandtime ) add_subdirectory( autostart ) add_subdirectory( ksplash ) - +add_subdirectory( showcasekconfigerror ) add_subdirectory( launch ) add_subdirectory( colors ) add_subdirectory( krdb ) diff --git a/kcms/showcasekconfigerror/CMakeLists.txt b/kcms/showcasekconfigerror/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/kcms/showcasekconfigerror/CMakeLists.txt @@ -0,0 +1,25 @@ +add_definitions(-DTRANSLATION_DOMAIN=\"kcm5_showcasekconfigerror\") + +set(SRCS_showcasekconfigerror + kcm.cpp +) +kconfig_add_kcfg_files(SRCS_showcasekconfigerror showcasekconfigerrorsettings.kcfgc GENERATE_MOC) + +add_library(kcm_showcasekconfigerror MODULE ${SRCS_showcasekconfigerror}) + +target_link_libraries(kcm_showcasekconfigerror + KF5::CoreAddons + KF5::KCMUtils + KF5::I18n + KF5::QuickAddons + Qt5::DBus + Qt5::Widgets +) + +kcoreaddons_desktop_to_json(kcm_showcasekconfigerror "kcm_showcasekconfigerror.desktop") + +install(FILES showcasekconfigerrorsettings.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR}) +install(FILES kcm_showcasekconfigerror.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) +install(TARGETS kcm_showcasekconfigerror DESTINATION ${KDE_INSTALL_PLUGINDIR}/kcms) + +kpackage_install_package(package kcm_showcasekconfigerror kcms) diff --git a/kcms/showcasekconfigerror/Messages.sh b/kcms/showcasekconfigerror/Messages.sh new file mode 100644 --- /dev/null +++ b/kcms/showcasekconfigerror/Messages.sh @@ -0,0 +1,4 @@ +#! /usr/bin/env bash +$EXTRACTRC `find . -name "*.ui"` >> rc.cpp || exit 11 +$XGETTEXT `find . -name "*.cpp"` -o $podir/kcm5_showcasekconfigerror.pot +rm -f rc.cpp diff --git a/kcms/showcasekconfigerror/README b/kcms/showcasekconfigerror/README new file mode 100644 --- /dev/null +++ b/kcms/showcasekconfigerror/README @@ -0,0 +1,20 @@ +Plasma KCM Template +---------------------- + +Create the project folder inside plasma-desktop/kcms and add the name of the folder in the parent CMake + +-- Build instructions -- + +Create the project folder inside plasma-desktop/kcms and add the name of the folder in the parent CMake +then compile normally plasma-desktop. + +test the kcm with +kcmshell5 kcm_KCM_NAME_HERE + + +-- Tutorials and resources -- +The explanation of the template +https://techbase.kde.org/Development/Tutorials/Plasma5/QML2/GettingStarted + +Plasma QML API explained +https://techbase.kde.org/Development/Tutorials/Plasma2/QML2/API diff --git a/kcms/showcasekconfigerror/kcm.h b/kcms/showcasekconfigerror/kcm.h new file mode 100644 --- /dev/null +++ b/kcms/showcasekconfigerror/kcm.h @@ -0,0 +1,39 @@ +/* This file is part of the KDE Project + * Copyright (C) 2019 by Tomaz Canabrava + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + 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 SHOWCASEKCONFIGERROR_H +#define SHOWCASEKCONFIGERROR_H + +#include + +class ShowcaseKConfigErrorSettings; + +class ShowcaseKConfigError : public KQuickAddons::ManagedConfigModule +{ + Q_OBJECT + Q_PROPERTY(ShowcaseKConfigErrorSettings *settings MEMBER m_settings CONSTANT) + +public: + ShowcaseKConfigError(QObject* parent, const QVariantList& args); + virtual ~ShowcaseKConfigError() override; + +private: + ShowcaseKConfigErrorSettings *m_settings; +}; + +#endif diff --git a/kcms/showcasekconfigerror/kcm.cpp b/kcms/showcasekconfigerror/kcm.cpp new file mode 100644 --- /dev/null +++ b/kcms/showcasekconfigerror/kcm.cpp @@ -0,0 +1,51 @@ +/* This file is part of the KDE Project + Copyright (C) 2019 by Tomaz Canabrava + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + 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 "kcm.h" + +#include +#include +#include +#include + +#include "showcasekconfigerrorsettings.h" + +K_PLUGIN_FACTORY_WITH_JSON(KCMShowcaseKConfigErrorFactory, "kcm_showcasekconfigerror.json", registerPlugin();) + +ShowcaseKConfigError::ShowcaseKConfigError(QObject* parent, const QVariantList& args) + : KQuickAddons::ManagedConfigModule(parent, args) + , m_settings(new ShowcaseKConfigErrorSettings(this)) +{ + qmlRegisterType(); + + KAboutData* about = new KAboutData( + QStringLiteral("kcm_showcasekconfigerror"), i18n("ShowcaseKConfigError Configuration Module"), + QStringLiteral("0.1"), QString(), KAboutLicense::GPL, + i18n("Copyright 2019 Tomaz Canabrava")); + + about->addAuthor(i18n("Tomaz Canabrava"), QString(), QStringLiteral("tomaz.canabrava@gmail.com")); + + setAboutData(about); + setButtons(Help | Apply | Default); +} + +ShowcaseKConfigError::~ShowcaseKConfigError() +{ +} + +#include "kcm.moc" diff --git a/kcms/showcasekconfigerror/kcm_showcasekconfigerror.desktop b/kcms/showcasekconfigerror/kcm_showcasekconfigerror.desktop new file mode 100644 --- /dev/null +++ b/kcms/showcasekconfigerror/kcm_showcasekconfigerror.desktop @@ -0,0 +1,15 @@ +[Desktop Entry] +Exec=kcmshell5 kcm_showcasekconfigerror +Icon=plasma +Type=Service + +X-KDE-ServiceTypes=KCModule +X-KDE-Library=kcm_showcasekconfigerror +X-KDE-ParentApp=kcontrol + +X-KDE-System-Settings-Parent-Category=Specify Your Category Here +X-KDE-Weight=10 + +Name=ShowcaseKConfigError +Comment=What your kcm is all about? +X-KDE-Keywords=Colors, Mouse, Monitor diff --git a/kcms/showcasekconfigerror/package/contents/ui/main.qml b/kcms/showcasekconfigerror/package/contents/ui/main.qml new file mode 100644 --- /dev/null +++ b/kcms/showcasekconfigerror/package/contents/ui/main.qml @@ -0,0 +1,49 @@ +/*************************************************************************** + * Copyright (C) 2019 by Tomaz Canabrava * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program 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 General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * + ***************************************************************************/ + +import QtQuick 2.1 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 2.11 as QQC2 +import QtQuick.Dialogs 1.2 as QtDialogs +import org.kde.kirigami 2.4 as Kirigami +import org.kde.kcm 1.1 as KCM + +KCM.SimpleKCM { + id: root + + KCM.ConfigModule.quickHelp: i18n("Quick help for the KCM that does nothing..") + ColumnLayout { + anchors.fill: parent + anchors.margins: Kirigami.Units.largeSpacing + + QQC2.TextField { + text: kcm.settings.workingExample + onEditingFinished: { + kcm.settings.workingExample = text + } + } + + QQC2.TextField { + text: kcm.settings.brokenExample + onEditingFinished: { + kcm.settings.brokenExample = text + } + } + } +} diff --git a/kcms/showcasekconfigerror/package/metadata.desktop b/kcms/showcasekconfigerror/package/metadata.desktop new file mode 100644 --- /dev/null +++ b/kcms/showcasekconfigerror/package/metadata.desktop @@ -0,0 +1,16 @@ +[Desktop Entry] +Name=ShowcaseKConfigError +Comment=what your app does in a few words +Icon=Plasma +Type=Service +X-KDE-PluginInfo-Author=Tomaz Canabrava +X-KDE-PluginInfo-Email=tomaz.canabrava@gmail.com +X-KDE-PluginInfo-License=GPL +X-KDE-PluginInfo-Name=kcm_showcasekconfigerror +X-KDE-PluginInfo-Version=0.1 +X-KDE-PluginInfo-Website= +X-KDE-ServiceTypes=Plasma/Generic +X-Plasma-API=declarativeappletscript + +X-Plasma-MainScript=ui/main.qml + diff --git a/kcms/showcasekconfigerror/showcasekconfigerrorsettings.kcfg b/kcms/showcasekconfigerror/showcasekconfigerrorsettings.kcfg new file mode 100644 --- /dev/null +++ b/kcms/showcasekconfigerror/showcasekconfigerrorsettings.kcfg @@ -0,0 +1,17 @@ + + + + + + + An Working Example String + + + + A Broken Example String + + + diff --git a/kcms/showcasekconfigerror/showcasekconfigerrorsettings.kcfgc b/kcms/showcasekconfigerror/showcasekconfigerrorsettings.kcfgc new file mode 100644 --- /dev/null +++ b/kcms/showcasekconfigerror/showcasekconfigerrorsettings.kcfgc @@ -0,0 +1,6 @@ +File=showcasekconfigerrorsettings.kcfg +ClassName=ShowcaseKConfigErrorSettings +Mutators=true +DefaultValueGetters=true +GenerateProperties=true +ParentInConstructor=true