[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [RFC,PATCH] Port libsvn_auth_kwallet to KDE3.

From: Daniel L. Rall <dlr_at_finemaltcoding.com>
Date: Fri, 30 May 2008 14:09:23 -0700

On Thu, 29 May 2008, Martin Furter wrote:

>
> Hello
>
> Here is an untested Patch to get libsvn_auth_kwallet to compile with KDE3
> and QT3. I'll test with kwallet as soon as I've found out how to use it...
>
> I send it now to get some general comments about the patch.

+1 on the idea.

> [[[
> Port libsvn_auth_kwallet to KDE3.
>
> * subversion/libsvn_auth_kwallet/kwallet.cpp
> (kwallet_password_get): Port to KDE3.
> (kwallet_password_set): Ditto.
>
> * configure.ac
> Add support for KDE3 and QT3. Define SVN_HAVE_QT3 if using QT3.
> ]]]

> Index: subversion/libsvn_auth_kwallet/kwallet.cpp
> ===================================================================
> --- subversion/libsvn_auth_kwallet/kwallet.cpp (revision 31484)
> +++ subversion/libsvn_auth_kwallet/kwallet.cpp (working copy)
> @@ -32,8 +32,15 @@
>
> #include "svn_private_config.h"
>
> +#ifdef SVN_HAVE_QT3
> +#include <qstring.h>
> +#include <qwidget.h>
> +/* TODO: where is ki18n in KDE3? */
> +#define ki18n(x) x

How about using klocale.h's i18n(), which returns a QString (which appears
to have a char * cast that calls its ascii() method)?

> +#else
> #include <QtCore/QString>
> #include <QtGui/QWidget>
> +#endif
>
> #include <kapplication.h>
> #include <kcmdlineargs.h>
> @@ -64,14 +71,24 @@
> return FALSE;
> }
>
> +#ifdef SVN_HAVE_QT3
> KCmdLineArgs::init(1,
> (char *[1]) { "svn" },
> "Subversion",
> "subversion",
> + ki18n("Version control system"),
> + SVN_VER_NUMBER,
> + true);
> +#else
> + KCmdLineArgs::init(1,
> + (char *[1]) { "svn" },
> + "Subversion",
> + "subversion",
> ki18n("Subversion"),
> SVN_VER_NUMBER,
> ki18n("Version control system"),
> KCmdLineArgs::CmdLineArgKDE);
> +#endif
> KApplication application;
> QWidget widget;
> WId wid = widget.winId();
> @@ -95,9 +112,15 @@
> QString q_password;
> if (wallet->readPassword(key, q_password) == 0);
> {
> +#ifdef SVN_HAVE_QT3
> *password = apr_pstrmemdup(pool,
> + q_password.utf8().data(),
> + q_password.length());
> +#else
> + *password = apr_pstrmemdup(pool,
> q_password.toUtf8().data(),
> q_password.size());
> +#endif
> ret = TRUE;
> }
> }
> @@ -129,14 +152,24 @@
> return FALSE;
> }
>
> +#ifdef SVN_HAVE_QT3
> KCmdLineArgs::init(1,
> (char *[1]) { "svn" },
> "Subversion",
> "subversion",
> + ki18n("Version control system"),
> + SVN_VER_NUMBER,
> + true);
> +#else
> + KCmdLineArgs::init(1,
> + (char *[1]) { "svn" },
> + "Subversion",
> + "subversion",
> ki18n("Subversion"),
> SVN_VER_NUMBER,
> ki18n("Version control system"),
> KCmdLineArgs::CmdLineArgKDE);
> +#endif

Factor this large duplicate section (repeated above) into a helper routine.

