From 1281f76995fa76e129d6014eafa637ba8fc71152 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 26 Feb 2012 14:45:00 -0600 Subject: Rename kde-config to tde-config --- Makefile.am.in | 2 +- dcop/dcopidlng/dcopidlng | 2 +- kconf_update/README.kconf_update | 2 +- kdoctools/move_kio_help_cache.sh | 4 +- tdecore/CMakeLists.txt | 8 +- tdecore/Makefile.am | 6 +- tdecore/configure.in.in | 2 +- tdecore/kde-config.cpp.cmake | 272 --------------------------------------- tdecore/kde-config.cpp.in | 270 -------------------------------------- tdecore/tde-config.cpp.cmake | 272 +++++++++++++++++++++++++++++++++++++++ tdecore/tde-config.cpp.in | 270 ++++++++++++++++++++++++++++++++++++++ 11 files changed, 555 insertions(+), 555 deletions(-) delete mode 100644 tdecore/kde-config.cpp.cmake delete mode 100644 tdecore/kde-config.cpp.in create mode 100644 tdecore/tde-config.cpp.cmake create mode 100644 tdecore/tde-config.cpp.in diff --git a/Makefile.am.in b/Makefile.am.in index c537e0c37..5690f976a 100644 --- a/Makefile.am.in +++ b/Makefile.am.in @@ -53,7 +53,7 @@ messages: find $$dirs -maxdepth 1 -name "*.cpp" -print > files ;\ find $$dirs -maxdepth 1 -name "*.cc" -print >> files ;\ find $$dirs -maxdepth 1 -name "*.h" -print >> files ;\ - echo ./tdecore/kde-config.cpp.in >> files ;\ + echo ./tdecore/tde-config.cpp.in >> files ;\ $(EXTRACTRC) `find $$dirs -maxdepth 1 \( -name "*.rc" -o -name "*.ui" \) ` ./dnssd/kcm_kdnssd.kcfg > rc.cpp; \ : > kde.pot ;\ $(XGETTEXT) -ktranslate -x qt-messages.pot rc.cpp `cat files` && cat messages.po qt-messages.pot > $(podir)/tdelibs.pot diff --git a/dcop/dcopidlng/dcopidlng b/dcop/dcopidlng/dcopidlng index 92ff412a1..5a4f2b401 100755 --- a/dcop/dcopidlng/dcopidlng +++ b/dcop/dcopidlng/dcopidlng @@ -4,7 +4,7 @@ tmpfile=`mktemp -t dcopidlng.XXXXXX` || { echo "$0: Cannot create temporary file trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15 if test -z "$KDECONFIG"; then - KDECONFIG=kde-config + KDECONFIG=tde-config fi LIBDIR="`$KDECONFIG --install data --expandvars`/dcopidlng" perl -I"$LIBDIR" "$LIBDIR/kalyptus" --allow_k_dcop_accessors -f dcopidl $1 2> $tmpfile diff --git a/kconf_update/README.kconf_update b/kconf_update/README.kconf_update index 385f3185e..32c087c01 100644 --- a/kconf_update/README.kconf_update +++ b/kconf_update/README.kconf_update @@ -87,7 +87,7 @@ and use Qt's powerful string API instead. A workaround for KDE 3.1.x and older is to install a .sh script in $(kde_datadir) that contains a simple exec: - exec "`kde-config --prefix`/bin/kconf_update_bin/my_update_app" + exec "`tde-config --prefix`/bin/kconf_update_bin/my_update_app" This is equivalent to what KDE 3.2 can do directly, but of course the .upd file now points to the .sh script instead of the binary application. diff --git a/kdoctools/move_kio_help_cache.sh b/kdoctools/move_kio_help_cache.sh index 671a73980..c31331c9e 100644 --- a/kdoctools/move_kio_help_cache.sh +++ b/kdoctools/move_kio_help_cache.sh @@ -1,6 +1,6 @@ #!/bin/sh -bas=`kde-config --localprefix`share/apps/kio_help -mv "$bas/cache" "`kde-config --path cache`kio_help" +bas=`tde-config --localprefix`share/apps/kio_help +mv "$bas/cache" "`tde-config --path cache`kio_help" rmdir "$bas" exit 0 diff --git a/tdecore/CMakeLists.txt b/tdecore/CMakeLists.txt index 1409c6cde..d5dbf8f96 100644 --- a/tdecore/CMakeLists.txt +++ b/tdecore/CMakeLists.txt @@ -177,14 +177,14 @@ tde_add_library( ${target} SHARED ) -##### kde-config ################################ +##### tde-config ################################ # FIXME still need some research and improvements -configure_file( kde-config.cpp.cmake kde-config.cpp @ONLY ) +configure_file( tde-config.cpp.cmake tde-config.cpp @ONLY ) -tde_add_executable( kde-config - SOURCES ${CMAKE_CURRENT_BINARY_DIR}/kde-config.cpp +tde_add_executable( tde-config + SOURCES ${CMAKE_CURRENT_BINARY_DIR}/tde-config.cpp LINK tdecore-shared DESTINATION ${BIN_INSTALL_DIR} ) diff --git a/tdecore/Makefile.am b/tdecore/Makefile.am index 976307ebd..f8856108c 100644 --- a/tdecore/Makefile.am +++ b/tdecore/Makefile.am @@ -168,9 +168,9 @@ kcharsets.lo: kentities.c parser: kentities.gperf cd $(srcdir) && gperf -a -L "ANSI-C" -E -C -c -o -t -k '*' -Nkde_findEntity -D -Hhash_Entity -Wwordlist_Entity -s 2 kentities.gperf > kentities.c -bin_PROGRAMS = kde-config kgrantpty +bin_PROGRAMS = tde-config kgrantpty -kde_config_SOURCES = kde-config.cpp +kde_config_SOURCES = tde-config.cpp kde_config_LDADD = ./libtdecore.la kde_config_LDFLAGS = $(KDE_RPATH) $(KDE_MT_LDFLAGS) @@ -186,7 +186,7 @@ install-exec-hook: @echo "This is needed for konsole, etc. to ensure that they can't be eavesdropped." @echo "" -DISTCLEANFILES = kde-config.cpp +DISTCLEANFILES = tde-config.cpp DOXYGEN_REFERENCES = dcop tdeui kparts kio DOXYGEN_EXCLUDE = malloc kde_file.h diff --git a/tdecore/configure.in.in b/tdecore/configure.in.in index 7439a7c12..ce957c92b 100644 --- a/tdecore/configure.in.in +++ b/tdecore/configure.in.in @@ -167,7 +167,7 @@ AC_TRY_LINK(dnl AC_CHECK_HEADERS(sys/mount.h) -dnl AC_OUTPUT(tdecore/kde-config.cpp) +dnl AC_OUTPUT(tdecore/tde-config.cpp) AM_CONFIG_HEADER(tdecore/kdemacros.h) diff --git a/tdecore/kde-config.cpp.cmake b/tdecore/kde-config.cpp.cmake deleted file mode 100644 index 8b3dd7afd..000000000 --- a/tdecore/kde-config.cpp.cmake +++ /dev/null @@ -1,272 +0,0 @@ -// -*- c++ -*- - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static const char *description = I18N_NOOP("A little program to output installation paths"); - -static KCmdLineOptions options[] = -{ - { "expandvars", I18N_NOOP("expand ${prefix} and ${exec_prefix} in output"), 0 }, - { "prefix", I18N_NOOP("Compiled in prefix for KDE libraries"), 0 }, - { "exec-prefix", I18N_NOOP("Compiled in exec_prefix for KDE libraries"), 0 }, - { "libsuffix", I18N_NOOP("Compiled in library path suffix"), 0 }, - { "localprefix", I18N_NOOP("Prefix in $HOME used to write files"), 0}, - { "version", I18N_NOOP("Compiled in version string for KDE libraries"), 0 }, - { "types", I18N_NOOP("Available KDE resource types"), 0 }, - { "path type", I18N_NOOP("Search path for resource type"), 0 }, - { "userpath type", I18N_NOOP("User path: desktop|autostart|trash|document"), 0 }, - { "install type", I18N_NOOP("Prefix to install resource files to"), 0}, - { 0,0,0 } -}; - -bool _expandvars = false; - -TQString expandvars(const char *_input) -{ - TQString result = TQString::fromLatin1(_input); - if (!_expandvars) - return result; - - bool changed = false; - int index = result.find("${prefix}"); - if (index >= 0) { - result = result.replace(index, 9, "@CMAKE_INSTALL_PREFIX@"); - changed = true; - } - index = result.find("$(prefix)"); - if (index >= 0) { - result = result.replace(index, 9, "@CMAKE_INSTALL_PREFIX@"); - changed = true; - } - index = result.find("${datadir}"); - if (index >= 0) { - result = result.replace(index, 10, "@SHARE_INSTALL_PREFIX@"); - changed = true; - } - index = result.find("$(datadir)"); - if (index >= 0) { - result = result.replace(index, 10, "@SHARE_INSTALL_PREFIX@"); - changed = true; - } - index = result.find("${exec_prefix}"); - if (index >= 0) { - result = result.replace(index, 14, "@EXEC_INSTALL_PREFIX@"); - changed = true; - } - index = result.find("$(exec_prefix)"); - if (index >= 0) { - result = result.replace(index, 14, "@EXEC_INSTALL_PREFIX@"); - changed = true; - } - index = result.find("${libdir}"); - if (index >= 0) { - result = result.replace(index, 9, "@LIB_INSTALL_DIR@"); - changed = true; - } - index = result.find("$(libdir)"); - if (index >= 0) { - result = result.replace(index, 9, "@LIB_INSTALL_DIR@"); - changed = true; - } - index = result.find("${includedir}"); - if (index >= 0) { - result = result.replace(index, 20, "@INCLUDE_INSTALL_DIR@"); - changed = true; - } - index = result.find("$(includedir)"); - if (index >= 0) { - result = result.replace(index, 20, "@INCLUDE_INSTALL_DIR@"); - changed = true; - } - index = result.find("${sysconfdir}"); - if (index >= 0) { - result = result.replace(index, 13, "@SYSCONF_INSTALL_DIR@"); - changed = true; - } - index = result.find("$(sysconfdir)"); - if (index >= 0) { - result = result.replace(index, 13, "@SYSCONF_INSTALL_DIR@"); - changed = true; - } - if (changed) - return expandvars(result.latin1()); - else - return result; -} - -void printResult(const TQString &s) -{ - if (s.isEmpty()) - printf("\n"); - else - printf("%s\n", s.local8Bit().data()); -} - -int main(int argc, char **argv) -{ - KLocale::setMainCatalogue("tdelibs"); - KAboutData about("kde-config", "kde-config", "1.0", description, KAboutData::License_GPL, "(C) 2000 Stephan Kulow"); - KCmdLineArgs::init( argc, argv, &about); - - KCmdLineArgs::addCmdLineOptions( options ); // Add my own options. - - KInstance a("kde-config"); - (void)KGlobal::dirs(); // trigger the creation - (void)KGlobal::config(); - - // Get application specific arguments - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - - _expandvars = args->isSet("expandvars"); - - if (args->isSet("prefix")) - { - printResult(expandvars("@CMAKE_INSTALL_PREFIX@")); - return 0; - } - - if (args->isSet("exec-prefix")) - { - printResult(expandvars("@EXEC_INSTALL_PREFIX@")); - return 0; - } - - if (args->isSet("libsuffix")) - { - TQString tmp(KDELIBSUFF); - tmp.remove('"'); - printResult(expandvars(tmp.local8Bit())); - return 0; - } - - if (args->isSet("localprefix")) - { - printResult(KGlobal::dirs()->localtdedir()); - return 0; - } - - if (args->isSet("version")) - { - printf("%s\n", TDE_VERSION_STRING); - return 0; - } - - if (args->isSet("types")) - { - TQStringList types = KGlobal::dirs()->allTypes(); - types.sort(); - const char *helptexts[] = { - "apps", I18N_NOOP("Applications menu (.desktop files)"), - "cgi", I18N_NOOP("CGIs to run from kdehelp"), - "config", I18N_NOOP("Configuration files"), - "data", I18N_NOOP("Where applications store data"), - "exe", I18N_NOOP("Executables in $prefix/bin"), - "html", I18N_NOOP("HTML documentation"), - "icon", I18N_NOOP("Icons"), - "kcfg", I18N_NOOP("Configuration description files"), - "lib", I18N_NOOP("Libraries"), - "include", I18N_NOOP("Includes/Headers"), - "locale", I18N_NOOP("Translation files for KLocale"), - "mime", I18N_NOOP("Mime types"), - "module", I18N_NOOP("Loadable modules"), - "qtplugins", I18N_NOOP("Qt plugins"), - "services", I18N_NOOP("Services"), - "servicetypes", I18N_NOOP("Service types"), - "sound", I18N_NOOP("Application sounds"), - "templates", I18N_NOOP("Templates"), - "wallpaper", I18N_NOOP("Wallpapers"), - "xdgdata-apps", I18N_NOOP("XDG Application menu (.desktop files)"), - "xdgdata-dirs", I18N_NOOP("XDG Menu descriptions (.directory files)"), - "xdgconf-menu", I18N_NOOP("XDG Menu layout (.menu files)"), - "cmake", I18N_NOOP("CMake import modules (.cmake files)"), - "tmp", I18N_NOOP("Temporary files (specific for both current host and current user)"), - "socket", I18N_NOOP("UNIX Sockets (specific for both current host and current user)"), - 0, 0 - }; - for (TQStringList::ConstIterator it = types.begin(); it != types.end(); ++it) - { - int index = 0; - while (helptexts[index] && *it != helptexts[index]) { - index += 2; - } - if (helptexts[index]) { - printf("%s - %s\n", helptexts[index], i18n(helptexts[index+1]).local8Bit().data()); - } else { - printf("%s", i18n("%1 - unknown type\n").arg(*it).local8Bit().data()); - } - } - return 0; - } - - TQString type = args->getOption("path"); - if (!type.isEmpty()) - { - printResult(KGlobal::dirs()->resourceDirs(type.latin1()).join(":")); - return 0; - } - - type = args->getOption("userpath"); - if (!type.isEmpty()) - { - if ( type == "desktop" ) - printResult(KGlobalSettings::desktopPath()); - else if ( type == "autostart" ) - printResult(KGlobalSettings::autostartPath()); - else if ( type == "trash" ) - printResult(KGlobalSettings::trashPath()); - else if ( type == "document" ) - printResult(KGlobalSettings::documentPath()); - else - fprintf(stderr, "%s", i18n("%1 - unknown type of userpath\n").arg(type).local8Bit().data() ); - return 0; - } - - type = args->getOption("install"); - if (!type.isEmpty()) - { - const char *installprefixes[] = { - "apps", "@APPS_INSTALL_DIR@", - "config", "@CONFIG_INSTALL_DIR@", - "kcfg", "@KCFG_INSTALL_DIR@", - "data", "@DATA_INSTALL_DIR@", - "exe", "@BIN_INSTALL_DIR@", - "html", "@HTML_INSTALL_DIR@", - "icon", "@ICON_INSTALL_DIR@", - "lib", "@LIB_INSTALL_DIR@", - "module", "@PLUGIN_INSTALL_DIR@", - "qtplugins", "@PLUGIN_INSTALL_DIR@/plugins", - "locale", "@LOCALE_INSTALL_DIR@", - "mime", "@MIME_INSTALL_DIR@", - "services", "@SERVICES_INSTALL_DIR@", - "servicetypes", "@SERVICETYPES_INSTALL_DIR@", - "sound", "@SOUND_INSTALL_DIR@", - "templates", "@TEMPLATES_INSTALL_DIR@", - "wallpaper", "@WALLPAPER_INSTALL_DIR@", - "xdgconf-menu", "@XDG_MENU_INSTALL_DIR@", - "xdgdata-apps", "@XDG_APPS_INSTALL_DIR@", - "xdgdata-dirs", "@XDG_DIRECTORY_INSTALL_DIR@", - "include", "@INCLUDE_INSTALL_DIR@", - "cmake", "@CMAKE_INSTALL_DIR@", - 0, 0 - }; - int index = 0; - while (installprefixes[index] && type != installprefixes[index]) { - index += 2; - } - if (installprefixes[index]) { - printResult(expandvars(installprefixes[index+1])); - } else { - printResult("NONE"); // no i18n here as for scripts - } - } - return 0; -} diff --git a/tdecore/kde-config.cpp.in b/tdecore/kde-config.cpp.in deleted file mode 100644 index 0fdf56e3d..000000000 --- a/tdecore/kde-config.cpp.in +++ /dev/null @@ -1,270 +0,0 @@ -// -*- c++ -*- - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static const char *description = I18N_NOOP("A little program to output installation paths"); - -static KCmdLineOptions options[] = -{ - { "expandvars", I18N_NOOP("expand ${prefix} and ${exec_prefix} in output"), 0 }, - { "prefix", I18N_NOOP("Compiled in prefix for KDE libraries"), 0 }, - { "exec-prefix", I18N_NOOP("Compiled in exec_prefix for KDE libraries"), 0 }, - { "libsuffix", I18N_NOOP("Compiled in library path suffix"), 0 }, - { "localprefix", I18N_NOOP("Prefix in $HOME used to write files"), 0}, - { "version", I18N_NOOP("Compiled in version string for KDE libraries"), 0 }, - { "types", I18N_NOOP("Available KDE resource types"), 0 }, - { "path type", I18N_NOOP("Search path for resource type"), 0 }, - { "userpath type", I18N_NOOP("User path: desktop|autostart|trash|document"), 0 }, - { "install type", I18N_NOOP("Prefix to install resource files to"), 0}, - { 0,0,0 } -}; - -bool _expandvars = false; - -TQString expandvars(const char *_input) -{ - TQString result = TQString::fromLatin1(_input); - if (!_expandvars) - return result; - - bool changed = false; - int index = result.find("${prefix}"); - if (index >= 0) { - result = result.replace(index, 9, "@prefix@"); - changed = true; - } - index = result.find("$(prefix)"); - if (index >= 0) { - result = result.replace(index, 9, "@prefix@"); - changed = true; - } - index = result.find("${datadir}"); - if (index >= 0) { - result = result.replace(index, 10, "@datadir@"); - changed = true; - } - index = result.find("$(datadir)"); - if (index >= 0) { - result = result.replace(index, 10, "@datadir@"); - changed = true; - } - index = result.find("${exec_prefix}"); - if (index >= 0) { - result = result.replace(index, 14, "@exec_prefix@"); - changed = true; - } - index = result.find("$(exec_prefix)"); - if (index >= 0) { - result = result.replace(index, 14, "@exec_prefix@"); - changed = true; - } - index = result.find("${libdir}"); - if (index >= 0) { - result = result.replace(index, 9, "@libdir@"); - changed = true; - } - index = result.find("$(libdir)"); - if (index >= 0) { - result = result.replace(index, 9, "@libdir@"); - changed = true; - } - index = result.find("${includedir}"); - if (index >= 0) { - result = result.replace(index, 20, "@includedir@"); - changed = true; - } - index = result.find("$(includedir)"); - if (index >= 0) { - result = result.replace(index, 20, "@includedir@"); - changed = true; - } - index = result.find("${sysconfdir}"); - if (index >= 0) { - result = result.replace(index, 13, "@sysconfdir@"); - changed = true; - } - index = result.find("$(sysconfdir)"); - if (index >= 0) { - result = result.replace(index, 13, "@sysconfdir@"); - changed = true; - } - if (changed) - return expandvars(result.latin1()); - else - return result; -} - -void printResult(const TQString &s) -{ - if (s.isEmpty()) - printf("\n"); - else - printf("%s\n", s.local8Bit().data()); -} - -int main(int argc, char **argv) -{ - KLocale::setMainCatalogue("tdelibs"); - KAboutData about("kde-config", "kde-config", "1.0", description, KAboutData::License_GPL, "(C) 2000 Stephan Kulow"); - KCmdLineArgs::init( argc, argv, &about); - - KCmdLineArgs::addCmdLineOptions( options ); // Add my own options. - - KInstance a("kde-config"); - (void)KGlobal::dirs(); // trigger the creation - (void)KGlobal::config(); - - // Get application specific arguments - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - - _expandvars = args->isSet("expandvars"); - - if (args->isSet("prefix")) - { - printResult(expandvars("@prefix@")); - return 0; - } - - if (args->isSet("exec-prefix")) - { - printResult(expandvars("@exec_prefix@")); - return 0; - } - - if (args->isSet("libsuffix")) - { - TQString tmp(KDELIBSUFF); - tmp.remove('"'); - printResult(expandvars(tmp.local8Bit())); - return 0; - } - - if (args->isSet("localprefix")) - { - printResult(KGlobal::dirs()->localtdedir()); - return 0; - } - - if (args->isSet("version")) - { - printf("%s\n", TDE_VERSION_STRING); - return 0; - } - - if (args->isSet("types")) - { - TQStringList types = KGlobal::dirs()->allTypes(); - types.sort(); - const char *helptexts[] = { - "apps", I18N_NOOP("Applications menu (.desktop files)"), - "cgi", I18N_NOOP("CGIs to run from kdehelp"), - "config", I18N_NOOP("Configuration files"), - "data", I18N_NOOP("Where applications store data"), - "exe", I18N_NOOP("Executables in $prefix/bin"), - "html", I18N_NOOP("HTML documentation"), - "icon", I18N_NOOP("Icons"), - "kcfg", I18N_NOOP("Configuration description files"), - "lib", I18N_NOOP("Libraries"), - "include", I18N_NOOP("Includes/Headers"), - "locale", I18N_NOOP("Translation files for KLocale"), - "mime", I18N_NOOP("Mime types"), - "module", I18N_NOOP("Loadable modules"), - "qtplugins", I18N_NOOP("Qt plugins"), - "services", I18N_NOOP("Services"), - "servicetypes", I18N_NOOP("Service types"), - "sound", I18N_NOOP("Application sounds"), - "templates", I18N_NOOP("Templates"), - "wallpaper", I18N_NOOP("Wallpapers"), - "xdgdata-apps", I18N_NOOP("XDG Application menu (.desktop files)"), - "xdgdata-dirs", I18N_NOOP("XDG Menu descriptions (.directory files)"), - "xdgconf-menu", I18N_NOOP("XDG Menu layout (.menu files)"), - "tmp", I18N_NOOP("Temporary files (specific for both current host and current user)"), - "socket", I18N_NOOP("UNIX Sockets (specific for both current host and current user)"), - 0, 0 - }; - for (TQStringList::ConstIterator it = types.begin(); it != types.end(); ++it) - { - int index = 0; - while (helptexts[index] && *it != helptexts[index]) { - index += 2; - } - if (helptexts[index]) { - printf("%s - %s\n", helptexts[index], i18n(helptexts[index+1]).local8Bit().data()); - } else { - printf("%s", TQString(i18n("%1 - unknown type\n").arg(*it)).local8Bit().data()); - } - } - return 0; - } - - TQString type = args->getOption("path"); - if (!type.isEmpty()) - { - printResult(KGlobal::dirs()->resourceDirs(type.latin1()).join(":")); - return 0; - } - - type = args->getOption("userpath"); - if (!type.isEmpty()) - { - if ( type == "desktop" ) - printResult(KGlobalSettings::desktopPath()); - else if ( type == "autostart" ) - printResult(KGlobalSettings::autostartPath()); - else if ( type == "trash" ) - printResult(KGlobalSettings::trashPath()); - else if ( type == "document" ) - printResult(KGlobalSettings::documentPath()); - else - fprintf(stderr, "%s", TQString(i18n("%1 - unknown type of userpath\n").arg(type)).local8Bit().data() ); - return 0; - } - - type = args->getOption("install"); - if (!type.isEmpty()) - { - const char *installprefixes[] = { - "apps", "@kde_appsdir@", - "config", "@kde_confdir@", - "kcfg", "@kde_kcfgdir@", - "data", "@kde_datadir@", - "exe", "@kde_bindir@", - "html", "@kde_htmldir@", - "icon", "@kde_icondir@", - "lib", "@libdir@", - "module", "@kde_moduledir@", - "qtplugins", "@kde_moduledir@/plugins", - "locale", "@kde_locale@", - "mime", "@kde_mimedir@", - "services", "@kde_servicesdir@", - "servicetypes", "@kde_servicetypesdir@", - "sound", "@kde_sounddir@", - "templates", "@kde_templatesdir@", - "wallpaper", "@kde_wallpaperdir@", - "xdgconf-menu", "@xdg_menudir@", - "xdgdata-apps", "@xdg_appsdir@", - "xdgdata-dirs", "@xdg_directorydir@", - "include", "@includedir@", - 0, 0 - }; - int index = 0; - while (installprefixes[index] && type != installprefixes[index]) { - index += 2; - } - if (installprefixes[index]) { - printResult(expandvars(installprefixes[index+1])); - } else { - printResult("NONE"); // no i18n here as for scripts - } - } - return 0; -} diff --git a/tdecore/tde-config.cpp.cmake b/tdecore/tde-config.cpp.cmake new file mode 100644 index 000000000..6716a24f6 --- /dev/null +++ b/tdecore/tde-config.cpp.cmake @@ -0,0 +1,272 @@ +// -*- c++ -*- + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static const char *description = I18N_NOOP("A little program to output installation paths"); + +static KCmdLineOptions options[] = +{ + { "expandvars", I18N_NOOP("expand ${prefix} and ${exec_prefix} in output"), 0 }, + { "prefix", I18N_NOOP("Compiled in prefix for KDE libraries"), 0 }, + { "exec-prefix", I18N_NOOP("Compiled in exec_prefix for KDE libraries"), 0 }, + { "libsuffix", I18N_NOOP("Compiled in library path suffix"), 0 }, + { "localprefix", I18N_NOOP("Prefix in $HOME used to write files"), 0}, + { "version", I18N_NOOP("Compiled in version string for KDE libraries"), 0 }, + { "types", I18N_NOOP("Available KDE resource types"), 0 }, + { "path type", I18N_NOOP("Search path for resource type"), 0 }, + { "userpath type", I18N_NOOP("User path: desktop|autostart|trash|document"), 0 }, + { "install type", I18N_NOOP("Prefix to install resource files to"), 0}, + { 0,0,0 } +}; + +bool _expandvars = false; + +TQString expandvars(const char *_input) +{ + TQString result = TQString::fromLatin1(_input); + if (!_expandvars) + return result; + + bool changed = false; + int index = result.find("${prefix}"); + if (index >= 0) { + result = result.replace(index, 9, "@CMAKE_INSTALL_PREFIX@"); + changed = true; + } + index = result.find("$(prefix)"); + if (index >= 0) { + result = result.replace(index, 9, "@CMAKE_INSTALL_PREFIX@"); + changed = true; + } + index = result.find("${datadir}"); + if (index >= 0) { + result = result.replace(index, 10, "@SHARE_INSTALL_PREFIX@"); + changed = true; + } + index = result.find("$(datadir)"); + if (index >= 0) { + result = result.replace(index, 10, "@SHARE_INSTALL_PREFIX@"); + changed = true; + } + index = result.find("${exec_prefix}"); + if (index >= 0) { + result = result.replace(index, 14, "@EXEC_INSTALL_PREFIX@"); + changed = true; + } + index = result.find("$(exec_prefix)"); + if (index >= 0) { + result = result.replace(index, 14, "@EXEC_INSTALL_PREFIX@"); + changed = true; + } + index = result.find("${libdir}"); + if (index >= 0) { + result = result.replace(index, 9, "@LIB_INSTALL_DIR@"); + changed = true; + } + index = result.find("$(libdir)"); + if (index >= 0) { + result = result.replace(index, 9, "@LIB_INSTALL_DIR@"); + changed = true; + } + index = result.find("${includedir}"); + if (index >= 0) { + result = result.replace(index, 20, "@INCLUDE_INSTALL_DIR@"); + changed = true; + } + index = result.find("$(includedir)"); + if (index >= 0) { + result = result.replace(index, 20, "@INCLUDE_INSTALL_DIR@"); + changed = true; + } + index = result.find("${sysconfdir}"); + if (index >= 0) { + result = result.replace(index, 13, "@SYSCONF_INSTALL_DIR@"); + changed = true; + } + index = result.find("$(sysconfdir)"); + if (index >= 0) { + result = result.replace(index, 13, "@SYSCONF_INSTALL_DIR@"); + changed = true; + } + if (changed) + return expandvars(result.latin1()); + else + return result; +} + +void printResult(const TQString &s) +{ + if (s.isEmpty()) + printf("\n"); + else + printf("%s\n", s.local8Bit().data()); +} + +int main(int argc, char **argv) +{ + KLocale::setMainCatalogue("tdelibs"); + KAboutData about("tde-config", "tde-config", "1.0", description, KAboutData::License_GPL, "(C) 2000 Stephan Kulow"); + KCmdLineArgs::init( argc, argv, &about); + + KCmdLineArgs::addCmdLineOptions( options ); // Add my own options. + + KInstance a("tde-config"); + (void)KGlobal::dirs(); // trigger the creation + (void)KGlobal::config(); + + // Get application specific arguments + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + + _expandvars = args->isSet("expandvars"); + + if (args->isSet("prefix")) + { + printResult(expandvars("@CMAKE_INSTALL_PREFIX@")); + return 0; + } + + if (args->isSet("exec-prefix")) + { + printResult(expandvars("@EXEC_INSTALL_PREFIX@")); + return 0; + } + + if (args->isSet("libsuffix")) + { + TQString tmp(KDELIBSUFF); + tmp.remove('"'); + printResult(expandvars(tmp.local8Bit())); + return 0; + } + + if (args->isSet("localprefix")) + { + printResult(KGlobal::dirs()->localtdedir()); + return 0; + } + + if (args->isSet("version")) + { + printf("%s\n", TDE_VERSION_STRING); + return 0; + } + + if (args->isSet("types")) + { + TQStringList types = KGlobal::dirs()->allTypes(); + types.sort(); + const char *helptexts[] = { + "apps", I18N_NOOP("Applications menu (.desktop files)"), + "cgi", I18N_NOOP("CGIs to run from kdehelp"), + "config", I18N_NOOP("Configuration files"), + "data", I18N_NOOP("Where applications store data"), + "exe", I18N_NOOP("Executables in $prefix/bin"), + "html", I18N_NOOP("HTML documentation"), + "icon", I18N_NOOP("Icons"), + "kcfg", I18N_NOOP("Configuration description files"), + "lib", I18N_NOOP("Libraries"), + "include", I18N_NOOP("Includes/Headers"), + "locale", I18N_NOOP("Translation files for KLocale"), + "mime", I18N_NOOP("Mime types"), + "module", I18N_NOOP("Loadable modules"), + "qtplugins", I18N_NOOP("Qt plugins"), + "services", I18N_NOOP("Services"), + "servicetypes", I18N_NOOP("Service types"), + "sound", I18N_NOOP("Application sounds"), + "templates", I18N_NOOP("Templates"), + "wallpaper", I18N_NOOP("Wallpapers"), + "xdgdata-apps", I18N_NOOP("XDG Application menu (.desktop files)"), + "xdgdata-dirs", I18N_NOOP("XDG Menu descriptions (.directory files)"), + "xdgconf-menu", I18N_NOOP("XDG Menu layout (.menu files)"), + "cmake", I18N_NOOP("CMake import modules (.cmake files)"), + "tmp", I18N_NOOP("Temporary files (specific for both current host and current user)"), + "socket", I18N_NOOP("UNIX Sockets (specific for both current host and current user)"), + 0, 0 + }; + for (TQStringList::ConstIterator it = types.begin(); it != types.end(); ++it) + { + int index = 0; + while (helptexts[index] && *it != helptexts[index]) { + index += 2; + } + if (helptexts[index]) { + printf("%s - %s\n", helptexts[index], i18n(helptexts[index+1]).local8Bit().data()); + } else { + printf("%s", i18n("%1 - unknown type\n").arg(*it).local8Bit().data()); + } + } + return 0; + } + + TQString type = args->getOption("path"); + if (!type.isEmpty()) + { + printResult(KGlobal::dirs()->resourceDirs(type.latin1()).join(":")); + return 0; + } + + type = args->getOption("userpath"); + if (!type.isEmpty()) + { + if ( type == "desktop" ) + printResult(KGlobalSettings::desktopPath()); + else if ( type == "autostart" ) + printResult(KGlobalSettings::autostartPath()); + else if ( type == "trash" ) + printResult(KGlobalSettings::trashPath()); + else if ( type == "document" ) + printResult(KGlobalSettings::documentPath()); + else + fprintf(stderr, "%s", i18n("%1 - unknown type of userpath\n").arg(type).local8Bit().data() ); + return 0; + } + + type = args->getOption("install"); + if (!type.isEmpty()) + { + const char *installprefixes[] = { + "apps", "@APPS_INSTALL_DIR@", + "config", "@CONFIG_INSTALL_DIR@", + "kcfg", "@KCFG_INSTALL_DIR@", + "data", "@DATA_INSTALL_DIR@", + "exe", "@BIN_INSTALL_DIR@", + "html", "@HTML_INSTALL_DIR@", + "icon", "@ICON_INSTALL_DIR@", + "lib", "@LIB_INSTALL_DIR@", + "module", "@PLUGIN_INSTALL_DIR@", + "qtplugins", "@PLUGIN_INSTALL_DIR@/plugins", + "locale", "@LOCALE_INSTALL_DIR@", + "mime", "@MIME_INSTALL_DIR@", + "services", "@SERVICES_INSTALL_DIR@", + "servicetypes", "@SERVICETYPES_INSTALL_DIR@", + "sound", "@SOUND_INSTALL_DIR@", + "templates", "@TEMPLATES_INSTALL_DIR@", + "wallpaper", "@WALLPAPER_INSTALL_DIR@", + "xdgconf-menu", "@XDG_MENU_INSTALL_DIR@", + "xdgdata-apps", "@XDG_APPS_INSTALL_DIR@", + "xdgdata-dirs", "@XDG_DIRECTORY_INSTALL_DIR@", + "include", "@INCLUDE_INSTALL_DIR@", + "cmake", "@CMAKE_INSTALL_DIR@", + 0, 0 + }; + int index = 0; + while (installprefixes[index] && type != installprefixes[index]) { + index += 2; + } + if (installprefixes[index]) { + printResult(expandvars(installprefixes[index+1])); + } else { + printResult("NONE"); // no i18n here as for scripts + } + } + return 0; +} diff --git a/tdecore/tde-config.cpp.in b/tdecore/tde-config.cpp.in new file mode 100644 index 000000000..e5ee257c1 --- /dev/null +++ b/tdecore/tde-config.cpp.in @@ -0,0 +1,270 @@ +// -*- c++ -*- + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static const char *description = I18N_NOOP("A little program to output installation paths"); + +static KCmdLineOptions options[] = +{ + { "expandvars", I18N_NOOP("expand ${prefix} and ${exec_prefix} in output"), 0 }, + { "prefix", I18N_NOOP("Compiled in prefix for KDE libraries"), 0 }, + { "exec-prefix", I18N_NOOP("Compiled in exec_prefix for KDE libraries"), 0 }, + { "libsuffix", I18N_NOOP("Compiled in library path suffix"), 0 }, + { "localprefix", I18N_NOOP("Prefix in $HOME used to write files"), 0}, + { "version", I18N_NOOP("Compiled in version string for KDE libraries"), 0 }, + { "types", I18N_NOOP("Available KDE resource types"), 0 }, + { "path type", I18N_NOOP("Search path for resource type"), 0 }, + { "userpath type", I18N_NOOP("User path: desktop|autostart|trash|document"), 0 }, + { "install type", I18N_NOOP("Prefix to install resource files to"), 0}, + { 0,0,0 } +}; + +bool _expandvars = false; + +TQString expandvars(const char *_input) +{ + TQString result = TQString::fromLatin1(_input); + if (!_expandvars) + return result; + + bool changed = false; + int index = result.find("${prefix}"); + if (index >= 0) { + result = result.replace(index, 9, "@prefix@"); + changed = true; + } + index = result.find("$(prefix)"); + if (index >= 0) { + result = result.replace(index, 9, "@prefix@"); + changed = true; + } + index = result.find("${datadir}"); + if (index >= 0) { + result = result.replace(index, 10, "@datadir@"); + changed = true; + } + index = result.find("$(datadir)"); + if (index >= 0) { + result = result.replace(index, 10, "@datadir@"); + changed = true; + } + index = result.find("${exec_prefix}"); + if (index >= 0) { + result = result.replace(index, 14, "@exec_prefix@"); + changed = true; + } + index = result.find("$(exec_prefix)"); + if (index >= 0) { + result = result.replace(index, 14, "@exec_prefix@"); + changed = true; + } + index = result.find("${libdir}"); + if (index >= 0) { + result = result.replace(index, 9, "@libdir@"); + changed = true; + } + index = result.find("$(libdir)"); + if (index >= 0) { + result = result.replace(index, 9, "@libdir@"); + changed = true; + } + index = result.find("${includedir}"); + if (index >= 0) { + result = result.replace(index, 20, "@includedir@"); + changed = true; + } + index = result.find("$(includedir)"); + if (index >= 0) { + result = result.replace(index, 20, "@includedir@"); + changed = true; + } + index = result.find("${sysconfdir}"); + if (index >= 0) { + result = result.replace(index, 13, "@sysconfdir@"); + changed = true; + } + index = result.find("$(sysconfdir)"); + if (index >= 0) { + result = result.replace(index, 13, "@sysconfdir@"); + changed = true; + } + if (changed) + return expandvars(result.latin1()); + else + return result; +} + +void printResult(const TQString &s) +{ + if (s.isEmpty()) + printf("\n"); + else + printf("%s\n", s.local8Bit().data()); +} + +int main(int argc, char **argv) +{ + KLocale::setMainCatalogue("tdelibs"); + KAboutData about("tde-config", "tde-config", "1.0", description, KAboutData::License_GPL, "(C) 2000 Stephan Kulow"); + KCmdLineArgs::init( argc, argv, &about); + + KCmdLineArgs::addCmdLineOptions( options ); // Add my own options. + + KInstance a("tde-config"); + (void)KGlobal::dirs(); // trigger the creation + (void)KGlobal::config(); + + // Get application specific arguments + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + + _expandvars = args->isSet("expandvars"); + + if (args->isSet("prefix")) + { + printResult(expandvars("@prefix@")); + return 0; + } + + if (args->isSet("exec-prefix")) + { + printResult(expandvars("@exec_prefix@")); + return 0; + } + + if (args->isSet("libsuffix")) + { + TQString tmp(KDELIBSUFF); + tmp.remove('"'); + printResult(expandvars(tmp.local8Bit())); + return 0; + } + + if (args->isSet("localprefix")) + { + printResult(KGlobal::dirs()->localtdedir()); + return 0; + } + + if (args->isSet("version")) + { + printf("%s\n", TDE_VERSION_STRING); + return 0; + } + + if (args->isSet("types")) + { + TQStringList types = KGlobal::dirs()->allTypes(); + types.sort(); + const char *helptexts[] = { + "apps", I18N_NOOP("Applications menu (.desktop files)"), + "cgi", I18N_NOOP("CGIs to run from kdehelp"), + "config", I18N_NOOP("Configuration files"), + "data", I18N_NOOP("Where applications store data"), + "exe", I18N_NOOP("Executables in $prefix/bin"), + "html", I18N_NOOP("HTML documentation"), + "icon", I18N_NOOP("Icons"), + "kcfg", I18N_NOOP("Configuration description files"), + "lib", I18N_NOOP("Libraries"), + "include", I18N_NOOP("Includes/Headers"), + "locale", I18N_NOOP("Translation files for KLocale"), + "mime", I18N_NOOP("Mime types"), + "module", I18N_NOOP("Loadable modules"), + "qtplugins", I18N_NOOP("Qt plugins"), + "services", I18N_NOOP("Services"), + "servicetypes", I18N_NOOP("Service types"), + "sound", I18N_NOOP("Application sounds"), + "templates", I18N_NOOP("Templates"), + "wallpaper", I18N_NOOP("Wallpapers"), + "xdgdata-apps", I18N_NOOP("XDG Application menu (.desktop files)"), + "xdgdata-dirs", I18N_NOOP("XDG Menu descriptions (.directory files)"), + "xdgconf-menu", I18N_NOOP("XDG Menu layout (.menu files)"), + "tmp", I18N_NOOP("Temporary files (specific for both current host and current user)"), + "socket", I18N_NOOP("UNIX Sockets (specific for both current host and current user)"), + 0, 0 + }; + for (TQStringList::ConstIterator it = types.begin(); it != types.end(); ++it) + { + int index = 0; + while (helptexts[index] && *it != helptexts[index]) { + index += 2; + } + if (helptexts[index]) { + printf("%s - %s\n", helptexts[index], i18n(helptexts[index+1]).local8Bit().data()); + } else { + printf("%s", TQString(i18n("%1 - unknown type\n").arg(*it)).local8Bit().data()); + } + } + return 0; + } + + TQString type = args->getOption("path"); + if (!type.isEmpty()) + { + printResult(KGlobal::dirs()->resourceDirs(type.latin1()).join(":")); + return 0; + } + + type = args->getOption("userpath"); + if (!type.isEmpty()) + { + if ( type == "desktop" ) + printResult(KGlobalSettings::desktopPath()); + else if ( type == "autostart" ) + printResult(KGlobalSettings::autostartPath()); + else if ( type == "trash" ) + printResult(KGlobalSettings::trashPath()); + else if ( type == "document" ) + printResult(KGlobalSettings::documentPath()); + else + fprintf(stderr, "%s", TQString(i18n("%1 - unknown type of userpath\n").arg(type)).local8Bit().data() ); + return 0; + } + + type = args->getOption("install"); + if (!type.isEmpty()) + { + const char *installprefixes[] = { + "apps", "@kde_appsdir@", + "config", "@kde_confdir@", + "kcfg", "@kde_kcfgdir@", + "data", "@kde_datadir@", + "exe", "@kde_bindir@", + "html", "@kde_htmldir@", + "icon", "@kde_icondir@", + "lib", "@libdir@", + "module", "@kde_moduledir@", + "qtplugins", "@kde_moduledir@/plugins", + "locale", "@kde_locale@", + "mime", "@kde_mimedir@", + "services", "@kde_servicesdir@", + "servicetypes", "@kde_servicetypesdir@", + "sound", "@kde_sounddir@", + "templates", "@kde_templatesdir@", + "wallpaper", "@kde_wallpaperdir@", + "xdgconf-menu", "@xdg_menudir@", + "xdgdata-apps", "@xdg_appsdir@", + "xdgdata-dirs", "@xdg_directorydir@", + "include", "@includedir@", + 0, 0 + }; + int index = 0; + while (installprefixes[index] && type != installprefixes[index]) { + index += 2; + } + if (installprefixes[index]) { + printResult(expandvars(installprefixes[index+1])); + } else { + printResult("NONE"); // no i18n here as for scripts + } + } + return 0; +} -- cgit v1.2.1