Revision: 7418
Author:   nogu.dev
Date:     Sat Jan 21 06:30:54 2012
Log:      * configure.ac
  - Add support for knotify4 as notify agent.
* notify/CMakeLists.txt
  - New file.
* notify/Makefile.am
  - Add knotify4.
* notify/uim-knotify4.cpp
  - New file.
http://code.google.com/p/uim/source/detail?r=7418

Added:
 /trunk/notify/CMakeLists.txt
 /trunk/notify/uim-knotify4.cpp
Modified:
 /trunk/configure.ac
 /trunk/notify/Makefile.am

=======================================
--- /dev/null
+++ /trunk/notify/CMakeLists.txt        Sat Jan 21 06:30:54 2012
@@ -0,0 +1,13 @@
+project(knotify4)
+
+find_package(KDE4 REQUIRED)
+
+include_directories(${KDE4_INCLUDES} ${CMAKE_SOURCE_DIR}/../uim
+        ${CMAKE_SOURCE_DIR}/../replace)
+
+set(uimnotify_knotify4_SRCS
+        uim-knotify4.cpp)
+
+kde4_add_library(uimnotify-knotify4 SHARED ${uimnotify_knotify4_SRCS})
+target_link_libraries(uimnotify-knotify4 ${KDE4_KDEUI_LIBS})
+install(TARGETS uimnotify-knotify4 DESTINATION ${UIMNOTIFY_PLUGINDIR})
=======================================
--- /dev/null
+++ /trunk/notify/uim-knotify4.cpp      Sat Jan 21 06:30:54 2012
@@ -0,0 +1,83 @@
+/*
+  Copyright (c) 2012 uim Project http://code.google.com/p/uim/
+
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+  3. Neither the name of authors nor the names of its contributors
+     may be used to endorse or promote products derived from this software
+     without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
+  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+  SUCH DAMAGE.
+
+*/
+#include <config.h>
+
+#include <kdemacros.h> // for KDE_EXPORT
+#include <knotification.h>
+
+#include "uim.h"  // for uim_bool
+#include "uim-notify.h"
+
+/*
+  interface
+ */
+static uim_notify_desc uim_notify_knotify4_desc = {
+  "knotify4",
+  "Output via knotify",
+};
+
+KDE_EXPORT const uim_notify_desc *
+uim_notify_plugin_get_desc(void)
+{
+  return &uim_notify_knotify4_desc;
+}
+
+KDE_EXPORT uim_bool
+uim_notify_plugin_init(void)
+{
+  return UIM_TRUE;
+}
+
+KDE_EXPORT void
+uim_notify_plugin_quit(void)
+{
+}
+
+static uim_bool
+send_knotify(const char *msg, KNotification::StandardEvent)
+{
+    KNotification::event(KNotification::Notification, msg,
+        QPixmap(UIM_PIXMAPSDIR "/uim-icon.png"));
+    return UIM_TRUE;
+}
+
+KDE_EXPORT uim_bool
+uim_notify_plugin_info(const char *msg)
+{
+  return send_knotify(msg, KNotification::Notification);
+}
+
+KDE_EXPORT uim_bool
+uim_notify_plugin_fatal(const char *msg)
+{
+  return send_knotify(msg, KNotification::Error);
+}
=======================================
--- /trunk/configure.ac Sun Jan  8 23:05:25 2012
+++ /trunk/configure.ac Sat Jan 21 06:30:54 2012
@@ -1647,13 +1647,13 @@
 # ****************************
 # *** Tests for uim-notify ***
 # ****************************
