Conversion to cmake building system

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/13/head
Michele Calgaro 12 months ago
parent fb563936c1
commit 95f2a2d8b5
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -0,0 +1,91 @@
############################################
#
# (C) 2023 Michele Calgaro
# Michele (DOT) Calgaro (AT) yahoo.it
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
############################################
cmake_minimum_required( VERSION 3.5 )
#### general package setup
project( tde-guidance )
#### include essential cmake modules
include( FindPkgConfig )
include( CheckSymbolExists )
include( CheckIncludeFile )
include( CheckLibraryExists )
include( CheckCSourceCompiles )
include( CheckCXXSourceCompiles )
include( CheckTypeSize )
#### include our cmake modules
include( TDEMacros )
##### set version number
tde_set_project_version( )
##### setup install paths
include( TDESetupPaths )
tde_setup_paths( )
##### optional stuff
option( WITH_ALL_OPTIONS "Enable all optional support" OFF )
option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} )
##### user requested modules
option( BUILD_ALL "Build all" ON )
option( BUILD_DOC "Build documentation" ${BUILD_ALL} )
option( BUILD_TRANSLATIONS "Build translations" ${BUILD_ALL} )
##### configure checks
include( ConfigureChecks.cmake )
##### global compiler settings
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" )
##### directories
add_subdirectory( kde )
add_subdirectory( mountconfig )
add_subdirectory( serviceconfig )
add_subdirectory( userconfig )
##### other data ################################
tde_conditional_add_project_docs( BUILD_DOC )
#tde_conditional_add_subdirectory( BUILD_TRANSLATIONS )
##### write configure files
configure_file( config.h.cmake config.h @ONLY )

