From 114a878c64ce6f8223cfd22d76a20eb16d177e5e Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/kconf_update/Makefile.am | 18 ++++ .../kdev-gen-settings-kconf_update.cpp | 113 +++++++++++++++++++++ src/kconf_update/kdev-gen-settings.upd | 8 ++ 3 files changed, 139 insertions(+) create mode 100644 src/kconf_update/Makefile.am create mode 100644 src/kconf_update/kdev-gen-settings-kconf_update.cpp create mode 100644 src/kconf_update/kdev-gen-settings.upd (limited to 'src/kconf_update') diff --git a/src/kconf_update/Makefile.am b/src/kconf_update/Makefile.am new file mode 100644 index 00000000..b31e578c --- /dev/null +++ b/src/kconf_update/Makefile.am @@ -0,0 +1,18 @@ +AM_CPPFLAGS = -DKDE_NO_COMPAT -DQT_NO_COMPAT $(all_includes) + +update_DATA = kdev-gen-settings.upd +updatedir = $(kde_datadir)/kconf_update + +# The Qt app cannot go into kde_datadir, that is not portable. +# install to kde_bindir/kconf_update_bin instead. +# KDE 3.2 will allow kconf_update scripts to run directly from there, +# but for us that's too late. Use the .sh script as a workaround. +kconf_PROGRAMS = kdev-gen-settings-kconf_update +kconfdir = $(libdir)/kconf_update_bin + +kdev_gen_settings_kconf_update_SOURCES = kdev-gen-settings-kconf_update.cpp +kdev_gen_settings_kconf_update_LDFLAGS = $(all_libraries) $(KDE_RPATH) +kdev_gen_settings_kconf_update_LDADD = $(LIB_QT) + +# vim: set noet: + diff --git a/src/kconf_update/kdev-gen-settings-kconf_update.cpp b/src/kconf_update/kdev-gen-settings-kconf_update.cpp new file mode 100644 index 00000000..1f3c9740 --- /dev/null +++ b/src/kconf_update/kdev-gen-settings-kconf_update.cpp @@ -0,0 +1,113 @@ +/* + kconf_update app for migrating kdevelop's ui settings to the new + code that will be in 3.3. + + Copyright (c) 2005 by Matt Rogers + Based on code Copyright (c) 2003 by Martijn Klingens + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + ************************************************************************* +*/ + +#include +#include +#include + +static QTextStream qcin ( stdin, IO_ReadOnly ); +static QTextStream qcout( stdout, IO_WriteOnly ); +static QTextStream qcerr( stderr, IO_WriteOnly ); + +// Group cache. Yes, I know global vars are ugly :) +bool needFlush = false; +QString newKeyValue; +int newDataValue; + +void parseKey( const QString &group, const QString &key, + const QString &value, const QString &rawLine ) +{ + + //qcerr << "*** group='" << group << "'" << endl; + if ( group == "General Options" && key == "Embed KDevDesigner") + { + newKeyValue = "Designer App"; + if ( value.lower() == "true" ) + newDataValue = 0; + else + newDataValue = 2; + qcout << newKeyValue << "=" << newDataValue << endl; + qcout << "# DELETE [" << key << "]" << endl; + + } + else if ( group == "General Options" && key == "Application Font" ) + { + newKeyValue = "OutputViewFont"; + qcout << newKeyValue << "=" << value << endl; + qcout << "# DELETE [" << key << "]" << endl; + } + else if ( group == "MakeOutputView" && key == "Messages Font" ) + { + qcout << "# DELETE [" << key << "]" << endl; + } + else if ( group == "TerminalEmulator" && key == "UseKDESetting" ) + { + newKeyValue = "UseKDESetting"; + if ( value.lower() == "true" ) + newDataValue = 0; + else + newDataValue = 1; + qcout << newKeyValue << "=" << newDataValue << endl; + } + else + { + // keys we don't convert. output the raw line instead. + qcout << rawLine << endl; + } +} + +int main() +{ + qcin.setEncoding( QTextStream::UnicodeUTF8 ); + qcout.setEncoding( QTextStream::UnicodeUTF8 ); + + QString curGroup; + + QRegExp groupRegExp( "^\\[(.*)\\]" ); + QRegExp keyRegExp( "^([a-zA-Z0-9:, _-]*)\\s*=\\s*(.*)\\s*" ); + QRegExp commentRegExp( "^(#.*)?$" ); + + while ( !qcin.atEnd() ) + { + QString line = qcin.readLine(); + + if ( commentRegExp.exactMatch( line ) ) + { + // We found a comment, leave unchanged + qcout << line << endl; + } + else if ( groupRegExp.exactMatch( line ) ) + { + curGroup = groupRegExp.capturedTexts()[ 1 ]; + qcout << line << endl; + } + else if ( keyRegExp.exactMatch( line ) ) + { + // We found the a key line + parseKey( curGroup, keyRegExp.capturedTexts()[ 1 ], keyRegExp.capturedTexts()[ 2 ], line ); + } + else + { + qcout << line << endl; + } + } + + return 0; +} + +// vim: set noet ts=4 sts=4 sw=4: + diff --git a/src/kconf_update/kdev-gen-settings.upd b/src/kconf_update/kdev-gen-settings.upd new file mode 100644 index 00000000..3592126f --- /dev/null +++ b/src/kconf_update/kdev-gen-settings.upd @@ -0,0 +1,8 @@ +#Update the KDevelop General Settings page to work with the +#new UI file created on 20050406 +Id=kdev-gen-settings-update/5 +File=kdeveloprc +Script=kdev-gen-settings-kconf_update +Options=overwrite +AllKeys + -- cgit v1.2.1