-notify_targets='stderr libnotify knotify3 growl'
+notify_targets='stderr libnotify knotify3 knotify4 growl'

 AC_ARG_ENABLE(notify,
AS_HELP_STRING([--enable-notify@<:@=agent-list@:>@ (HIGHLY EXPERIMENTAL)],
                  [enable system message notification for users
                  (specify comma separated notification agent list
-                 from stderr, libnotify, knotify3 and growl)]),
+                 from stderr, libnotify, knotify3, knotify4 and growl)]),
   [ enable_notify=$enableval
     have_notify_opt=yes ],
   [ enable_notify=yes
@@ -1724,6 +1724,20 @@
   use_notify="${use_notify}knotify3 "
 fi

+AC_MSG_CHECKING([whether knotify4 is requested])
+if test "x$au_enable_knotify4" = xyes; then
+  if test "x$CMAKE" != "xno"; then
+    AC_MSG_RESULT([yes])
+    use_knotify4="yes"
+    use_notify="${use_notify}knotify4 "
+  else
+    AC_MSG_WARN([no CMake found])
+    use_knotify4="no"
+  fi
+else
+  AC_MSG_RESULT(no)
+fi
+
 AC_MSG_CHECKING([whether growl is requested])
 if test "x$au_enable_growl" = xyes; then
   AC_MSG_RESULT([yes])
@@ -1740,6 +1754,7 @@
 AM_CONDITIONAL(NOTIFY, test "x$enable_notify" != xno)
 AM_CONDITIONAL(LIBNOTIFY, test x$use_libnotify = xyes)
 AM_CONDITIONAL(KNOTIFY3, test x$use_knotify3 = xyes)
+AM_CONDITIONAL(KNOTIFY4, test x$use_knotify4 = xyes)
 AM_CONDITIONAL(GROWL, test x$use_growl = xyes)


@@ -1973,6 +1988,18 @@

 AC_OUTPUT

+if test "x$CMAKE" != "xno"; then
+    if test "x$enable_debug" = xyes; then
+        cmake_build_type=Debug
+    else
+        cmake_build_type=Release
+    fi
+    # FIXME: move CMAKE_CXX_FLAGS into cmake_option
+    cmake_option="-DCMAKE_BUILD_TYPE=${cmake_build_type}"
+    cmake_option="${cmake_option} -DCMAKE_INSTALL_PREFIX=${prefix}"
+    cmake_option="${cmake_option} -DCMAKE_SKIP_RPATH=true"
+    cmake_option="${cmake_option} -DKDE4_USE_ALWAYS_FULL_RPATH=false"
+fi
 # Generate Makefiles for Qt4 by qmake
 if test x$use_qt4 = xyes; then
     if test x$use_qt4_immodule = xyes; then
@@ -1992,19 +2019,11 @@

     # Generate a Makefile for KDE4 applet by cmake
     if test x$use_applet_kde4 = xyes; then
-        if test "x$enable_debug" = xyes; then
-            cmake_build_type=Debug
-        else
-            cmake_build_type=Release
-        fi
         mkdir -p ${ac_abs_top_builddir}/qt4/toolbar/build
         cd ${ac_abs_top_builddir}/qt4/toolbar/build
-        ${CMAKE} \
-            -DCMAKE_CXX_FLAGS="${CXXFLAGS} ${X_CFLAGS}" \
-            -DCMAKE_BUILD_TYPE=${cmake_build_type} \
-            -DCMAKE_INSTALL_PREFIX=${prefix} \
-            -DCMAKE_SKIP_RPATH=true -DKDE4_USE_ALWAYS_FULL_RPATH=false \
-            ${ac_abs_top_srcdir}/qt4/toolbar
+        # FIXME: move CMAKE_CXX_FLAGS into cmake_option
+        ${CMAKE} -DCMAKE_CXX_FLAGS="${CXXFLAGS} ${X_CFLAGS}" \
+            ${cmake_option} ${ac_abs_top_srcdir}/qt4/toolbar
         cd -
     fi
 fi
@@ -2018,6 +2037,16 @@
     ${QMAKE4} -o ${ac_abs_top_builddir}/qt4/edittest/Makefile.qmake \
                  ${ac_abs_top_srcdir}/qt4/edittest/edittest.pro
 fi
+if test "x$use_knotify4" = xyes; then
+    # Generate a Makefile for KNotify plugin by cmake
+    mkdir -p ${ac_abs_top_builddir}/notify/build
+    cd ${ac_abs_top_builddir}/notify/build
+    # FIXME: move CMAKE_CXX_FLAGS into cmake_option
+    ${CMAKE} -DCMAKE_CXX_FLAGS="${CXXFLAGS} ${X_CFLAGS}" \
+        -DUIMNOTIFY_PLUGINDIR="${LIBDIR}/${PACKAGE}"/notify \
+        ${cmake_option} ${ac_abs_top_srcdir}/notify
+    cd -
+fi

 AC_MSG_RESULT([
 Configure Result :
=======================================
--- /trunk/notify/Makefile.am   Tue Mar 17 04:26:43 2009
+++ /trunk/notify/Makefile.am   Sat Jan 21 06:30:54 2012
@@ -29,3 +29,15 @@
libuimnotify_growl_la_LDFLAGS = -avoid-version -module -framework Cocoa -F../../../Sources/Growl -framework Growl
 libuimnotify_growl_la_LIBADD = $(top_builddir)/replace/libreplace.la
 endif
+
+if KNOTIFY4
+all cleaninstall uninstall:
+       ( cd build; $(MAKE) $(AM_MAKEFLAGS) $@ )
+endif
+
+distclean:
+       -rm -rf build/*
+
+FORCE:
+
+EXTRA_DIST = uim-knotify4.cpp CMakeLists.txt

Reply via email to