Commit 1656092a authored by Alexander Lohnau's avatar Alexander Lohnau 💬

Add template to generate a custom file template

parent f124dab2
Pipeline #38657 canceled with stage
in 16 minutes and 46 seconds
......@@ -7,4 +7,5 @@ kdevplatform_add_app_templates(
cpp/QMake/qt5-qml2
c/CMake/cmake_plainc
empty
kdevelop/file_template_template
)
[General]
# See https://techbase.kde.org/KDevelop5/File_template_specification for documentation
Name=%{APPNAME}
Comment=
Category=MyCategory/Subcategory
Type=Other
Language=MyProgrammingLanguage
Files=MyFile
OptionsFile=options.kcfg
[MyFile]
Name=Demo File
File=DemoFile.txt
OutputFile={{ name }}.txt
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
<kcfgfile arg="true"/>
<group name="">
<entry name="example" type="String">
<tooltip>Example tooltip (optional)</tooltip>
<label>Example</label>
<default>Default Value</default>
</entry>
</group>
</kcfg>
project(%{APPNAMELC})
cmake_minimum_required(VERSION 3.0)
find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH})
include(KDEInstallDirs)
include(KDEPackageAppTemplates)
kde_package_app_templates(TEMPLATES "%{APPNAMELC}" INSTALL_DIR "${KDE_INSTALL_DATADIR}/kdevfiletemplates/templates")
### %{APPNAME} template
To install tis template you can use cmake:
```
# create a build directory called build and configure cmake
# with the custom install prefix we install it in the user-specific folder
cmake --source . --build build -DCMAKE_INSTALL_PREFIX=~/.local
# create and install the template
cmake --build build --target install
```
After this the template shows up in the dialog under File -> New From Template.
If you think that the template can be useful to other people
you can upload it to the KDE store https://store.kde.org/browse/cat/327/.
In case you have an older version of the CMake macro that generates the archive
you can run `rm build/%{APPNAMELC}.tar.bz2` to make sure the file gets recreated.
[General]
Name=KDevelop File Template
Comment=Setup for KDevelop File Template which is packaged using CMake
Category=KDevelop/Template
ShowFilesAfterGeneration=%{APPNAMELC}/%{APPNAMELC}.desktop
Markdown is supported
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