--- scim-qtimm-0.9.4.orig/debian/copyright
+++ scim-qtimm-0.9.4/debian/copyright
@@ -0,0 +1,30 @@
+This package was debianized by ZhengPeng Hou <zhengpeng-hou@ubuntu.com> on
+Thu, 22 Dec 2005 16:58:17 +0800.
+
+Upstream Author: liucougar (liuspider) <liuspider@users.sourceforge.net> 
+
+Homepage:  http://www.scim-im.org/
+
+The package was downloaded from http://prdownloads.sourceforge.net/scim/
+
+
+Copyright :
+
+  Copyright 2004-2005  liuspider <liuspider@users.sourceforge.net> 
+
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public
+    License version 2 as published by the Free Software Foundation.
+
+    This library 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free
+    Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+    MA 02110-1301, USA.
+
+  On Debian systems, the complete text of the GNU General Public License
+  can be found in the file '/usr/share/common-licenses/GPL-2'.
--- scim-qtimm-0.9.4.orig/debian/changelog
+++ scim-qtimm-0.9.4/debian/changelog
@@ -0,0 +1,31 @@
+scim-qtimm (0.9.4-4) unstable; urgency=low
+
+  * Fix debian/rules, because of my stupid fault. (Closes: #514042)
+    - thanks Sven Eckelmann
+
+ -- Zhengpeng Hou <zhengpeng-hou@ubuntu.com>  Tue, 03 Feb 2009 23:53:39 +0000
+
+scim-qtimm (0.9.4-3) unstable; urgency=low
+
+  * Fix failed to report upstream version via debian/watch. (Closes: #450360)
+  * Add 11_qt_link.dpatch, make scim-qtimm link to qt3. (Closes: #432331)
+  * Add 12_configure.dpatch, fix ftbfs with gcc-4.3/gcc-snapshot. Closes: #441596
+  * Add 20_reset-frontend-data.dpatch fix kdesktop_lock has problem 
+    with scim. (Closes: #510851)
+  * Re-wrote debian/rules.
+  * Bump Standards Version to 3.8.0.
+  * Correct my first name in maintainer field.
+
+ -- Zhengpeng Hou <zhengpeng-hou@ubuntu.com>  Tue, 03 Feb 2009 03:11:46 +0000
+
+scim-qtimm (0.9.4-2) unstable; urgency=low
+
+  * Add scim | skim to Depends. Closes: #426801
+
+ -- ZhengPeng Hou <zhengpeng-hou@ubuntu.com>  Thu, 31 May 2007 11:55:12 +0000
+
+scim-qtimm (0.9.4-1) unstable; urgency=low
+
+  * Initial release. Closes: #354845
+
+ -- ZhengPeng Hou <zhengpeng-hou@ubuntu.com>  Tue, 05 Dec 2006 15:23:56 +0800
--- scim-qtimm-0.9.4.orig/debian/control
+++ scim-qtimm-0.9.4/debian/control
@@ -0,0 +1,18 @@
+Source: scim-qtimm
+Section: utils
+Priority: optional
+Maintainer: Zhengpeng Hou <zhengpeng-hou@ubuntu.com>
+Build-Depends: debhelper (>= 5), autotools-dev, libqt3-mt-dev (>=3.3.6), scim-dev (>= 1.4.2), dpatch (>= 2.0.16) 
+Standards-Version: 3.8.0
+Homepage: http://www.scim-im.org
+
+Package: scim-qtimm
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, scim | skim
+Description: SCIM context plugin for qt-immodule
+ SCIM (Smart Common Input Method) is an input method (IM) platform.
+ .
+ This package brings functionality similar to the immodule for 
+ GTK+ to the Qt library. The main goal is to extend and enhance
+ the input method support in the Qt library, in order to provide
+ a modern and powerful multi-language input system.
--- scim-qtimm-0.9.4.orig/debian/rules
+++ scim-qtimm-0.9.4/debian/rules
@@ -0,0 +1,98 @@
+#!/usr/bin/make -f
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+export DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+export DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+ONFFLAGS =
+ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
+  CONFFLAGS += --build $(DEB_HOST_GNU_TYPE)
+else
+  CONFFLAGS += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
+endif
+
+DEBUGFLAGS=-g
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+        DEBUGFLAGS += -O0
+else
+        DEBUGFLAGS += -O2
+endif
+
+CFLAGS:=-Wall -pipe $(DEBUGFLAGS)
+CXXFLAGS:=$(CFLAGS)
+
+configure: patch 
+config.status: configure
+	dh_testdir
+	# Add here commands to configure the package.
+	./configure CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" $(CONFFLAGS) \
+		--prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info \
+		--disable-rpath
+
+
+build: build-stamp
+
+build-stamp:  config.status
+	dh_testdir
+
+	# Add here commands to compile the package.
+	$(MAKE)
+	#docbook-to-man debian/scim-bridge-agent.sgml > scim-bridge-agent.1
+
+	touch build-stamp
+
+clean: clean-patched unpatch
+clean-patched:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp 
+	[ ! -f Makefile ] || $(MAKE) distclean
+	find po -iname "*.gmo" -exec rm {} \;
+
+#find po -empty -exec rm {} \;
+
+	dh_clean 
+
+patch: patch-stamp
+patch-stamp:
+	dpatch apply-all
+
+unpatch:
+	dpatch deapply-all
+	rm -rf patch-stamp debian/patched
+
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k 
+	dh_installdirs
+
+	# Add here commands to install the package into debian/scim-bridge.
+	$(MAKE) DESTDIR=$(CURDIR)/debian/scim-qtimm install
+	rm -f $(CURDIR)/debian/scim-qtimm/usr/lib/qt3/plugins/inputmethods/libqscim.la
+
+binary-indep: build install
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs ChangeLog
+	dh_installdocs
+	dh_installexamples
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install 
--- scim-qtimm-0.9.4.orig/debian/compat
+++ scim-qtimm-0.9.4/debian/compat
@@ -0,0 +1 @@
+5
--- scim-qtimm-0.9.4.orig/debian/docs
+++ scim-qtimm-0.9.4/debian/docs
@@ -0,0 +1,3 @@
+NEWS
+README
+TODO
--- scim-qtimm-0.9.4.orig/debian/watch
+++ scim-qtimm-0.9.4/debian/watch
@@ -0,0 +1,3 @@
+version=3
+http://sf.net/scim/scim-qtimm-([\d\.]*)\.tar\.gz debian uupdate
+
--- scim-qtimm-0.9.4.orig/debian/patches/20_reset-frontend-data.dpatch
+++ scim-qtimm-0.9.4/debian/patches/20_reset-frontend-data.dpatch
@@ -0,0 +1,44 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 20_reset-frontend-data.dpatch by <zsu@novell.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: 
+
+@DPATCH@
+diff --git a/src/qsciminputcontext.cpp b/src/qsciminputcontext.cpp
+index 0123952..d436ba8 100644
+--- a/src/qsciminputcontext.cpp
++++ b/src/qsciminputcontext.cpp
+@@ -658,6 +658,8 @@ QScimInputContext::QScimInputContext()
+ 
+     if (global.shared_input_method)
+         m_is_on = global.config->read (String (SCIM_CONFIG_FRONTEND_IM_OPENED_BY_DEFAULT), m_is_on);
++    // Associate this context with the instance.
++    m_instance->set_frontend_data (static_cast<void*> (this));
+ 
+     global.panel_client->prepare (m_id);
+     global.panel_client->register_input_context (m_id, m_instance->get_factory_uuid ());
+@@ -900,6 +902,7 @@ QScimInputContext::finalize ()
+         // Only do full finalize, if the Panel doesn't exit.
+         if (!global.panel_exited) {
+             global.panel_client->prepare (m_id);
++            m_instance->set_frontend_data (static_cast<void*>(this));
+  
+             if (global.focused_ic == this)
+                 m_instance->focus_out ();
+@@ -911,6 +914,7 @@ QScimInputContext::finalize ()
+             QScimInputContext *old_focused = global.focused_ic;
+             global.focused_ic = this;
+             // XXX: Free the smart pointer, not reset the instance.
++            m_instance->set_frontend_data (0);
+             m_instance.reset ();
+             global.focused_ic = old_focused;
+  
+@@ -922,6 +926,7 @@ QScimInputContext::finalize ()
+             global.panel_client->remove_input_context (m_id);
+             global.panel_client->send ();
+         } else {
++            m_instance->set_frontend_data (0);
+             m_instance.reset ();
+         }
+     }
--- scim-qtimm-0.9.4.orig/debian/patches/00list
+++ scim-qtimm-0.9.4/debian/patches/00list
@@ -0,0 +1,4 @@
+10_qt-immodule_install_dir.dpatch
+11_qt_link.dpatch
+12_configure.dpatch
+20_reset-frontend-data.dpatch
--- scim-qtimm-0.9.4.orig/debian/patches/11_qt_link.dpatch
+++ scim-qtimm-0.9.4/debian/patches/11_qt_link.dpatch
@@ -0,0 +1,32 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 01_qt_link.dpatch by  Matthias Klose <doko@ubuntu.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: 
+
+@DPATCH@
+
+--- scim-qtimm-0.9.4.orig/src/Makefile.am
++++ scim-qtimm-0.9.4/src/Makefile.am
+@@ -24,7 +24,7 @@
+ # the application source, library search path, and link libraries
+ libqscim_la_SOURCES = plugin.cpp qsciminputcontext.cpp
+ libqscim_la_LDFLAGS = -avoid-version -rpath $(pkglibdir) -module $(all_libraries)
+-libqscim_la_LIBADD = @SCIM_LIBS@ @SCIM_X11_LIBS@
++libqscim_la_LIBADD = @SCIM_LIBS@ $(LIB_QT) @SCIM_X11_LIBS@
+ 
+ #KDE_OPTIONS = qtonly
+ 
+only in patch2:
+unchanged:
+--- scim-qtimm-0.9.4.orig/src/Makefile.in
++++ scim-qtimm-0.9.4/src/Makefile.in
+@@ -256,7 +256,7 @@
+ # the application source, library search path, and link libraries
+ libqscim_la_SOURCES = plugin.cpp qsciminputcontext.cpp
+ libqscim_la_LDFLAGS = -avoid-version -rpath $(pkglibdir) -module $(all_libraries)
+-libqscim_la_LIBADD = @SCIM_LIBS@ @SCIM_X11_LIBS@
++libqscim_la_LIBADD = @SCIM_LIBS@ $(LIB_QT) @SCIM_X11_LIBS@
+ 
+ 
+ #KDE_OPTIONS = qtonly
--- scim-qtimm-0.9.4.orig/debian/patches/12_configure.dpatch
+++ scim-qtimm-0.9.4/debian/patches/12_configure.dpatch
@@ -0,0 +1,30 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: 
+
+@DPATCH@
+
+--- ./configure~	2005-08-17 01:30:35.000000000 +0200
++++ ./configure	2007-09-12 22:37:42.000000000 +0200
+@@ -30090,20 +30090,6 @@
+ fi
+ 
+ 
+-# Define the identity of the package.
+- PACKAGE=scim-qtimm
+- VERSION=0.9.4
+-
+-
+-cat >>confdefs.h <<_ACEOF
+-#define PACKAGE "$PACKAGE"
+-_ACEOF
+-
+-
+-cat >>confdefs.h <<_ACEOF
+-#define VERSION "$VERSION"
+-_ACEOF
+-
+ # Some tools Automake needs.
+ 
+ ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
--- scim-qtimm-0.9.4.orig/debian/patches/10_qt-immodule_install_dir.dpatch
+++ scim-qtimm-0.9.4/debian/patches/10_qt-immodule_install_dir.dpatch
@@ -0,0 +1,22 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 01_disable_rpath.dpatch by  <zhengpeng.hou@gmail.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: 
+
+@DPATCH@
+
+diff -Nru scim-qtimm-0.9.4.orig/configure scim-qtimm-0.9.4/configure
+--- scim-qtimm-0.9.4.orig/configure     2005-08-16 23:30:35.000000000 +0000
++++ scim-qtimm-0.9.4/configure  2006-01-09 07:14:47.000000000 +0000
+@@ -34444,7 +34444,7 @@
+ else
+   QTDIR_LOCAL=$QTDIR
+ fi
+-INPUTMETHODSDIR=$QTDIR_LOCAL/plugins/inputmethods
++INPUTMETHODSDIR=/usr/lib/qt3/plugins/inputmethods
+
+
+ if test "$kde_qtver" = "3"; then
+
+