@ -0,0 +1,72 @@
###########################################
# #
# Improvements and feedback are welcome #
# #
# This file is released under GPL >= 3 #
# #
###########################################
# required stuff
find_package( TQt )
find_package( TDE )
tde_setup_architecture_flags( )
include(TestBigEndian)
test_big_endian(WORDS_BIGENDIAN)
tde_setup_largefiles( )
##### check for gcc visibility support
if( WITH_GCC_VISIBILITY )
tde_setup_gcc_visibility( )
endif( WITH_GCC_VISIBILITY )
##### find python libraries
if( ${CMAKE_VERSION} VERSION_LESS "3.12" )
find_package( PythonInterp )
find_package( PythonLibs )
if( NOT PYTHONLIBS_FOUND )
tde_message_fatal( "Python is required, but was not found on your system" )
endif( NOT PYTHONLIBS_FOUND )
else( )
find_package( Python COMPONENTS Interpreter Development )
if( NOT Python_Development_FOUND )
tde_message_fatal( "Python is required, but was not found on your system" )
endif( )
set( PYTHON_EXECUTABLE ${Python_EXECUTABLE} )
set( PYTHON_INCLUDE_DIR ${Python_INCLUDE_DIRS} )
set( PYTHON_LIBRARIES ${Python_LIBRARIES} )
endif( )
##### find python setuptools location and set tde-guidance package location
execute_process(
COMMAND "${PYTHON_EXECUTABLE}" -c "import os; import setuptools; print(os.path.dirname(setuptools.__path__[0]))"
OUTPUT_VARIABLE TDE_GUIDANCE_DIST_PKG_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set( TDE_GUIDANCE_DIST_PKG_PATH ${TDE_GUIDANCE_DIST_PKG_PATH}/tde-guidance )
##### find pytquic executable
find_program( PYTQUIC_EXECUTABLE NAMES pytquic )
if( NOT PYTQUIC_EXECUTABLE )
tde_message_fatal( "pytquic is required, but was not found on your system" )
endif()
##### find pythonize library
find_library( PYTHONIZE_LIBRARIES pythonize HINTS ${LIB_INSTALL_DIR} )
if( "${PYTHONIZE_LIBRARIES}" STREQUAL "PYTHONIZE_LIBRARIES-NOTFOUND" )
tde_message_fatal( "pythonize library is required, but was not found on your system" )
endif( )

@ -0,0 +1,8 @@
#define VERSION "@VERSION@"
// Defined if you have fvisibility and fvisibility-inlines-hidden support.
#cmakedefine __KDE_HAVE_GCC_VISIBILITY 1
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@

@ -0,0 +1,69 @@
.\" Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.TH "MOUNTCONFIG" "1" "aout 2, 2005" "" ""
.SH "NAME"
mountconfig \- disk and filesystem administration tool
.SH "SYNOPSIS"
.B mountconfig
.RI [ options ]
.br
.SH "DESCRIPTION"
This manual page documents briefly the
.B mountconfig
commands. This manual page was written for the Debian distribution
because the original program does not have a manual page.
.PP
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
.\" respectively.
\fBmountconfig\fP is a disk and filesystem administration tool.
.SH "OPTIONS"
These programs follow the usual GNU command line syntax, with long
options starting with two dashes (`\-').
A summary of options is included below.
.TP
.B \-\-help
Show summary of options.
.TP
.B \-\-help\-qt
Show QT specific help (common for all QT apps).
.TP
.B \-\-help\-tde
Show TDE specific help (common for all TDE apps).
.TP
.B \-\-help\-all
Show the complete help.
.TP
.B \-\-author
Show program author(s).
.TP
.B \-v, \-\-version
Show version of program.
.TP
.B \-\-license
Show program license.
.SH "SEE ALSO"
.BR displayconfig (1),
.BR displayconfig-restore (1),
.BR serviceconfig (1),
.BR userconfig (1).
.br
.SH "AUTHOR"
mountconfig was written by <simon@simonzone.com>.
.PP
This manual page was written by Fathi Boudra <fboudra@free.fr>,
for the Debian project (but may be used by others).

@ -0,0 +1,69 @@
.\" Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.TH "SERVICECONFIG" "1" "aout 2, 2005" "" ""
.SH "NAME"
serviceconfig \- Service/daemon administration tool
.SH "SYNOPSIS"
.B serviceconfig
.RI [ options ]
.br
.SH "DESCRIPTION"
This manual page documents briefly the
.B serviceconfig
commands. This manual page was written for the Debian distribution
because the original program does not have a manual page.
.PP
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
.\" respectively.
\fBserviceconfig\fP is a service/daemon administration tool.
.SH "OPTIONS"
These programs follow the usual GNU command line syntax, with long
options starting with two dashes (`\-').
A summary of options is included below.
.TP
.B \-\-help
Show summary of options.
.TP
.B \-\-help\-qt
Show QT specific help (common for all QT apps).
.TP
.B \-\-help\-tde
Show TDE specific help (common for all TDE apps).
.TP
.B \-\-help\-all
Show the complete help.
.TP
.B \-\-author
Show program author(s).
.TP
.B \-v, \-\-version
Show version of program.
.TP
.B \-\-license
Show program license.
.SH "SEE ALSO"
.BR displayconfig (1),
.BR displayconfig-restore (1),
.BR mountconfig (1),
.BR userconfig (1).
.br
.SH "AUTHOR"
serviceconfig was written by <simon@simonzone.com>.
.PP
This manual page was written by Fathi Boudra <fboudra@free.fr>,
for the Debian project (but may be used by others).

@ -0,0 +1,69 @@
.\" Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.TH "USERCONFIG" "1" "aout 2, 2005" "" ""
.SH "NAME"
userconfig \- user and group administration tool
.SH "SYNOPSIS"
.B userconfig
.RI [ options ]
.br
.SH "DESCRIPTION"
This manual page documents briefly the
.B userconfig
commands. This manual page was written for the Debian distribution
because the original program does not have a manual page.
.PP
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
.\" respectively.
\fBuserconfig\fP is an user and group administration tool.
.SH "OPTIONS"
These programs follow the usual GNU command line syntax, with long
options starting with two dashes (`\-').
A summary of options is included below.
.TP
.B \-\-help
Show summary of options.
.TP
.B \-\-help\-qt
Show QT specific help (common for all QT apps).
.TP
.B \-\-help\-tde
Show TDE specific help (common for all TDE apps).
.TP
.B \-\-help\-all
Show the complete help.
.TP
.B \-\-author
Show program author(s).
.TP
.B \-v, \-\-version
Show version of program.
.TP
.B \-\-license
Show program license.
.SH "SEE ALSO"
.BR displayconfig (1),
.BR displayconfig-restore (1),
.BR mountconfig (1),
.BR serviceconfig (1).
.br
.SH "AUTHOR"
userconfig was written by <simon@simonzone.com>.
.PP
This manual page was written by Fathi Boudra <fboudra@free.fr>,
for the Debian project (but may be used by others).

@ -0,0 +1,37 @@
##### png files
file( GLOB _png_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*/pics/*.png )
install(
FILES ${_png_files}
DESTINATION ${DATA_INSTALL_DIR}/guidance/pics
)
##### icon files
file( GLOB _icons16_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*/pics/16x16/*.png )
install(
FILES ${_icons16_files}
DESTINATION ${ICON_INSTALL_DIR}/crystalsvg/16x16/apps
)
install(
FILES serviceconfig/pics/hi32-app-daemons.png
DESTINATION ${ICON_INSTALL_DIR}/crystalsvg/32x32/apps
RENAME daemons.png
)
install(
FILES mountconfig/pics/kcmpartitions.png
DESTINATION ${ICON_INSTALL_DIR}/crystalsvg/32x32/apps
RENAME disksfilesystems.png
)
install(
FILES userconfig/pics/hi32-user.png
DESTINATION ${ICON_INSTALL_DIR}/crystalsvg/32x32/apps
RENAME userconfig.png
)

@ -0,0 +1,78 @@
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}
${PYTHON_INCLUDE_DIR}
${TQT_INCLUDE_DIRS}
${TDE_INCLUDE_DIR}
)
link_directories(
${TQT_LIBRARY_DIRS}
${TDE_LIBRARY_DIRS}
)
##### generate kcm control module code
set( MODULE_NAME mountconfig )
set( _MODULEDIR_ ${DATA_INSTALL_DIR}/guidance )
set( _EXTRAMODULE_ ${TDE_GUIDANCE_DIST_PKG_PATH} )
set( _MODULENAME_ ${MODULE_NAME} )
set( _FACTORYFUNCTION_ create_${MODULE_NAME} )
configure_file(
${CMAKE_SOURCE_DIR}/templates/kcm_module_stub.cpp.cmake
${CMAKE_CURRENT_BINARY_DIR}/kcm_${MODULE_NAME}.cpp @ONLY
)
##### kcm_userconfig (module) #######################
tde_add_kpart( kcm_${MODULE_NAME} AUTOMOC
SOURCES ${CMAKE_CURRENT_BINARY_DIR}/kcm_${MODULE_NAME}.cpp
LINK
tdecore-shared tdeui-shared
${PYTHON_LIBRARIES} ${PYTHONIZE_LIBRARIES}
${CMAKE_DL_LIBS}
DESTINATION ${PLUGIN_INSTALL_DIR}
)
##### Generate UI files
add_custom_command(
OUTPUT fuser_ui.py
COMMAND ${PYTQUIC_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/fuser_ui.ui
-o ${CMAKE_CURRENT_BINARY_DIR}/fuser_ui.py
COMMENT "Gerenate fuser_ui.py"
)
add_custom_target( fuser_ui-pytquic ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/fuser_ui.py
)
##### other files
tde_create_translated_desktop(
SOURCE ${MODULE_NAME}.desktop
DESTINATION ${XDG_APPS_INSTALL_DIR}
)
install(
FILES
SimpleCommandRunner.py SMBShareSelectDialog.py MicroHAL.py
fuser.py ${CMAKE_CURRENT_BINARY_DIR}/fuser_ui.py sizeview.py
DESTINATION ${TDE_GUIDANCE_DIST_PKG_PATH}
)
install(
PROGRAMS ${MODULE_NAME}.py
DESTINATION ${TDE_GUIDANCE_DIST_PKG_PATH}
)
tde_install_symlink( ${TDE_GUIDANCE_DIST_PKG_PATH}/${MODULE_NAME}.py ${BIN_INSTALL_DIR}/${MODULE_NAME} )

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
########################################################################### ###########################################################################
# MicroHAL.py - # # MicroHAL.py - #
# ------------------------------ # # ------------------------------ #

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
########################################################################### ###########################################################################
# fuser.py - description # # fuser.py - description #
# ------------------------------ # # ------------------------------ #

@ -12,8 +12,20 @@ Name[pt_BR]=Disco & Sistemas de Arquivos
Name[sr]=Диск и фајл-системи Name[sr]=Диск и фајл-системи
Name[sr@Latn]=Disk i fajl-sistemi Name[sr@Latn]=Disk i fajl-sistemi
Name[sv]=Disk- och filsystem Name[sv]=Disk- och filsystem
Name[xx]=xxDisk & Filesystemsxx
name[en_GB]=Disk & Filesystems GenericName=Mount Point Editor
GenericName[el]=Επεξεργαστής σημείων προσάρτησης
GenericName[es]=Editor del punto de montaje
GenericName[et]=Ühenduspunktide redaktor
GenericName[it]=Editor dei punti di montaggio
GenericName[ja]=マウントポイントエディタ
GenericName[nl]=Aankoppelpunten bewerken
GenericName[pt]=Editor de Pontos de Montagem
GenericName[pt_BR]=Editor de Pontos de Montagem
GenericName[sr]=Уређивач тачки монтирања
GenericName[sr@Latn]=Uređivač tački montiranja
GenericName[sv]=Editor för monteringspunkter
Comment=Disk & Filesystem Configuration Comment=Disk & Filesystem Configuration
Comment[el]=Ρυθμίσεις δίσκων & συστημάτων αρχείων Comment[el]=Ρυθμίσεις δίσκων & συστημάτων αρχείων
Comment[es]=Configuración del disco y sistema de archivos Comment[es]=Configuración del disco y sistema de archivos
@ -26,7 +38,7 @@ Comment[pt_BR]=Configuração de Disco e Sistemas de Arquivos
Comment[sr]=Подешавање диска и фајл-система Comment[sr]=Подешавање диска и фајл-система
Comment[sr@Latn]=Podešavanje diska i fajl-sistema Comment[sr@Latn]=Podešavanje diska i fajl-sistema
Comment[sv]=Disk och filsysteminitierníng Comment[sv]=Disk och filsysteminitierníng
Comment[xx]=xxDisk & Filesystem Configurationxx
Icon=disksfilesystems Icon=disksfilesystems
Encoding=UTF-8 Encoding=UTF-8
X-TDE-ModuleType=Library X-TDE-ModuleType=Library
@ -36,16 +48,3 @@ X-TDE-RootOnly=true
Type=Application Type=Application
Exec=tdecmshell System/mountconfig Exec=tdecmshell System/mountconfig
Categories=Qt;TDE;X-TDE-settings-system; Categories=Qt;TDE;X-TDE-settings-system;
GenericName=Mount Point Editor
GenericName[el]=Επεξεργαστής σημείων προσάρτησης
GenericName[es]=Editor del punto de montaje
GenericName[et]=Ühenduspunktide redaktor
GenericName[it]=Editor dei punti di montaggio
GenericName[ja]=マウントポイントエディタ
GenericName[nl]=Aankoppelpunten bewerken
GenericName[pt]=Editor de Pontos de Montagem
GenericName[pt_BR]=Editor de Pontos de Montagem
GenericName[sr]=Уређивач тачки монтирања
GenericName[sr@Latn]=Uređivač tački montiranja
GenericName[sv]=Editor för monteringspunkter
GenericName[xx]=xxMount Point Editorxx

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: UTF-8 -*- # -*- coding: UTF-8 -*-
########################################################################### ###########################################################################
# mountconfig.py - description # # mountconfig.py - description #

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/python3
from PyTQt.tqt import * from PyTQt.tqt import *
from tdecore import * from tdecore import *

@ -0,0 +1,56 @@
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}
${PYTHON_INCLUDE_DIR}
${TQT_INCLUDE_DIRS}
${TDE_INCLUDE_DIR}
)
link_directories(
${TQT_LIBRARY_DIRS}
${TDE_LIBRARY_DIRS}
)
##### generate kcm control module code
set( MODULE_NAME serviceconfig )
set( _MODULEDIR_ ${DATA_INSTALL_DIR}/guidance )
set( _EXTRAMODULE_ ${TDE_GUIDANCE_DIST_PKG_PATH} )
set( _MODULENAME_ ${MODULE_NAME} )
set( _FACTORYFUNCTION_ create_${MODULE_NAME} )
configure_file(
${CMAKE_SOURCE_DIR}/templates/kcm_module_stub.cpp.cmake
${CMAKE_CURRENT_BINARY_DIR}/kcm_${MODULE_NAME}.cpp @ONLY
)
##### kcm_userconfig (module) #######################
tde_add_kpart( kcm_${MODULE_NAME} AUTOMOC
SOURCES ${CMAKE_CURRENT_BINARY_DIR}/kcm_${MODULE_NAME}.cpp
LINK
tdecore-shared tdeui-shared
${PYTHON_LIBRARIES} ${PYTHONIZE_LIBRARIES}
${CMAKE_DL_LIBS}
DESTINATION ${PLUGIN_INSTALL_DIR}
)
##### other files
tde_create_translated_desktop(
SOURCE ${MODULE_NAME}.desktop
DESTINATION ${XDG_APPS_INSTALL_DIR}
)
install(
PROGRAMS ${MODULE_NAME}.py
DESTINATION ${TDE_GUIDANCE_DIST_PKG_PATH}
)
tde_install_symlink( ${TDE_GUIDANCE_DIST_PKG_PATH}/${MODULE_NAME}.py ${BIN_INSTALL_DIR}/${MODULE_NAME} )

@ -11,8 +11,20 @@ Name[pt_BR]=Serviços do Sistema
Name[sr]=Системски сервиси Name[sr]=Системски сервиси
Name[sr@Latn]=Sistemski servisi Name[sr@Latn]=Sistemski servisi
Name[sv]=Systemtjänster Name[sv]=Systemtjänster
Name[xx]=xxSystem Servicesxx
name[en_GB]=System Services GenericName=Runlevel Editor
GenericName[el]=Επεξεργαστής επιπέδων εκτέλεσης
GenericName[es]=Editor del nivel de ejecución
GenericName[et]=Käitustasemete redaktor
GenericName[it]=Editor dei runlevel
GenericName[ja]=ランレベルエディタ
GenericName[nl]=Runlevel-bewerker
GenericName[pt]=Editor de Níveis de Execução
GenericName[pt_BR]=Editor de Níveis de Execução
GenericName[sr]=Уређивач радних нивоа
GenericName[sr@Latn]=Uređivač radnih nivoa
GenericName[sv]=Editor för körnivå
Comment=System Service Configuration Comment=System Service Configuration
Comment[el]=Ρυθμίσεις υπηρεσιών συστήματος Comment[el]=Ρυθμίσεις υπηρεσιών συστήματος
Comment[es]=Configuración del servicio del sistema Comment[es]=Configuración del servicio del sistema
@ -25,7 +37,7 @@ Comment[pt_BR]=Configuração dos Serviços do Sistema
Comment[sr]=Подешавање системских сервиса Comment[sr]=Подешавање системских сервиса
Comment[sr@Latn]=Podešavanje sistemskih servisa Comment[sr@Latn]=Podešavanje sistemskih servisa
Comment[sv]=Inställning av systemtjänster Comment[sv]=Inställning av systemtjänster
Comment[xx]=xxSystem Service Configurationxx
Icon=daemons Icon=daemons
Encoding=UTF-8 Encoding=UTF-8
X-TDE-ModuleType=Library X-TDE-ModuleType=Library
@ -35,16 +47,3 @@ X-TDE-RootOnly=true
Type=Application Type=Application
Exec=tdecmshell System/serviceconfig Exec=tdecmshell System/serviceconfig
Categories=Qt;TDE;X-TDE-settings-system; Categories=Qt;TDE;X-TDE-settings-system;
GenericName=Runlevel Editor
GenericName[el]=Επεξεργαστής επιπέδων εκτέλεσης
GenericName[es]=Editor del nivel de ejecución
GenericName[et]=Käitustasemete redaktor
GenericName[it]=Editor dei runlevel
GenericName[ja]=ランレベルエディタ
GenericName[nl]=Runlevel-bewerker
GenericName[pt]=Editor de Níveis de Execução
GenericName[pt_BR]=Editor de Níveis de Execução
GenericName[sr]=Уређивач радних нивоа
GenericName[sr@Latn]=Uređivač radnih nivoa
GenericName[sv]=Editor för körnivå
GenericName[xx]=xxRunlevel Editorxx

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: UTF-8 -*- # -*- coding: UTF-8 -*-
########################################################################### ###########################################################################
# serviceconfig.py - description # # serviceconfig.py - description #

@ -0,0 +1,151 @@
/*
* pykcm_launcher.cpp
*
* Launch Control Centre modules written in Python using an embedded Python
* interpreter.
* Based on David Boddie's PyTDE-components.
*/
// pythonize.h must be included first.
#include <pythonize.h>
#include <tdecmodule.h>
#include <tdeglobal.h>
#include <tdelocale.h>
#include <klibloader.h>
#include <kstandarddirs.h>
#include <ksimpleconfig.h>
#include <tqstring.h>
#include <sip-tqt.h>
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif // _GNU_SOURCE
#include <dlfcn.h>
#define MODULE_DIR "@_MODULEDIR_@"
#define EXTRA_MODULE_DIR "@_EXTRAMODULE_@"
#define MODULE_NAME "@_MODULENAME_@"
#define FACTORY "@_FACTORYFUNCTION_@"
#define CPP_FACTORY @_FACTORYFUNCTION_@
#define debug 1
static TDECModule *report_error(const char *msg) {
if (debug) printf ("error: %s\n", msg);
return NULL;
}
static TDECModule* return_instance( TQWidget *parent, const char *name ) {
TDECModule* tdecmodule;
PyObject *pyTDECModuleTuple;
PyObject *pyTDECModule;
Pythonize *pyize; // Pythonize object to manage the Python interpreter.
// Try to determine what py script we're loading. Note that "name"
// typically appears to be NULL.
TQString script(MODULE_NAME);
// Reload this module, but this time tell the runtime linker to make the
// symbols global and available for later loaded libraries/module.
Dl_info info;
if (!dladdr((const void *)(&return_instance), &info) || !info.dli_fname || !dlopen(info.dli_fname, RTLD_GLOBAL|RTLD_NOW)) {
return report_error ("***Unable to export symbols\n");
}
// Start the interpreter.
pyize = initialize();
if (!pyize) {
return report_error ("***Failed to start interpreter\n");
}
// Add the path to the python script to the interpreter search path.
TQString path = TQString(MODULE_DIR);
if(path == TQString::null) {
return report_error ("***Failed to locate script path");
}
if(!pyize->appendToSysPath (path.latin1 ())) {
return report_error ("***Failed to set sys.path\n");
}
// Add the extra path to the python script to the interpreter search path.
TQString extrapath = TQString(EXTRA_MODULE_DIR);
if(!pyize->appendToSysPath (extrapath.latin1 ())) {
return report_error ("***Failed to set extra sys.path\n");
}
// Load the Python script.
PyObject *pyModule = pyize->importModule ((char *)script.latin1 ());
if(!pyModule) {
PyErr_Print();
return report_error ("***failed to import module\n");
}
// Inject a helper function
TQString bridge = TQString("import sip_tqt\n"
"from PyTQt import tqt\n"
"def kcontrol_bridge_" FACTORY "(parent,name):\n"
" if parent!=0:\n"
" wparent = sip_tqt.wrapinstance(parent,tqt.TQWidget)\n"
" else:\n"
" wparent = None\n"
" inst = " FACTORY "(wparent, name)\n"
" return (inst,sip_tqt.unwrapinstance(inst))\n");
PyRun_String(bridge.latin1(),Py_file_input,PyModule_GetDict(pyModule),PyModule_GetDict(pyModule));
// Get the Python module's factory function.
PyObject *kcmFactory = pyize->getNewObjectRef(pyModule, "kcontrol_bridge_" FACTORY);
if(!kcmFactory) {
return report_error ("***failed to find module factory\n");
}
// Call the factory function. Set up the args.
PyObject *pyParent = PyLong_FromVoidPtr(parent);
PyObject *pyName = PyBytes_FromString(MODULE_NAME);
// Using NN here is effect gives our references to the arguement away.
PyObject *args = Py_BuildValue ("NN", pyParent, pyName);
if(pyName && pyParent && args) {
// run the factory function
pyTDECModuleTuple = pyize->runFunction(kcmFactory, args);
if(!pyTDECModuleTuple) {
PyErr_Print();
return report_error ("*** runFunction failure\n;");
}
} else {
return report_error ("***failed to create args\n");
}
// cleanup a bit
pyize->decref(args);
pyize->decref(kcmFactory);
// Stop this from getting garbage collected.
Py_INCREF(PyTuple_GET_ITEM(pyTDECModuleTuple,0));
// convert the TDECModule PyObject to a real C++ TDECModule *.
pyTDECModule = PyTuple_GET_ITEM(pyTDECModuleTuple,1);
tdecmodule = (TDECModule *)PyLong_AsVoidPtr(pyTDECModule);
if(!tdecmodule) {
return report_error ("***failed sip-tqt conversion to C++ pointer\n");
}
pyize->decref(pyTDECModuleTuple);
// PyTDE can't run the module without this - Pythonize
// grabs the lock at initialization and we have to give
// it back before exiting. At this point, we no longer need
// it.
//pyize->releaseLock ();
// take care of any translation info
TDEGlobal::locale()->insertCatalogue(script);
// Return the pointer to our new TDECModule
return tdecmodule;
}
extern "C"
{
// Factory function that kcontrol will call.
KDE_EXPORT TDECModule* CPP_FACTORY(TQWidget *parent, const char *name)
{
return return_instance(parent, name);
}
}

@ -0,0 +1,61 @@
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}
${PYTHON_INCLUDE_DIR}
${TQT_INCLUDE_DIRS}
${TDE_INCLUDE_DIR}
)
link_directories(
${TQT_LIBRARY_DIRS}
${TDE_LIBRARY_DIRS}
)
##### generate kcm control module code
set( MODULE_NAME userconfig )
set( _MODULEDIR_ ${DATA_INSTALL_DIR}/guidance )
set( _EXTRAMODULE_ ${TDE_GUIDANCE_DIST_PKG_PATH} )
set( _MODULENAME_ ${MODULE_NAME} )
set( _FACTORYFUNCTION_ create_${MODULE_NAME} )
configure_file(
${CMAKE_SOURCE_DIR}/templates/kcm_module_stub.cpp.cmake
${CMAKE_CURRENT_BINARY_DIR}/kcm_${MODULE_NAME}.cpp @ONLY
)
##### kcm_userconfig (module) #######################
tde_add_kpart( kcm_${MODULE_NAME} AUTOMOC
SOURCES ${CMAKE_CURRENT_BINARY_DIR}/kcm_${MODULE_NAME}.cpp
LINK
tdecore-shared tdeui-shared
${PYTHON_LIBRARIES} ${PYTHONIZE_LIBRARIES}
${CMAKE_DL_LIBS}
DESTINATION ${PLUGIN_INSTALL_DIR}
)
##### other files
tde_create_translated_desktop(
SOURCE ${MODULE_NAME}.desktop
DESTINATION ${XDG_APPS_INSTALL_DIR}
)
install(
FILES unixauthdb.py
DESTINATION ${TDE_GUIDANCE_DIST_PKG_PATH}
)
install(
PROGRAMS ${MODULE_NAME}.py
DESTINATION ${TDE_GUIDANCE_DIST_PKG_PATH}
)
tde_install_symlink( ${TDE_GUIDANCE_DIST_PKG_PATH}/${MODULE_NAME}.py ${BIN_INSTALL_DIR}/${MODULE_NAME} )

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
########################################################################### ###########################################################################
# Copyright (C) 2004-2006 by Simon Edwards # Copyright (C) 2004-2006 by Simon Edwards
# <simon@simonzone.com> # <simon@simonzone.com>

@ -11,7 +11,20 @@ Name[pt_BR]=Gerenciamento de Usuários
Name[sr]=Управљање корисницима Name[sr]=Управљање корисницима
Name[sr@Latn]=Upravljanje korisnicima Name[sr@Latn]=Upravljanje korisnicima
Name[sv]=Användarhantering Name[sv]=Användarhantering
Name[xx]=xxUser Managementxx
GenericName=User Account Editor
GenericName[el]=Επεξεργαστής λογαριασμών χρηστών
GenericName[es]=Editor de cuenta de usuario
GenericName[et]=Kasutajakonto redaktor
GenericName[it]=Editor degli account degli utenti
GenericName[ja]=ユーザアカウントエディタ
GenericName[nl]=Gebruikeraccounts bewerken
GenericName[pt]=Editor de Contas dos Utilizadores
GenericName[pt_BR]=Editor de Contas de Usuários
GenericName[sr]=Уређивач корисничких налога
GenericName[sr@Latn]=Uređivač korisničkih naloga
GenericName[sv]=Editor för användarkonton
Comment=Users & Groups Administration Comment=Users & Groups Administration
Comment[el]=Διαχείριση χρηστών & ομάδων Comment[el]=Διαχείριση χρηστών & ομάδων
Comment[es]=Administrador de usuarios y grupos Comment[es]=Administrador de usuarios y grupos
@ -24,7 +37,7 @@ Comment[pt_BR]=Administração de Usuários & Grupos
Comment[sr]=Администрирање корисника и група Comment[sr]=Администрирање корисника и група
Comment[sr@Latn]=Administriranje korisnika i grupa Comment[sr@Latn]=Administriranje korisnika i grupa
Comment[sv]=Administration av användare och grupper Comment[sv]=Administration av användare och grupper
Comment[xx]=xxUsers & Groups Administrationxx
Icon=userconfig Icon=userconfig
Encoding=UTF-8 Encoding=UTF-8
X-TDE-ModuleType=Library X-TDE-ModuleType=Library
@ -34,16 +47,3 @@ X-TDE-RootOnly=true
Type=Application Type=Application
Exec=tdecmshell System/userconfig Exec=tdecmshell System/userconfig
Categories=Qt;TDE;X-TDE-settings-system; Categories=Qt;TDE;X-TDE-settings-system;
GenericName=User Account Editor
GenericName[el]=Επεξεργαστής λογαριασμών χρηστών
GenericName[es]=Editor de cuenta de usuario
GenericName[et]=Kasutajakonto redaktor
GenericName[it]=Editor degli account degli utenti
GenericName[ja]=ユーザアカウントエディタ
GenericName[nl]=Gebruikeraccounts bewerken
GenericName[pt]=Editor de Contas dos Utilizadores
GenericName[pt_BR]=Editor de Contas de Usuários
GenericName[sr]=Уређивач корисничких налога
GenericName[sr@Latn]=Uređivač korisničkih naloga
GenericName[sv]=Editor för användarkonton
GenericName[xx]=xxUser Account Editorxx

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
# -*- coding: UTF-8 -*- # -*- coding: UTF-8 -*-
########################################################################### ###########################################################################
# userconfig.py - description # # userconfig.py - description #

Loading…
Cancel
Save