[20185] trunk/dports/kde/kdeutils3

source_changes at macosforge.org source_changes at macosforge.org
Fri Oct 27 11:22:07 PDT 2006


Revision: 20185
          http://trac.macosforge.org/projects/macports/changeset/20185
Author:   takanori at macports.org
Date:     2006-10-27 11:22:07 -0700 (Fri, 27 Oct 2006)

Log Message:
-----------
Version 3.5.4.

Modified Paths:
--------------
    trunk/dports/kde/kdeutils3/Portfile
    trunk/dports/kde/kdeutils3/files/CompileScript.sh
    trunk/dports/kde/kdeutils3/files/InstallScript.sh
    trunk/dports/kde/kdeutils3/files/kdeutils3.patch

Modified: trunk/dports/kde/kdeutils3/Portfile
===================================================================
--- trunk/dports/kde/kdeutils3/Portfile	2006-10-27 18:22:01 UTC (rev 20184)
+++ trunk/dports/kde/kdeutils3/Portfile	2006-10-27 18:22:07 UTC (rev 20185)
@@ -1,57 +1,54 @@
 # $Id$
 
-#Synced with Fink, Version 3.5.1-1023
+#Synced with Fink, Version 3.5.4-1021
 
 PortSystem 1.0
 name		kdeutils3
-version		3.5.1
-revision	1
-set kdeadmin	kde-admindir-3.5.1
+version		3.5.4
+set kdeadmin	kde-admindir-252
 categories	kde
 maintainers	ben at macports.org takanori at macports.org
 description	KDE utilities. \
-                NB No KDE sound support.
+		NB No KDE sound support.
+long_description ${description}
 platforms	darwin
-master_sites	opendarwin::kde351 \
+homepage	http://www.kde.org/
+master_sites	opendarwin::kde354 \
 		opendarwin::admin
 #		kde:stable/${version}/src
 #		http://ranger.befunk.com/fink/:admin
-extract.suffix	.tar.bz2
 use_bzip2	yes
 distname	kdeutils-${version}
-distfiles	${distname}.tar.bz2:kde351 \
+distfiles	${distname}.tar.bz2:kde354 \
 		${kdeadmin}.tar.bz2:admin
 depends_build	port:autoconf \
-		port:automake
-depends_lib	port:kdebase3 \
-		port:gmp
+		port:unsermake
+depends_lib	port:gmp \
+		port:kdebase3
 #		port:python24
+#		port:xmms
 
-checksums	${distname}.tar.bz2 md5 1286c6a09b04452adfe492de2fad79bd \
-                ${kdeadmin}.tar.bz2 md5 b6115a7310f8e8533af91be02e225d0e
+checksums	${distname}.tar.bz2 md5 e24cd91576db3d2414fb30cab47e44e5 \
+		${kdeadmin}.tar.bz2 md5 54a89925e71bd32f759c81b312ad0b9e
 
-extract.only ${distname}.tar.bz2
-post-extract { system "cd ${worksrcpath} && bzcat -dc ${distpath}/${kdeadmin}.tar.bz2 | tar xf -" }
+extract.only	${distname}.tar.bz2
+post-extract	{ system "cd ${worksrcpath} && bzcat -dc ${distpath}/${kdeadmin}.tar.bz2 | tar xf -" }
 
 patchfiles	kdeutils3.patch
 patch		{
 		cd ${worksrcpath}
 		foreach file $patchfiles {
-		    system "sed -e 's, at FINKPREFIX@,${prefix},g' ${portpath}/${filesdir}/${file} | patch -p1"
+		    system "sed -e 's, at FINKPREFIX@,${prefix},g' ${filespath}/${file} | patch -p1"
 		}
+		system "perl -pi -e 's,-O2,-Os,g; s,doc/HTML,doc/kde,g; s,/usr/share/doc/packages/qt3/html,${prefix}/share/doc/qt3/html,g;' admin/*"
 }