...
> --- configure.ac (revision 31484)
> +++ configure.ac (working copy)
...
> +dnl KWallet3 -------------------
> +
> +AC_ARG_WITH(kwallet3,
> + [AS_HELP_STRING([[--with-kwallet3[=PATH]]],
> + [Enable use of KWallet (KDE 43) for auth credentials])],

43?

> + [with_kwallet3="$withval"],
> + [with_kwallet3=no])
> +
> +AC_MSG_CHECKING([whether to look for KWallet3])
> +if test "$with_kwallet3" != "no"; then
> + AC_MSG_RESULT([yes])
> + if test "$with_kwallet" = "no"; then
> + if test "$enable_shared" = "yes"; then
> + if test "$APR_HAS_DSO" = "yes"; then
> + if test "$USE_NLS" = "yes"; then
> + if test "$HAVE_PKG_CONFIG" = "yes"; then
> + AC_MSG_CHECKING([for qt-mt])
> + if pkg-config --exists qt-mt; then
> + AC_MSG_RESULT([yes])
> + if test "$with_kwallet3" != "yes"; then
> + AC_MSG_CHECKING([for kde-config])
> + kde_config="$with_kwallet3/bin/kde-config"
> + if test -f "$kde_config" && test -x "$kde_config"; then
> + HAVE_KDE_CONFIG="yes"
> + AC_MSG_RESULT([yes])
> + else
> + AC_MSG_RESULT([no])
> + fi
> + else
> + AC_CHECK_PROG(HAVE_KDE_CONFIG, kde-config, yes)
> + kde_config="kde-config"
> + fi
> + if test "$HAVE_KDE_CONFIG" = "yes"; then
> + AC_MSG_CHECKING([for KWallet])
> + old_CXXFLAGS="$CXXFLAGS"
> + old_LDFLAGS="$LDFLAGS"
> + old_LIBS="$LIBS"
> + for d in [`pkg-config --cflags qt-mt | $GREP -o -- -D[^[:space:]]*`]; do
> + CPPFLAGS="$CPPFLAGS $d"
> + done
> + qt_include_dirs=""
> + for i in [`pkg-config --cflags qt-mt | $GREP -o -- -I[^[:space:]]*`]; do
> + qt_include_dirs="$qt_include_dirs $i"
> + done
> + qt_include_dirs="${qt_include_dirs## }"
> + kde_dir="`$kde_config --prefix`"
> + SVN_KWALLET_INCLUDES="$qt_include_dirs -I$kde_dir/include/kde"
> + SVN_KWALLET_LIBS="-lqt-mt -lkdecore -lkdeui -lkwalletclient"
> + CXXFLAGS="$CXXFLAGS $SVN_KWALLET_INCLUDES"
> + LIBS="$LIBS $SVN_KWALLET_LIBS"
> + qt_lib_dirs=""
> + for l in [`pkg-config --libs qt-mt | $GREP -o -- -L[^[:space:]]*`]; do
> + qt_lib_dirs="$qt_lib_dirs $l"
> + done
> + qt_lib_dirs="${qt_lib_dirs## }"
> + LDFLAGS="$old_LDFLAGS $qt_lib_dirs -L$kde_dir/lib`$kde_config --libsuffix`"
> + AC_LANG(C++)
> + AC_LINK_IFELSE([
> + #include <kwallet.h>
> + int main()
> + {KWallet::Wallet::walletList();}], with_kwallet3="yes", with_kwallet3="no")
> + AC_LANG(C)
> + if test "$with_kwallet3" = "yes"; then
> + AC_DEFINE([SVN_HAVE_KWALLET], [1],
> + [Is KWallet support enabled?])
> + AC_DEFINE([SVN_HAVE_QT3], [1],
> + [Is KWallet using qt3?])
> + AC_MSG_RESULT([yes])
> + CXXFLAGS="$old_CXXFLAGS"
> + LIBS="$old_LIBS"
> + else
> + AC_MSG_RESULT([no])
> + AC_MSG_ERROR([cannot find KWallet])
> + fi
> + else
> + AC_MSG_ERROR([cannot find kde-config])
> + fi
> + else
> + AC_MSG_RESULT([no])
> + AC_MSG_ERROR([cannot find qt-mt])
> + fi
> + else
> + AC_MSG_ERROR([cannot find pkg-config])
> + fi
> + else
> + AC_MSG_ERROR([missing support for internationalization])
> + fi
> + else
> + AC_MSG_ERROR([APR does not have support for DSOs])
> + fi
> + else
> + AC_MSG_ERROR([--with-kwallet3 conflicts with --disable-shared])
> + fi
> + else
> + AC_MSG_ERROR([--with-kwallet3 conflicts with --with-kwallet])
> + fi
> +else
> + AC_MSG_RESULT([no])
> +fi
> +AC_SUBST(SVN_KWALLET_INCLUDES)
> +AC_SUBST(SVN_KWALLET_LIBS)
...
> @@ -569,6 +672,12 @@
...
> +if test "$with_kwallet3" = "yes"; then
> + BUILD_RULES="$BUILD_RULES kwallet-lib"
> + INSTALL_RULES="`echo $INSTALL_RULES | sed 's/install-lib/install-lib install-kwallet-lib/'`"
> + INSTALL_STATIC_RULES="$INSTALL_STATIC_RULES install-kwallet-lib"
> +fi
> +
> if test "$with_gnome_keyring" = "yes"; then
> BUILD_RULES="$BUILD_RULES gnome-keyring-lib"
> INSTALL_RULES="`echo $INSTALL_RULES | sed 's/install-lib/install-lib install-gnome-keyring-lib/'`"

  • application/pgp-signature attachment: stored
Received on 2008-05-30 23:09:41 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.