-post-patch      {
-		reinplace "s|lib/freetype219/||g" ${worksrcpath}/environment-helper.sh
-		reinplace "s|include/qt|include/qt3|g" ${worksrcpath}/environment-helper.sh
+post-patch	{
+		reinplace "s|/lib/freetype219||g" ${worksrcpath}/environment-helper.sh
 		reinplace "s|--with-ssl-dir=/usr|--with-ssl-dir=\$PREFIX|g" ${worksrcpath}/environment-helper.sh
-		reinplace "s|2.5\\*|2.\[56\]\\*|g" ${worksrcpath}/admin/cvs.sh
-		foreach file [glob ${worksrcpath}/admin/*] {
-		    reinplace "s|-O2|-Os|g" $file
-		    reinplace "s|doc/HTML|doc/kde|g" $file
-		    reinplace "s|/usr/share/doc/packages/qt3/html|${prefix}/share/doc/qt3/html|g" $file
-		}
+		reinplace "s|HOME=/tmp|HOME=${workpath}|g" ${worksrcpath}/environment-helper.sh
+		reinplace "s|/tmp/buildlog|${workpath}/buildlog|g" ${worksrcpath}/build-helper.sh
 		foreach file {CompileScript.sh InstallScript.sh} {
-		    file copy ${portpath}/${filesdir}/${file} ${worksrcpath}
+		    file copy ${filespath}/${file} ${worksrcpath}
 		    reinplace "s|%p|${prefix}|g" ${worksrcpath}/${file}
 		    reinplace "s|%N|${name}|g" ${worksrcpath}/${file}
 		    reinplace "s|%v|${version}|g" ${worksrcpath}/${file}
@@ -63,20 +60,16 @@
 		}
 		# disable ksim which depends on net-snmp which doesn't build
 		# on Mac OS 10.4
-		file delete -force ${worksrcpath}/ksim
+		delete ${worksrcpath}/ksim
 }
 
-configure.args	--with-distribution='DarwinPorts/Mac OS X' --without-arts
+configure.args	--with-distribution='MacPorts/Mac OS X' --without-arts
 
 configure	{}
 build		{ system "cd ${worksrcpath} && ./CompileScript.sh" }
 destroot	{ system "cd ${worksrcpath} && ./InstallScript.sh" }
 
-post-destroot   {
+post-destroot	{
 		xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
 		xinstall -m 644 -W ${worksrcpath} AUTHORS COPYING INSTALL README ${destroot}${prefix}/share/doc/${name}
 }
-
-platform darwin 6 {
-	depends_lib-append	lib:libdl:dlcompat
-}

Modified: trunk/dports/kde/kdeutils3/files/CompileScript.sh
===================================================================
--- trunk/dports/kde/kdeutils3/files/CompileScript.sh	2006-10-27 18:22:01 UTC (rev 20184)
+++ trunk/dports/kde/kdeutils3/files/CompileScript.sh	2006-10-27 18:22:07 UTC (rev 20185)
@@ -1,16 +1,9 @@
 #!/bin/sh -e
 
-        export HOME=/tmp
-        export PREFIX="%p"
+        export PREFIX="%p" USE_UNSERMAKE=1
         . ./environment-helper.sh
-        export lt_cv_sys_max_cmd_len=65536
 
-#darwinports
-	export UNSERMAKE="no"
-
-        export CC=gcc CXX=g++
-
         ./build-helper.sh cvs       %N %v %r make -f admin/Makefile.common cvs
         ./build-helper.sh configure %N %v %r ./configure %c $CONFIGURE_PARAMS
-        perl -pi.bak -e 's, kgpg , ,' Makefile
-        ./build-helper.sh make      %N %v %r make all all_libraries="$ALL_LIBRARIES"
+        perl -pi -e 's, kgpg , ,' Makefile
+        ./build-helper.sh make      %N %v %r unsermake $UNSERMAKEFLAGS

Modified: trunk/dports/kde/kdeutils3/files/InstallScript.sh
===================================================================
--- trunk/dports/kde/kdeutils3/files/InstallScript.sh	2006-10-27 18:22:01 UTC (rev 20184)
+++ trunk/dports/kde/kdeutils3/files/InstallScript.sh	2006-10-27 18:22:07 UTC (rev 20185)
@@ -1,13 +1,10 @@
 #!/bin/sh -e
 
-        export PREFIX="%p"
+        export PREFIX="%p" USE_UNSERMAKE=1
         . ./environment-helper.sh
 
-#darwinports
-	export UNSERMAKE="no"
+        ./build-helper.sh install %N %v %r unsermake -p -j1 install DESTDIR=%d kgpg_SUBDIR_included_TRUE='#' kgpg_SUBDIR_included_FALSE=
 
-        ./build-helper.sh install %N %v %r make -j1 install DESTDIR=%d kgpg_SUBDIR_included_TRUE=# kgpg_SUBDIR_included_FALSE=
-
         mkdir -p %i/share/doc/installed-packages
         touch %i/share/doc/installed-packages/%N
         touch %i/share/doc/installed-packages/%N-base

Modified: trunk/dports/kde/kdeutils3/files/kdeutils3.patch
===================================================================
--- trunk/dports/kde/kdeutils3/files/kdeutils3.patch	2006-10-27 18:22:01 UTC (rev 20184)
+++ trunk/dports/kde/kdeutils3/files/kdeutils3.patch	2006-10-27 18:22:07 UTC (rev 20185)
@@ -1,5 +1,6 @@
---- kdeutils-3.5.0/klaptopdaemon/Makefile.am	2005-09-10 04:21:28.000000000 -0400
-+++ kdeutils-3.5.0-new/klaptopdaemon/Makefile.am	2005-11-26 16:00:12.000000000 -0500
+
+--- kdeutils-3.5.4/klaptopdaemon/Makefile.am	2006-01-19 11:49:18.000000000 -0500
++++ kdeutils-3.5.4-new/klaptopdaemon/Makefile.am	2006-08-01 23:42:11.000000000 -0400
 @@ -21,7 +21,7 @@
  kcm_laptop_la_SOURCES = battery.cpp main.cpp pcmcia.cpp power.cpp warning.cpp \
  	acpi.cpp sony.cpp profile.cpp buttons.cpp apm.cpp  
@@ -9,16 +10,147 @@
  kcm_laptop_la_COMPILE_FIRST = crcresult.h
  
  AM_CPPFLAGS = $(all_includes)
---- kdeutils-3.5.0/ksim/monitors/snmp/configure.in.in	2005-10-10 10:59:12.000000000 -0400
-+++ kdeutils-3.5.0-new/ksim/monitors/snmp/configure.in.in	2005-11-26 16:01:00.000000000 -0500
-@@ -32,4 +32,4 @@
+--- kdeutils-3.5.4/ksim/monitors/snmp/configure.in.in	2006-07-22 04:12:20.000000000 -0400
++++ kdeutils-3.5.4-new/ksim/monitors/snmp/configure.in.in	2006-08-01 23:42:11.000000000 -0400
+@@ -37,4 +37,4 @@
    fi
  fi
  
 -AM_CONDITIONAL(include_ksim_monitors_snmp, test "x$enable_snmp" = xyes)
 +AM_CONDITIONAL(include_ksim_monitors_snmp, /usr/bin/false)
---- kdeutils-3.5.0/superkaramba/src/Makefile.am	2005-09-12 09:21:13.000000000 -0400
-+++ kdeutils-3.5.0-new/superkaramba/src/Makefile.am	2005-11-27 21:15:58.000000000 -0500
+--- kdeutils-3.5.4/ksim/monitors/snmp/configure.in.in.orig	1969-12-31 19:00:00.000000000 -0500
++++ kdeutils-3.5.4-new/ksim/monitors/snmp/configure.in.in.orig	2006-07-22 04:12:20.000000000 -0400
+@@ -0,0 +1,40 @@
++AC_ARG_WITH(snmp,
++  [AC_HELP_STRING(--with-snmp,
++    [enable support for SNMP @<:@default=check@:>@])],
++  [], with_snmp=check)
++
++enable_snmp=no
++if test "x$with_snmp" != xno; then
++  KDE_CHECK_HEADER( net-snmp/library/snmp_api.h, 
++    [ have_netsnmp_h=yes ], [ have_netsnmp_h=no ],
++    [ #include <net-snmp/net-snmp-config.h>
++      #include <net-snmp/types.h>
++    ]
++  )
++
++  if test "$have_netsnmp_h" = yes; then
++    KDE_CHECK_LIB( netsnmp, snmp_sess_init, [
++        AC_SUBST( LIBSNMP, "-lnetsnmp" )
++        enable_snmp=yes
++    ], [], [] )
++  fi
++
++  if test "$enable_snmp" != yes; then
++    AC_MSG_CHECKING([if libnetsnmp needs -lcrypto])
++
++    dnl use a different symbol to prevent autoconf from caching
++    KDE_CHECK_LIB( netsnmp, snmp_open, [
++        AC_SUBST( LIBSNMP, "-lnetsnmp -lcrypto" )
++        enable_snmp=yes
++        AC_MSG_RESULT(yes)
++    ], [
++        AC_MSG_RESULT(no)
++    ], [-lcrypto] )
++  fi
++
++  if test "x$with_snmp" != xcheck && test "x$enable_snmp" != xyes; then
++    AC_MSG_ERROR([--with-snmp was given, but test for net-snmp failed])
++  fi
++fi
++
++AM_CONDITIONAL(include_ksim_monitors_snmp, test "x$enable_snmp" = xyes)
+--- kdeutils-3.5.4/superkaramba/configure.in.in	2006-01-20 01:49:18.000000000 -0500
++++ kdeutils-3.5.4-new/superkaramba/configure.in.in	2006-08-01 23:42:11.000000000 -0400
+@@ -75,3 +75,5 @@
+ if test -z "$PYTHONINC" ; then
+         DO_NOT_COMPILE="$DO_NOT_COMPILE superkaramba"
+ fi
++
++AC_CHECK_HEADERS(netinet/in.h sys/sockio.h)
+--- kdeutils-3.5.4/superkaramba/configure.in.in.orig	1969-12-31 19:00:00.000000000 -0500
++++ kdeutils-3.5.4-new/superkaramba/configure.in.in.orig	2006-01-20 01:49:18.000000000 -0500
+@@ -0,0 +1,77 @@
++#MIN_CONFIG
++
++AM_INIT_AUTOMAKE(superkaramba, 0.38)
++AC_C_BIGENDIAN
++AC_CHECK_KDEMAXPATHLEN
++
++dnl AM_PATH_XMMS([1.0.0])
++dnl AC_PATH_PROG(XMMS_CONFIG, xmms-config, no)
++dnl AM_PATH_XMMS(1.0.0,,AC_MSG_ERROR([*** XMMS >= 1.0.0 not installed - please install first ***]))
++
++KDE_CHECK_PYTHON
++AC_DEFUN([AC_CHECK_XMMS],
++[
++  AC_MSG_CHECKING([for libxmms])
++  AC_CACHE_VAL(ac_cv_have_xmms,
++  [
++    ac_save_libs="$LIBS"
++    LIBS="`xmms-config --libs`"
++    ac_CPPFLAGS_save="$CPPFLAGS"
++    CPPFLAGS="$CPPFLAGS $all_includes `xmms-config --cflags`"
++    ac_LDFLAGS_save="$LDFLAGS"
++    LDFLAGS="$LDFLAGS $all_libraries"
++    AC_TRY_LINK(
++      [#include <xmms/xmmsctrl.h>],
++      [xmms_remote_stop(0);],
++      [ac_cv_have_xmms="yes"],
++      [ac_cv_have_xmms="no"]
++    )
++    LIBS="$ac_save_libs"
++    LDFLAGS="$ac_LDFLAGS_save"
++    CPPFLAGS="$ac_CPPFLAGS_save"
++  ])
++  AC_MSG_RESULT($ac_cv_have_xmms)
++  if test "$ac_cv_have_xmms" = "yes"; then
++    XMMS_INCLUDES="`xmms-config --cflags`"
++
++    for arg in `xmms-config --libs`; do
++	case $arg in
++	    -[[lL]]*)
++	    XMMS_LIBS="$XMMS_LIBS $arg"
++	    ;;
++	    *)
++	    XMMS_LDFLAGS="$XMMS_LDFLAGS $arg"
++	esac
++    done
++    AC_DEFINE(HAVE_XMMS, 1, [Define if you have xmms libraries and header files.])
++  fi
++])
++
++AC_ARG_WITH(xmms,
++  [AC_HELP_STRING(--with-xmms,
++    [enable support for XMMS @<:@default=check@:>@])],
++  [], with_xmms=check)
++
++if test "x$with_xmms" != xno; then
++  AC_CHECK_XMMS
++
++  if test "x$with_xmms" != xcheck && test "x$ac_cv_have_xmms" = xno; then
++    AC_MSG_ERROR([--with-xmms was given, but test for XMMS failed])
++  fi
++fi
++AC_SUBST(XMMS_LIBS)
++AC_SUBST(XMMS_LDFLAGS)
++AC_SUBST(XMMS_INCLUDES)
++
++kde_have_knewstuff=yes
++KDE_CHECK_LIB(knewstuff, main, [MY_LIBKNEWSTUFF="-lknewstuff"], kde_have_knewstuff=no)
++if test "$kde_have_knewstuff" = "yes"; then
++  AC_DEFINE(HAVE_KNEWSTUFF, 1, [Define if you have knewstuff])
++  AC_SUBST(MY_LIBKNEWSTUFF)
++fi
++
++AC_CHECK_LIB(kvm, main, [LIBKVM="-lkvm"])
++AC_SUBST(LIBKVM)
++if test -z "$PYTHONINC" ; then
++        DO_NOT_COMPILE="$DO_NOT_COMPILE superkaramba"
++fi
+--- kdeutils-3.5.4/superkaramba/src/Makefile.am	2006-01-19 11:49:35.000000000 -0500
++++ kdeutils-3.5.4-new/superkaramba/src/Makefile.am	2006-08-01 23:42:11.000000000 -0400
 @@ -40,7 +40,7 @@
  
  # kde_cfg_DATA = superkaramba.kcfg
@@ -28,17 +160,9 @@
  #superkaramba_LDADD = -lkio $(LIB_KDEUI) $(XMMS_LDADD) $(LIBPYTHON) $(LIBKVM) $(MY_LIBKNEWSTUFF)
  superkaramba_LDADD = -lkio $(LIB_KDEUI) $(XMMS_LIBS) $(LIBPYTHON) $(LIBKVM) $(MY_LIBKNEWSTUFF)
  
---- kdeutils-3.5.0/superkaramba/configure.in.in	2005-10-10 10:59:13.000000000 -0400
-+++ kdeutils-3.5.0-new/superkaramba/configure.in.in	2006-01-16 22:24:41.000000000 -0500
-@@ -71,3 +71,5 @@
- if test -z "$PYTHONINC" ; then
-         DO_NOT_COMPILE="$DO_NOT_COMPILE superkaramba"
- fi
-+
-+AC_CHECK_HEADERS(netinet/in.h sys/sockio.h)
---- kdeutils-3.5.0/superkaramba/src/misc_python.cpp	2005-11-19 05:02:57.000000000 -0500
-+++ kdeutils-3.5.0-new/superkaramba/src/misc_python.cpp	2006-01-16 22:25:28.000000000 -0500
-@@ -425,10 +425,10 @@
+--- kdeutils-3.5.4/superkaramba/src/misc_python.cpp	2006-03-17 05:13:37.000000000 -0500
++++ kdeutils-3.5.4-new/superkaramba/src/misc_python.cpp	2006-08-01 23:42:11.000000000 -0400
+@@ -617,10 +617,10 @@
  #include <sys/ioctl.h>
  #include <net/if.h>
  #include <arpa/inet.h>
@@ -51,3 +175,806 @@
  #include <sys/sockio.h>
  #endif
  /* now a method we need to expose to Python */
+--- kdeutils-3.5.4/superkaramba/src/misc_python.cpp.orig	1969-12-31 19:00:00.000000000 -0500
++++ kdeutils-3.5.4-new/superkaramba/src/misc_python.cpp.orig	2006-03-17 05:13:37.000000000 -0500
+@@ -0,0 +1,800 @@
++/****************************************************************************
++*  misc_python.cpp  -  Misc Functions for python api
++*
++*  Copyright (C) 2003 Hans Karlsson <karlsson.h at home.se>
++*  Copyright (C) 2003-2004 Adam Geitgey <adam at rootnode.org>
++*  Copyright (C) 2004 Petri Damst� <damu at iki.fi>
++*  Copyright (C) 2004, 2005 Luke Kenneth Casson Leighton <lkcl at lkcl.net>
++*
++*  This file is part of SuperKaramba.
++*
++*  SuperKaramba is free software; you can redistribute it and/or modify
++*  it under the terms of the GNU General Public License as published by
++*  the Free Software Foundation; either version 2 of the License, or
++*  (at your option) any later version.
++*
++*  SuperKaramba is distributed in the hope that it will be useful,
++*  but WITHOUT ANY WARRANTY; without even the implied warranty of
++*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++*  GNU General Public License for more details.
++*
++*  You should have received a copy of the GNU General Public License
++*  along with SuperKaramba; if not, write to the Free Software
++*  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
++****************************************************************************/
++
++#ifdef _XOPEN_SOURCE
++#undef _XOPEN_SOURCE
++#endif
++
++#include <Python.h>
++#include <qglobal.h>
++#include <qobject.h>
++#include "kdebug.h"
++#include "karamba.h"
++#include "karambaapp.h"
++#include "themefile.h"
++#include "themelocale.h"
++#include "meter.h"
++#include "meter_python.h"
++#include "misc_python.h"
++
++/* now a method we need to expose to Python */
++long acceptDrops(long widget)
++{
++  karamba* currTheme = (karamba*)widget;
++
++  currTheme->setAcceptDrops(true);
++
++  return 1;
++}
++
++PyObject* py_accept_drops(PyObject *, PyObject *args)
++{
++  long widget;
++
++  if (!PyArg_ParseTuple(args, (char*)"l", &widget))
++    return NULL;
++  if (!checkKaramba(widget))
++    return NULL;
++  return Py_BuildValue((char*)"l", acceptDrops(widget));
++}
++
++// Runs a command, returns 0 if it could not start command
++PyObject* py_run_command(PyObject*, PyObject* args)
++{
++  char* name;
++  char* command;
++  char* icon;
++  PyObject *lst;
++  if (!PyArg_ParseTuple(args, (char*)"sssO:run", &name, &command, &icon, &lst) ||
++      lst == NULL || !PyList_Check(lst))
++      return NULL;
++
++  QString n;
++  QString c;
++  QString i;
++
++  n.setAscii(name);
++  c.setAscii(command);
++  i.setAscii(icon);
++
++  KService svc(n, c, i);
++  KURL::List l;
++
++  for (int i = 0; i < PyList_Size(lst); i++)
++  {
++    l.append(PyString2QString(PyList_GetItem(lst, i)));
++  }
++  KRun::run(svc, l);
++  return Py_BuildValue("l", 1);
++}
++
++// Runs a command, returns 0 if it could not start command
++PyObject* py_execute_command(PyObject *, PyObject* args)
++{
++  PyObject* s;
++
++  if (!PyArg_ParseTuple(args, (char*)"O:execute", &s))
++      return NULL;
++  return Py_BuildValue((char*)"l", KRun::runCommand(PyString2QString(s)));
++}
++
++// Runs a command, returns 0 if it could not start command
++PyObject* py_execute_command_interactive(PyObject *, PyObject* args)
++{
++  long widget;
++  //if (!PyArg_ParseTuple(args, (char*)"ls", &widget, &command))
++  //  return NULL;
++
++  int numLines;       /* how many lines we passed for parsing */
++  QString line;       /* pointer to the line as a string */
++
++  PyObject * listObj; /* the list of strings */
++  PyObject * strObj;  /* one string in the list */
++
++  /* the O! parses for a Python object (listObj) checked
++     to be of type PyList_Type */
++  if (! PyArg_ParseTuple(args, (char*)"lO!", &widget, &PyList_Type, &listObj))
++    return NULL;
++  if (!checkKaramba(widget))
++    return NULL;
++
++  karamba* currTheme = (karamba*)widget;
++
++  currTheme->currProcess = new KProcess;
++
++  /* get the number of lines passed to us */
++  numLines = PyList_Size(listObj);
++
++  /* should raise an error here. */
++  if (numLines < 0) return NULL; /* Not a list */
++
++  /* iterate over items of the list, grabbing strings, and parsing
++     for numbers */
++  for (int i=0; i<numLines; i++){
++
++    /* grab the string object from the next element of the list */
++    strObj = PyList_GetItem(listObj, i); /* Can't fail */
++
++    /* make it a string */
++    line = PyString2QString(strObj);
++
++    /* now do the parsing */
++    *(currTheme->currProcess) << line;
++
++  }
++  QApplication::connect(currTheme->currProcess,
++                        SIGNAL(processExited(KProcess *)),
++                        currTheme,
++                        SLOT(processExited(KProcess *)));
++  QApplication::connect(currTheme->currProcess,
++                        SIGNAL(receivedStdout(KProcess *, char *, int)),
++                        currTheme,
++                        SLOT(receivedStdout(KProcess *, char *, int)));
++  currTheme->currProcess->start(KProcess::NotifyOnExit, KProcess::Stdout);
++
++  return Py_BuildValue((char*)"l", (int)(currTheme->currProcess->pid()));
++}
++
++long attachClickArea(long widget, long meter, QString LeftButton, QString MiddleButton, QString RightButton)
++{
++  karamba* currTheme = (karamba*) widget;
++  Meter* currMeter = (Meter*) meter;
++
++  // Look if currMeter has an ClickArea attached.
++  bool meterAlreadyClickable = currTheme->clickList->containsRef(currMeter);
++
++  // if currMeter is of type ImageLabel*
++  if (ImageLabel* image = dynamic_cast<ImageLabel*>(currMeter))
++  {
++      image -> attachClickArea(LeftButton, MiddleButton, RightButton);
++      if (!meterAlreadyClickable)
++      {
++          //qWarning("attachClickArea : meter is image");
++          currTheme -> clickList -> append(image);
++      }
++  }
++  // else if currMeter is of type TextLabel*
++  else if (TextLabel* text = dynamic_cast<TextLabel*>(currMeter))
++  {
++      text -> attachClickArea(LeftButton, MiddleButton, RightButton);
++      if (!meterAlreadyClickable)
++      {
++          //qWarning("attachClickArea : meter is text");
++          currTheme -> clickList -> append(text);
++      }
++  }
++  else
++  {
++      //The given meter does not support attached clickAreas.
++      qWarning("The given meter is not of type image or text");
++      return 0;
++  }
++  return 1;
++}
++
++PyObject* py_attach_clickArea(PyObject*, PyObject* args, PyObject* dict)
++{
++  long widget;
++  long meter;
++  char* LeftButton = NULL;
++  char* MiddleButton = NULL;
++  char* RightButton = NULL;
++  const char* mouseButtons[] = {"Widget", "Meter", "LeftButton", "MiddleButton",
++                                "RightButton", NULL};
++  if (!PyArg_ParseTupleAndKeywords(args, dict, (char*)"ll|sss:attachClickArea",
++   (char**)mouseButtons, &widget, &meter, &LeftButton, &MiddleButton, &RightButton))
++    return NULL;
++  if (!checkKaramba(widget))
++    return NULL;
++  QString lB, mB, rB;
++  if (LeftButton != NULL)
++  {
++      lB.setAscii(LeftButton);
++  }
++  else
++  {
++      lB.setAscii("");
++  }
++  if (MiddleButton != NULL)
++  {
++      mB.setAscii(MiddleButton);
++  }
++  else
++  {
++      mB.setAscii("");
++  }
++  if (RightButton != NULL)
++  {
++       rB.setAscii(RightButton);
++  }
++  else
++  {
++       rB.setAscii("");
++  }
++  return Py_BuildValue((char*)"l", attachClickArea(widget, meter, lB, mB, rB));
++}
++
++/* now a method we need to expose to Python */
++long toggleShowDesktop(long)
++{
++  ShowDesktop *s = ShowDesktop::the();
++  s->toggle();
++  return 1;
++}
++
++PyObject* py_toggle_show_desktop(PyObject *, PyObject *args)
++{
++  long widget;
++  if (!PyArg_ParseTuple(args, (char*)"l:toggleShowDesktop", &widget))
++    return NULL;
++  if (!checkKaramba(widget))
++    return NULL;
++  return Py_BuildValue((char*)"l", toggleShowDesktop(widget));
++}
++
++/* now a method we need to expose to Python */
++const char* getPrettyName(long widget) {
++  karamba* currTheme = (karamba*)widget;
++
++  return currTheme->prettyName.ascii();
++}
++
++PyObject* py_get_pretty_name(PyObject *, PyObject *args)
++{
++  long widget;
++  if (!PyArg_ParseTuple(args, (char*)"l:getPrettyThemeName", &widget))
++    return NULL;
++  return Py_BuildValue((char*)"s", getPrettyName(widget));
++}
++
++/* now a method we need to expose to Python */
++const char* getThemePath(long widget) {
++  karamba* currTheme = (karamba*)widget;
++
++  return currTheme->theme().path().ascii();
++}
++
++PyObject* py_get_theme_path(PyObject *, PyObject *args)
++{
++  long widget;
++  if (!PyArg_ParseTuple(args, (char*)"l:getThemePath", &widget))
++    return NULL;
++  if (!checkKaramba(widget))
++    return NULL;
++  return Py_BuildValue((char*)"s", getThemePath(widget));
++}
++
++PyObject* py_language(PyObject *, PyObject *args)
++{
++  long widget;
++  if (!PyArg_ParseTuple(args, (char*)"l:language", &widget))
++    return NULL;
++  if (!checkKaramba(widget))
++    return NULL;
++  return Py_BuildValue((char*)"s",
++      ((karamba*)widget)->theme().locale()->language().ascii());
++}
++
++PyObject* py_read_theme_file(PyObject *, PyObject *args)
++{
++  long widget;
++  char *file;
++  if (!PyArg_ParseTuple(args, (char*)"ls:readThemeFile", &widget, &file))
++    return NULL;
++  if (!checkKaramba(widget))
++    return NULL;
++  karamba* k = (karamba*)widget;
++  QByteArray ba = k->theme().readThemeFile(file);
++  return PyString_FromStringAndSize(ba.data(), ba.size());
++}
++
++/* now a method we need to expose to Python */
++long removeClickArea(long widget, long click) {
++
++  karamba* currTheme = (karamba*)widget;
++  ClickArea *tmp = (ClickArea*)click;
++
++  currTheme -> clickList -> remove(tmp);
++
++  delete tmp;
++  return (long)tmp;
++}
++
++/* now a method we need to expose to Python */
++long createServiceClickArea(long widget, long x, long y, long w, long h, char *name, char* exec, char *icon) {
++
++  karamba* currTheme = (karamba*)widget;
++  ClickArea *tmp = new ClickArea( currTheme, x, y, w, h );
++  QString n;
++  QString e;
++  QString i;
++
++  n.setAscii(name);
++  e.setAscii(exec);
++  i.setAscii(icon);
++
++  tmp->setServiceOnClick(n, e, i);
++
++  currTheme -> clickList -> append(tmp);
++  return (long)tmp;
++}
++
++long createClickArea(long widget, long x, long y, long w, long h, char* text) {
++
++  karamba* currTheme = (karamba*)widget;
++  ClickArea *tmp = new ClickArea(currTheme, x, y, w, h );
++  QString onclick;
++
++  onclick.setAscii(text);
++
++  tmp->setOnClick(onclick );
++
++  currTheme -> clickList -> append(tmp);
++  return (long)tmp;
++}
++
++PyObject* py_remove_click_area(PyObject *, PyObject *args)
++{
++  long widget, click;
++  if (!PyArg_ParseTuple(args, (char*)"ll:removeClickArea", &widget, &click))
++    return NULL;
++  return Py_BuildValue((char*)"l", removeClickArea(widget, click));
++}
++
++PyObject* py_create_service_click_area(PyObject *, PyObject *args)
++{
++  long widget, x, y, w, h;
++  char *name;
++  char *exec;
++  char *icon;
++  if (!PyArg_ParseTuple(args, (char*)"lllllsss:createServiceClickArea", &widget, &x, &y,
++                        &w, &h, &name, &exec, &icon))
++    return NULL;
++  return Py_BuildValue((char*)"l", createServiceClickArea(widget, x, y, w, h, name, exec, icon));
++}
++
++PyObject* py_create_click_area(PyObject *, PyObject *args)
++{
++  long widget, x, y, w, h;
++  char *text;
++  if (!PyArg_ParseTuple(args, (char*)"llllls:createClickArea", &widget, &x, &y,
++                        &w, &h, &text))
++    return NULL;
++  if (!checkKaramba(widget))
++    return NULL;
++  return Py_BuildValue((char*)"l", createClickArea(widget, x, y, w, h, text));
++}
++
++static long callTheme(long widget, char* path, char *str)
++{
++  karamba* currTheme = (karamba*) widget;
++
++  if (currTheme)
++    currTheme->callTheme(QString(path), QString(str));
++
++  return (long)currTheme;
++}
++
++static long setIncomingData(long widget, char* path, char *obj)
++{
++  karamba* currTheme = (karamba*) widget;
++
++  if (currTheme)
++    currTheme->setIncomingData(QString(path), QString(obj));
++
++  return (long)currTheme;
++}
++
++static QString getIncomingData(long widget)
++{
++  karamba* currTheme = (karamba*) widget;
++
++  if (currTheme)
++    return currTheme->getIncomingData();
++
++  return QString("");
++}
++
++/*
++ * openNamedTheme.  this function checks to see whether the theme
++ * being opened is unique or not (against all running karamba widgets).
++ * this is important, as loading themes with the same name causes
++ * grief.
++ */
++long openNamedTheme(char* path, char *name, bool is_sub_theme) {
++
++  QString filename;
++  karamba* currTheme = 0;
++
++  filename.setAscii(path);
++
++  QFileInfo file( filename );
++
++  if( file.exists() )
++  {
++      QCString prettyName(name);
++      KarambaApplication* app = (KarambaApplication*)qApp;
++      if (!app->themeExists(prettyName))
++      {
++        currTheme = new karamba( filename, prettyName, false ,
++                   -1, is_sub_theme);
++      currTheme->show();
++    }
++  }
++  return (long)currTheme;
++}
++
++/* now a method we need to expose to Python */
++long openTheme(char* path)
++{
++
++  QString filename;
++  karamba* currTheme = 0;
++
++  filename.setAscii(path);
++
++  QFileInfo file( filename );
++
++  if( file.exists() )
++    {
++      currTheme = new karamba( filename, QString() );
++      currTheme->show();
++    }
++
++  return (long)currTheme;
++}
++
++PyObject* py_get_incoming_data(PyObject *, PyObject *args)
++{
++  long widget;
++  if (!PyArg_ParseTuple(args, (char*)"l:getIncomingData", &widget))
++    return NULL;
++  return Py_BuildValue((char*)"O", QString2PyString(getIncomingData(widget)));
++}
++
++PyObject* py_set_incoming_data(PyObject *, PyObject *args)
++{
++  char *themePath;
++  long widget;
++  char *obj;
++  if (!PyArg_ParseTuple(args, (char*)"lss:setIncomingData", &widget, &themePath, &obj))
++    return NULL;
++  return Py_BuildValue((char*)"l", setIncomingData(widget, themePath, obj));
++}
++
++PyObject* py_call_theme(PyObject *, PyObject *args)
++{
++  char *themePath;
++  char *str;
++  long widget;
++  if (!PyArg_ParseTuple(args, (char*)"lss:callTheme", &widget, &themePath, &str))
++    return NULL;
++  return Py_BuildValue((char*)"l", callTheme(widget, themePath, str));
++}
++
++PyObject* py_open_named_theme(PyObject *, PyObject *args)
++{
++  char *themePath;
++  char *themeName;
++  long is_sub_theme;
++  if (!PyArg_ParseTuple(args, (char*)"ssl:openNamedTheme", &themePath, &themeName, &is_sub_theme))
++    return NULL;
++  return Py_BuildValue((char*)"l", openNamedTheme(themePath, themeName, is_sub_theme ? true : false));
++}
++
++PyObject* py_open_theme(PyObject *, PyObject *args)
++{
++  char *themePath;
++  if (!PyArg_ParseTuple(args, (char*)"s:openTheme", &themePath))
++    return NULL;
++  return Py_BuildValue((char*)"l", openTheme(themePath));
++}
++
++PyObject* py_reload_theme(PyObject *, PyObject *args)
++{
++  long widget;
++  if (!PyArg_ParseTuple(args, (char*)"l:reloadTheme", &widget))
++    return NULL;
++  if (!checkKaramba(widget))
++    return NULL;
++  ((karamba*)widget)->reloadConfig();
++  return Py_BuildValue((char*)"l", 1);
++}
++
++/* now a method we need to expose to Python */
++int getNumberOfDesktops(long widget)
++{
++  karamba* currTheme = (karamba*)widget;
++
++  return currTheme->kWinModule->numberOfDesktops();
++}
++
++PyObject* py_get_number_of_desktops(PyObject *, PyObject *args)
++{
++  long widget;
++  if (!PyArg_ParseTuple(args, (char*)"l:getNumberOfDesktops", &widget))
++    return NULL;
++  if (!checkKaramba(widget))
++    return NULL;
++  return Py_BuildValue((char*)"l", getNumberOfDesktops(widget));
++}
++
++/* now a method we need to expose to Python */
++int translateAll(long widget, int x, int y)
++{
++  karamba* currTheme = (karamba*)widget;
++
++  QObjectListIt it2( *currTheme->meterList ); // iterate over meters
++
++  while ( it2 != 0 )
++  {
++    ((Meter*) *it2)->setSize(((Meter*) *it2)->getX()+x,
++                             ((Meter*) *it2)->getY()+y,
++                             ((Meter*) *it2)->getWidth(),
++                             ((Meter*) *it2)->getHeight());
++    ++it2;
++  }
++
++  if (currTheme->systray != 0)
++  {
++    currTheme->systray->move(currTheme->systray->x()+x,
++                             currTheme->systray->y()+y);
++  }
++  return 0;
++}
++
++PyObject* py_translate_all(PyObject *, PyObject *args)
++{
++  long widget;
++  int x, y;
++  if (!PyArg_ParseTuple(args, (char*)"lii:translateAll", &widget, &x, &y))
++    return NULL;
++  if (!checkKaramba(widget))
++    return NULL;
++  return Py_BuildValue((char*)"lii", translateAll(widget, x, y));
++}
++
++/* now a method we need to expose to Python */
++int show(long widget)
++{
++  karamba* currTheme = (karamba*)widget;
++  currTheme->show();
++  return 0;
++}
++
++PyObject* py_show(PyObject *, PyObject *args)
++{
++  long widget;
++  if (!PyArg_ParseTuple(args, (char*)"l:show", &widget))
++    return NULL;
++  if (!checkKaramba(widget))
++    return NULL;
++  return Py_BuildValue((char*)"l", show(widget));
++}
++
++/* now a method we need to expose to Python */
++int hide(long widget)
++{
++  karamba* currTheme = (karamba*)widget;
++  currTheme->hide();
++  return 0;
++}
++
++PyObject* py_hide(PyObject *, PyObject *args)
++{
++  long widget;
++  if (!PyArg_ParseTuple(args, (char*)"l:hide", &widget))
++    return NULL;
++  if (!checkKaramba(widget))
++    return NULL;
++  return Py_BuildValue((char*)"l", hide(widget));
++}
++
++/*Putting includes here to show the dependency for the call(s) below (if we ever decide to move the networking callbacks into a separate file*/
++#include <sys/socket.h>
++#include <sys/ioctl.h>
++#include <net/if.h>
++#include <arpa/inet.h>
++#ifdef __FreeBSD__
++#include <netinet/in.h>
++#endif
++#if defined(Q_OS_SOLARIS)
++#include <sys/sockio.h>
++#endif
++/* now a method we need to expose to Python */
++QString getIp(char *device_name)
++{
++  int i, sd, numdevs;
++  struct ifconf ifc_conf;
++  char ifc_conf_buf[sizeof ( struct ifreq ) * 32];
++  struct ifreq *devptr;
++  int ifc_conf_buf_size;
++  static struct in_addr host;
++  QString retval;
++
++  retval = "Disconnected";
++
++  /*
++   * Open a socket, any type will do so we choose UDP, and ask it with
++   * an ioctl call what devices are behind it.
++   */
++  if ((sd = socket(AF_INET,SOCK_DGRAM,0)) < 0)
++  {
++    qWarning("Error: Unable to create socket (socket)");
++    return "Error";
++  }
++
++  /*
++   * Fill the buffer with our static buffer, probably big enough, and get
++   * the interface configuration.
++   */
++  ifc_conf_buf_size = sizeof ifc_conf_buf;
++  ifc_conf.ifc_len = ifc_conf_buf_size;
++  ifc_conf.ifc_buf = ifc_conf_buf;
++  if (ioctl(sd,SIOCGIFCONF,&ifc_conf) < 0)
++  {
++    qWarning("Error: Unable to get network interface conf (ioctl)");
++    close(sd);
++    return "Error";
++  }
++
++  /*
++   * An array of devices were returned.  Which ones are up right now and
++   * have broadcast capability?
++   */
++  numdevs = ifc_conf.ifc_len / sizeof (struct ifreq);
++  //qDebug("numdevs = %d", numdevs);
++  for (i = 0; i < numdevs; i++)
++  {
++    //qDebug("iterations: %d", i);
++    /* devptr points into an array of ifreq structs. */
++    devptr = &ifc_conf.ifc_req[i];
++
++    if (ioctl(sd, SIOCGIFADDR, devptr) < 0 || devptr->ifr_addr.sa_family != AF_INET)
++      continue;
++
++    if (ioctl(sd,SIOCGIFFLAGS,devptr) < 0)
++    {
++      qWarning("Error: Unable to get device interface flags (ioctl).");
++      close(sd);
++      return "Error";
++    }
++
++  //We generally don't want probing of the loopback devices
++  if ((devptr->ifr_flags & IFF_LOOPBACK) != 0)
++   continue;
++
++    if ((devptr->ifr_flags & IFF_UP) == 0)
++    continue;
++
++    if ((devptr->ifr_flags & IFF_BROADCAST) == 0)
++    continue;
++
++  /* Get the broadcast address. */
++  if (ioctl(sd,SIOCGIFFLAGS,devptr) < 0)
++  {
++    qWarning("Error: Unable to get device interface flags (ioctl).");
++    close(sd);
++    return "Error";
++  }
++  else
++  {
++    if (!strcmp((char*)devptr->ifr_name, device_name))
++    {
++    host.s_addr = ((struct sockaddr_in*)&devptr->ifr_addr)->sin_addr.s_addr;
++    retval = inet_ntoa(host);
++    break;
++    }
++  }
++  }
++  close(sd);
++  return retval;
++}
++
++PyObject* py_set_update_time(PyObject *, PyObject *args)
++{
++  long widget;
++  double time;
++  if (!PyArg_ParseTuple(args, (char*)"ld:setUpdateTime", &widget, &time))
++    return NULL;
++  karamba* currTheme = (karamba*)widget;
++  currTheme->setUpdateTime(time);
++  return Py_BuildValue((char*)"l", 1);
++}
++
++PyObject* py_get_update_time(PyObject *, PyObject *args)
++{
++  long widget;
++  double time;
++  if (!PyArg_ParseTuple(args, (char*)"l:getUpdateTime", &widget, &time))
++    return NULL;
++  karamba* currTheme = (karamba*)widget;
++  return Py_BuildValue((char*)"d", currTheme->getUpdateTime());
++}
++
++PyObject* py_get_ip(PyObject *, PyObject *args)
++{
++  long widget;
++  char *interface;
++  if (!PyArg_ParseTuple(args, (char*)"ls:getIp", &widget, &interface))
++    return NULL;
++  if (!checkKaramba(widget))
++    return NULL;
++  return Py_BuildValue((char*)"O", QString2PyString(getIp(interface)));
++}
++
++static void management_popup(long widget)
++{
++  karamba* currTheme = (karamba*)widget;
++  currTheme->management_popup();
++}
++
++PyObject* py_management_popup(PyObject *, PyObject *args)
++{
++  long widget;
++  if (!PyArg_ParseTuple(args, (char*)"l:managementPopup", &widget))
++    return NULL;
++  if (!checkKaramba(widget))
++    return NULL;
++  management_popup(widget);
++  return Py_BuildValue((char*)"l", 1);
++}
++
++static void set_want_right_button(long widget, long yesno)
++{
++  karamba* currTheme = (karamba*)widget;
++  currTheme->setWantRightButton(yesno);
++}
++
++PyObject* py_want_right_button(PyObject *, PyObject *args)
++{
++  long widget, i;
++  if (!PyArg_ParseTuple(args, (char*)"ll:wantRightButton", &widget, &i))
++    return NULL;
++  if (!checkKaramba(widget))
++    return NULL;
++  set_want_right_button(widget, i);
++  return Py_BuildValue((char*)"l", 1);
++}
++
++
++static void changeInterval(long widget, long interval)
++{
++  karamba* currTheme = (karamba*)widget;
++  currTheme->changeInterval(interval);
++}
++
++PyObject* py_change_interval(PyObject *, PyObject *args)
++{
++  long widget, i;
++  if (!PyArg_ParseTuple(args, (char*)"ll:changeInterval", &widget, &i))
++    return NULL;
++  if (!checkKaramba(widget))
++    return NULL;
++  changeInterval(widget, i);
++  return Py_BuildValue((char*)"l", 1);
++}
++
++

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20061027/48a0d72a/attachment.html


More information about the macports-changes mailing list