rev 4940 - in trunk/packages/kdepim/debian: . patches
Sune Vuorela
pusling-guest at alioth.debian.org
Mon Nov 20 10:40:13 UTC 2006
Author: pusling-guest
Date: 2006-11-20 11:40:00 +0100 (Mon, 20 Nov 2006)
New Revision: 4940
Added:
trunk/packages/kdepim/debian/patches/25_fix_kpilot_feature_pull_thx_vanrijn.diff
Modified:
trunk/packages/kdepim/debian/changelog
trunk/packages/kdepim/debian/kpilot.install
trunk/packages/kdepim/debian/patches/01_kdepim_branch_20061030.diff
Log:
I think it builds - have no clue if it works
Modified: trunk/packages/kdepim/debian/changelog
===================================================================
--- trunk/packages/kdepim/debian/changelog 2006-11-20 10:36:08 UTC (rev 4939)
+++ trunk/packages/kdepim/debian/changelog 2006-11-20 10:40:00 UTC (rev 4940)
@@ -1,5 +1,7 @@
kdepim (4:3.5.5.dfsg.1-2) unstable; urgency=low
+ * This release is dedicated to Rembrandt van Rijn for fixing kpilot
+
+++ Changes by Sune Vuorela
* Adds 18_optimize_splitAddressInternal.diff to fix lock up on weird
@@ -17,8 +19,12 @@
* fixed .ro debconf template (Closes: 397827)
* don't chmod stuff in kpilot if it is not there (in case of udev) i
(Closes: #378696)
+ * Adds gigantic patch to kpilot to fix it (patch 25) (Closes: 394534)
+ + The new patch does not build all conduits.
+ + kpilot.install modified because of this
+ + parts of the branch pull removed as it is included in the kpilot diff
- -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org> Sun, 19 Nov 2006 09:40:57 +0100
+ -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org> Mon, 20 Nov 2006 11:23:31 +0100
kdepim (4:3.5.5.dfsg.1-1) unstable; urgency=medium
Modified: trunk/packages/kdepim/debian/kpilot.install
===================================================================
--- trunk/packages/kdepim/debian/kpilot.install 2006-11-20 10:36:08 UTC (rev 4939)
+++ trunk/packages/kdepim/debian/kpilot.install 2006-11-20 10:40:00 UTC (rev 4940)
@@ -1,4 +1,3 @@
-/usr/bin/kpalmdoc
/usr/bin/kpilot
/usr/bin/kpilotDaemon
/usr/lib/kde3/conduit_*.la
@@ -7,52 +6,34 @@
/usr/lib/kde3/kcm_kpilot.so
/usr/lib/libkpilot.so.0
/usr/lib/libkpilot.so.0.0.0
-/usr/share/applications/kde/kpalmdoc.desktop
/usr/share/applications/kde/kpilot.desktop
/usr/share/applications/kde/kpilotdaemon.desktop
-/usr/share/apps/kconf_update/kpalmdoc.upd
/usr/share/apps/kconf_update/kpilot.upd
/usr/share/apps/kpilot
/usr/share/config.kcfg/abbrowserconduit.kcfg
-/usr/share/config.kcfg/docconduit.kcfg
-/usr/share/config.kcfg/knotesconduit.kcfg
-/usr/share/config.kcfg/kpalmdoc.kcfg
/usr/share/config.kcfg/kpilot.kcfg
/usr/share/config.kcfg/kpilotlib.kcfg
-/usr/share/config.kcfg/malconduit.kcfg
/usr/share/config.kcfg/memofileconduit.kcfg
/usr/share/config.kcfg/popmail.kcfg
/usr/share/config.kcfg/sysinfoconduit.kcfg
-/usr/share/config.kcfg/timeconduit.kcfg
/usr/share/config.kcfg/vcalconduitbase.kcfg
/usr/share/doc/kde/HTML/en/kpilot
-/usr/share/icons/crystalsvg/16x16/apps/kpalmdoc.png
/usr/share/icons/hicolor/16x16/apps/kpilot.png
/usr/share/icons/crystalsvg/16x16/apps/kpilotDaemon.png
-/usr/share/icons/crystalsvg/22x22/apps/kpalmdoc.png
/usr/share/icons/hicolor/22x22/apps/kpilot.png
/usr/share/icons/crystalsvg/22x22/apps/kpilotDaemon.png
-/usr/share/icons/crystalsvg/32x32/apps/kpalmdoc.png
/usr/share/icons/hicolor/32x32/apps/kpilot.png
/usr/share/icons/crystalsvg/32x32/apps/kpilotDaemon.png
-/usr/share/icons/crystalsvg/48x48/apps/kpalmdoc.png
/usr/share/icons/hicolor/48x48/apps/kpilot.png
/usr/share/icons/crystalsvg/48x48/apps/kpilotDaemon.png
/usr/share/icons/locolor/16x16/apps/kpilot.png
/usr/share/services/abbrowser_conduit.desktop
-/usr/share/services/doc_conduit.desktop
-/usr/share/services/knotes-conduit.desktop
/usr/share/services/kpilot_config.desktop
-/usr/share/services/mal_conduit.desktop
-/usr/share/services/memofile-conduit.desktop
-/usr/share/services/notepad-conduit.desktop
/usr/share/services/popmail-conduit.desktop
+/usr/share/services/memofile-conduit.desktop
/usr/share/services/sysinfo_conduit.desktop
-/usr/share/services/time_conduit.desktop
/usr/share/services/todo-conduit.desktop
/usr/share/services/vcal-conduit.desktop
/usr/share/servicetypes/kpilotconduit.desktop
../icons/kpilot.xpm /usr/share/pixmaps
../icons/kpilot-16.xpm /usr/share/pixmaps
-../icons/kpalmdoc.xpm /usr/share/pixmaps
-../icons/kpalmdoc-16.xpm /usr/share/pixmaps
Modified: trunk/packages/kdepim/debian/patches/01_kdepim_branch_20061030.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/01_kdepim_branch_20061030.diff 2006-11-20 10:36:08 UTC (rev 4939)
+++ trunk/packages/kdepim/debian/patches/01_kdepim_branch_20061030.diff 2006-11-20 10:40:00 UTC (rev 4940)
@@ -1555,45 +1555,6 @@
*/
class KDE_EXPORT HtmlExport
{
-Index: kpilot/conduits/sysinfoconduit/sysinfo-setup_dialog.ui
-===================================================================
---- kpilot/conduits/sysinfoconduit/sysinfo-setup_dialog.ui (.../tags/KDE/3.5.5/kdepim) (revision 600288)
-+++ kpilot/conduits/sysinfoconduit/sysinfo-setup_dialog.ui (.../branches/KDE/3.5/kdepim) (revision 600288)
-@@ -99,7 +99,7 @@
- <bool>true</bool>
- </property>
- <property name="whatsThis" stdset="0">
-- <string><qt>Select this option to output the system information data as a HTML document.</qt></string>
-+ <string><qt>Select this option to output the system information data as an HTML document.</qt></string>
- </property>
- </widget>
- <widget class="QRadioButton" row="1" column="0" rowspan="1" colspan="2">
-Index: kpilot/conduits/memofileconduit/memofile-conduit.desktop
-===================================================================
---- kpilot/conduits/memofileconduit/memofile-conduit.desktop (.../tags/KDE/3.5.5/kdepim) (revision 600288)
-+++ kpilot/conduits/memofileconduit/memofile-conduit.desktop (.../branches/KDE/3.5/kdepim) (revision 600288)
-@@ -47,7 +47,7 @@
- Comment[es]=Este conducto sincroniza las notas de su agenda electrónica con el directorio local.
- Comment[et]=See kanal sünkroniseerib pihuarvutis ja arvutis olevad memod.
- Comment[eu]=Kanal honek zure agendako oharrak direktorio lokal batekin sinkronizatzen ditu.
--Comment[fa]=اÛÙ ÙÙÙÙØ memoâÙØ§Û Ø¯Ø³ØªÛ Ø®ÙØ¯ را با ÛÚ© ÙÙØ±Ø³Øª راÙÙÙ
Ø§Û Ù
ØÙÛ ÙÙ
گاÙ
âØ³Ø§Ø²Û Ú©ÙÛØ¯.
-+Comment[fa]=اÛÙ ÙÙÙÙØ memoâÙØ§Û Ø¯Ø³ØªÛ Ø®ÙØ¯ را با ÛÚ© ÙÙØ±Ø³Øª راÙÙÙ
Ø§Û Ù
ØÙÛ ÙÙ
گاÙ
âØ³Ø§Ø²Û Ù
ÛâÚ©ÙØ¯.
- Comment[fi]=Tämä yhdyskäytävä synkronoi taskutietokoneen muistiot paikalliseen kansioon.
- Comment[fr]=Ce canal synchronise les mémos du Palm avec ceux de KDE.
- Comment[hu]=Ezzel a csatolóval egy kézi számÃtógép memóit lehet szinkronizálni a helyi cÃmjegyzékkel.
-Index: kpilot/conduits/docconduit/doc_conduit.desktop
-===================================================================
---- kpilot/conduits/docconduit/doc_conduit.desktop (.../tags/KDE/3.5.5/kdepim) (revision 600288)
-+++ kpilot/conduits/docconduit/doc_conduit.desktop (.../branches/KDE/3.5/kdepim) (revision 600288)
-@@ -17,7 +17,7 @@
- Comment[hu]=Szöveges fájlok hozzáadása a kézi számÃtógéphez, DOC-olvasók számára.
- Comment[is]=Bætir textaskrám, sem hægt er að lesa à DOC lesara, við lófatölvuna þÃna.
- Comment[it]=Aggiunge file di testo al tuo Pilot, adatti per lettori DOC.
--Comment[ja]=ããã¹ããã¡ã¤ã«ã DOC ãªã¼ãã«é©ããå½¢å¼ã§ãã³ããã«ãã«è¿½å ãã¾ãã
-+Comment[ja]=ããã¹ããã¡ã¤ã«ã DOC ãªã¼ãã¼ã«é©ããå½¢å¼ã§ãã³ããã«ãã«è¿½å ãã¾ãã
- Comment[km]=ááááááâá¯ááá¶áâá¢áááááâáá
âá§áááááâáá½áâááâááááâá¢ááá (ááááááâááááá¶ááâáááááá·áá¸âá¢á¶á DOC) á
- Comment[lt]=Prideda teksto bylas prie JÅ«sų neÅ¡iojamos knygelÄs, tinka DOC skaityklÄms.
- Comment[ms]=Menambah fail teks ke komputer telapak, sesuai dengan pembaca DOC.
Index: kontact/plugins/akregator/akregatorplugin.desktop
===================================================================
--- kontact/plugins/akregator/akregatorplugin.desktop (.../tags/KDE/3.5.5/kdepim) (revision 600288)
Added: trunk/packages/kdepim/debian/patches/25_fix_kpilot_feature_pull_thx_vanrijn.diff
===================================================================
--- trunk/packages/kdepim/debian/patches/25_fix_kpilot_feature_pull_thx_vanrijn.diff 2006-11-20 10:36:08 UTC (rev 4939)
+++ trunk/packages/kdepim/debian/patches/25_fix_kpilot_feature_pull_thx_vanrijn.diff 2006-11-20 10:40:00 UTC (rev 4940)
@@ -0,0 +1,18925 @@
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/ChangeLog kdepim-3.5.5.dfsg.1/kpilot/ChangeLog
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/ChangeLog 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/ChangeLog 2006-11-19 22:21:12.000000000 +0100
+@@ -8,11 +8,38 @@ TODO: Figure out why archived records ar
+ record->isDeleted() is false, on sync, but it is modified and
+ updated on the pc, although that does not change anything.
+
++TODO: store map of pilot-id <-> uid elsewhere (not in the .vcf file)
++TODO: don't make ActionQueue auto-delete the actions in it.
+ TODO: provide template-based, interpreted databases much like the
+- AppInfo classes now have.
++ AppInfo classes now have.
+ TODO: give the knotes conduit a decent test mode.
+ TODO: only re-write a local database if it is changed.
+-TODO: move set-category code from subclasses into PilotRecordBase.
++
++2006-10-24 Jason 'vanRijn' Kasper
++* Getting rid of FastSync. The only difference between it and HotSync was
++ that HotSync did a Backup and FastSync did not. Having a third
++ permutation because of not having a way to set it in the Backup settings
++ seems wrong. Also, if one of them is to go, I think that HotSync is much
++ more recognizable and widely used than FastSync.
++* Allowing finer-grained control around when database backups are done.
++ This is so that users can choose when they want a backup to be done.
++ The problem I need to solve for myself is that since I'm now syncing
++ between 2 PCs, I need a full sync to be done whenever I switch. But I
++ do not EVER want an automatic backup to be done. Currently, this is not
++ possible. Fixing it. =:) This will also allow for schedule backups to
++ be done, which is also of interest to me.
++
++2006-01-30 Adriaan de Groot
++* Updated pilot-link to today's CVS, with one change - use of pl_socklen_t
++ in inet.c changed back to socklen_t.
++* Added --loop to kpilotTest to repeatedly run the same action. Only
++ works for --list right now.
++
++2006-01-23 Adriaan de Groot
++* Gosh, where to begin. KPilot moved SVN repositories, changed build
++ systems, had the guts of the device link class refactored, bumped the
++ plugin API version again, and tons more. The commit logs are probably
++ the most useful source of information about what's changed.
+
+ 2005-08-18 Adriaan de Groot
+ * Found out that the PilotAppCategory constructor that takes
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/cmake/modules/FindPilotlink.cmake kdepim-3.5.5.dfsg.1/kpilot/cmake/modules/FindPilotlink.cmake
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/cmake/modules/FindPilotlink.cmake 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/cmake/modules/FindPilotlink.cmake 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,25 @@
++
++FIND_PATH(PILOTLINK_INCLUDE_DIR pi-dlp.h /usr/include /usr/local/include)
++FIND_LIBRARY(PILOTLINK_LIBRARY NAMES pisock PATH /usr/lib /usr/local/lib)
++
++IF (NOT PILOTLINK_INCLUDE_DIR)
++ MESSAGE(STATUS "Could not find pi-dlp.h")
++ENDIF (NOT PILOTLINK_INCLUDE_DIR)
++
++IF (NOT PILOTLINK_LIBRARY)
++ MESSAGE(STATUS "Could not find libpisock")
++ENDIF (NOT PILOTLINK_LIBRARY)
++
++IF (PILOTLINK_INCLUDE_DIR AND PILOTLINK_LIBRARY)
++ SET(PILOTLINK_FOUND TRUE)
++ENDIF (PILOTLINK_INCLUDE_DIR AND PILOTLINK_LIBRARY)
++
++IF (PILOTLINK_FOUND)
++ MESSAGE(STATUS "Found pilot-link: ${PILOTLINK_LIBRARY}")
++ELSE (PILOTLINK_FOUND)
++ IF (Pilotlink_FIND_REQUIRED)
++ MESSAGE(STATUS "KPilot requires pilot-link 0.12.1 or later. Pilot-link is available from pilot-link.org and is packaged by most distributions. Remember to install the development package with the compilation headers as well.")
++ MESSAGE(FATAL_ERROR "Could not find pilot-link.")
++ ENDIF (Pilotlink_FIND_REQUIRED)
++ENDIF (PILOTLINK_FOUND)
++
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/cmake/modules/KPilotCustom.cmake kdepim-3.5.5.dfsg.1/kpilot/cmake/modules/KPilotCustom.cmake
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/cmake/modules/KPilotCustom.cmake 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/cmake/modules/KPilotCustom.cmake 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,53 @@
++MACRO(KDE3_INSTALL_ICONS_CUSTOM _theme)
++ ADD_CUSTOM_TARGET(install_icons )
++ SET_TARGET_PROPERTIES(install_icons PROPERTIES POST_INSTALL_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake )
++ FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake "# icon installations rules\n")
++ FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake "SET(CMAKE_BACKWARDS_COMPATIBILITY \"2.2\") \n")
++
++ FILE(GLOB _icons *.png)
++ FOREACH(_current_ICON ${_icons} )
++ STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\1" _size "${_current_ICON}")
++ STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\2" _group "${_current_ICON}")
++ STRING(REGEX REPLACE "^.*/[a-zA-Z]+([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" "\\3" _name "${_current_ICON}")
++
++ SET(_icon_GROUP "unknown")
++
++ IF(${_group} STREQUAL "mime")
++ SET(_icon_GROUP "mimetypes")
++ ENDIF(${_group} STREQUAL "mime")
++
++ IF(${_group} STREQUAL "filesys")
++ SET(_icon_GROUP "filesystems")
++ ENDIF(${_group} STREQUAL "filesys")
++
++ IF(${_group} STREQUAL "device")
++ SET(_icon_GROUP "devices")
++ ENDIF(${_group} STREQUAL "device")
++
++ IF(${_group} STREQUAL "app")
++ SET(_icon_GROUP "apps")
++ ENDIF(${_group} STREQUAL "app")
++
++ IF(${_group} STREQUAL "action")
++ SET(_icon_GROUP "actions")
++ ENDIF(${_group} STREQUAL "action")
++
++ IF( NOT ${_icon_GROUP} STREQUAL "unknown")
++# message(STATUS "icon: ${_current_ICON} size: ${_size} group: ${_group} name: ${_name}" )
++ SET(_ICON_INSTALL_NAME ${CMAKE_INSTALL_PREFIX}/share/icons/${_theme}/${_size}x${_size}/${_icon_GROUP}/${_name})
++ FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake "message(STATUS \"Installing ${_ICON_INSTALL_NAME}\") \n")
++ FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake "CONFIGURE_FILE( ${_current_ICON} ${_ICON_INSTALL_NAME} COPYONLY) \n")
++ ELSE( NOT ${_icon_GROUP} STREQUAL "unknown")
++ message(STATUS "icon: ${_current_ICON} doesn't fit naming conventions. ignoring." )
++ ENDIF( NOT ${_icon_GROUP} STREQUAL "unknown")
++
++ ENDFOREACH (_current_ICON)
++ENDMACRO(KDE3_INSTALL_ICONS_CUSTOM)
++
++
++MACRO(KPILOT_RPATH _thing)
++ set_target_properties(${_thing} PROPERTIES
++ INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib;${KDE3_DIR}/lib;${PILOTLINK_LIBRARY}
++ INSTALL_RPATH_USE_LINK_PATH true
++ )
++ENDMACRO(KPILOT_RPATH _thing)
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/CMakeLists.txt kdepim-3.5.5.dfsg.1/kpilot/CMakeLists.txt
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/CMakeLists.txt 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,63 @@
++project(kpilot)
++
++# Search our own cmake modules path first
++set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
++
++# Need 2.4.3 for its KDE3 support
++cmake_minimum_required(VERSION 2.4.3)
++
++CONFIGURE_FILE(
++ "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
++ "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
++ IMMEDIATE @ONLY)
++
++ADD_CUSTOM_TARGET(uninstall
++ "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
++
++# Disallow in-source build
++STRING(COMPARE EQUAL "${kpilot_SOURCE_DIR}" "${kpilot_BINARY_DIR}" insource)
++if(insource)
++ MESSAGE(FATAL_ERROR
++ "KPilot requires an out of source build. Please create a separate build
++directory and run 'cmake path_to_kpilot [options]' there."
++ )
++endif(insource)
++
++find_package(Qt3 REQUIRED) # find and setup Qt3 for this project
++find_package(KDE3 REQUIRED) # find and setup KDE3 for this project
++find_package(Pilotlink REQUIRED)
++
++add_definitions(
++ ${QT_DEFINITIONS}
++ ${KDE3_DEFINITIONS}
++ -DQT_THREAD_SUPPORT
++)
++
++# Get the kde3 dir. This is a bit tricky, i'm not sure how well
++# this works on other systems.
++STRING(REPLACE "/lib" "" KDE3_DIR ${KDE3_LIB_DIR})
++
++# TODO: INSTALL PREFIX. RIGHT NOW EVERYTHING IS INSTALLED IN $KDEDIR
++if(NOT CMAKE_INSTALL_PREFIX)
++ set(CMAKE_INSTALL_PREFIX ${KDE3_DIR})
++endif(NOT CMAKE_INSTALL_PREFIX)
++set(KDE3_KCFG_DIR ${CMAKE_INSTALL_PREFIX}/share/config.kcfg)
++set(KDE3_SERVICETYPES_DIR ${CMAKE_INSTALL_PREFIX}/share/servicetypes)
++set(KDE3_SERVICES_DIR ${CMAKE_INSTALL_PREFIX}/share/services)
++set(KDE3_XDG_APPS_DIR ${CMAKE_INSTALL_PREFIX}/share/applications/kde)
++set(KDE3_LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib)
++set(KDE3_PLUGIN_INSTALL_DIR ${KDE3_LIB_INSTALL_DIR}/kde3)
++
++# tell cmake where to search for libraries:
++link_directories(${KDE3_LIB_DIR})
++
++# tell cmake where to search for Qt/KDE headers:
++include_directories(${PILOTLINK_INCLUDE_DIR} ${KDE3_INCLUDE_DIR} ${QT_INCLUDE_DIR})
++
++# include custom macros
++INCLUDE(${CMAKE_SOURCE_DIR}/cmake/modules/KPilotCustom.cmake)
++
++# tell cmake to process CMakeLists.txt in that subdirectory
++add_subdirectory(lib)
++add_subdirectory(kpilot)
++add_subdirectory(conduits)
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/cmake_uninstall.cmake.in kdepim-3.5.5.dfsg.1/kpilot/cmake_uninstall.cmake.in
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/cmake_uninstall.cmake.in 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/cmake_uninstall.cmake.in 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,23 @@
++IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
++ MESSAGE(FATAL_ERROR "Cannot find install manifest:
++\"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
++ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
++
++FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
++STRING(REGEX REPLACE "\n" ";" files "${files}")
++FOREACH(file ${files})
++ MESSAGE(STATUS "Uninstalling \"${file}\"")
++ IF(EXISTS "${file}")
++ EXEC_PROGRAM(
++ "@CMAKE_COMMAND@" ARGS "-E remove \"${file}\""
++ OUTPUT_VARIABLE rm_out
++ RETURN_VALUE rm_retval
++ )
++ IF("${rm_retval}" STREQUAL 0)
++ ELSE("${rm_retval}" STREQUAL 0)
++ MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"")
++ ENDIF("${rm_retval}" STREQUAL 0)
++ ELSE(EXISTS "${file}")
++ MESSAGE(STATUS "File \"${file}\" does not exist.")
++ ENDIF(EXISTS "${file}")
++ENDFOREACH(file)
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/abbrowserconduit/abbrowser-conduit.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/abbrowserconduit/abbrowser-conduit.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/abbrowserconduit/abbrowser-conduit.cc 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/abbrowserconduit/abbrowser-conduit.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -40,6 +40,7 @@
+ #include <kabc/stdaddressbook.h>
+ #include <kabc/resourcefile.h>
+ #include <kio/netaccess.h>
++#include <ksavefile.h>
+
+ #include <pilotSerialDatabase.h>
+ #include <pilotLocalDatabase.h>
+@@ -57,7 +58,7 @@
+ extern "C"
+ {
+ long version_conduit_address = KPILOT_PLUGIN_API;
+-const char *id_conduit_address="$Id: abbrowser-conduit.cc 450360 2005-08-17 23:55:06Z adridg $";
++const char *id_conduit_address="$Id: abbrowser-conduit.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+ }
+
+
+@@ -86,7 +87,7 @@ static inline void _setPhoneNumber(Addre
+
+
+
+-AbbrowserConduit::AbbrowserConduit(KPilotDeviceLink * o, const char *n, const QStringList & a):
++AbbrowserConduit::AbbrowserConduit(KPilotLink * o, const char *n, const QStringList & a):
+ ConduitAction(o, n, a),
+ fAddressAppInfo(0L),
+ addresseeMap(),
+@@ -167,6 +168,7 @@ bool AbbrowserConduit::_prepare()
+
+ readConfig();
+ syncedIds.clear();
++ pilotindex = 0;
+
+ return true;
+ }
+@@ -182,20 +184,26 @@ void AbbrowserConduit::readConfig()
+ SyncAction::ConflictResolution res = (SyncAction::ConflictResolution)AbbrowserSettings::conflictResolution();
+ setConflictResolution(res);
+
+-#ifdef DEBUG
+ DEBUGCONDUIT << fname
+- << ": Settings "
++ << ": Reading addressbook "
++ << ( AbbrowserSettings::addressbookType() == AbbrowserSettings::eAbookFile ?
++ AbbrowserSettings::fileName() : CSL1("Standard") )
++ << endl;
++ DEBUGCONDUIT << fname
++ << ": "
+ << " fConflictResolution=" << getConflictResolution()
++ << " fArchive=" << AbbrowserSettings::archiveDeleted()
++ << " fFirstTime=" << isFirstSync()
++ << endl;
++ DEBUGCONDUIT << fname
++ << ": "
+ << " fPilotStreetHome=" << AbbrowserSettings::pilotStreet()
+ << " fPilotFaxHome=" << AbbrowserSettings::pilotFax()
+- << " fArchive=" << AbbrowserSettings::archiveDeleted()
+ << " eCustom[0]=" << AbbrowserSettings::custom0()
+ << " eCustom[1]=" << AbbrowserSettings::custom1()
+ << " eCustom[2]=" << AbbrowserSettings::custom2()
+ << " eCustom[3]=" << AbbrowserSettings::custom3()
+- << " fFirstTime=" << isFirstSync()
+ << endl;
+-#endif
+ }
+
+
+@@ -703,9 +711,6 @@ void AbbrowserConduit::showAdresses(Addr
+ /* virtual */ bool AbbrowserConduit::exec()
+ {
+ FUNCTIONSETUP;
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname << id_conduit_address << endl;
+-#endif
+
+ _prepare();
+
+@@ -717,11 +722,20 @@ void AbbrowserConduit::showAdresses(Addr
+ }
+ setFirstSync( retrieved );
+
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname << ": First sync now " << isFirstSync() << endl;
+-#endif
+-
+ _getAppInfo();
++
++ // Local block
++ {
++ QString dbpath = fLocalDatabase->dbPathName();
++ DEBUGCONDUIT << fname << ": Local database path " << dbpath << endl;
++ }
++
++ if ( syncMode().isTest() )
++ {
++ QTimer::singleShot(0, this, SLOT(slotTestRecord()));
++ return true;
++ }
++
+ if(!_loadAddressBook())
+ {
+ emit logError(i18n("Unable to open the addressbook."));
+@@ -738,7 +752,6 @@ void AbbrowserConduit::showAdresses(Addr
+
+ // perform syncing from palm to abbrowser
+ // iterate through all records in palm pilot
+- pilotindex = 0;
+
+ #ifdef DEBUG
+ DEBUGCONDUIT << fname << ": fullsync=" << isFullSync() << ", firstSync=" << isFirstSync() << endl;
+@@ -1059,10 +1072,27 @@ void AbbrowserConduit::slotCleanup()
+ fLocalDatabase->resetSyncFlags();
+ fLocalDatabase->cleanup();
+ }
++
++ // Write out the sync maps
++ QString syncFile = fLocalDatabase->dbPathName() + CSL1(".sync");
++ DEBUGCONDUIT << fname << ": Writing sync map to " << syncFile << endl;
++ KSaveFile map( syncFile );
++ if ( map.status() == 0 )
++ {
++ DEBUGCONDUIT << fname << ": Writing sync map ..." << endl;
++ (*map.dataStream()) << addresseeMap ;
++ map.close();
++ }
++ // This also picks up errors from map.close()
++ if ( map.status() != 0 )
++ {
++ kdWarning() << k_funcinfo << ": Could not make backup of sync map." << endl;
++ }
++
+ KPILOT_DELETE(fDatabase);
+ KPILOT_DELETE(fLocalDatabase);
+ _saveAddressBook();
+- emit syncDone(this);
++ delayDone();
+ }
+
+
+@@ -2266,3 +2296,24 @@ Addressee AbbrowserConduit::_findMatch(c
+ return Addressee();
+ }
+
++void AbbrowserConduit::slotTestRecord()
++{
++ FUNCTIONSETUP;
++
++ // Get a record and interpret it as an address.
++ PilotRecord *r = fDatabase->readRecordByIndex( pilotindex );
++ if (!r)
++ {
++ delayDone();
++ return;
++ }
++ PilotAddress a(fAddressAppInfo,r);
++ KPILOT_DELETE(r);
++
++ // Process this record.
++ showPilotAddress(&a);
++
++ // Schedule more work.
++ ++pilotindex;
++ QTimer::singleShot(0, this, SLOT(slotTestRecord()));
++}
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/abbrowserconduit/abbrowser-conduit.h kdepim-3.5.5.dfsg.1/kpilot/conduits/abbrowserconduit/abbrowser-conduit.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/abbrowserconduit/abbrowser-conduit.h 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/abbrowserconduit/abbrowser-conduit.h 2006-11-19 22:21:12.000000000 +0100
+@@ -56,7 +56,7 @@ class AbbrowserConduit : public ConduitA
+ {
+ Q_OBJECT
+ public:
+- AbbrowserConduit(KPilotDeviceLink *o,const char *n = 0L,
++ AbbrowserConduit(KPilotLink *o,const char *n = 0L,
+ const QStringList &a = QStringList() );
+ virtual ~AbbrowserConduit();
+
+@@ -72,6 +72,8 @@ protected slots:
+ void slotDeleteUnsyncedHHRecords();
+ void slotCleanup();
+
++ void slotTestRecord();
++
+ private:
+
+ /********************************************************/
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/abbrowserconduit/CMakeLists.txt kdepim-3.5.5.dfsg.1/kpilot/conduits/abbrowserconduit/CMakeLists.txt
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/abbrowserconduit/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/abbrowserconduit/CMakeLists.txt 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,40 @@
++include_directories(
++ ${CMAKE_CURRENT_BINARY_DIR}
++)
++
++set(conduit_abbrowser_SRCS
++ resolutionDialog.cc
++ abbrowser-factory.cc
++ abbrowser-setup.cc
++ abbrowser-conduit.cc
++)
++
++set(conduit_abbrowser_UIS
++ resolutionDialog_base.ui
++ kaddressbookConduit.ui
++)
++
++set(conduit_abbrowser_KCFGS
++ abbrowserSettings.kcfgc
++)
++
++kde3_add_kcfg_files(conduit_abbrowser_SRCS ${conduit_abbrowser_KCFGS})
++kde3_add_ui_files(conduit_abbrowser_SRCS ${conduit_abbrowser_UIS})
++kde3_automoc(${conduit_abbrowser_SRCS})
++add_library(conduit_address SHARED ${conduit_abbrowser_SRCS})
++target_link_libraries(conduit_address kabc_file)
++set_target_properties(conduit_address PROPERTIES LOCATION ${KDE3_PLUGIN_INSTALL_DIR}
++ INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib
++ PREFIX ""
++)
++
++kde3_install_libtool_file(conduit_address)
++
++install(
++ TARGETS conduit_address
++ LIBRARY DESTINATION ${KDE3_PLUGIN_INSTALL_DIR}
++)
++
++install(
++ FILES abbrowser_conduit.desktop DESTINATION ${KDE3_SERVICES_DIR}
++)
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/abbrowserconduit/kaddressbookConduit.ui kdepim-3.5.5.dfsg.1/kpilot/conduits/abbrowserconduit/kaddressbookConduit.ui
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/abbrowserconduit/kaddressbookConduit.ui 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/abbrowserconduit/kaddressbookConduit.ui 2006-11-19 22:21:12.000000000 +0100
+@@ -738,9 +738,9 @@
+ <tabstop>fFax</tabstop>
+ </tabstops>
+ <layoutdefaults spacing="6" margin="11"/>
+-<includehints>
+- <includehint>kurlrequester.h</includehint>
+- <includehint>klineedit.h</includehint>
+- <includehint>kpushbutton.h</includehint>
+-</includehints>
++<includes>
++ <include location="global" impldecl="in implementation">kurlrequester.h</include>
++ <include location="global" impldecl="in implementation">klineedit.h</include>
++ <include location="global" impldecl="in implementation">kpushbutton.h</include>
++</includes>
+ </UI>
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/abbrowserconduit/resolutionDialog.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/abbrowserconduit/resolutionDialog.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/abbrowserconduit/resolutionDialog.cc 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/abbrowserconduit/resolutionDialog.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -171,8 +171,8 @@ void ResolutionCheckListItem::updateText
+ *
+ *****************************************************************/
+
+-ResolutionDlg::ResolutionDlg( QWidget* parent, KPilotDeviceLink*fH,
+- QString caption, QString helpText, ResolutionTable*tab) :
++ResolutionDlg::ResolutionDlg( QWidget* parent, KPilotLink*fH,
++ const QString &caption, const QString &helpText, ResolutionTable*tab) :
+ KDialogBase( parent, "ResolutionDlg", false, caption, Apply|Cancel, Apply),
+ tickleTimer(0L),
+ fHandle(fH),
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/abbrowserconduit/resolutionDialog.h kdepim-3.5.5.dfsg.1/kpilot/conduits/abbrowserconduit/resolutionDialog.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/abbrowserconduit/resolutionDialog.h 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/abbrowserconduit/resolutionDialog.h 2006-11-19 22:21:12.000000000 +0100
+@@ -29,7 +29,7 @@
+ */
+
+ #include <kdialogbase.h>
+-class KPilotDeviceLink;
++class KPilotLink;
+ class QTimer;
+ class QListView;
+ class ResolutionDialogBase;
+@@ -42,7 +42,11 @@ class ResolutionDlg : public KDialogBase
+ Q_OBJECT
+
+ public:
+- ResolutionDlg( QWidget* parent=0, KPilotDeviceLink*fH=0L, QString caption=QString::null, QString helpText=QString::null, ResolutionTable*tab=0L );
++ ResolutionDlg( QWidget* parent=0,
++ KPilotLink*fH=0L,
++ const QString &caption=QString(),
++ const QString &helpText=QString(),
++ ResolutionTable *tab=0L );
+ ~ResolutionDlg();
+
+ public slots:
+@@ -57,10 +61,10 @@ protected:
+ void adjustButtons(ResolutionTable*tab);
+
+ QTimer* tickleTimer;
+- KPilotDeviceLink* fHandle;
++ KPilotLink* fHandle;
+ ResolutionTable*fTable;
+
+ ResolutionDialogBase*fWidget;
+ };
+
+-#endif // MYDIALOG_H
++#endif // RESOLUTIONDIALOG_H
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/CMakeLists.txt kdepim-3.5.5.dfsg.1/kpilot/conduits/CMakeLists.txt
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/CMakeLists.txt 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,12 @@
++include_directories(
++ ${CMAKE_BINARY_DIR}/lib
++ ${CMAKE_SOURCE_DIR}/lib
++ ${CMAKE_CURRENT_BINARY_DIR}
++)
++
++add_subdirectory(abbrowserconduit)
++add_subdirectory(memofileconduit)
++add_subdirectory(null)
++add_subdirectory(popmail)
++add_subdirectory(sysinfoconduit)
++add_subdirectory(vcalconduit)
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/docconduit/doc-conduit.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/docconduit/doc-conduit.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/docconduit/doc-conduit.cc 2005-09-10 10:24:37.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/docconduit/doc-conduit.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -57,7 +57,7 @@
+ extern "C"
+ {
+ long version_conduit_doc = KPILOT_PLUGIN_API;
+-const char *id_conduit_doc = "$Id: doc-conduit.cc 437980 2005-07-23 19:53:57Z kainhofe $";
++const char *id_conduit_doc = "$Id: doc-conduit.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+ }
+
+ QString dirToString(eSyncDirectionEnum dir) {
+@@ -330,7 +330,7 @@ bool DOCConduit::doSync(docSyncInfo &sin
+ // instance which points either to a local database or a database on the handheld.
+ PilotDatabase *database = preSyncAction(sinfo);
+
+- if (database && ( !database->isDBOpen() ) ) {
++ if (database && ( !database->isOpen() ) ) {
+ #ifdef DEBUG
+ DEBUGCONDUIT<<"Database "<<sinfo.dbinfo.name<<" does not yet exist. Creating it:"<<endl;
+ #endif
+@@ -342,7 +342,7 @@ bool DOCConduit::doSync(docSyncInfo &sin
+ }
+ }
+
+- if (database && database->isDBOpen()) {
++ if (database && database->isOpen()) {
+ DOCConverter docconverter;
+ connect(&docconverter, SIGNAL(logError(const QString &)), SIGNAL(logError(const QString &)));
+ connect(&docconverter, SIGNAL(logMessage(const QString &)), SIGNAL(logMessage(const QString &)));
+@@ -720,7 +720,7 @@ bool DOCConduit::needsSync(docSyncInfo &
+
+ if (QFile::exists(sinfo.txtfilename)) sinfo.fPCStatus=eStatNew;
+ else sinfo.fPCStatus=eStatDoesntExist;
+- if (docdb && docdb->isDBOpen()) sinfo.fPalmStatus=eStatNew;
++ if (docdb && docdb->isOpen()) sinfo.fPalmStatus=eStatNew;
+ else sinfo.fPalmStatus=eStatDoesntExist;
+ KPILOT_DELETE(docdb);
+
+@@ -771,7 +771,7 @@ bool DOCConduit::needsSync(docSyncInfo &
+ #endif
+ }
+
+- if (!docdb || !docdb->isDBOpen()) sinfo.fPalmStatus=eStatDeleted;
++ if (!docdb || !docdb->isOpen()) sinfo.fPalmStatus=eStatDeleted;
+ else if (hhTextChanged(docdb)) {
+ #ifdef DEBUG
+ DEBUGCONDUIT<<"Handheld side has changed!"<<endl;
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/docconduit/doc_conduit.desktop kdepim-3.5.5.dfsg.1/kpilot/conduits/docconduit/doc_conduit.desktop
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/docconduit/doc_conduit.desktop 2006-10-01 19:30:36.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/docconduit/doc_conduit.desktop 2006-10-15 07:31:57.000000000 +0200
+@@ -17,7 +17,7 @@ Comment[fr]=Ajoute des fichiers texte Ã
+ Comment[hu]=Szöveges fájlok hozzáadása a kézi számÃtógéphez, DOC-olvasók számára.
+ Comment[is]=Bætir textaskrám, sem hægt er að lesa à DOC lesara, við lófatölvuna þÃna.
+ Comment[it]=Aggiunge file di testo al tuo Pilot, adatti per lettori DOC.
+-Comment[ja]=ããã¹ããã¡ã¤ã«ã DOC ãªã¼ãã«é©ããå½¢å¼ã§ãã³ããã«ãã«è¿½å ãã¾ãã
++Comment[ja]=ããã¹ããã¡ã¤ã«ã DOC ãªã¼ãã¼ã«é©ããå½¢å¼ã§ãã³ããã«ãã«è¿½å ãã¾ãã
+ Comment[km]=ááááááâá¯ááá¶áâá¢áááááâáá
âá§áááááâáá½áâááâááááâá¢ááá (ááááááâááááá¶ááâáááááá·áá¸âá¢á¶á DOC) á
+ Comment[lt]=Prideda teksto bylas prie JÅ«sų neÅ¡iojamos knygelÄs, tinka DOC skaityklÄms.
+ Comment[ms]=Menambah fail teks ke komputer telapak, sesuai dengan pembaca DOC.
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/docconduit/DOC-converter.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/docconduit/DOC-converter.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/docconduit/DOC-converter.cc 2005-11-08 23:33:38.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/docconduit/DOC-converter.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -47,7 +47,7 @@
+
+ // Something to allow us to check what revision
+ // the modules are that make up a binary distribution.
+-const char *doc_converter_id = "$Id: DOC-converter.cc 476284 2005-11-01 01:48:20Z thiago $";
++const char *doc_converter_id = "$Id: DOC-converter.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ #define min(a,b) (a<b)?(a):(b)
+
+@@ -441,7 +441,7 @@ bool DOCConverter::convertTXTtoPDB() {
+ }
+ #endif
+
+- if (!docdb->isDBOpen()) {
++ if (!docdb->isOpen()) {
+ emit logError(i18n("Unable to open palm doc database %1").arg(docdb->dbPathName()) );
+ return false;
+ }
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/docconduit/doc-setupdialog.ui kdepim-3.5.5.dfsg.1/kpilot/conduits/docconduit/doc-setupdialog.ui
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/docconduit/doc-setupdialog.ui 2005-11-08 23:33:38.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/docconduit/doc-setupdialog.ui 2006-11-19 22:21:12.000000000 +0100
+@@ -549,12 +549,9 @@
+ <tabstop>RadioButton1</tabstop>
+ </tabstops>
+ <layoutdefaults spacing="6" margin="11"/>
+-<includehints>
+- <includehint>kurlrequester.h</includehint>
+- <includehint>klineedit.h</includehint>
+- <includehint>kpushbutton.h</includehint>
+- <includehint>kurlrequester.h</includehint>
+- <includehint>klineedit.h</includehint>
+- <includehint>kpushbutton.h</includehint>
+-</includehints>
++<includes>
++ <include location="global" impldecl="in implementation">kurlrequester.h</include>
++ <include location="global" impldecl="in implementation">klineedit.h</include>
++ <include location="global" impldecl="in implementation">kpushbutton.h</include>
++</includes>
+ </UI>
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/docconduit/kpalmdoc_dlgbase.ui kdepim-3.5.5.dfsg.1/kpilot/conduits/docconduit/kpalmdoc_dlgbase.ui
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/docconduit/kpalmdoc_dlgbase.ui 2005-09-10 10:24:37.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/docconduit/kpalmdoc_dlgbase.ui 2006-11-19 22:21:12.000000000 +0100
+@@ -427,14 +427,9 @@
+ </connection>
+ </connections>
+ <layoutdefaults spacing="6" margin="11"/>
+-<includehints>
+- <includehint>kurlrequester.h</includehint>
+- <includehint>klineedit.h</includehint>
+- <includehint>kpushbutton.h</includehint>
+- <includehint>kpushbutton.h</includehint>
+- <includehint>kpushbutton.h</includehint>
+- <includehint>kurlrequester.h</includehint>
+- <includehint>klineedit.h</includehint>
+- <includehint>kpushbutton.h</includehint>
+-</includehints>
++<includes>
++ <include location="global" impldecl="in implementation">kurlrequester.h</include>
++ <include location="global" impldecl="in implementation">klineedit.h</include>
++ <include location="global" impldecl="in implementation">kpushbutton.h</include>
++</includes>
+ </UI>
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/docconduit/kpalmdoc_dlg.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/docconduit/kpalmdoc_dlg.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/docconduit/kpalmdoc_dlg.cc 2005-09-10 10:24:37.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/docconduit/kpalmdoc_dlg.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -459,7 +459,7 @@ bool ConverterDlg::convertTXTtoPDB(QStri
+ PilotLocalDatabase*pdbdb=new PilotLocalDatabase(pdbdir, QFileInfo(pdbfile).baseName(), false);
+ if (pdbdb)
+ {
+- if (!pdbdb->isDBOpen())
++ if (!pdbdb->isOpen())
+ {
+ #ifdef DEBUG
+ DEBUGCONDUIT<<pdbfile<<" does not yet exist. Creating it"<<endl;
+@@ -468,7 +468,7 @@ bool ConverterDlg::convertTXTtoPDB(QStri
+ }
+ }
+
+- if (pdbdb->isDBOpen())
++ if (pdbdb->isOpen())
+ {
+ conv->setPDB(pdbdb);
+ conv->setTXTpath(txtdir, txtfile);
+@@ -504,7 +504,7 @@ bool ConverterDlg::convertPDBtoTXT(QStri
+ PilotLocalDatabase*pdbdb=new PilotLocalDatabase(pdbdir, QFileInfo(pdbfile).baseName(), false);
+ if (pdbdb)
+ {
+- if (pdbdb->isDBOpen())
++ if (pdbdb->isOpen())
+ {
+ conv->setPDB(pdbdb);
+ conv->setTXTpath(txtdir, txtfile);
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/knotes/knotes-action.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/knotes/knotes-action.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/knotes/knotes-action.cc 2005-09-10 10:24:37.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/knotes/knotes-action.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -58,7 +58,7 @@ extern "C"
+ {
+
+ long version_conduit_knotes = KPILOT_PLUGIN_API;
+-const char *id_conduit_knotes = "$Id: knotes-action.cc 437980 2005-07-23 19:53:57Z kainhofe $" ;
++const char *id_conduit_knotes = "$Id: knotes-action.cc 606279 2006-11-19 21:21:12Z vanrijn $" ;
+
+ }
+
+@@ -361,7 +361,6 @@ void KNotesAction::listNotes()
+ listNotes(); // Debugging
+ fActionStatus = MemosToKNotes;
+ break;
+- case SyncAction::SyncMode::eFastSync:
+ case SyncAction::SyncMode::eHotSync:
+ case SyncAction::SyncMode::eFullSync:
+ case SyncAction::SyncMode::eCopyPCToHH:
+@@ -396,7 +395,6 @@ void KNotesAction::listNotes()
+ // Impossible!
+ fActionStatus = Done;
+ break;
+- case SyncAction::SyncMode::eFastSync:
+ case SyncAction::SyncMode::eHotSync:
+ case SyncAction::SyncMode::eFullSync:
+ fActionStatus = MemosToKNotes;
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/Makefile.am kdepim-3.5.5.dfsg.1/kpilot/conduits/Makefile.am
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/Makefile.am 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/Makefile.am 2006-11-19 22:21:12.000000000 +0100
+@@ -27,13 +27,10 @@ NOTEPAD_SUBDIR = notepadconduit
+ endif
+
+ SUBDIRS = \
+- docconduit \
+- knotes \
+ popmail \
+- timeconduit \
+ sysinfoconduit \
+ memofileconduit \
+- $(MAL_SUBDIR) $(ABC_SUBDIR) $(NOTEPAD_SUBDIR)
++ $(ABC_SUBDIR)
+
+ ###
+ ### Subdirs you might have for experimental purposes:
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/malconduit/mal-setup_dialog.ui kdepim-3.5.5.dfsg.1/kpilot/conduits/malconduit/mal-setup_dialog.ui
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/malconduit/mal-setup_dialog.ui 2005-09-10 10:24:37.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/malconduit/mal-setup_dialog.ui 2006-11-19 22:21:12.000000000 +0100
+@@ -627,8 +627,8 @@
+ <tabstop>tabWidget</tabstop>
+ </tabstops>
+ <layoutdefaults spacing="6" margin="11"/>
+-<includehints>
+- <includehint>klineedit.h</includehint>
+- <includehint>knuminput.h</includehint>
+-</includehints>
++<includes>
++ <include location="global" impldecl="in implementation">klineedit.h</include>
++ <include location="global" impldecl="in implementation">knuminput.h</include>
++</includes>
+ </UI>
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/memofileconduit/CMakeLists.txt kdepim-3.5.5.dfsg.1/kpilot/conduits/memofileconduit/CMakeLists.txt
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/memofileconduit/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/memofileconduit/CMakeLists.txt 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,40 @@
++include_directories(
++ ${CMAKE_CURRENT_BINARY_DIR}
++)
++
++set(conduit_memofile_SRCS
++ memofile-factory.cc
++ memofile.cc
++ memofiles.cc
++ memofile-conduit.cc
++)
++
++set(conduit_memofile_UIS
++ setup_base.ui
++)
++
++set(conduit_memofile_KCFGS
++ memofileSettings.kcfgc
++)
++
++kde3_add_kcfg_files(conduit_memofile_SRCS ${conduit_memofile_KCFGS})
++kde3_add_ui_files(conduit_memofile_SRCS ${conduit_memofile_UIS})
++kde3_automoc(${conduit_memofile_SRCS})
++add_library(conduit_memofile SHARED ${conduit_memofile_SRCS})
++
++set_target_properties(
++ conduit_memofile PROPERTIES LOCATION ${KDE3_PLUGIN_INSTALL_DIR}
++ INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib
++ PREFIX ""
++)
++
++kde3_install_libtool_file(conduit_memofile)
++
++install(
++ TARGETS conduit_memofile
++ LIBRARY DESTINATION ${KDE3_PLUGIN_INSTALL_DIR}
++)
++
++install(
++ FILES memofile-conduit.desktop DESTINATION ${KDE3_SERVICES_DIR}
++)
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/memofileconduit/memofile-conduit.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/memofileconduit/memofile-conduit.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/memofileconduit/memofile-conduit.cc 2005-09-10 10:24:37.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/memofileconduit/memofile-conduit.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -34,7 +34,7 @@
+ //
+ //
+ static const char *memofile_conduit_id=
+- "$Id: memofile-conduit.cc 437980 2005-07-23 19:53:57Z kainhofe $";
++ "$Id: memofile-conduit.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ // Only include what we really need:
+ // First UNIX system stuff, then std C++,
+@@ -65,7 +65,7 @@ static const char *memofile_conduit_id=
+ /**
+ * Our workhorse. This is the main driver for the conduit.
+ */
+-MemofileConduit::MemofileConduit(KPilotDeviceLink *d,
++MemofileConduit::MemofileConduit(KPilotLink *d,
+ const char *n,
+ const QStringList &l) :
+ ConduitAction(d,n,l),
+@@ -504,8 +504,8 @@ void MemofileConduit::deleteUnsyncedHHRe
+ FUNCTIONSETUP;
+ if ( syncMode()==SyncMode::eCopyPCToHH )
+ {
+- RecordIDList ids=fDatabase->idList();
+- RecordIDList::iterator it;
++ Pilot::RecordIDList ids=fDatabase->idList();
++ Pilot::RecordIDList::iterator it;
+ for ( it = ids.begin(); it != ids.end(); ++it )
+ {
+ if (!_memofiles->find(*it))
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/memofileconduit/memofile-conduit.desktop kdepim-3.5.5.dfsg.1/kpilot/conduits/memofileconduit/memofile-conduit.desktop
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/memofileconduit/memofile-conduit.desktop 2006-10-01 19:30:36.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/memofileconduit/memofile-conduit.desktop 2006-10-11 07:33:54.000000000 +0200
+@@ -47,7 +47,7 @@ Comment[el]=ÎÏ
ÏÏÏ Î¿ ÏÏνδεÏμ
+ Comment[es]=Este conducto sincroniza las notas de su agenda electrónica con el directorio local.
+ Comment[et]=See kanal sünkroniseerib pihuarvutis ja arvutis olevad memod.
+ Comment[eu]=Kanal honek zure agendako oharrak direktorio lokal batekin sinkronizatzen ditu.
+-Comment[fa]=اÛÙ ÙÙÙÙØ memoâÙØ§Û Ø¯Ø³ØªÛ Ø®ÙØ¯ را با ÛÚ© ÙÙØ±Ø³Øª راÙÙÙ
Ø§Û Ù
ØÙÛ ÙÙ
گاÙ
âØ³Ø§Ø²Û Ú©ÙÛØ¯.
++Comment[fa]=اÛÙ ÙÙÙÙØ memoâÙØ§Û Ø¯Ø³ØªÛ Ø®ÙØ¯ را با ÛÚ© ÙÙØ±Ø³Øª راÙÙÙ
Ø§Û Ù
ØÙÛ ÙÙ
گاÙ
âØ³Ø§Ø²Û Ù
ÛâÚ©ÙØ¯.
+ Comment[fi]=Tämä yhdyskäytävä synkronoi taskutietokoneen muistiot paikalliseen kansioon.
+ Comment[fr]=Ce canal synchronise les mémos du Palm avec ceux de KDE.
+ Comment[hu]=Ezzel a csatolóval egy kézi számÃtógép memóit lehet szinkronizálni a helyi cÃmjegyzékkel.
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/memofileconduit/memofile-conduit.h kdepim-3.5.5.dfsg.1/kpilot/conduits/memofileconduit/memofile-conduit.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/memofileconduit/memofile-conduit.h 2005-09-10 10:24:37.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/memofileconduit/memofile-conduit.h 2006-11-19 22:21:12.000000000 +0100
+@@ -38,7 +38,7 @@ class MemofileConduit : public ConduitAc
+ {
+ Q_OBJECT
+ public:
+- MemofileConduit(KPilotDeviceLink *,
++ MemofileConduit(KPilotLink *,
+ const char *name=0L,
+ const QStringList &args = QStringList());
+ virtual ~MemofileConduit();
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/memofileconduit/memofile-factory.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/memofileconduit/memofile-factory.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/memofileconduit/memofile-factory.cc 2005-09-10 10:24:37.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/memofileconduit/memofile-factory.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -39,20 +39,10 @@
+
+ #include "setup_base.h"
+ #include "memofile-conduit.h"
+-#include "memofile-factory.moc"
+ #include "memofileSettings.h"
+ #include "uiDialog.h"
+
+-
+-extern "C"
+-{
+-
+-void *init_conduit_memofile()
+-{
+- return new MemofileConduitFactory;
+-}
+-
+-}
++#include "pluginfactory.h"
+
+ class MemofileConduitConfig : public ConduitConfigBase
+ {
+@@ -70,7 +60,18 @@ MemofileConduitConfig::MemofileConduitCo
+ {
+ FUNCTIONSETUP;
+ fConduitName = i18n("Memofile");
+- UIDialog::addAboutPage(fConfigWidget->tabWidget,MemofileConduitFactory::about());
++ KAboutData *about = new KAboutData("MemofileConduit",
++ I18N_NOOP("Memofile Conduit for KPilot"),
++ KPILOT_VERSION,
++ I18N_NOOP("Configures the Memofile Conduit for KPilot"),
++ KAboutData::License_GPL,
++ "(C) 2004, Jason 'vanRijn' Kasper");
++ about->addAuthor("Jason 'vanRijn' Kasper",
++ I18N_NOOP("Primary Author"),
++ "vR at movingparts.net",
++ "http://www.cs.kun.nl/~adridg/kpilot");
++
++ UIDialog::addAboutPage(fConfigWidget->tabWidget,about);
+ fWidget=fConfigWidget;
+ QObject::connect(fConfigWidget->fDirectory,SIGNAL(textChanged(const QString&)),
+ this,SLOT(modified()));
+@@ -116,77 +117,17 @@ MemofileConduitConfig::MemofileConduitCo
+ unmodified();
+ }
+
+-KAboutData *MemofileConduitFactory::fAbout = 0L;
+-MemofileConduitFactory::MemofileConduitFactory(QObject *p, const char *n) :
+- KLibFactory(p,n)
+-{
+- FUNCTIONSETUP;
+
+- fInstance = new KInstance("Memofileconduit");
+- fAbout = new KAboutData("MemofileConduit",
+- I18N_NOOP("Memofile Conduit for KPilot"),
+- KPILOT_VERSION,
+- I18N_NOOP("Configures the Memofile Conduit for KPilot"),
+- KAboutData::License_GPL,
+- "(C) 2004, Jason 'vanRijn' Kasper");
+- fAbout->addAuthor("Jason 'vanRijn' Kasper",
+- I18N_NOOP("Primary Author"),
+- "vR at movingparts.net",
+- "http://www.cs.kun.nl/~adridg/kpilot");
+-}
+
+-MemofileConduitFactory::~MemofileConduitFactory()
++extern "C"
+ {
+- FUNCTIONSETUP;
+
+- KPILOT_DELETE(fInstance);
+- KPILOT_DELETE(fAbout);
+-}
+-
+-/* virtual */ QObject *MemofileConduitFactory::createObject( QObject *p,
+- const char *n,
+- const char *c,
+- const QStringList &a)
++void *init_conduit_memofile()
+ {
+- FUNCTIONSETUP;
+-
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
+- << ": Creating object of class "
+- << c
+- << endl;
+-#endif
++ return new ConduitFactory<MemofileConduitConfig,MemofileConduit>(0,"memofileconduit");
++}
+
+- if (qstrcmp(c,"ConduitConfigBase")==0)
+- {
+- QWidget *w = dynamic_cast<QWidget *>(p);
+- if (w)
+- {
+- return new MemofileConduitConfig(w);
+- }
+- else
+- {
+- return 0L;
+- }
+- }
+- else if (qstrcmp(c,"SyncAction")==0)
+- {
+- KPilotDeviceLink *d = dynamic_cast<KPilotDeviceLink *>(p);
+-
+- if (d)
+- {
+- return new MemofileConduit(d,n,a);
+- }
+- else
+- {
+- kdError() << k_funcinfo
+- << ": Couldn't cast to KPilotDeviceLink"
+- << endl;
+- return 0L;
+- }
+- }
++long version_conduit_memofile = KPILOT_PLUGIN_API;
+
+- return 0L;
+ }
+
+-
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/memofileconduit/memofile-factory.h kdepim-3.5.5.dfsg.1/kpilot/conduits/memofileconduit/memofile-factory.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/memofileconduit/memofile-factory.h 2005-09-10 10:24:37.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/memofileconduit/memofile-factory.h 2006-11-19 22:21:12.000000000 +0100
+@@ -29,33 +29,6 @@
+ ** Bug reports and questions can be sent to kde-pim at kde.org
+ */
+
+-#include <klibloader.h>
+-
+-#include "plugin.h"
+-
+-class MemofileWidget;
+-class KInstance;
+-class KAboutData;
+-
+-class MemofileConduitFactory : public KLibFactory
+-{
+-Q_OBJECT
+-
+-public:
+- MemofileConduitFactory(QObject * = 0L,const char * = 0L);
+- virtual ~MemofileConduitFactory();
+-
+- static KAboutData *about() { return fAbout; } ;
+-
+-protected:
+- virtual QObject* createObject( QObject* parent = 0,
+- const char* name = 0,
+- const char* classname = "QObject",
+- const QStringList &args = QStringList() );
+-private:
+- KInstance *fInstance;
+- static KAboutData *fAbout;
+-} ;
+
+ extern "C"
+ {
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/memofileconduit/setup_base.ui kdepim-3.5.5.dfsg.1/kpilot/conduits/memofileconduit/setup_base.ui
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/memofileconduit/setup_base.ui 2005-09-10 10:24:37.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/memofileconduit/setup_base.ui 2006-11-19 22:21:12.000000000 +0100
+@@ -135,9 +135,9 @@ the Memofile-conduit settings.</comment>
+ <tabstop>tabWidget</tabstop>
+ </tabstops>
+ <layoutdefaults spacing="6" margin="11"/>
+-<includehints>
+- <includehint>kurlrequester.h</includehint>
+- <includehint>klineedit.h</includehint>
+- <includehint>kpushbutton.h</includehint>
+-</includehints>
++<includes>
++ <include location="global" impldecl="in implementation">kurlrequester.h</include>
++ <include location="global" impldecl="in implementation">klineedit.h</include>
++ <include location="global" impldecl="in implementation">kpushbutton.h</include>
++</includes>
+ </UI>
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/notepadconduit/notepad-conduit.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/notepadconduit/notepad-conduit.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/notepadconduit/notepad-conduit.cc 2005-09-10 10:24:36.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/notepadconduit/notepad-conduit.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -51,7 +51,7 @@ extern "C"
+ {
+ long version_conduit_notepad = KPILOT_PLUGIN_API;
+ const char *id_conduit_notepad =
+- "$Id: notepad-conduit.cc 437980 2005-07-23 19:53:57Z kainhofe $";
++ "$Id: notepad-conduit.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+ }
+
+ NotepadConduit::NotepadConduit(KPilotDeviceLink *d, const char *n,
+@@ -140,11 +140,14 @@ void NotepadActionThread::run()
+ QValueList<recordid_t> vl = db->idList();
+ QValueList<recordid_t>::iterator it;
+ struct NotePad a;
+- for ( it = vl.begin(); it != vl.end(); ++it ) {
++ for ( it = vl.begin(); it != vl.end(); ++it )
++ {
+ PilotRecord *pr = db->readRecordById(*it);
+- if(pr) {
++ if(pr)
++ {
+ unpack_NotePad(&a, (unsigned char*)pr->getData(), pr->size());
+ saveImage(&a);
++ free_NotePad(&a);
+ }
+ }
+ }
+@@ -152,67 +155,110 @@ void NotepadActionThread::run()
+ QApplication::postEvent(fParent, new QEvent(QEvent::User));
+ }
+
++static void saveImageFromBITS(QImage &image, struct NotePad *n, unsigned int width)
++{
++ FUNCTIONSETUP;
++ image.setColor(0, qRgb(0xaa, 0xc1 ,0x91));
++ image.setColor(1, qRgb(0x30, 0x36, 0x29));
++
++ int x = 0;
++ int y = 0;
++ int pos = 0;
++ for(unsigned int i=0; i<n->body.dataLen/2; ++i)
++ {
++ for(int j=0; j<n->data[i].repeat; ++j)
++ {
++ for(int k=0; k<8; ++k)
++ {
++ y = pos / width;
++ x = pos % width ;
++
++ image.setPixel( x, y,
++ (n->data[i].data & 1<<(7-k)) ? 1 : 0 );
++ ++pos;
++ }
++ }
++ }
++}
++
++static void saveImageFromUNCOMPRESSED(QImage &image, struct NotePad *n, unsigned int width)
++{
++ FUNCTIONSETUP;
++
++ image.setColor(0, qRgb(0xaa, 0xc1 ,0x91));
++ image.setColor(1, qRgb(0x30, 0x36, 0x29));
++
++ unsigned int pos = 0;
++ unsigned int x,y;
++
++ for (unsigned int i=0; i<n->body.dataLen / 2; ++i)
++ {
++ for (unsigned int k=0; k<8; ++k)
++ {
++ y = pos / width;
++ x = pos % width ;
++
++ image.setPixel( x, y,
++ (n->data[i].repeat & 1<<(7-k)) ? 1 : 0 );
++ ++pos;
++ }
++
++ for (unsigned int k=0; k<8; ++k)
++ {
++ y = pos / width;
++ x = pos % width ;
++
++ image.setPixel( x, y,
++ (n->data[i].data & 1<<(7-k)) ? 1 : 0 );
++ ++pos;
++ }
++ }
++}
++
+ void NotepadActionThread::saveImage(struct NotePad *n)
+ {
+ FUNCTIONSETUP;
+
+- int width = n->body.width + 8;
+- int height = n->body.height;
+-
+- QImage image(width, height, 8, 2);
++ // Width needs adjusting, based on whether it's low res (+8)
++ // or a hi-res notepad image.
++ int width = n->body.width + ( n->body.width > 160 ? 16 : 8 );
++ int height = n->body.height;
++
++
++ QImage image(width, height, 8, 2);
+
+- if(n->body.dataType == NOTEPAD_DATA_BITS)
+- {
+- image.setColor(0, qRgb(0xaa, 0xc1 ,0x91));
+- image.setColor(1, qRgb(0x30, 0x36, 0x29));
+-
+- int x = 0;
+- int y = 0;
+- int pos = 0;
+- for(int i=0; i<n->body.dataLen/2; ++i)
+- {
+- for(int j=0; j<n->data[i].repeat; ++j)
+- {
+- for(int k=0; k<8; ++k)
+- {
+- y = pos / width;
+- x = pos % width ;
+-
+- if(n->data[i].data & 1<<(7-k))
+- image.setPixel(x,y,1);
+- else
+- image.setPixel(x,y,0);
+- ++pos;
+- }
+- }
+- }
+- }
+- else if(n->body.dataType == NOTEPAD_DATA_PNG)
+- {
+- image.loadFromData((uchar*)(n->data), n->body.dataLen);
+- }
+- else
+- {
+- // Unknown data type
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname << ": Unknown data type: " << n->body.dataType << endl;
+-#endif
+- return;
+- }
++ switch (n->body.dataType)
++ {
++ case NOTEPAD_DATA_BITS :
++ saveImageFromBITS( image,n,width );
++ break;
++ case NOTEPAD_DATA_UNCOMPRESSED :
++ saveImageFromUNCOMPRESSED( image,n,width );
++ break;
++ case NOTEPAD_DATA_PNG :
++ image.loadFromData((uchar*)(n->data), n->body.dataLen);
++ break;
++ default :
++ // Unknown data type
++ kdWarning() << fname << ": Unknown data type: "
++ << n->body.dataType << endl;
++ return;
++
++ // TODO: Post a warning to the UI
++ }
+
+- QString filename(n->name);
+- if(filename.isEmpty())
+- {
+- filename.sprintf("%4d-%02d-%02d_%02d-%02d-%02d",
+- n->changeDate.year,
+- n->changeDate.month,
+- n->changeDate.day,
+- n->changeDate.hour,
+- n->changeDate.min,
+- n->changeDate.sec);
+-
+- }
+- QString imgname = QString("%1/%2.png").arg(NotepadConduitSettings::outputDirectory()).arg(filename);
++ QString filename(n->name);
++ if(filename.isEmpty())
++ {
++ filename.sprintf("%4d-%02d-%02d_%02d-%02d-%02d",
++ n->changeDate.year,
++ n->changeDate.month,
++ n->changeDate.day,
++ n->changeDate.hour,
++ n->changeDate.min,
++ n->changeDate.sec);
++ }
++ QString imgname = QString("%1/%2.png").arg(NotepadConduitSettings::outputDirectory()).arg(filename);
+
+
+ #ifdef DEBUG
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/notepadconduit/notepad-conduit.h kdepim-3.5.5.dfsg.1/kpilot/conduits/notepadconduit/notepad-conduit.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/notepadconduit/notepad-conduit.h 2005-09-10 10:24:36.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/notepadconduit/notepad-conduit.h 2006-11-19 22:21:12.000000000 +0100
+@@ -81,6 +81,12 @@ private:
+ int saved;
+
+ int unpackNotePad(struct NotePad *a, unsigned char *buffer, int len);
++
++ /**
++ * Saves a single NotePad structure to disk, using the name in
++ * the Note @p n, or if no name is specified, using the
++ * timestamp in the note.
++ */
+ void saveImage(struct NotePad *n);
+ };
+
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/notepadconduit/notepad-setup.ui kdepim-3.5.5.dfsg.1/kpilot/conduits/notepadconduit/notepad-setup.ui
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/notepadconduit/notepad-setup.ui 2005-09-10 10:24:36.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/notepadconduit/notepad-setup.ui 2006-11-19 22:21:12.000000000 +0100
+@@ -71,9 +71,9 @@
+ </grid>
+ </widget>
+ <layoutdefaults spacing="6" margin="11"/>
+-<includehints>
+- <includehint>kurlrequester.h</includehint>
+- <includehint>klineedit.h</includehint>
+- <includehint>kpushbutton.h</includehint>
+-</includehints>
++<includes>
++ <include location="global" impldecl="in implementation">kurlrequester.h</include>
++ <include location="global" impldecl="in implementation">klineedit.h</include>
++ <include location="global" impldecl="in implementation">kpushbutton.h</include>
++</includes>
+ </UI>
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/null/CMakeLists.txt kdepim-3.5.5.dfsg.1/kpilot/conduits/null/CMakeLists.txt
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/null/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/null/CMakeLists.txt 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,38 @@
++include_directories(
++ ${CMAKE_CURRENT_BINARY_DIR}
++)
++
++set(conduit_null_SRCS
++ null-conduit.cc
++ null-factory.cc
++)
++
++set(conduit_null_UIS
++ setup_base.ui
++)
++
++set(conduit_null_KCFGS
++ nullSettings.kcfgc
++)
++
++kde3_add_kcfg_files(conduit_null_SRCS ${conduit_null_KCFGS})
++kde3_add_ui_files(conduit_null_SRCS ${conduit_null_UIS})
++kde3_automoc(${conduit_null_SRCS})
++add_library(conduit_null SHARED ${conduit_null_SRCS})
++
++set_target_properties(
++ conduit_null PROPERTIES LOCATION ${KDE3_PLUGIN_INSTALL_DIR}
++ INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib
++ PREFIX ""
++)
++
++kde3_install_libtool_file(conduit_null)
++
++install(
++ TARGETS conduit_null
++ LIBRARY DESTINATION ${KDE3_PLUGIN_INSTALL_DIR}
++)
++
++install(
++ FILES null-conduit.desktop DESTINATION ${KDE3_SERVICES_DIR}
++)
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/null/null-conduit.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/null/null-conduit.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/null/null-conduit.cc 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/null/null-conduit.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -38,7 +38,7 @@
+ //
+ //
+ static const char *null_conduit_id=
+- "$Id: null-conduit.cc 437980 2005-07-23 19:53:57Z kainhofe $";
++ "$Id: null-conduit.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ // Only include what we really need:
+ // First UNIX system stuff, then std C++,
+@@ -59,16 +59,15 @@ static const char *null_conduit_id=
+ // simple constructor and destructor.
+ //
+ //
+-NullConduit::NullConduit(KPilotDeviceLink *d,
++NullConduit::NullConduit(KPilotLink *d,
+ const char *n,
+ const QStringList &l) :
+ ConduitAction(d,n,l),
+- fDatabase(0L)
++ fDatabase(0L),
++ fFailImmediately( l.contains( CSL1("--fail") ))
+ {
+ FUNCTIONSETUP;
+-#ifdef DEBUG
+- DEBUGCONDUIT<<null_conduit_id<<endl;
+-#endif
++ DEBUGCONDUIT << null_conduit_id << endl;
+ fConduitName=i18n("Null");
+ }
+
+@@ -81,13 +80,12 @@ NullConduit::~NullConduit()
+ /* virtual */ bool NullConduit::exec()
+ {
+ FUNCTIONSETUP;
+- DEBUGCONDUIT<<null_conduit_id<<endl;
+
+- if ( NullConduitSettings::failImmediately() )
++ DEBUGCONDUIT << fname << ": Mode " << syncMode().name() << endl;
++
++ if ( fFailImmediately )
+ {
+-#ifdef DEBUG
+ DEBUGCONDUIT << fname << ": Config says to fail now." << endl;
+-#endif
+ emit logError(i18n("NULL conduit is programmed to fail."));
+ return false;
+ }
+@@ -98,12 +96,10 @@ NullConduit::~NullConduit()
+ addSyncLogEntry(m);
+ }
+
+-#ifdef DEBUG
+ DEBUGCONDUIT << fname
+ << ": Message from null-conduit: "
+ << m
+ << endl;
+-#endif
+
+ emit syncDone(this);
+ return true;
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/null/null-conduit.h kdepim-3.5.5.dfsg.1/kpilot/conduits/null/null-conduit.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/null/null-conduit.h 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/null/null-conduit.h 2006-11-19 22:21:12.000000000 +0100
+@@ -35,10 +35,21 @@
+ class PilotRecord;
+ class PilotDatabase;
+
++/**
++ * The conduit Null does nothing. Almost nothing, anyway.
++ * It writes a single log message to the sync log and then
++ * completes successfully. For debugging purposes it can
++ * also simulate failure, but that is a very specialized
++ * case available only programmatically.
++ */
+ class NullConduit : public ConduitAction
+ {
+ public:
+- NullConduit(KPilotDeviceLink *,
++ /** Constructor. Special case is if @p contains
++ * @c --fail as an argument to the conduit, then
++ * the conduit will fail instead of trivially succeeding.
++ */
++ NullConduit(KPilotLink *,
+ const char *name=0L,
+ const QStringList &args = QStringList());
+ virtual ~NullConduit();
+@@ -48,6 +59,7 @@ protected:
+
+ protected:
+ PilotDatabase *fDatabase;
++ bool fFailImmediately;
+ };
+
+ #endif
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/null/nullconduit.kcfg kdepim-3.5.5.dfsg.1/kpilot/conduits/null/nullconduit.kcfg
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/null/nullconduit.kcfg 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/null/nullconduit.kcfg 2006-11-19 22:21:12.000000000 +0100
+@@ -5,18 +5,9 @@
+ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
+ <kcfgfile name="kpilotrc"/>
+ <group name="Null-conduit">
+- <entry name="FailImmediately" key="FailNow" type="Bool">
+- <label>Whether the conduit should immediately bail out with an error</label>
+- <default>false</default>
+- </entry>
+ <entry name="LogMessage" type="String">
+- <label>The error message if the null conduit is supposed to fail</label>
+- <default>KPilot was here.</default>
++ <label>The error message if the null conduit is supposed to fail</label>
++ <default>KPilot was here.</default>
+ </entry>
+- <entry name="Databases" type="StringList">
+- <label>Databases that are skipped on sync</label>
+- <default></default>
+- </entry>
+ </group>
+-
+ </kcfg>
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/null/null-factory.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/null/null-factory.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/null/null-factory.cc 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/null/null-factory.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -62,7 +62,7 @@ NullConduitConfig::NullConduitConfig(QWi
+ {
+ FUNCTIONSETUP;
+ fConduitName = i18n("Null");
+- fAbout = new KAboutData("nullConduit",
++ fAbout = new KAboutData("nullConduit",
+ I18N_NOOP("Null Conduit for KPilot"),
+ KPILOT_VERSION,
+ I18N_NOOP("Configures the Null Conduit for KPilot"),
+@@ -77,10 +77,6 @@ NullConduitConfig::NullConduitConfig(QWi
+ fWidget=fConfigWidget;
+ QObject::connect(fConfigWidget->fLogMessage,SIGNAL(textChanged(const QString&)),
+ this,SLOT(modified()));
+- QObject::connect(fConfigWidget->fDatabases,SIGNAL(textChanged(const QString&)),
+- this,SLOT(modified()));
+- QObject::connect(fConfigWidget->fFailImmediately,SIGNAL(toggled(bool)),
+- this,SLOT(modified()));
+ }
+
+ /* virtual */ void NullConduitConfig::commit()
+@@ -92,15 +88,9 @@ NullConduitConfig::NullConduitConfig(QWi
+ << ": Message="
+ << fConfigWidget->fLogMessage->text()
+ << endl;
+- DEBUGCONDUIT << fname
+- << ": Databases="
+- << fConfigWidget->fDatabases->text()
+- << endl;
+ #endif
+
+ NullConduitSettings::setLogMessage( fConfigWidget->fLogMessage->text() );
+- NullConduitSettings::setDatabases( fConfigWidget->fDatabases->text() );
+- NullConduitSettings::setFailImmediately( fConfigWidget->fFailImmediately->isChecked());
+ NullConduitSettings::self()->writeConfig();
+ unmodified();
+ }
+@@ -111,18 +101,11 @@ NullConduitConfig::NullConduitConfig(QWi
+ NullConduitSettings::self()->readConfig();
+
+ fConfigWidget->fLogMessage->setText( NullConduitSettings::logMessage() );
+- fConfigWidget->fDatabases->setText( NullConduitSettings::databases().join(",") );
+- fConfigWidget->fFailImmediately->setChecked( NullConduitSettings::failImmediately() );
+-
+ #ifdef DEBUG
+ DEBUGCONDUIT << fname
+ << ": Read Message="
+ << fConfigWidget->fLogMessage->text()
+ << endl;
+- DEBUGCONDUIT << fname
+- << ": Read Database="
+- << fConfigWidget->fDatabases->text()
+- << endl;
+ #endif
+
+ unmodified();
+@@ -133,6 +116,7 @@ NullConduitConfig::NullConduitConfig(QWi
+ extern "C"
+ {
+
++long version_conduit_null = KPILOT_PLUGIN_API;
+ void *init_conduit_null()
+ {
+ return new ConduitFactory<NullConduitConfig,NullConduit>(0,"nullconduit");
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/null/setup_base.ui kdepim-3.5.5.dfsg.1/kpilot/conduits/null/setup_base.ui
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/null/setup_base.ui 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/null/setup_base.ui 2006-11-19 22:21:12.000000000 +0100
+@@ -1,4 +1,4 @@
+-<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
++<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+ <class>NullWidget</class>
+ <comment>A tabWidget for configuring
+ the Null-conduit settings.</comment>
+@@ -99,25 +99,6 @@ the Null-conduit settings.</comment>
+ <cstring>fLogMessage</cstring>
+ </property>
+ </widget>
+- <widget class="QLabel" row="1" column="0">
+- <property name="name">
+- <cstring>TextLabel2_2</cstring>
+- </property>
+- <property name="text">
+- <string>&Databases:</string>
+- </property>
+- <property name="buddy" stdset="0">
+- <cstring>fDatabases</cstring>
+- </property>
+- </widget>
+- <widget class="QLineEdit" row="1" column="1">
+- <property name="name">
+- <cstring>fDatabases</cstring>
+- </property>
+- <property name="whatsThis" stdset="0">
+- <string><qt>The Null-conduit can be attached to several databases, effectively preventing them from Syncing. Enter the database names here.</qt></string>
+- </property>
+- </widget>
+ <spacer row="3" column="1">
+ <property name="name">
+ <cstring>Spacer4</cstring>
+@@ -135,17 +116,6 @@ the Null-conduit settings.</comment>
+ </size>
+ </property>
+ </spacer>
+- <widget class="QCheckBox" row="2" column="1">
+- <property name="name">
+- <cstring>fFailImmediately</cstring>
+- </property>
+- <property name="text">
+- <string>Simulate failure</string>
+- </property>
+- <property name="whatsThis" stdset="0">
+- <string>Force the conduit to simulate a failure to perform the HotSync.</string>
+- </property>
+- </widget>
+ </grid>
+ </widget>
+ </widget>
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/popmail/CMakeLists.txt kdepim-3.5.5.dfsg.1/kpilot/conduits/popmail/CMakeLists.txt
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/popmail/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/popmail/CMakeLists.txt 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,39 @@
++include_directories(
++ ${CMAKE_CURRENT_BINARY_DIR}
++)
++
++set(conduit_popmail_SRCS
++ popmail-factory.cc
++ popmail-conduit.cc
++ setupDialog.cc
++)
++
++set(conduit_popmail_UIS
++ setup-dialog.ui
++)
++
++set(conduit_popmail_KCFGS
++ popmailSettings.kcfgc
++)
++
++kde3_add_kcfg_files(conduit_popmail_SRCS ${conduit_popmail_KCFGS})
++kde3_add_ui_files(conduit_popmail_SRCS ${conduit_popmail_UIS})
++kde3_automoc(${conduit_popmail_SRCS})
++add_library(conduit_popmail SHARED ${conduit_popmail_SRCS})
++
++set_target_properties(
++ conduit_popmail PROPERTIES LOCATION ${KDE3_PLUGIN_INSTALL_DIR}
++ INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib
++ PREFIX ""
++)
++
++kde3_install_libtool_file(conduit_popmail)
++
++install(
++ TARGETS conduit_popmail
++ LIBRARY DESTINATION ${KDE3_PLUGIN_INSTALL_DIR}
++)
++
++install(
++ FILES popmail-conduit.desktop DESTINATION ${KDE3_SERVICES_DIR}
++)
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/popmail/popmail-conduit.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/popmail/popmail-conduit.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/popmail/popmail-conduit.cc 2005-09-10 10:24:37.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/popmail/popmail-conduit.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -39,7 +39,7 @@ extern "C"
+
+ long version_conduit_popmail = KPILOT_PLUGIN_API;
+ const char *id_conduit_popmail =
+- "$Id: popmail-conduit.cc 437980 2005-07-23 19:53:57Z kainhofe $";
++ "$Id: popmail-conduit.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ }
+
+@@ -80,22 +80,8 @@ const char *id_conduit_popmail =
+ #include "popmailSettings.h"
+ #include "setupDialog.h"
+
+-#if 0
+-static void reset_Mail(struct Mail *t)
+-{
+- t->to = 0;
+- t->from = 0;
+- t->cc = 0;
+- t->bcc = 0;
+- t->subject = 0;
+- t->replyTo = 0;
+- t->sentTo = 0;
+- t->body = 0;
+- t->dated = 0;
+-}
+-#endif
+
+-PopMailConduit::PopMailConduit(KPilotDeviceLink *d,
++PopMailConduit::PopMailConduit(KPilotLink *d,
+ const char *n,
+ const QStringList &l) :
+ ConduitAction(d,n,l)
+@@ -119,11 +105,9 @@ void PopMailConduit::doSync()
+ int sent_count=0;
+ int mode=MailConduitSettings::syncOutgoing();
+
+-#ifdef DEBUG
+ DEBUGCONDUIT << fname
+ << ": Outgoing mail disposition "
+ << mode << endl;
+-#endif
+
+ if(mode)
+ {
+@@ -168,13 +152,11 @@ int PopMailConduit::sendPendingMail(int
+ }
+ else
+ {
+-#ifdef DEBUG
+ DEBUGCONDUIT << fname
+ << ": Sent "
+ << count
+ << " messages"
+ << endl;
+-#endif
+ }
+
+ return count;
+@@ -230,21 +212,17 @@ int PopMailConduit::sendViaKMail()
+
+ while (PilotRecord *pilotRec = fDatabase->readNextRecInCategory(1))
+ {
+-#ifdef DEBUG
+ DEBUGCONDUIT << fname
+ << ": Reading "
+ << count + 1
+ << "th message"
+ << endl;
+-#endif
+
+ if (pilotRec->isDeleted() || pilotRec->isArchived())
+ {
+-#ifdef DEBUG
+ DEBUGCONDUIT << fname
+ << ": Skipping record."
+ << endl;
+-#endif
+ continue;
+ }
+
+@@ -279,7 +257,7 @@ int PopMailConduit::sendViaKMail()
+ }
+
+ unpack_Mail(&theMail,
+- (unsigned char*)pilotRec->getData(),
++ (unsigned char*)pilotRec->data(),
+ pilotRec->size());
+ writeMessageToFile(sendf, theMail);
+
+@@ -288,11 +266,11 @@ int PopMailConduit::sendViaKMail()
+ QCString returnType;
+ QDataStream arg(data,IO_WriteOnly);
+
+- arg << kmailOutboxName << t.name();
++ arg << kmailOutboxName << t.name() << CSL1("N") ;
+
+ if (!dcopptr->call("kmail",
+ "KMailIface",
+- "dcopAddMessage(QString,QString)",
++ "dcopAddMessage(QString,QString,QString)",
+ data,
+ returnType,
+ returnValue,
+@@ -308,14 +286,12 @@ int PopMailConduit::sendViaKMail()
+ continue;
+ }
+
+-#ifdef DEBUG
+ DEBUGCONDUIT << fname
+ << ": DCOP call returned "
+ << returnType
+ << " of "
+ << (const char *)returnValue
+ << endl;
+-#endif
+
+ // Mark it as filed...
+ pilotRec->setCategory(3);
+@@ -328,19 +304,6 @@ int PopMailConduit::sendViaKMail()
+ count++;
+ }
+
+-#if 0
+- if ((count > 0) && sendImmediate)
+- {
+- QByteArray data;
+- if (dcopptr->send("kmail","KMailIface","sendQueued",data))
+- {
+- kdWarning() << k_funcinfo
+- << ": Could not flush queue."
+- << endl;
+- }
+- }
+-#endif
+-
+ return count;
+ }
+
+@@ -368,16 +331,12 @@ void PopMailConduit::writeMessageToFile(
+ mailPipe << "\r\n";
+
+
+-#ifdef DEBUG
+ DEBUGCONDUIT << fname << ": To: " << theMail.to << endl;
+-#endif
+
+
+ if(theMail.body)
+ {
+-#ifdef DEBUG
+ DEBUGCONDUIT << fname << ": Sent body." << endl;
+-#endif
+ mailPipe << theMail.body << "\r\n";
+ }
+
+@@ -385,9 +344,7 @@ void PopMailConduit::writeMessageToFile(
+ QString signature = MailConduitSettings::signature();
+ if(!signature.isEmpty())
+ {
+-#ifdef DEBUG
+ DEBUGCONDUIT << fname << ": Reading signature" << endl;
+-#endif
+
+ QFile f(signature);
+ if ( f.open(IO_ReadOnly) )
+@@ -403,9 +360,7 @@ void PopMailConduit::writeMessageToFile(
+ }
+ mailPipe << "\r\n";
+
+-#ifdef DEBUG
+ DEBUGCONDUIT << fname << ": Done" << endl;
+-#endif
+ }
+
+
+@@ -415,12 +370,10 @@ void PopMailConduit::writeMessageToFile(
+
+ QString outbox = getKMailOutbox();
+
+-#ifdef DEBUG
+ DEBUGCONDUIT << fname
+ << ": KMail's outbox is "
+ << outbox
+ << endl;
+-#endif
+ }
+
+ /* virtual */ bool PopMailConduit::exec()
+@@ -439,10 +392,9 @@ void PopMailConduit::writeMessageToFile(
+ }
+ else
+ {
+- fDatabase=new PilotSerialDatabase(pilotSocket(),
+- CSL1("MailDB"));
++ fDatabase = deviceLink()->database( CSL1("MailDB") );
+
+- if (!fDatabase || !fDatabase->isDBOpen())
++ if (!fDatabase || !fDatabase->isOpen())
+ {
+ emit logError(i18n("Unable to open mail database on handheld"));
+ KPILOT_DELETE(fDatabase);
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/popmail/popmail-conduit.h kdepim-3.5.5.dfsg.1/kpilot/conduits/popmail/popmail-conduit.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/popmail/popmail-conduit.h 2005-09-10 10:24:37.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/popmail/popmail-conduit.h 2006-11-19 22:21:12.000000000 +0100
+@@ -44,7 +44,7 @@ class PilotDatabase;
+ class PopMailConduit : public ConduitAction
+ {
+ public:
+- PopMailConduit(KPilotDeviceLink *d,
++ PopMailConduit(KPilotLink *d,
+ const char *n=0L,
+ const QStringList &l=QStringList());
+ virtual ~PopMailConduit();
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/popmail/popmail-factory.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/popmail/popmail-factory.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/popmail/popmail-factory.cc 2005-09-10 10:24:37.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/popmail/popmail-factory.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -1,6 +1,7 @@
+ /* KPilot
+ **
+ ** Copyright (C) 2001 by Dan Pilone
++** Copyright (C) 2006 by Adriaan de Groot <groot at kde.org>
+ **
+ ** This file defines the factory for the popmail-conduit plugin.
+ */
+@@ -28,16 +29,10 @@
+
+ #include "options.h"
+
+-#include <qtabwidget.h>
+-#include <qlineedit.h>
+-
+-#include <kconfig.h>
+-#include <kinstance.h>
+-#include <kaboutdata.h>
+
+ #include "setupDialog.h"
+ #include "popmail-conduit.h"
+-#include "popmail-factory.moc"
++#include "pluginfactory.h"
+
+
+ extern "C"
+@@ -45,96 +40,8 @@ extern "C"
+
+ void *init_conduit_popmail()
+ {
+- return new PopMailConduitFactory;
+-}
+-
+-}
+-
+-
+-KAboutData *PopMailConduitFactory::fAbout = 0L;
+-PopMailConduitFactory::PopMailConduitFactory(QObject *p, const char *n) :
+- KLibFactory(p,n)
+-{
+- FUNCTIONSETUP;
+-
+- fInstance = new KInstance("popmailconduit");
+- fAbout = new KAboutData("popmailConduit",
+- I18N_NOOP("Mail Conduit for KPilot"),
+- KPILOT_VERSION,
+- I18N_NOOP("Configures the Mail Conduit for KPilot"),
+- KAboutData::License_GPL,
+- "(C) 2001, Dan Pilone, Michael Kropfberger, Adriaan de Groot");
+- fAbout->addAuthor("Adriaan de Groot",
+- I18N_NOOP("Maintainer"),
+- "groot at kde.org",
+- "http://www.cs.kun.nl/~adridg/kpilot");
+- fAbout->addAuthor("Dan Pilone",
+- I18N_NOOP("Original Author"));
+- fAbout->addCredit("Michael Kropfberger",
+- I18N_NOOP("POP3 code"));
+- fAbout->addCredit("Marko Grönroos",
+- I18N_NOOP("SMTP support and redesign"),
+- "magi at iki.fi",
+- "http://www/iki.fi/magi/");
++ return new ConduitFactory<PopMailWidgetConfig,PopMailConduit>;
+ }
+
+-PopMailConduitFactory::~PopMailConduitFactory()
+-{
+- FUNCTIONSETUP;
+-
+- KPILOT_DELETE(fInstance);
+- KPILOT_DELETE(fAbout);
+-}
+-
+-/* virtual */ QObject *PopMailConduitFactory::createObject( QObject *p,
+- const char *n,
+- const char *c,
+- const QStringList &a)
+-{
+- FUNCTIONSETUP;
+-
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
+- << ": Creating object of class "
+- << c
+- << endl;
+-#endif
+-
+- if (qstrcmp(c,"ConduitConfigBase")==0)
+- {
+- QWidget *w = dynamic_cast<QWidget *>(p);
+-
+- if (w)
+- {
+- return new PopMailWidgetConfig(w,n);
+- }
+- else
+- {
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
+- << ": Couldn't cast parent to widget."
+- << endl;
+-#endif
+- return 0L;
+- }
+- }
+-
+- if (qstrcmp(c,"SyncAction")==0)
+- {
+- KPilotDeviceLink *d = dynamic_cast<KPilotDeviceLink *>(p);
+-
+- if (d)
+- {
+- return new PopMailConduit(d,n,a);
+- }
+- else
+- {
+- kdError() << k_funcinfo
+- << ": Couldn't cast to KPilotDeviceLink"
+- << endl;
+- return 0L;
+- }
+- }
+- return 0L;
+ }
+
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/popmail/popmail-factory.h kdepim-3.5.5.dfsg.1/kpilot/conduits/popmail/popmail-factory.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/popmail/popmail-factory.h 2005-09-10 10:24:37.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/popmail/popmail-factory.h 2006-11-19 22:21:12.000000000 +0100
+@@ -28,30 +28,6 @@
+ ** Bug reports and questions can be sent to kde-pim at kde.org
+ */
+
+-#include <klibloader.h>
+-
+-class KInstance;
+-class KAboutData;
+-
+-class PopMailConduitFactory : public KLibFactory
+-{
+-Q_OBJECT
+-
+-public:
+- PopMailConduitFactory(QObject * = 0L,const char * = 0L);
+- virtual ~PopMailConduitFactory();
+-
+- static KAboutData *about() { return fAbout; } ;
+-
+-protected:
+- virtual QObject* createObject( QObject* parent = 0,
+- const char* name = 0,
+- const char* classname = "QObject",
+- const QStringList &args = QStringList() );
+-private:
+- KInstance *fInstance;
+- static KAboutData *fAbout;
+-} ;
+
+ extern "C"
+ {
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/popmail/setupDialog.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/popmail/setupDialog.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/popmail/setupDialog.cc 2005-09-10 10:24:37.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/popmail/setupDialog.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -34,7 +34,7 @@
+ //
+ //
+ static const char *setupDialog_id=
+- "$Id: setupDialog.cc 437980 2005-07-23 19:53:57Z kainhofe $";
++ "$Id: setupDialog.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ #include "options.h"
+
+@@ -46,6 +46,7 @@ static const char *setupDialog_id=
+ #include <kconfig.h>
+ #include <kstandarddirs.h>
+ #include <klineedit.h>
++#include <kaboutdata.h>
+
+ #include <qcheckbox.h>
+ #include <qdir.h>
+@@ -70,7 +71,26 @@ PopMailWidgetConfig::PopMailWidgetConfig
+ {
+ FUNCTIONSETUP;
+ fConduitName = i18n("KMail");
+- UIDialog::addAboutPage(fConfigWidget->fTabWidget,PopMailConduitFactory::about());
++ KAboutData *fAbout = new KAboutData("popmailConduit",
++ I18N_NOOP("Mail Conduit for KPilot"),
++ KPILOT_VERSION,
++ I18N_NOOP("Configures the Mail Conduit for KPilot"),
++ KAboutData::License_GPL,
++ "(C) 2001, Dan Pilone, Michael Kropfberger, Adriaan de Groot");
++ fAbout->addAuthor("Adriaan de Groot",
++ I18N_NOOP("Maintainer"),
++ "groot at kde.org",
++ "http://www.kpilot.org/");
++ fAbout->addAuthor("Dan Pilone",
++ I18N_NOOP("Original Author"));
++ fAbout->addCredit("Michael Kropfberger",
++ I18N_NOOP("POP3 code"));
++ fAbout->addCredit("Marko Grönroos",
++ I18N_NOOP("SMTP support and redesign"),
++ "magi at iki.fi",
++ "http://www.iki.fi/magi/");
++
++ UIDialog::addAboutPage(fConfigWidget->fTabWidget,fAbout);
+ fWidget=fConfigWidget;
+
+ #define CM(a,b) connect(fConfigWidget->a,b,this,SLOT(modified()));
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/popmail/setup-dialog.ui kdepim-3.5.5.dfsg.1/kpilot/conduits/popmail/setup-dialog.ui
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/popmail/setup-dialog.ui 2005-09-10 10:24:37.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/popmail/setup-dialog.ui 2006-11-19 22:21:12.000000000 +0100
+@@ -133,9 +133,9 @@
+ </grid>
+ </widget>
+ <layoutdefaults spacing="6" margin="11"/>
+-<includehints>
+- <includehint>klineedit.h</includehint>
+- <includehint>kurlrequester.h</includehint>
+- <includehint>kpushbutton.h</includehint>
+-</includehints>
++<includes>
++ <include location="global" impldecl="in implementation">klineedit.h</include>
++ <include location="global" impldecl="in implementation">kurlrequester.h</include>
++ <include location="global" impldecl="in implementation">kpushbutton.h</include>
++</includes>
+ </UI>
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/recordconduit/factory.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/recordconduit/factory.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/recordconduit/factory.cc 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/recordconduit/factory.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,145 @@
++/* KPilot
++**
++** Copyright (C) 2005 by Adriaan de Groot
++**
++** This file defines the factory for the recordconduit plugin.
++*/
++
++/*
++** 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.1 of the License, or
++** (at your option) any later version.
++**
++** This program 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 program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include "options.h"
++
++#include <qtabwidget.h>
++#include <qlineedit.h>
++#include <qcheckbox.h>
++
++#include <kconfig.h>
++#include <kinstance.h>
++#include <kaboutdata.h>
++
++#include "uiDialog.h"
++#include "pluginfactory.h"
++#include "pilotDatabase.h"
++#include "recordConduit.h"
++
++#include "setup_base.h"
++#include "factory.h"
++#include "settings.h"
++
++
++class ConduitConfig : public ConduitConfigBase
++{
++public:
++ ConduitConfig(QWidget *parent=0L, const char *n=0L);
++ virtual void commit();
++ virtual void load();
++protected:
++ RecordWidget *fConfigWidget;
++ KAboutData *fAbout;
++} ;
++
++ConduitConfig::ConduitConfig(QWidget *p, const char *n) :
++ ConduitConfigBase(p,n),
++ fConfigWidget(new RecordWidget(p))
++{
++ FUNCTIONSETUP;
++ fConduitName = TODO_I18N("Record Conduit");
++ fAbout = new KAboutData("recordConduit",
++ I18N_NOOP("Record Conduit for KPilot"),
++ KPILOT_VERSION,
++ I18N_NOOP("Configures the Record Conduit for KPilot"),
++ KAboutData::License_GPL,
++ "(C) 2005, Adriaan de Groot");
++ fAbout->addAuthor("Adriaan de Groot",
++ I18N_NOOP("Primary Author"),
++ "groot at kde.org",
++ "http://people.fruitsalad.org/adridg/");
++
++ UIDialog::addAboutPage(fConfigWidget->tabWidget,fAbout);
++ fWidget=fConfigWidget;
++ QObject::connect(fConfigWidget->fLogMessage,SIGNAL(textChanged(const QString&)),
++ this,SLOT(modified()));
++ QObject::connect(fConfigWidget->fDatabases,SIGNAL(textChanged(const QString&)),
++ this,SLOT(modified()));
++ QObject::connect(fConfigWidget->fFailImmediately,SIGNAL(toggled(bool)),
++ this,SLOT(modified()));
++}
++
++/* virtual */ void ConduitConfig::commit()
++{
++ FUNCTIONSETUP;
++
++#ifdef DEBUG
++ DEBUGCONDUIT << fname
++ << ": Message="
++ << fConfigWidget->fLogMessage->text()
++ << endl;
++ DEBUGCONDUIT << fname
++ << ": Databases="
++ << fConfigWidget->fDatabases->text()
++ << endl;
++#endif
++
++ ConduitSettings::setLogMessage( fConfigWidget->fLogMessage->text() );
++ ConduitSettings::setDatabases( fConfigWidget->fDatabases->text() );
++ ConduitSettings::setFailImmediately( fConfigWidget->fFailImmediately->isChecked());
++ ConduitSettings::self()->writeConfig();
++ unmodified();
++}
++
++/* virtual */ void ConduitConfig::load()
++{
++ FUNCTIONSETUP;
++ ConduitSettings::self()->readConfig();
++
++ fConfigWidget->fLogMessage->setText( ConduitSettings::logMessage() );
++ fConfigWidget->fDatabases->setText( ConduitSettings::databases().join(",") );
++ fConfigWidget->fFailImmediately->setChecked( ConduitSettings::failImmediately() );
++
++#ifdef DEBUG
++ DEBUGCONDUIT << fname
++ << ": Read Message="
++ << fConfigWidget->fLogMessage->text()
++ << endl;
++ DEBUGCONDUIT << fname
++ << ": Read Database="
++ << fConfigWidget->fDatabases->text()
++ << endl;
++#endif
++
++ unmodified();
++}
++
++typedef PilotDatabase PilotDatabaseContainer;
++
++typedef RecordConduit<PilotRecord, PilotDatabaseContainer, PilotRecord, PilotAppInfoBase, NullMapper<PilotRecord> > RecordAction;
++
++extern "C"
++{
++
++void *init_conduit_record()
++{
++ return new ConduitFactory<ConduitConfig,RecordAction>(0,"recordconduit");
++}
++
++}
++
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/recordconduit/factory.h kdepim-3.5.5.dfsg.1/kpilot/conduits/recordconduit/factory.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/recordconduit/factory.h 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/recordconduit/factory.h 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,40 @@
++#ifndef KPILOT_RECORD_FACTORY_H
++#define KPILOT_RECORD_FACTORY_H
++/* factory.h KPilot
++**
++** Copyright (C) 2005 by Adriaan de Groot
++**
++** This is the factory for the recordconduit, which uses the
++** template class RecordConduit for demonstration purposes.
++*/
++
++/*
++** 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.1 of the License, or
++** (at your option) any later version.
++**
++** This program 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 program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++
++extern "C"
++{
++
++void *init_conduit_record();
++
++}
++
++#endif
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/recordconduit/Makefile.am kdepim-3.5.5.dfsg.1/kpilot/conduits/recordconduit/Makefile.am
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/recordconduit/Makefile.am 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/recordconduit/Makefile.am 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,15 @@
++INCLUDES= $(PISOCK_INCLUDE) -I$(top_srcdir)/kpilot/lib $(all_includes)
++
++METASOURCES = AUTO
++
++servicedir = $(kde_servicesdir)
++service_DATA = record-conduit.desktop
++
++kde_module_LTLIBRARIES = conduit_record.la
++
++
++conduit_record_la_SOURCES = settings.kcfgc setup_base.ui factory.cc
++conduit_record_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
++conduit_record_la_LIBADD = ../../lib/libkpilot.la $(LIB_KDEUI)
++
++kde_kcfg_DATA = settings.kcfg
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/recordconduit/record-conduit.desktop kdepim-3.5.5.dfsg.1/kpilot/conduits/recordconduit/record-conduit.desktop
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/recordconduit/record-conduit.desktop 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/recordconduit/record-conduit.desktop 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,45 @@
++[Desktop Entry]
++Encoding=UTF-8
++Type=Service
++Name=Records (Experimental)
++Comment=This conduit does nothing.
++Comment[bg]=Това неÑо пÑави ниÑо
++Comment[bs]=Ovaj conduit ne radi ništa.
++Comment[ca]=Aquest conducte no fa res.
++Comment[cs]=Toto propojenà nedÄlá nic.
++Comment[cy]=Nid yw'r cwndid yma yn gwneud unrhyw beth.
++Comment[da]=Denne conduit gør ingenting.
++Comment[de]=Dieser Abgleich (Conduit) ist ohne Funktion
++Comment[el]=ÎÏ
ÏÏÏ Î¿ ÏÏνδεÏÎ¼Î¿Ï Î´ÎµÎ½ κάνει ÏίÏοÏα.
++Comment[et]=See kanal ei tee mitte kui midagi.
++Comment[fi]=Tämä yhdyskäytävä ei tee mitään.
++Comment[fr]=Ce canal ne fait rien.
++Comment[ga]=Nà dhéanann an seoladán seo faic.
++Comment[hi]=यह à¤à¤¨à¥à¤¡à¥à¤¯à¥à¤à¤ à¤à¥à¤ नहà¥à¤ à¤à¤°à¤¤à¤¾ हà¥.
++Comment[hu]=Ez a csatoló üres, csak tesztelési célokat szolgál
++Comment[is]=Ãessi rás gerir ekkert
++Comment[it]=Questo conduit non fa nulla.
++Comment[ja]=ãã®ã³ã³ã¸ããã¯æªç¥ã§ãã
++Comment[lt]=Å is kanalas nieko neatlieka.
++Comment[nb]=Denne kanalen gjør ingenting.
++Comment[nl]=Dit conduit doet niets.
++Comment[nn]=Denne koplinga gjer ingenting.
++Comment[pl]=Ten ÅÄ
cznik nic nie robi.
++Comment[pt]=Esta conduta não faz nada.
++Comment[pt_BR]=Este conduÃte não faz coisa alguma.
++Comment[ro]=AceastÄ conductÄ nu face nimic.
++Comment[ru]=Ðанал, коÑоÑÑй ниÑего не делаеÑ.
++Comment[sk]=Táto spojka niÄ nerobÃ.
++Comment[sl]=Ta veznik ne poÄne niÄesar.
++Comment[sr]=ÐÐ²Ð°Ñ Ð¿Ñовод не Ñади ниÑÑа.
++Comment[sr at Latn]=Ovaj provod ne radi ništa.
++Comment[sv]=Den här kanalen gör ingenting.
++Comment[ta]=à®à®¨à¯à®¤ à®à®¾à®ªà¯à®ªà¯à®à¯ à®à¯à®´à®¾à®¯à¯ à®à®©à¯à®±à¯à®®à¯ à®à¯à®¯à¯à®¯à®¾à®¤à¯
++Comment[tg]=Ðанале, ки Ð´Ð°Ñ Ò³Ð¾Ð»Ð°Ñи ÑÑÑÓ¯Ñ Ð½ÐµÑÑ.
++Comment[tr]=Bu kanal herhangi bir iÅlem yapmaz.
++Comment[uk]=Цей акведÑк нÑÑого не ÑобиÑÑ.
++Comment[xx]=xxThis conduit does nothing.xx
++Comment[zh_CN]=æ¤ç®¡éä¸åä»»ä½äºã
++Implemented=file
++ServiceTypes=KPilotConduit
++X-KDE-Library=conduit_record
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/recordconduit/settings.kcfg kdepim-3.5.5.dfsg.1/kpilot/conduits/recordconduit/settings.kcfg
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/recordconduit/settings.kcfg 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/recordconduit/settings.kcfg 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,22 @@
++<?xml version="1.0" encoding="UTF-8"?>
++<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
++ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
++ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
++ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
++ <kcfgfile name="kpilotrc"/>
++ <group name="RecordConduit">
++ <entry name="FailImmediately" key="FailNow" type="Bool">
++ <label>Whether the conduit should immediately bail out with an error</label>
++ <default>false</default>
++ </entry>
++ <entry name="LogMessage" type="String">
++ <label>The error message if the null conduit is supposed to fail</label>
++ <default>KPilot was here.</default>
++ </entry>
++ <entry name="Databases" type="StringList">
++ <label>Databases that are skipped on sync</label>
++ <default></default>
++ </entry>
++ </group>
++
++</kcfg>
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/recordconduit/settings.kcfgc kdepim-3.5.5.dfsg.1/kpilot/conduits/recordconduit/settings.kcfgc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/recordconduit/settings.kcfgc 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/recordconduit/settings.kcfgc 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,7 @@
++File=settings.kcfg
++ClassName= ConduitSettings
++Singleton=true
++ItemAccessors=true
++Mutators=true
++GlobalEnums=true
++SetUserTexts=true
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/recordconduit/setup_base.ui kdepim-3.5.5.dfsg.1/kpilot/conduits/recordconduit/setup_base.ui
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/recordconduit/setup_base.ui 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/recordconduit/setup_base.ui 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,158 @@
++<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
++<class>RecordWidget</class>
++<comment>A tabWidget for configuring
++the Record-conduit settings.</comment>
++<author>Adriaan de Groot</author>
++<widget class="QWidget">
++ <property name="name">
++ <cstring>Form1</cstring>
++ </property>
++ <property name="geometry">
++ <rect>
++ <x>0</x>
++ <y>0</y>
++ <width>342</width>
++ <height>163</height>
++ </rect>
++ </property>
++ <property name="sizePolicy">
++ <sizepolicy>
++ <hsizetype>5</hsizetype>
++ <vsizetype>5</vsizetype>
++ <horstretch>0</horstretch>
++ <verstretch>0</verstretch>
++ </sizepolicy>
++ </property>
++ <property name="baseSize">
++ <size>
++ <width>570</width>
++ <height>270</height>
++ </size>
++ </property>
++ <property name="caption">
++ <string>Null-Conduit Options</string>
++ </property>
++ <property name="layoutMargin" stdset="0">
++ </property>
++ <property name="layoutSpacing" stdset="0">
++ </property>
++ <grid>
++ <property name="name">
++ <cstring>unnamed</cstring>
++ </property>
++ <property name="margin">
++ <number>0</number>
++ </property>
++ <property name="spacing">
++ <number>6</number>
++ </property>
++ <widget class="QTabWidget" row="0" column="0">
++ <property name="name">
++ <cstring>tabWidget</cstring>
++ </property>
++ <property name="sizePolicy">
++ <sizepolicy>
++ <hsizetype>7</hsizetype>
++ <vsizetype>7</vsizetype>
++ <horstretch>0</horstretch>
++ <verstretch>0</verstretch>
++ </sizepolicy>
++ </property>
++ <property name="layoutMargin" stdset="0">
++ </property>
++ <widget class="QWidget">
++ <property name="name">
++ <cstring>Widget2</cstring>
++ </property>
++ <attribute name="title">
++ <string>General</string>
++ </attribute>
++ <grid>
++ <property name="name">
++ <cstring>unnamed</cstring>
++ </property>
++ <property name="margin">
++ <number>11</number>
++ </property>
++ <property name="spacing">
++ <number>6</number>
++ </property>
++ <widget class="QLineEdit" row="0" column="1">
++ <property name="name">
++ <cstring>fLogMessage</cstring>
++ </property>
++ <property name="text">
++ <string>KPilot was here.</string>
++ </property>
++ <property name="whatsThis" stdset="0">
++ <string><qt>Enter the message to add to the Sync Log on your Pilot here.</qt></string>
++ </property>
++ </widget>
++ <widget class="QLabel" row="0" column="0">
++ <property name="name">
++ <cstring>TextLabel1_2</cstring>
++ </property>
++ <property name="text">
++ <string>&Log message:</string>
++ </property>
++ <property name="buddy" stdset="0">
++ <cstring>fLogMessage</cstring>
++ </property>
++ </widget>
++ <widget class="QLabel" row="1" column="0">
++ <property name="name">
++ <cstring>TextLabel2_2</cstring>
++ </property>
++ <property name="text">
++ <string>&Databases:</string>
++ </property>
++ <property name="buddy" stdset="0">
++ <cstring>fDatabases</cstring>
++ </property>
++ </widget>
++ <widget class="QLineEdit" row="1" column="1">
++ <property name="name">
++ <cstring>fDatabases</cstring>
++ </property>
++ <property name="whatsThis" stdset="0">
++ <string><qt>The Null-conduit can be attached to several databases, effectively preventing them from Syncing. Enter the database names here.</qt></string>
++ </property>
++ </widget>
++ <spacer row="3" column="1">
++ <property name="name">
++ <cstring>Spacer4</cstring>
++ </property>
++ <property name="orientation">
++ <enum>Vertical</enum>
++ </property>
++ <property name="sizeType">
++ <enum>Expanding</enum>
++ </property>
++ <property name="sizeHint">
++ <size>
++ <width>20</width>
++ <height>20</height>
++ </size>
++ </property>
++ </spacer>
++ <widget class="QCheckBox" row="2" column="1">
++ <property name="name">
++ <cstring>fFailImmediately</cstring>
++ </property>
++ <property name="text">
++ <string>Simulate failure</string>
++ </property>
++ <property name="whatsThis" stdset="0">
++ <string>Force the conduit to simulate a failure to perform the HotSync.</string>
++ </property>
++ </widget>
++ </grid>
++ </widget>
++ </widget>
++ </grid>
++</widget>
++<tabstops>
++ <tabstop>tabWidget</tabstop>
++</tabstops>
++<layoutdefaults spacing="6" margin="11"/>
++</UI>
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/sysinfoconduit/CMakeLists.txt kdepim-3.5.5.dfsg.1/kpilot/conduits/sysinfoconduit/CMakeLists.txt
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/sysinfoconduit/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/sysinfoconduit/CMakeLists.txt 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,53 @@
++include_directories(
++ ${CMAKE_CURRENT_BINARY_DIR}
++)
++
++set(conduit_sysinfo_SRCS
++ sysinfo-setup.cc
++ sysinfo-factory.cc
++ sysinfo-conduit.cc
++)
++
++set(conduit_sysinfo_UIS
++ sysinfo-setup_dialog.ui
++)
++
++set(conduit_sysinfo_KCFGS
++ sysinfoSettings.kcfgc
++)
++
++kde3_add_kcfg_files(conduit_sysinfo_SRCS ${conduit_sysinfo_KCFGS})
++kde3_add_ui_files(conduit_sysinfo_SRCS ${conduit_sysinfo_UIS})
++kde3_automoc(${conduit_sysinfo_SRCS})
++add_library(conduit_sysinfo SHARED ${conduit_sysinfo_SRCS})
++
++set_target_properties(
++ conduit_sysinfo PROPERTIES LOCATION ${KDE3_PLUGIN_INSTALL_DIR}
++ INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib
++ PREFIX ""
++)
++
++kde3_install_libtool_file(conduit_sysinfo)
++
++install(
++ TARGETS conduit_sysinfo
++ LIBRARY DESTINATION ${KDE3_PLUGIN_INSTALL_DIR}
++)
++
++install(
++ FILES sysinfo_conduit.desktop DESTINATION ${KDE3_SERVICES_DIR}
++)
++
++install(
++ FILES sysinfoSettings.kcfgc DESTINATION ${KDE3_KCFG_DIR}
++)
++
++install(
++ FILES Template.html DESTINATION ${CMAKE_INSTALL_PREFIX}/share
++)
++
++install(
++ FILES Template.txt
++ DESTINATION ${CMAKE_INSTALL_PREFIX}/share/apps/kpilot/sysinfoconduit
++)
++
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/sysinfoconduit/sysinfo-conduit.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/sysinfoconduit/sysinfo-conduit.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/sysinfoconduit/sysinfo-conduit.cc 2005-09-10 10:24:36.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/sysinfoconduit/sysinfo-conduit.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -150,13 +150,13 @@ extern "C"
+
+ long version_conduit_sysinfo = KPILOT_PLUGIN_API;
+ const char *id_conduit_sysinfo =
+- "$Id: sysinfo-conduit.cc 437980 2005-07-23 19:53:57Z kainhofe $";
++ "$Id: sysinfo-conduit.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ }
+
+
+
+-SysInfoConduit::SysInfoConduit(KPilotDeviceLink * o,
++SysInfoConduit::SysInfoConduit(KPilotLink * o,
+ const char *n,
+ const QStringList & a) :
+ ConduitAction(o, n, a)
+@@ -213,7 +213,7 @@ void SysInfoConduit::hardwareInfo()
+ FUNCTIONSETUP;
+ if (fHardwareInfo) {
+ QString unknown = i18n("unknown");
+-
++
+ /* Retrieve values for
+ * - #deviceid#
+ * - #devicename#
+@@ -221,17 +221,10 @@ void SysInfoConduit::hardwareInfo()
+ * - #manufactorer#
+ * - #devicetype#
+ */
+- KPilotSysInfo *sysinfo = fHandle->getSysInfo();
+- if (sysinfo)
+- {
+- fValues[CSL1("deviceid")] = QString::fromLatin1(sysinfo->getProductID());
+- }
+- else
+- {
+- fValues[CSL1("deviceid")] = unknown;
+- }
+-
+- KPilotCard *device = fHandle->getCardInfo();
++ KPilotSysInfo sysinfo = fHandle->getSysInfo();
++ fValues[CSL1("deviceid")] = QString::fromLatin1(sysinfo.getProductID());
++
++ const KPilotCard *device = fHandle->getCardInfo();
+ if (device)
+ {
+ fValues[CSL1("devicename")] = QString::fromLatin1(device->getCardName());
+@@ -244,9 +237,9 @@ void SysInfoConduit::hardwareInfo()
+ fValues[CSL1("devicemodel")] = unknown;
+ fValues[CSL1("manufacturer")] = unknown;
+ }
+-
++
+ fValues[CSL1("devicetype")] = unknown;
+-
++
+ KPILOT_DELETE(device);
+ keepParts.append(CSL1("hardware"));
+ } else removeParts.append(CSL1("hardware"));
+@@ -261,14 +254,14 @@ void SysInfoConduit::userInfo()
+ * - #username#
+ * - #uid#
+ */
+- KPilotUser*user=fHandle->getPilotUser();
+- fValues[CSL1("username")] = user->getUserName();
+- if (user->getPasswordLength()>0)
++ KPilotUser user=fHandle->getPilotUser();
++ fValues[CSL1("username")] = user.getUserName();
++ if (user.getPasswordLength()>0)
+ fValues[CSL1("pw")] = i18n("Password set");
+ else
+ fValues[CSL1("pw")] = i18n("No password set");
+- fValues[CSL1("uid")] = QString::number(user->getUserID());
+- fValues[CSL1("viewerid")] = QString::number(user->getViewerID());
++ fValues[CSL1("uid")] = QString::number(user.getUserID());
++ fValues[CSL1("viewerid")] = QString::number(user.getViewerID());
+ keepParts.append(CSL1("user"));
+ } else removeParts.append(CSL1("user"));
+ QTimer::singleShot(0, this, SLOT(memoryInfo()));
+@@ -283,10 +276,13 @@ void SysInfoConduit::memoryInfo()
+ * - #totalmem#
+ * - #freemem#
+ */
+- KPilotCard*device = fHandle->getCardInfo();
+- fValues[CSL1("rom")] = QString::number(device->getRomSize()/1024);
+- fValues[CSL1("totalmem")] = QString::number(device->getRamSize()/1024);
+- fValues[CSL1("freemem")] = QString::number(device->getRamFree()/1024);
++ const KPilotCard *device = fHandle->getCardInfo();
++ if (device)
++ {
++ fValues[CSL1("rom")] = QString::number(device->getRomSize()/1024);
++ fValues[CSL1("totalmem")] = QString::number(device->getRamSize()/1024);
++ fValues[CSL1("freemem")] = QString::number(device->getRamFree()/1024);
++ }
+ keepParts.append(CSL1("memory"));
+ } else removeParts.append(CSL1("memory"));
+ QTimer::singleShot(0, this, SLOT(storageInfo()));
+@@ -299,7 +295,7 @@ void SysInfoConduit::storageInfo()
+ /* Retrieve values for
+ * - $cards$
+ */
+- KPilotCard*device = fHandle->getCardInfo(1);
++ const KPilotCard *device = fHandle->getCardInfo(1);
+ if (device) {
+ fValues[CSL1("cards")] = CSL1("%1 (%2, %3 kB of %3 kB free)")
+ .arg(QString::fromLatin1(device->getCardName()))
+@@ -322,7 +318,7 @@ void SysInfoConduit::dbListInfo()
+ /* Retrieve values for
+ * - #dblist(structure)#
+ */
+- dblist=fHandle->getDBList();
++ dblist=deviceLink()->getDBList();
+ keepParts.append(CSL1("dblist"));
+ } else removeParts.append(CSL1("dblist"));
+ QTimer::singleShot(0, this, SLOT(recNumberInfo()));
+@@ -338,28 +334,28 @@ void SysInfoConduit::recNumberInfo()
+ * - #todos#
+ * - #memos#
+ */
+- PilotDatabase*fDatabase;
++ PilotDatabase *fDatabase = 0L;
+ QString ERROR = CSL1("ERROR");
+ fValues[CSL1("addresses")] = ERROR;
+ fValues[CSL1("events")] = ERROR;
+ fValues[CSL1("todos")] = ERROR;
+ fValues[CSL1("memos")] = ERROR;
+- fDatabase = new PilotSerialDatabase(pilotSocket(), CSL1("AddressDB"));
++ fDatabase = deviceLink()->database(CSL1("AddressDB"));
+ if (fDatabase) {
+ fValues[CSL1("addresses")] = QString::number(fDatabase->recordCount());
+ KPILOT_DELETE(fDatabase);
+ }
+- fDatabase = new PilotSerialDatabase(pilotSocket(), CSL1("DatebookDB"));
++ fDatabase = deviceLink()->database(CSL1("DatebookDB"));
+ if (fDatabase) {
+ fValues[CSL1("events")] = QString::number(fDatabase->recordCount());
+ KPILOT_DELETE(fDatabase);
+ }
+- fDatabase = new PilotSerialDatabase(pilotSocket(), CSL1("ToDoDB"));
++ fDatabase = deviceLink()->database(CSL1("ToDoDB"));
+ if (fDatabase) {
+ fValues[CSL1("todos")] = QString::number(fDatabase->recordCount());
+ KPILOT_DELETE(fDatabase);
+ }
+- fDatabase = new PilotSerialDatabase(pilotSocket(), CSL1("MemoDB"));
++ fDatabase = deviceLink()->database(CSL1("MemoDB"));
+ if (fDatabase) {
+ fValues[CSL1("memos")] = QString::number(fDatabase->recordCount());
+ KPILOT_DELETE(fDatabase);
+@@ -378,15 +374,15 @@ void SysInfoConduit::syncInfo()
+ * - #lastsuccsync#
+ * - #lastsyncpc#
+ */
+- KPilotUser*user=fHandle->getPilotUser();
+- time_t lastsync = user->getLastSyncDate();
++ KPilotUser user = deviceLink()->getPilotUser();
++ time_t lastsync = user.getLastSyncDate();
+ QDateTime qlastsync;
+ qlastsync.setTime_t(lastsync);
+ fValues[CSL1("lastsync")] = qlastsync.toString(Qt::LocalDate);
+- lastsync = user->getLastSuccessfulSyncDate();
++ lastsync = user.getLastSuccessfulSyncDate();
+ qlastsync.setTime_t(lastsync);
+ fValues[CSL1("lastsuccsync")] = qlastsync.toString(Qt::LocalDate);
+- fValues[CSL1("lastsyncpc")] = QString::number(user->getLastSyncPC());
++ fValues[CSL1("lastsyncpc")] = QString::number(user.getLastSyncPC());
+ keepParts.append(CSL1("sync"));
+ } else removeParts.append(CSL1("sync"));
+ QTimer::singleShot(0, this, SLOT(pcVersionInfo()));
+@@ -448,7 +444,8 @@ void SysInfoConduit::palmVersionInfo()
+ .arg(fHandle->getSysInfo()->getMinorVersion())
+ .arg(fHandle->getSysInfo()->getCompatMajorVersion())
+ .arg(fHandle->getSysInfo()->getCompatMinorVersion());*/
+- fValues[CSL1("palmos")] = CSL1("PalmOS %1.%2").arg(fHandle->majorVersion()).arg(fHandle->minorVersion());
++ KPilotSysInfo i = deviceLink()->getSysInfo();
++ fValues[CSL1("palmos")] = CSL1("PalmOS %1.%2").arg(i.getMajorVersion()).arg(i.getMinorVersion());
+
+ keepParts.append(CSL1("palmversion"));
+ } else removeParts.append(CSL1("palmversion"));
+@@ -535,8 +532,8 @@ void SysInfoConduit::writeFile()
+ while (re.search(output)>=0){
+ QString dbstring;
+ QString subpatt=re.cap(1);
+- DBInfo*dbi;
+- for (dbi=dblist.first(); dbi; dbi=dblist.next() ) {
++ for (DBInfoList::ConstIterator i = dblist.begin(); i != dblist.end(); ++i ) {
++ DBInfo dbi = *i;
+ QString newpatt(subpatt);
+ char tmpchr[5];
+ ::memset(&tmpchr[0], 0, 5);
+@@ -552,21 +549,21 @@ void SysInfoConduit::writeFile()
+ * %8 .. modifyDate
+ * %9 .. backupDate
+ */
+- newpatt.replace(CSL1("%0"), QString::fromLatin1(dbi->name));
+- set_long(&tmpchr[0],dbi->type);
++ newpatt.replace(CSL1("%0"), QString::fromLatin1(dbi.name));
++ set_long(&tmpchr[0],dbi.type);
+ newpatt.replace(CSL1("%1"), QString::fromLatin1(tmpchr));
+- set_long(&tmpchr[0],dbi->creator);
++ set_long(&tmpchr[0],dbi.creator);
+ newpatt.replace(CSL1("%2"), QString::fromLatin1(tmpchr));
+- newpatt.replace(CSL1("%3"), QString::number(dbi->index));
+- newpatt.replace(CSL1("%4"), QString::number(dbi->flags));
+- newpatt.replace(CSL1("%5"), QString::number(dbi->miscFlags));
+- newpatt.replace(CSL1("%6"), QString::number(dbi->version));
++ newpatt.replace(CSL1("%3"), QString::number(dbi.index));
++ newpatt.replace(CSL1("%4"), QString::number(dbi.flags));
++ newpatt.replace(CSL1("%5"), QString::number(dbi.miscFlags));
++ newpatt.replace(CSL1("%6"), QString::number(dbi.version));
+ QDateTime tm;
+- tm.setTime_t(dbi->createDate);
++ tm.setTime_t(dbi.createDate);
+ newpatt.replace(CSL1("%7"), tm.toString(Qt::LocalDate));
+- tm.setTime_t(dbi->modifyDate);
++ tm.setTime_t(dbi.modifyDate);
+ newpatt.replace(CSL1("%8"), tm.toString(Qt::LocalDate));
+- tm.setTime_t(dbi->backupDate);
++ tm.setTime_t(dbi.backupDate);
+ newpatt.replace(CSL1("%9"), tm.toString(Qt::LocalDate));
+
+ dbstring.append(newpatt);
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/sysinfoconduit/sysinfo-conduit.h kdepim-3.5.5.dfsg.1/kpilot/conduits/sysinfoconduit/sysinfo-conduit.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/sysinfoconduit/sysinfo-conduit.h 2005-09-10 10:24:36.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/sysinfoconduit/sysinfo-conduit.h 2006-11-19 22:21:12.000000000 +0100
+@@ -35,7 +35,7 @@ class SysInfoConduit : public ConduitAct
+ Q_OBJECT
+ public:
+ SysInfoConduit(
+- KPilotDeviceLink *o,
++ KPilotLink *o,
+ const char *n = 0L,
+ const QStringList &a = QStringList() );
+ virtual ~SysInfoConduit();
+@@ -70,7 +70,7 @@ private:
+ eOutputTemplate
+ } fOutputType;
+
+- QPtrList<DBInfo> dblist;
++ DBInfoList dblist;
+ QStringList removeParts;
+ QStringList keepParts;
+ static const QString defaultpage;
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/sysinfoconduit/sysinfo-factory.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/sysinfoconduit/sysinfo-factory.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/sysinfoconduit/sysinfo-factory.cc 2005-09-10 10:24:36.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/sysinfoconduit/sysinfo-factory.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -27,100 +27,17 @@
+ */
+
+ #include "options.h"
+-
+-#include <kapplication.h>
+-#include <kinstance.h>
+-#include <kaboutdata.h>
++#include "pluginfactory.h"
+
+ #include "sysinfo-conduit.h"
+ #include "sysinfo-setup.h"
+
+-#include "sysinfo-factory.moc"
+-
+-
+ extern "C"
+ {
+
+ void *init_conduit_sysinfo()
+ {
+- return new SysInfoConduitFactory;
+-}
+-
+-}
+-
+-
+-// A number of static variables
+-KAboutData *SysInfoConduitFactory::fAbout = 0L;
+-
+-
+-SysInfoConduitFactory::SysInfoConduitFactory(QObject *p, const char *n) :
+- KLibFactory(p,n)
+-{
+- FUNCTIONSETUP;
+-
+- fInstance = new KInstance("SysInfoConduit");
+- fAbout = new KAboutData("SysInfoConduit",
+- I18N_NOOP("KPilot System Information conduit"),
+- KPILOT_VERSION,
+- I18N_NOOP("Retrieves System, Hardware, and User Info from the Handheld and stores them to a file."),
+- KAboutData::License_GPL,
+- "(C) 2003, Reinhold Kainhofer");
+- fAbout->addAuthor("Reinhold Kainhofer",
+- I18N_NOOP("Primary Author"), "reinhold at kainhofer.com", "http://reinhold.kainhofer.com/");
++ return new ConduitFactory<SysInfoWidgetConfig,SysInfoConduit>;
+ }
+
+-SysInfoConduitFactory::~SysInfoConduitFactory()
+-{
+- FUNCTIONSETUP;
+-
+- KPILOT_DELETE(fInstance);
+- KPILOT_DELETE(fAbout);
+ }
+-
+-/* virtual */ QObject *SysInfoConduitFactory::createObject( QObject *p,
+- const char *n,
+- const char *c,
+- const QStringList &a)
+-{
+- FUNCTIONSETUP;
+-
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
+- << ": Creating object of class "
+- << c
+- << endl;
+-#endif
+-
+- if (qstrcmp(c,"ConduitConfigBase")==0)
+- {
+- QWidget *w = dynamic_cast<QWidget *>(p);
+- if (w)
+- {
+- return new SysInfoWidgetConfig(w,"ConduitConfigBase");
+- }
+- else
+- {
+- return 0L;
+- }
+- }
+- else
+- if (qstrcmp(c,"SyncAction")==0)
+- {
+- KPilotDeviceLink *d = dynamic_cast<KPilotDeviceLink *>(p);
+-
+- if (d)
+- {
+- return new SysInfoConduit(d,n,a);
+- }
+- else
+- {
+- kdError() << k_funcinfo
+- << ": Couldn't cast parent to KPilotDeviceLink"
+- << endl;
+- return 0L;
+- }
+- }
+-
+- return 0L;
+-}
+-
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/sysinfoconduit/sysinfo-factory.h kdepim-3.5.5.dfsg.1/kpilot/conduits/sysinfoconduit/sysinfo-factory.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/sysinfoconduit/sysinfo-factory.h 2005-09-10 10:24:36.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/sysinfoconduit/sysinfo-factory.h 2006-11-19 22:21:12.000000000 +0100
+@@ -28,31 +28,6 @@
+ ** Bug reports and questions can be sent to kde-pim at kde.org
+ */
+
+-#include <klibloader.h>
+-
+-class KInstance;
+-class KAboutData;
+-
+-class SysInfoConduitFactory : public KLibFactory
+-{
+- Q_OBJECT
+-
+-public:
+- SysInfoConduitFactory(QObject * = 0L,const char * = 0L);
+- virtual ~SysInfoConduitFactory();
+-
+- static KAboutData *about() { return fAbout; } ;
+-
+-protected:
+- virtual QObject* createObject( QObject* parent = 0,
+- const char* name = 0,
+- const char* classname = "QObject",
+- const QStringList &args = QStringList() );
+-private:
+- KInstance *fInstance;
+- static KAboutData *fAbout;
+-} ;
+-
+ extern "C"
+ {
+ void *init_libsysinfoconduit();
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/sysinfoconduit/sysinfo-setup.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/sysinfoconduit/sysinfo-setup.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/sysinfoconduit/sysinfo-setup.cc 2005-09-10 10:24:36.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/sysinfoconduit/sysinfo-setup.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -33,6 +33,8 @@
+ #include <qcheckbox.h>
+ #include <qbuttongroup.h>
+ #include <qlistview.h>
++
++#include <kaboutdata.h>
+ #include <kapplication.h>
+ #include <kurlrequester.h>
+
+@@ -89,7 +91,17 @@ SysInfoWidgetConfig::SysInfoWidgetConfig
+ fConfigWidget(new SysInfoWidget(w))
+ {
+ FUNCTIONSETUP;
+- UIDialog::addAboutPage(fConfigWidget->tabWidget,SysInfoConduitFactory::about());
++
++ KAboutData *fAbout = new KAboutData("SysInfoConduit",
++ I18N_NOOP("KPilot System Information conduit"),
++ KPILOT_VERSION,
++ I18N_NOOP("Retrieves System, Hardware, and User Info from the Handheld and stores them to a file."),
++ KAboutData::License_GPL,
++ "(C) 2003, Reinhold Kainhofer");
++ fAbout->addAuthor("Reinhold Kainhofer",
++ I18N_NOOP("Primary Author"), "reinhold at kainhofer.com", "http://reinhold.kainhofer.com/");
++
++ UIDialog::addAboutPage(fConfigWidget->tabWidget,fAbout);
+ fWidget=fConfigWidget;
+
+ QObject::connect(fConfigWidget->fOutputFile,SIGNAL(textChanged(const QString&)),
+@@ -121,7 +133,7 @@ void SysInfoWidgetConfig::commit()
+ << (ci->isOn() ? " on" : " off") << endl;
+ #endif
+ int index=ci->text(PART_KEY).toInt();
+- if (0<=index && index<=10)
++ if (0<=index && index<=10)
+ {
+ const sysinfoEntry_t *p = sysinfoEntries+index;
+ p->mutator(ci->isOn());
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/sysinfoconduit/sysinfo-setup_dialog.ui kdepim-3.5.5.dfsg.1/kpilot/conduits/sysinfoconduit/sysinfo-setup_dialog.ui
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/sysinfoconduit/sysinfo-setup_dialog.ui 2005-09-10 10:24:36.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/sysinfoconduit/sysinfo-setup_dialog.ui 2006-11-19 22:21:12.000000000 +0100
+@@ -206,12 +206,9 @@
+ <tabstop>tabWidget</tabstop>
+ </tabstops>
+ <layoutdefaults spacing="6" margin="11"/>
+-<includehints>
+- <includehint>kurlrequester.h</includehint>
+- <includehint>klineedit.h</includehint>
+- <includehint>kpushbutton.h</includehint>
+- <includehint>kurlrequester.h</includehint>
+- <includehint>klineedit.h</includehint>
+- <includehint>kpushbutton.h</includehint>
+-</includehints>
++<includes>
++ <include location="global" impldecl="in implementation">kurlrequester.h</include>
++ <include location="global" impldecl="in implementation">klineedit.h</include>
++ <include location="global" impldecl="in implementation">kpushbutton.h</include>
++</includes>
+ </UI>
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/cleanupstate.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/cleanupstate.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/cleanupstate.cc 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/cleanupstate.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,132 @@
++/* KPilot
++**
++** Copyright (C) 2006 by Bertjan Broeksema <b.broeksema at gmail.com>
++**
++** This file is the implementation of the CleanUpState.
++*/
++
++/*
++** This program 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.
++**
++** This program 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 this program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include <options.h>
++
++#include <kio/netaccess.h>
++#include <qfile.h>
++
++#include "pilotDatabase.h"
++
++#include "vcal-conduitbase.h"
++#include "vcalconduitSettings.h"
++#include "cleanupstate.h"
++
++
++CleanUpState::CleanUpState()
++{
++ fState = eCleanUp;
++}
++
++CleanUpState::~CleanUpState()
++{
++}
++
++void CleanUpState::startSync( ConduitAction *ca )
++{
++ FUNCTIONSETUP;
++
++ VCalConduitBase *vccb = dynamic_cast<VCalConduitBase*>(ca);
++ if( !vccb )
++ {
++ return;
++ }
++
++ DEBUGCONDUIT << fname << ": Starting CleanUpState." << endl;
++
++ vccb->addLogMessage( i18n( "Cleaning up ..." ) );
++ vccb->postSync();
++
++ if ( vccb->database() )
++ {
++ vccb->database()->resetSyncFlags();
++ vccb->database()->cleanup();
++ }
++ if ( vccb->localDatabase() )
++ {
++ vccb->localDatabase()->resetSyncFlags();
++ vccb->localDatabase()->cleanup();
++ }
++
++ KCal::Calendar *fCalendar = vccb->calendar();
++ QString fCalendarFile = vccb->calendarFile();
++
++ if ( fCalendar )
++ {
++ KURL kurl( vccb->config()->calendarFile() );
++ switch( vccb->config()->calendarType() )
++ {
++ case VCalConduitSettings::eCalendarLocal:
++ dynamic_cast<KCal::CalendarLocal*>(fCalendar)->save( fCalendarFile );
++ if(!kurl.isLocalFile())
++ {
++ if( !KIO::NetAccess::upload( fCalendarFile
++ , vccb->config()->calendarFile(), 0L) )
++ {
++ vccb->addLogError( i18n( "An error occurred while uploading"
++ " \"%1\". You can try to upload "
++ "the temporary local file \"%2\" manually.")
++ .arg(vccb->config()->calendarFile()).arg(fCalendarFile));
++ }
++ else {
++ KIO::NetAccess::removeTempFile( fCalendarFile );
++ }
++ QFile backup( fCalendarFile + CSL1( "~" ) );
++ backup.remove();
++ }
++ break;
++ case VCalConduitSettings::eCalendarResource:
++ fCalendar->save();
++ break;
++ default:
++ break;
++ }
++ fCalendar->close();
++ }
++
++ vccb->setHasNextRecord( false );
++}
++
++void CleanUpState::handleRecord( ConduitAction *ca )
++{
++ FUNCTIONSETUP;
++}
++
++void CleanUpState::finishSync( ConduitAction *ca )
++{
++ FUNCTIONSETUP;
++
++ VCalConduitBase *vccb = dynamic_cast<VCalConduitBase*>(ca);
++ if( !vccb )
++ {
++ return;
++ }
++
++ DEBUGCONDUIT << fname << ": Finished CleanUpState." << endl;
++ vccb->setState( 0L );
++}
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/cleanupstate.h kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/cleanupstate.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/cleanupstate.h 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/cleanupstate.h 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,49 @@
++#ifndef _KPILOT_CLEANUPSTATE_H
++#define _KPILOT_CLEANUPSTATE_H
++/* cleanupstate.h KPilot
++**
++** Copyright (C) 2006 Bertjan Broeksema
++**
++** This file defines the cleanupstate for vcal-conduitbase.
++*/
++
++/*
++** This program 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.
++**
++** This program 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 this program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include "conduitstate.h"
++
++class ConduitAction;
++
++/**
++ * State to Cleanup after all sync actions are finished. @see vcal-conduitstate.h
++ */
++class CleanUpState : public ConduitState
++{
++public:
++ CleanUpState();
++ virtual ~CleanUpState();
++
++ virtual void startSync( ConduitAction* );
++ virtual void handleRecord( ConduitAction* );
++ virtual void finishSync( ConduitAction* );
++};
++
++#endif
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/CMakeLists.txt kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/CMakeLists.txt
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/CMakeLists.txt 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,68 @@
++set(conduit_LIBS kcal)
++
++include_directories(
++ ${CMAKE_CURRENT_BINARY_DIR}
++)
++
++set(conduit_SHARED
++ vcal-setupbase.cc
++ vcal-conduitbase.cc
++ teststate.cc
++ initstate.cc
++ pctohhstate.cc
++ hhtopcstate.cc
++ cleanupstate.cc
++ deleteunsyncedpcstate.cc
++ deleteunsyncedhhstate.cc
++)
++
++kde3_add_kcfg_files(conduit_SHARED vcalconduitSettings.kcfgc)
++kde3_add_ui_files(conduit_SHARED korganizerConduit.ui)
++
++set(conduit_vcal_SRCS
++ ${conduit_SHARED}
++ vcal-conduit.cc
++ vcal-factory.cc
++ vcal-setup.cc
++)
++
++kde3_automoc(${conduit_vcal_SRCS})
++add_library(conduit_vcal SHARED ${conduit_vcal_SRCS})
++target_link_libraries(conduit_vcal kcal)
++
++set(conduit_todo_SRCS
++ ${conduit_SHARED}
++ todo-factory.cc
++ todo-setup.cc
++ todo-conduit.cc
++)
++
++kde3_automoc(${conduit_todo_SRCS})
++add_library(conduit_todo SHARED ${conduit_todo_SRCS})
++target_link_libraries(conduit_todo kcal)
++
++set_target_properties(
++ conduit_vcal PROPERTIES LOCATION ${KDE3_PLUGIN_INSTALL_DIR}
++ INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib
++ PREFIX ""
++)
++set_target_properties(
++ conduit_todo PROPERTIES LOCATION ${KDE3_PLUGIN_INSTALL_DIR}
++ INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib
++ PREFIX ""
++)
++
++kde3_install_libtool_file(conduit_vcal)
++
++install(
++ TARGETS conduit_vcal conduit_todo
++ LIBRARY DESTINATION ${KDE3_PLUGIN_INSTALL_DIR}
++ LIBRARY DESTINATION ${KDE3_PLUGIN_INSTALL_DIR}
++)
++
++kde3_install_libtool_file(conduit_todo)
++
++install(
++ FILES vcal-conduit.desktop todo-conduit.desktop
++ DESTINATION ${KDE3_SERVICES_DIR}
++)
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/conduitstate.h kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/conduitstate.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/conduitstate.h 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/conduitstate.h 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,86 @@
++#ifndef _KPILOT_CONDUITSTATE_H
++#define _KPILOT_CONDUITSTATE_H
++/* vcal-conduitstate.h KPilot
++**
++** Copyright (C) 2006 Bertjan Broeksema
++**
++** This file defines the vcal-conduitstate.
++*/
++
++/*
++** This program 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.
++**
++** This program 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 this program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include "plugin.h"
++
++/**
++ * This class defines the current state of the vcal-conduitbase. Subclasses of
++ * this class can do the things that are needed, in methods defined here, for
++ * the state that they define.
++ */
++class ConduitState
++{
++public:
++ enum state_t {
++ eTest,
++ eInit,
++ ePCToHH,
++ eHHToPC,
++ eDeleteUnsyncedHH,
++ eDeleteUnsyncedPC,
++ eCleanUp
++ };
++
++protected:
++ state_t fState;
++ bool fStarted;
++
++public:
++ ConduitState(){ fState = eInit; fStarted = false; };
++ virtual ~ConduitState() {};
++
++ /**
++ * Prepare for a sync in the current state. Don't forget to set fState to
++ * true in this method. Otherwise the state won't handle records.
++ */
++ virtual void startSync( ConduitAction * ) = 0;
++
++ /**
++ * Sync the next record in row.
++ */
++ virtual void handleRecord( ConduitAction * ) = 0;
++
++ /**
++ * Clean up after all records are synced and enter next state.
++ */
++ virtual void finishSync( ConduitAction * ) = 0;
++
++ /**
++ * Returns the state type.
++ */
++ state_t state() { return fState; };
++
++ /**
++ * Returns wether or not this state has started.
++ */
++ bool started() { return fStarted; };
++};
++
++#endif
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/deleteunsyncedhhstate.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/deleteunsyncedhhstate.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/deleteunsyncedhhstate.cc 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/deleteunsyncedhhstate.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,115 @@
++/* KPilot
++**
++** Copyright (C) 2006 by Bertjan Broeksema <b.broeksema at gmail.com>
++**
++** This file is the implementation of the DeleteUnsyncedHHState.
++*/
++
++/*
++** This program 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.
++**
++** This program 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 this program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include <options.h>
++#include <plugin.h>
++
++#include "pilotDatabase.h"
++#include "pilotRecord.h"
++
++#include "vcal-conduitbase.h"
++#include "deleteunsyncedhhstate.h"
++#include "deleteunsyncedpcstate.h"
++#include "cleanupstate.h"
++
++DeleteUnsyncedHHState::DeleteUnsyncedHHState()
++{
++ fState = eDeleteUnsyncedHH;
++}
++
++DeleteUnsyncedHHState::~DeleteUnsyncedHHState()
++{
++}
++
++void DeleteUnsyncedHHState::startSync( ConduitAction *ca )
++{
++ FUNCTIONSETUP;
++
++ VCalConduitBase *vccb = dynamic_cast<VCalConduitBase*>(ca);
++ if( !vccb )
++ {
++ return;
++ }
++
++ DEBUGCONDUIT << fname << ": Starting DeleteUnsyncedHHState." << endl;
++
++ fPilotIndex = 0;
++ fNextState = new DeleteUnsyncedPCState();
++
++ vccb->setHasNextRecord( true );
++ fStarted = true;
++}
++
++void DeleteUnsyncedHHState::handleRecord( ConduitAction *ca )
++{
++ FUNCTIONSETUP;
++
++ VCalConduitBase *vccb = dynamic_cast<VCalConduitBase*>(ca);
++ if( !vccb )
++ {
++ return;
++ }
++
++ PilotRecord *r = vccb->localDatabase()->readRecordByIndex( fPilotIndex++ );
++ // if either we don't have a record, or if we're copying everything
++ // from the handheld to the pc, then we don't have anything to do
++ // here. the latter is because if we're copying HH->PC, then by
++ // definition, we will have everything from the HH on the PC and
++ // therefore can't possibly have anything that needs to be deleted
++ // from it.
++ if ( !r
++ || ( vccb->syncMode().mode() == ConduitAction::SyncMode::eCopyHHToPC ) )
++ {
++ vccb->setHasNextRecord( false );
++ return;
++ }
++
++ KCal::Incidence *e = vccb->privateBase()->findIncidence( r->id() );
++ if ( !e )
++ {
++ DEBUGCONDUIT << "Didn't find incidence with id = " << r->id()
++ << ", deleting it" << endl;
++ vccb->deletePalmRecord( NULL, r );
++ }
++
++ KPILOT_DELETE( r );
++}
++
++void DeleteUnsyncedHHState::finishSync( ConduitAction *ca )
++{
++ FUNCTIONSETUP;
++
++ VCalConduitBase *vccb = dynamic_cast<VCalConduitBase*>(ca);
++ if( !vccb )
++ {
++ return;
++ }
++
++ DEBUGCONDUIT << fname << ": Finishing DeleteUnsyncedHHState." << endl;
++ vccb->setState( fNextState );
++}
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/deleteunsyncedhhstate.h kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/deleteunsyncedhhstate.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/deleteunsyncedhhstate.h 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/deleteunsyncedhhstate.h 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,53 @@
++#ifndef _KPILOT_DUSHHSTATE_H
++#define _KPILOT_DUSHHSTATE_H
++/* deleteunsyncedhhstate.h KPilot
++**
++** Copyright (C) 2006 Bertjan Broeksema
++**
++** This file defines the deleteunsyncedpcstate for vcal-conduitbase.
++*/
++
++/*
++** This program 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.
++**
++** This program 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 this program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include "conduitstate.h"
++
++class VCalConduitBase;
++
++/**
++ * State to handle delete unsynced pc records. @see vcal-conduitstate.h
++ */
++class DeleteUnsyncedHHState : public ConduitState
++{
++private:
++ ConduitState *fNextState;
++ int fPilotIndex;
++
++public:
++ DeleteUnsyncedHHState();
++ virtual ~DeleteUnsyncedHHState();
++
++ virtual void startSync( ConduitAction* );
++ virtual void handleRecord( ConduitAction* );
++ virtual void finishSync( ConduitAction* );
++};
++
++#endif
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/deleteunsyncedpcstate.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/deleteunsyncedpcstate.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/deleteunsyncedpcstate.cc 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/deleteunsyncedpcstate.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,135 @@
++/* KPilot
++**
++** Copyright (C) 2006 by Bertjan Broeksema <b.broeksema at gmail.com>
++**
++** This file is the implementation of the DeleteUnsyncedPCState.
++*/
++
++/*
++** This program 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.
++**
++** This program 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 this program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include <options.h>
++#include <plugin.h>
++
++#include "pilotDatabase.h"
++#include "pilotRecord.h"
++
++#include "vcal-conduitbase.h"
++#include "deleteunsyncedpcstate.h"
++#include "cleanupstate.h"
++
++DeleteUnsyncedPCState::DeleteUnsyncedPCState()
++{
++ fState = eDeleteUnsyncedPC;
++}
++
++DeleteUnsyncedPCState::~DeleteUnsyncedPCState()
++{
++}
++
++void DeleteUnsyncedPCState::startSync( ConduitAction *ca )
++{
++ FUNCTIONSETUP;
++
++ VCalConduitBase *vccb = dynamic_cast<VCalConduitBase*>(ca);
++ if( !vccb )
++ {
++ return;
++ }
++
++ DEBUGCONDUIT << fname << ": Starting DeleteUnsyncedPCState." << endl;
++
++ fPilotIndex = 0;
++ fNextState = new CleanUpState();
++
++ vccb->setHasNextRecord( true );
++ fStarted = true;
++}
++
++void DeleteUnsyncedPCState::handleRecord( ConduitAction *ca )
++{
++ FUNCTIONSETUP;
++
++ VCalConduitBase *vccb = dynamic_cast<VCalConduitBase*>(ca);
++ if( !vccb )
++ {
++ return;
++ }
++
++ KCal::Incidence *e = 0L;
++ e = vccb->privateBase()->getNextIncidence();
++
++ // if we don't have a record, then we can't do anything. also, if
++ // we're copying everything from the PC to our handheld, then we're
++ // guaranteed not to have anything extra on our PC that's not on
++ // our handheld that needs to get deleted, so we can return in that
++ // case too...
++
++ if( !e || ( vccb->syncMode().mode() == ConduitAction::SyncMode::eCopyPCToHH ) )
++ {
++ vccb->setHasNextRecord( false );
++ return;
++ }
++
++
++ // try to find the corresponding index on the palm. if we can't
++ // find it, then we have a pc record that needs to be deleted.
++ recordid_t id = e->pilotId();
++
++ PilotRecord *s = 0L;
++
++ if( id > 0 )
++ {
++ s = vccb->database()->readRecordById( id );
++ }
++
++ // if we either have a pc record with no palm id or if we can't
++ // find a palm record that matches, then we need to delete this PC
++ // record.
++ if ( id <=0 || !s )
++ {
++#ifdef DEBUG
++ DEBUGCONDUIT << fname << ": found PC entry with pilotID: [" << id
++ << "], Description: [" << e->summary()
++ << "], Time: ["<< e->dtStart().toString() << "] until: ["
++ << e->dtEnd().toString() << "]. Can't find it on Palm, "
++ << "so I'm deleting it from the local calendar." << endl;
++#endif
++ vccb->privateBase()->removeIncidence(e);
++ }
++
++ KPILOT_DELETE( s );
++
++}
++
++void DeleteUnsyncedPCState::finishSync( ConduitAction *ca )
++{
++ FUNCTIONSETUP;
++
++ VCalConduitBase *vccb = dynamic_cast<VCalConduitBase*>(ca);
++ if( !vccb )
++ {
++ return;
++ }
++
++ DEBUGCONDUIT << fname << ": Finishing DeleteUnsyncedPCState." << endl;
++ vccb->setState( fNextState );
++}
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/deleteunsyncedpcstate.h kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/deleteunsyncedpcstate.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/deleteunsyncedpcstate.h 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/deleteunsyncedpcstate.h 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,53 @@
++#ifndef _KPILOT_DUSPCSTATE_H
++#define _KPILOT_DUSPCSTATE_H
++/* deleteunsyncedpcstate.h KPilot
++**
++** Copyright (C) 2006 Bertjan Broeksema
++**
++** This file defines the deleteunsyncedpcstate for vcal-conduitbase.
++*/
++
++/*
++** This program 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.
++**
++** This program 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 this program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include "conduitstate.h"
++
++class VCalConduitBase;
++
++/**
++ * State to handle delete unsynced pc records. @see vcal-conduitstate.h
++ */
++class DeleteUnsyncedPCState : public ConduitState
++{
++private:
++ ConduitState *fNextState;
++ int fPilotIndex;
++
++public:
++ DeleteUnsyncedPCState();
++ virtual ~DeleteUnsyncedPCState();
++
++ virtual void startSync( ConduitAction* );
++ virtual void handleRecord( ConduitAction* );
++ virtual void finishSync( ConduitAction* );
++};
++
++#endif
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/hhtopcstate.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/hhtopcstate.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/hhtopcstate.cc 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/hhtopcstate.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,249 @@
++/* KPilot
++**
++** Copyright (C) 2006 by Bertjan Broeksema <b.broeksema at gmail.com>
++**
++** This file is the implementation of the HHtoPCState
++*/
++
++/*
++** This program 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.
++**
++** This program 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 this program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include <options.h>
++
++#include "pilotDatabase.h"
++#include "pilotRecord.h"
++
++#include "vcalconduitSettings.h"
++#include "vcal-conduitbase.h"
++#include "hhtopcstate.h"
++#include "pctohhstate.h"
++#include "cleanupstate.h"
++
++HHToPCState::HHToPCState()
++{
++ fState = eHHToPC;
++ fPilotindex = 0;
++}
++
++HHToPCState::~HHToPCState()
++{
++}
++
++void HHToPCState::startSync( ConduitAction *ca )
++{
++ FUNCTIONSETUP;
++
++ VCalConduitBase *vccb = dynamic_cast<VCalConduitBase*>(ca);
++ if( !vccb )
++ {
++ return;
++ }
++
++ DEBUGCONDUIT << fname << ": Starting HHToPCState." << endl;
++
++ if ( vccb->syncMode() == ConduitAction::SyncMode::eCopyHHToPC )
++ {
++ fNextState = new CleanUpState();
++ }
++ else
++ {
++ fNextState = new PCToHHState();
++ }
++
++ fStarted = true;
++ vccb->setHasNextRecord( true );
++}
++
++void HHToPCState::handleRecord( ConduitAction *ca )
++{
++ FUNCTIONSETUP;
++
++ VCalConduitBase *vccb = dynamic_cast<VCalConduitBase*>(ca);
++ if( !vccb )
++ {
++ return;
++ }
++
++ PilotRecord *r;
++ PilotRecord *s = 0L;
++
++ if ( vccb->isFullSync() )
++ {
++ r = vccb->database()->readRecordByIndex( fPilotindex++ );
++ }
++ else
++ {
++ r = vccb->database()->readNextModifiedRec();
++ }
++
++ if (!r)
++ {
++ vccb->privateBase()->updateIncidences();
++ vccb->setHasNextRecord( false );
++ return;
++ }
++
++ // let subclasses do something with the record before we try to sync
++ vccb->preRecord( r );
++
++ bool archiveRecord = ( r->isArchived() );
++ s = vccb->database()->readRecordById( r->id() );
++
++ if ( !s || vccb->isFirstSync() )
++ {
++#ifdef DEBUG
++ if ( r->id() > 0 && !s )
++ {
++ DEBUGCONDUIT << "-------------------------------------------------";
++ DEBUGCONDUIT << "--------------------------" << endl;
++ DEBUGCONDUIT << fname << ": Could not read palm record with ID ";
++ DEBUGCONDUIT << r->id() << endl;
++ }
++#endif
++ if ( !r->isDeleted()
++ || ( vccb->config()->syncArchived() && archiveRecord ) )
++ {
++ KCal::Incidence *e = vccb->addRecord( r );
++ if ( vccb->config()->syncArchived() && archiveRecord ) {
++ e->setSyncStatus( KCal::Incidence::SYNCDEL );
++ }
++ }
++ }
++ else
++ {
++ if ( r->isDeleted() )
++ {
++ if ( vccb->config()->syncArchived() && archiveRecord )
++ {
++ vccb->changeRecord( r, s );
++ }
++ else
++ {
++ vccb->deleteRecord( r, s );
++ }
++ }
++ else
++ {
++ vccb->changeRecord( r, s );
++ }
++ }
++
++ KPILOT_DELETE(r);
++ KPILOT_DELETE(s);
++}
++
++void HHToPCState::finishSync( ConduitAction *ca )
++{
++ FUNCTIONSETUP;
++
++ VCalConduitBase *vccb = dynamic_cast<VCalConduitBase*>(ca);
++ if( !vccb )
++ {
++ return;
++ }
++
++ DEBUGCONDUIT << fname << ": Finished HHToPCState." << endl;
++ vccb->setState( fNextState );
++}
++
++/*
++void VCalConduitBase::slotPalmRecToPC()
++{
++ FUNCTIONSETUP;
++
++ PilotRecord *r;
++ if (isFullSync())
++ {
++ r = fDatabase->readRecordByIndex(pilotindex++);
++ }
++ else
++ {
++ r = fDatabase->readNextModifiedRec();
++ }
++ PilotRecord *s = 0L;
++
++ if (!r)
++ {
++ fP->updateIncidences();
++ if ( syncMode()==SyncMode::eCopyHHToPC )
++ {
++ emit logMessage(i18n("Cleaning up ..."));
++ QTimer::singleShot(0, this, SLOT(cleanup()));
++ return;
++ }
++ else
++ {
++ emit logMessage(i18n("Copying records to Pilot ..."));
++ QTimer::singleShot(0 ,this,SLOT(slotPCRecToPalm()));
++ return;
++ }
++ }
++
++ // let subclasses do something with the record before we try to sync
++ preRecord(r);
++
++// DEBUGCONDUIT<<fname<<": Event: "<<e->dtStart()<<" until "<<e->dtEnd()<<endl;
++// DEBUGCONDUIT<<fname<<": Time: "<<e->dtStart()<<" until "<<e->dtEnd()<<endl;
++ bool archiveRecord=(r->isArchived());
++
++ s = fLocalDatabase->readRecordById(r->id());
++ if (!s || isFirstSync())
++ {
++#ifdef DEBUG
++ if (r->id()>0 && !s)
++ {
++ DEBUGCONDUIT<<"---------------------------------------------------------------------------"<<endl;
++ DEBUGCONDUIT<< fname<<": Could not read palm record with ID "<<r->id()<<endl;
++ }
++#endif
++ if (!r->isDeleted() || (config()->syncArchived() && archiveRecord))
++ {
++ KCal::Incidence*e=addRecord(r);
++ if (config()->syncArchived() && archiveRecord) {
++ e->setSyncStatus(KCal::Incidence::SYNCDEL);
++ }
++ }
++ }
++ else
++ {
++ if (r->isDeleted())
++ {
++ if (config()->syncArchived() && archiveRecord)
++ {
++ changeRecord(r,s);
++ }
++ else
++ {
++ deleteRecord(r,s);
++ }
++ }
++ else
++ {
++ changeRecord(r,s);
++ }
++ }
++
++ KPILOT_DELETE(r);
++ KPILOT_DELETE(s);
++
++ QTimer::singleShot(0,this,SLOT(slotPalmRecToPC()));
++}
++*/
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/hhtopcstate.h kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/hhtopcstate.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/hhtopcstate.h 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/hhtopcstate.h 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,55 @@
++#ifndef _KPILOT_HHTOPCSTATE_H
++#define _KPILOT_HHTOPCSTATE_H
++/* hhtopcstate.h KPilot
++**
++** Copyright (C) 2006 Bertjan Broeksema
++**
++** This file defines the teststate for vcal-conduitbase.
++*/
++
++/*
++** This program 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.
++**
++** This program 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 this program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include <libkcal/calendarlocal.h>
++
++#include "conduitstate.h"
++
++class VCalConduitBase;
++
++/**
++ * State to test the vcal-conduit. @see vcal-conduitstate.h
++ */
++class HHToPCState : public ConduitState
++{
++private:
++ ConduitState *fNextState;
++ int fPilotindex;
++
++public:
++ HHToPCState();
++ virtual ~HHToPCState();
++
++ virtual void startSync( ConduitAction* );
++ virtual void handleRecord( ConduitAction* );
++ virtual void finishSync( ConduitAction* );
++};
++
++#endif
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/initstate.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/initstate.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/initstate.cc 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/initstate.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,109 @@
++/* KPilot
++**
++** Copyright (C) 2006 by Bertjan Broeksema <b.broeksema at gmail.com>
++**
++** This file is the implementation of the InitState.
++*/
++
++/*
++** This program 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.
++**
++** This program 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 this program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include <options.h>
++#include <plugin.h>
++
++#include "vcal-conduitbase.h"
++#include "initstate.h"
++#include "teststate.h"
++#include "pctohhstate.h"
++#include "hhtopcstate.h"
++
++InitState::InitState()
++{
++ fState = eInit;
++}
++
++InitState::~InitState()
++{
++}
++
++void InitState::startSync( ConduitAction *ca )
++{
++ FUNCTIONSETUP;
++
++ VCalConduitBase *vccb = dynamic_cast<VCalConduitBase*>(ca);
++ if( !vccb )
++ {
++ return;
++ }
++
++ DEBUGCONDUIT << fname << ": Starting InitState." << endl;
++
++ vccb->addLogMessage( i18n( "Initializing conduit ..." ) );
++ vccb->preSync();
++
++ if ( vccb->syncMode().isTest() )
++ {
++ fNextState = new TestState();
++ }
++ else
++ {
++ switch( vccb->syncMode().mode() )
++ {
++ case ConduitAction::SyncMode::eCopyPCToHH:
++ // TODO: Clear the palm and backup database??? Or just add the
++ // new items ignore the Palm->PC side and leave the existing items
++ // on the palm?
++ fNextState = new PCToHHState();
++ break;
++ case ConduitAction::SyncMode::eCopyHHToPC:
++ // TODO: Clear the backup database and the calendar, update fP
++ // or just add the palm items and leave the PC ones there????
++ fNextState = new HHToPCState();
++ break;
++ default:
++ fNextState = new HHToPCState();
++ break;
++ }
++ }
++
++ fStarted = true;
++ vccb->setHasNextRecord( false );
++}
++
++void InitState::handleRecord( ConduitAction *vccb )
++{
++ FUNCTIONSETUP;
++ Q_UNUSED(vccb);
++}
++
++void InitState::finishSync( ConduitAction *ca )
++{
++ FUNCTIONSETUP;
++
++ VCalConduitBase *vccb = dynamic_cast<VCalConduitBase*>(ca);
++ if( !vccb )
++ {
++ return;
++ }
++
++ DEBUGCONDUIT << fname << ": Finished InitState." << endl;
++ vccb->setState( fNextState );
++}
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/initstate.h kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/initstate.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/initstate.h 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/initstate.h 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,52 @@
++#ifndef _KPILOT_INITSTATE_H
++#define _KPILOT_INITSTATE_H
++/* initstate.h KPilot
++**
++** Copyright (C) 2006 Bertjan Broeksema
++**
++** This file defines the teststate for vcal-conduitbase.
++*/
++
++/*
++** This program 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.
++**
++** This program 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 this program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include "conduitstate.h"
++
++class VCalConduitBase;
++
++/**
++ * State to test the vcal-conduit. @see vcal-conduitstate.h
++ */
++class InitState : public ConduitState
++{
++private:
++ ConduitState *fNextState;
++
++public:
++ InitState();
++ virtual ~InitState();
++
++ virtual void startSync( ConduitAction *vccb );
++ virtual void handleRecord( ConduitAction *vccb );
++ virtual void finishSync( ConduitAction *vccb );
++};
++
++#endif
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/korganizerConduit.ui kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/korganizerConduit.ui
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/korganizerConduit.ui 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/korganizerConduit.ui 2006-11-19 22:21:12.000000000 +0100
+@@ -267,9 +267,9 @@ be saved in the calendar on the PC.</str
+ <tabstop>tabWidget</tabstop>
+ </tabstops>
+ <layoutdefaults spacing="6" margin="11"/>
+-<includehints>
+- <includehint>kurlrequester.h</includehint>
+- <includehint>klineedit.h</includehint>
+- <includehint>kpushbutton.h</includehint>
+-</includehints>
++<includes>
++ <include location="global" impldecl="in implementation">kurlrequester.h</include>
++ <include location="global" impldecl="in implementation">klineedit.h</include>
++ <include location="global" impldecl="in implementation">kpushbutton.h</include>
++</includes>
+ </UI>
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/Makefile.am kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/Makefile.am
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/Makefile.am 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/Makefile.am 2006-11-19 22:21:12.000000000 +0100
+@@ -16,9 +16,10 @@ noinst_LTLIBRARIES = libvcalconduit_shar
+
+ libvcalconduit_shared_la_SOURCES = vcalconduitSettings.kcfgc \
+ korganizerConduit.ui \
+- vcal-factorybase.cc \
+ vcal-setupbase.cc \
+- vcal-conduitbase.cc
++ vcal-conduitbase.cc \
++ cleanupstate.cc deleteunsyncedhhstate.cc deleteunsyncedpcstate.cc \
++ hhtopcstate.cc initstate.cc pctohhstate.cc teststate.cc
+
+ conduit_vcal_la_SOURCES = vcal-conduit.cc vcal-factory.cc vcal-setup.cc
+ conduit_vcal_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/pctohhstate.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/pctohhstate.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/pctohhstate.cc 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/pctohhstate.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,156 @@
++/* KPilot
++**
++** Copyright (C) 2006 by Bertjan Broeksema <b.broeksema at gmail.com>
++**
++** This file is the implementation of the PCToHHState.
++*/
++
++/*
++** This program 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.
++**
++** This program 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 this program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include <options.h>
++
++#include "pilotDatabase.h"
++#include "pilotRecord.h"
++
++#include "vcal-conduitbase.h"
++#include "pctohhstate.h"
++#include "cleanupstate.h"
++#include "deleteunsyncedhhstate.h"
++
++PCToHHState::PCToHHState()
++{
++ fState = ePCToHH;
++}
++
++PCToHHState::~PCToHHState()
++{
++}
++
++void PCToHHState::startSync( ConduitAction *ca )
++{
++ FUNCTIONSETUP;
++ VCalConduitBase *vccb = dynamic_cast<VCalConduitBase*>(ca);
++ if( !vccb )
++ {
++ return;
++ }
++
++ DEBUGCONDUIT << fname << ": Starting PCToHHState." << endl;
++
++ // if we are asked to copy HH to PC, we shouldn't look for deleted records
++ // on the Palm, since we've just copied them all. =:) Otherwise, look for
++ // data on the palm that shouldn't be there and delete it if we find it....
++ if ( vccb->syncMode() == ConduitAction::SyncMode::eCopyHHToPC )
++ {
++ fNextState = new CleanUpState();
++ }
++ else
++ {
++ fNextState = new DeleteUnsyncedHHState();
++ }
++
++ vccb->addLogMessage( i18n( "Copying records to Pilot ..." ) );
++
++ fStarted = true;
++ vccb->setHasNextRecord( true );
++}
++
++void PCToHHState::handleRecord( ConduitAction *ca )
++{
++ FUNCTIONSETUP;
++ VCalConduitBase *vccb = dynamic_cast<VCalConduitBase*>(ca);
++ if( !vccb )
++ {
++ return;
++ }
++
++ KCal::Incidence *e = 0L;
++
++ if( vccb->isFullSync() )
++ {
++ e = vccb->privateBase()->getNextIncidence();
++ }
++ else
++ {
++ e = vccb->privateBase()->getNextModifiedIncidence();
++ }
++
++ // No more incidences to sync
++ if( !e )
++ {
++ vccb->setHasNextRecord( false );
++ return;
++ }
++
++ // let subclasses do something with the event
++ vccb->preIncidence( e );
++
++ // find the corresponding index on the palm and sync. If there is none,
++ // create it.
++ recordid_t id = e->pilotId();
++
++ DEBUGCONDUIT << fname << ": found PC entry with pilotID " << id <<endl;
++ DEBUGCONDUIT << fname << ": Description: " << e->summary() << endl;
++ DEBUGCONDUIT << fname << ": Time: "<< e->dtStart().toString() << " until "
++ << e->dtEnd().toString() << endl;
++
++ PilotRecord *s = 0L;
++
++ if( id > 0 && ( s = vccb->database()->readRecordById( id ) ) )
++ {
++ if( e->syncStatus() == KCal::Incidence::SYNCDEL )
++ {
++ vccb->deletePalmRecord( e, s );
++ }
++ else
++ {
++ vccb->changePalmRecord( e, s );
++ }
++
++ KPILOT_DELETE( s );
++ } else {
++#ifdef DEBUG
++ if (id > 0 )
++ {
++ DEBUGCONDUIT << "-------------------------------------------------"
++ << "--------------------------" << endl;
++ DEBUGCONDUIT << fname << ": Could not read palm record with ID "
++ << id << endl;
++ }
++#endif
++ vccb->addPalmRecord( e );
++ }
++}
++
++void PCToHHState::finishSync( ConduitAction *ca )
++{
++ FUNCTIONSETUP;
++
++ VCalConduitBase *vccb = dynamic_cast<VCalConduitBase*>(ca);
++ if( !vccb )
++ {
++ return;
++ }
++
++ DEBUGCONDUIT << fname << ": Finished PCToHHState." << endl;
++ vccb->setState( fNextState );
++}
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/pctohhstate.h kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/pctohhstate.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/pctohhstate.h 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/pctohhstate.h 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,54 @@
++#ifndef _KPILOT_PCTOHHSTATE_H
++#define _KPILOT_PCTOHHSTATE_H
++/* pctohhstate.h KPilot
++**
++** Copyright (C) 2006 Bertjan Broeksema
++**
++** This file defines the pctohhstate for vcal-conduitbase.
++*/
++
++/*
++** This program 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.
++**
++** This program 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 this program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include "conduitstate.h"
++
++class VCalConduitBase;
++
++/**
++ * State that handles copying of records from pc to handheld.
++ * @see vcal-conduitstate.h
++ */
++class PCToHHState : public ConduitState
++{
++private:
++ ConduitState *fNextState;
++ int fPilotindex;
++
++public:
++ PCToHHState();
++ virtual ~PCToHHState();
++
++ virtual void startSync( ConduitAction* );
++ virtual void handleRecord( ConduitAction* );
++ virtual void finishSync( ConduitAction* );
++};
++
++#endif
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/teststate.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/teststate.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/teststate.cc 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/teststate.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,127 @@
++/* KPilot
++**
++** Copyright (C) 2006 by Bertjan Broeksema <b.broeksema at gmail.com>
++**
++** This file is the implementation of the TestState.
++*/
++
++/*
++** This program 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.
++**
++** This program 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 this program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include <options.h>
++
++#include <qdatetime.h>
++#include <qfile.h>
++
++#include "pilotSerialDatabase.h"
++#include "pilotLocalDatabase.h"
++#include "pilotDateEntry.h"
++
++#include "teststate.h"
++#include "vcal-conduitbase.h"
++
++TestState::TestState() : fCalendar( QString::null )
++{
++ fState = eTest;
++}
++
++TestState::~TestState()
++{
++ FUNCTIONSETUP;
++}
++
++void TestState::startSync( ConduitAction *ca )
++{
++ FUNCTIONSETUP;
++
++ VCalConduitBase *vccb = dynamic_cast<VCalConduitBase*>(ca);
++ if( !vccb )
++ {
++ return;
++ }
++
++ DEBUGCONDUIT << fname << ": Starting teststate." << endl;
++
++ vccb->setHasNextRecord( true );
++ fPilotindex = 0;
++ fStarted = true;
++}
++
++void TestState::handleRecord( ConduitAction *ca )
++{
++ FUNCTIONSETUP;
++
++ VCalConduitBase *vccb = dynamic_cast<VCalConduitBase*>(ca);
++ if( !vccb )
++ {
++ return;
++ }
++
++ DEBUGCONDUIT << fname << ": Handling record " << fPilotindex << endl;
++
++ PilotRecord *record = vccb->readRecordByIndex( fPilotindex );
++
++ if( record )
++ {
++ KCal::Incidence *i = vccb->incidenceFromRecord( record );
++ fCalendar.addIncidence( i );
++
++ KPILOT_DELETE(record);
++
++ // Schedule more work.
++ ++fPilotindex;
++ }
++ else
++ {
++ vccb->setHasNextRecord( false );
++ }
++}
++
++void TestState::finishSync( ConduitAction *ca )
++{
++ FUNCTIONSETUP;
++
++ VCalConduitBase *vccb = dynamic_cast<VCalConduitBase*>(ca);
++ if( !vccb )
++ {
++ return;
++ }
++
++ DEBUGCONDUIT << fname << ": finishing teststate." << endl;
++
++ // No more records present on the device so lets dump the
++ // readed records in a file.
++ QFile f( CSL1("dump.ics") );
++ if( !f.exists() )
++ {
++ f.open( IO_WriteOnly );
++ f.close();
++ }
++
++ if( !fCalendar.save( CSL1("dump.ics") ) )
++ {
++ DEBUGCONDUIT << fname << ": Can't save calendar file." << endl;
++ }
++
++ fCalendar.close();
++
++ vccb->setState( 0L );
++}
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/teststate.h kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/teststate.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/teststate.h 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/teststate.h 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,55 @@
++#ifndef _KPILOT_TESTSTATE_H
++#define _KPILOT_TESTSTATE_H
++/* teststate.h KPilot
++**
++** Copyright (C) 2006 Bertjan Broeksema
++**
++** This file defines the teststate for vcal-conduitbase.
++*/
++
++/*
++** This program 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.
++**
++** This program 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 this program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include <libkcal/calendarlocal.h>
++
++#include "conduitstate.h"
++
++class VCalConduitBase;
++
++/**
++ * State to test the vcal-conduit. @see vcal-conduitstate.h
++ */
++class TestState : public ConduitState
++{
++private:
++ KCal::CalendarLocal fCalendar;
++ int fPilotindex;
++
++public:
++ TestState();
++ virtual ~TestState();
++
++ virtual void startSync( ConduitAction* );
++ virtual void handleRecord( ConduitAction* );
++ virtual void finishSync( ConduitAction* );
++};
++
++#endif
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/todo-conduit.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/todo-conduit.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/todo-conduit.cc 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/todo-conduit.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -54,7 +54,7 @@ extern "C"
+ {
+ long version_conduit_todo = KPILOT_PLUGIN_API;
+
+-const char *id_conduit_todo = "$Id: todo-conduit.cc 450417 2005-08-18 06:07:11Z vanrijn $";
++const char *id_conduit_todo = "$Id: todo-conduit.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ }
+
+@@ -82,7 +82,12 @@ int TodoConduitPrivate::updateIncidences
+ void TodoConduitPrivate::removeIncidence(KCal::Incidence *e)
+ {
+ fAllTodos.remove(static_cast<KCal::Todo*>(e));
++ if (!fCalendar) return;
+ fCalendar->deleteTodo(static_cast<KCal::Todo*>(e));
++ // now just in case we're in the middle of reading through our list
++ // and we delete something, set reading to false so we start at the
++ // top again next time and don't have problems with our iterator
++ reading = false;
+ }
+
+
+@@ -169,7 +174,7 @@ KCal::Incidence *TodoConduitPrivate::get
+ * TodoConduit class *
+ ****************************************************************************/
+
+-TodoConduit::TodoConduit(KPilotDeviceLink *d,
++TodoConduit::TodoConduit(KPilotLink *d,
+ const char *n,
+ const QStringList &a) : VCalConduitBase(d,n,a)
+ {
+@@ -195,6 +200,12 @@ void TodoConduit::_setAppInfo()
+ {
+ FUNCTIONSETUP;
+ // get the address application header information
++
++ if( fTodoAppInfo )
++ DEBUGCONDUIT << fname << ": fTodoAppInfo not null" << endl;
++ if( fDatabase )
++ DEBUGCONDUIT << fname << ": fDatabase not null" << endl;
++
+ fTodoAppInfo->write(fDatabase);
+ }
+
+@@ -237,7 +248,12 @@ void TodoConduit::readConfig()
+ #endif
+ }
+
+-
++void TodoConduit::preSync()
++{
++ FUNCTIONSETUP;
++ VCalConduitBase::preSync();
++ _getAppInfo();
++}
+
+ void TodoConduit::postSync()
+ {
+@@ -438,17 +454,27 @@ void TodoConduit::setCategory(KCal::Todo
+ // if this event only has one category associated with it, then we can
+ // safely assume that what we should be doing here is changing it to match
+ // the palm. if there's already more than one category in the event, however, we
+- // won't cause data loss--we'll just append what the palm has to the
++ // won't cause data loss--we'll just append what the palm has to the
+ // event's categories
+ if (cats.count() <=1) cats.clear();
+-
++
+ cats.append( newcat );
+ e->setCategories(cats);
+ }
+ }
+ }
+
+-VCalConduitSettings *TodoConduit::config()
+-{
+- return ToDoConduitFactory::config();
++static VCalConduitSettings *config_vcal = 0L;
++
++VCalConduitSettings *TodoConduit::theConfig() {
++ if (!config_vcal)
++ {
++ config_vcal = new VCalConduitSettings(CSL1("Calendar"));
++ }
++
++ return config_vcal;
++}
++
++VCalConduitSettings *TodoConduit::config() {
++ return theConfig();
+ }
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/todo-conduit.h kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/todo-conduit.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/todo-conduit.h 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/todo-conduit.h 2006-11-19 22:21:12.000000000 +0100
+@@ -67,7 +67,7 @@ class TodoConduit : public VCalConduitBa
+ {
+ Q_OBJECT
+ public:
+- TodoConduit(KPilotDeviceLink *,
++ TodoConduit(KPilotLink *,
+ const char *name=0L,
+ const QStringList &args = QStringList());
+ virtual ~TodoConduit();
+@@ -76,7 +76,7 @@ protected:
+ virtual const QString getTitle(PilotAppCategory*de);
+
+ virtual const QString dbname() { return CSL1("ToDoDB"); };
+- virtual void preSync() {_getAppInfo(); };
++ virtual void preSync();
+ virtual VCalConduitPrivateBase* newVCalPrivate(KCal::Calendar *fCalendar) {
+ return new TodoConduitPrivate(fCalendar);
+ };
+@@ -96,6 +96,8 @@ protected:
+
+ virtual void preRecord(PilotRecord*r);
+ virtual VCalConduitSettings *config();
++public:
++ static VCalConduitSettings *theConfig();
+
+ protected:
+
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/todo-factory.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/todo-factory.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/todo-factory.cc 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/todo-factory.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -29,118 +29,18 @@
+
+ #include "options.h"
+
+-#include <kaboutdata.h>
++#include "pluginfactory.h"
+
+ #include "todo-setup.h"
+ #include "todo-conduit.h"
+-#include "todo-factory.moc"
+-#include "vcalconduitSettings.h"
+
+ extern "C"
+ {
+
+ void *init_conduit_todo()
+ {
+- return new ToDoConduitFactory;
++ return new ConduitFactory<ToDoWidgetSetup,TodoConduit>;
+ }
+
+ }
+
+-VCalConduitSettings* ToDoConduitFactory::fConfig=0L;
+-
+-ToDoConduitFactory::ToDoConduitFactory(QObject *p, const char *n) :
+- VCalConduitFactoryBase(p,n)
+-{
+- FUNCTIONSETUP;
+-
+- fInstance = new KInstance("todoconduit");
+- fAbout = new KAboutData("todoConduit",
+- I18N_NOOP("To-do Conduit for KPilot"),
+- KPILOT_VERSION,
+- I18N_NOOP("Configures the To-do Conduit for KPilot"),
+- KAboutData::License_GPL,
+- "(C) 2001, Adriaan de Groot\n(C) 2002-2003, Reinhold Kainhofer");
+- fAbout->addAuthor("Dan Pilone",
+- I18N_NOOP("Original Author"));
+- fAbout->addAuthor("Preston Brown",
+- I18N_NOOP("Original Author"));
+- fAbout->addAuthor("Herwin-Jan Steehouwer",
+- I18N_NOOP("Original Author"));
+- fAbout->addAuthor("Adriaan de Groot",
+- I18N_NOOP("Maintainer"),
+- "groot at kde.org",
+- "http://www.cs.kun.nl/~adridg/kpilot");
+- fAbout->addAuthor("Reinhold Kainhofer",
+- I18N_NOOP("Maintainer"),
+- "reinhold at kainhofer.com",
+- "http://reinhold.kainhofer.com/Linux/");
+-}
+-
+-ToDoConduitFactory::~ToDoConduitFactory()
+-{
+- FUNCTIONSETUP;
+-
+- KPILOT_DELETE(fInstance);
+- KPILOT_DELETE(fAbout);
+-}
+-
+-VCalConduitSettings* ToDoConduitFactory::config()
+-{
+- if (!fConfig) {
+- fConfig = new VCalConduitSettings( CSL1("ToDo") );
+- if (fConfig) fConfig->readConfig();
+- }
+- return fConfig;
+-}
+-
+-/* virtual */ QObject *ToDoConduitFactory::createObject( QObject *p,
+- const char *n,
+- const char *c,
+- const QStringList &a)
+-{
+- FUNCTIONSETUP;
+-
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
+- << ": Creating object of class "
+- << c
+- << endl;
+-#endif
+-
+- if (qstrcmp(c,"ConduitConfigBase")==0)
+- {
+- QWidget *w = dynamic_cast<QWidget *>(p);
+-
+- if (w)
+- {
+- return new ToDoWidgetSetup(w,n);
+- }
+- else
+- {
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
+- << ": Couldn't cast parent to widget."
+- << endl;
+-#endif
+- return 0L;
+- }
+- }
+- else
+- if (qstrcmp(c,"SyncAction")==0)
+- {
+- KPilotDeviceLink *d = dynamic_cast<KPilotDeviceLink *>(p);
+-
+- if (d)
+- {
+- return new TodoConduit(d,n,a);
+- }
+- else
+- {
+- kdError() << k_funcinfo
+- << ": Couldn't cast to KPilotDeviceLink."
+- << endl;
+- }
+- }
+-
+- return 0L;
+-}
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/todo-factory.h kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/todo-factory.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/todo-factory.h 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/todo-factory.h 2006-11-19 22:21:12.000000000 +0100
+@@ -30,29 +30,6 @@
+ ** Bug reports and questions can be sent to kde-pim at kde.org
+ */
+
+-#include "vcal-factorybase.h"
+-
+-class KInstance;
+-
+-class ToDoConduitFactory : public VCalConduitFactoryBase
+-{
+- Q_OBJECT
+-
+-public:
+- ToDoConduitFactory(QObject * = 0L,const char * = 0L);
+- virtual ~ToDoConduitFactory();
+- static VCalConduitSettings*config();
+-
+-protected:
+- virtual QObject* createObject( QObject* parent = 0,
+- const char* name = 0,
+- const char* classname = "QObject",
+- const QStringList &args = QStringList() );
+-private:
+- KInstance *fInstance;
+- static VCalConduitSettings*fConfig;
+-};
+-
+ extern "C"
+ {
+
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/todo-setup.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/todo-setup.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/todo-setup.cc 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/todo-setup.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -30,9 +30,10 @@
+ #include "options.h"
+
+ #include <qbuttongroup.h>
++#include <kaboutdata.h>
+
+ #include "korganizerConduit.h"
+-#include "todo-factory.h"
++#include "todo-conduit.h"
+ #include "todo-setup.h"
+
+ #include "uiDialog.h"
+@@ -43,7 +44,28 @@ ToDoWidgetSetup::ToDoWidgetSetup(QWidget
+ {
+ FUNCTIONSETUP;
+ fConduitName = i18n("To-do");
+- UIDialog::addAboutPage(fConfigWidget->tabWidget,VCalConduitFactoryBase::about());
++ KAboutData *fAbout = new KAboutData("todoConduit",
++ I18N_NOOP("To-do Conduit for KPilot"),
++ KPILOT_VERSION,
++ I18N_NOOP("Configures the To-do Conduit for KPilot"),
++ KAboutData::License_GPL,
++ "(C) 2001, Adriaan de Groot\n(C) 2002-2003, Reinhold Kainhofer");
++ fAbout->addAuthor("Dan Pilone",
++ I18N_NOOP("Original Author"));
++ fAbout->addAuthor("Preston Brown",
++ I18N_NOOP("Original Author"));
++ fAbout->addAuthor("Herwin-Jan Steehouwer",
++ I18N_NOOP("Original Author"));
++ fAbout->addAuthor("Adriaan de Groot",
++ I18N_NOOP("Maintainer"),
++ "groot at kde.org",
++ "http://www.cs.kun.nl/~adridg/kpilot");
++ fAbout->addAuthor("Reinhold Kainhofer",
++ I18N_NOOP("Maintainer"),
++ "reinhold at kainhofer.com",
++ "http://reinhold.kainhofer.com/Linux/");
++
++ UIDialog::addAboutPage(fConfigWidget->tabWidget,fAbout);
+
+ fConfigWidget->fSyncDestination->setTitle(i18n("To-do Destination"));
+ }
+@@ -58,8 +80,8 @@ ToDoWidgetSetup::~ToDoWidgetSetup()
+ return new ToDoWidgetSetup(w,n);
+ }
+
+-VCalConduitSettings*ToDoWidgetSetup::config()
++VCalConduitSettings*ToDoWidgetSetup::config()
+ {
+- return ToDoConduitFactory::config();
++ return TodoConduit::theConfig();
+ }
+
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/vcal-conduitbase.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/vcal-conduitbase.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/vcal-conduitbase.cc 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/vcal-conduitbase.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -5,6 +5,7 @@
+ **
+ ** Contributions:
+ ** Copyright (c) 2001 David Jarvie <software at astrojar.org.uk>
++** Copyright (C) 2006 by Bertjan Broeksema <b.broeksema at gmail.com>
+ **
+ ** This file defines the vcal-conduit plugin.
+ */
+@@ -30,7 +31,7 @@
+ ** Bug reports and questions can be sent to kde-pim at kde.org
+ */
+
+-static const char *vcalconduitbase_id = "$Id: vcal-conduitbase.cc 450417 2005-08-18 06:07:11Z vanrijn $";
++static const char *vcalconduitbase_id = "$Id: vcal-conduitbase.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ #include <options.h>
+
+@@ -52,20 +53,20 @@ static const char *vcalconduitbase_id =
+ #include "vcal-conduitbase.moc"
+ #include "vcalconduitSettings.h"
+
+-
+ #ifndef LIBKCAL_IS_VERSION
+ #warning "Using an old version of libkcal with timezone bug."
+ #define LIBKCAL_IS_VERSION(a,b,c) (0)
+ #endif
+
++#include "conduitstate.h"
++#include "initstate.h"
+
+
+ /****************************************************************************
+- * VCalConduitBase class *
++ * VCalConduitBase class *
+ ****************************************************************************/
+
+-
+-VCalConduitBase::VCalConduitBase(KPilotDeviceLink *d,
++VCalConduitBase::VCalConduitBase(KPilotLink *d,
+ const char *n,
+ const QStringList &a) :
+ ConduitAction(d,n,a),
+@@ -73,72 +74,89 @@ VCalConduitBase::VCalConduitBase(KPilotD
+ fP(0L)
+ {
+ FUNCTIONSETUP;
+-#ifdef DEBUG
+- DEBUGCONDUIT<<vcalconduitbase_id<<endl;
+-#endif
+-}
+-
+
++ fState = new InitState();
++ DEBUGCONDUIT << vcalconduitbase_id << endl;
++}
+
+ VCalConduitBase::~VCalConduitBase()
+ {
+ FUNCTIONSETUP;
+
+ KPILOT_DELETE(fP);
++ KPILOT_DELETE(fState);
+ KPILOT_DELETE(fCalendar);
++ KPILOT_DELETE(fDatabase);
++ KPILOT_DELETE(fLocalDatabase);
+ }
+
+
+-/* There are several different scenarios for a record on the Palm and its PC counterpart
+- N means a new record, M flags a modified record, D a deleted and - an unmodified record
+- first is the Palm record, second the corresponding PC record
+- (-,-)...unchanged, just sync if first time or full sync
+- (N,-)...no rec matching the Palm ID in the backupDB/calendar yet => add KCal::Event
+- (M,-)...record is in backupDB, unchanged in calendar => modify in calendar and in backupDB
+- (D,-)...deleted on Palm, exists in backupDB and calendar => just delete from calendar and backupDB
+- (-,N)...no or invalid pilotID set for the KCal::Event => just add to palm and backupDB
+- (-,M)...valid PilotID set => just modify on Palm
+- (-,D)...Record in backupDB, but not in calendar => delete from Palm and backupDB
+- (N,N)...Can't find out (the two records are not correlated in any way, they just have the same data!!
+- (M,M),(M,L),(L,M)...(Record exists on Palm and the Event has the ID) CONFLICT, ask the user what to do
+- or use a config setting
+- (L,L)...already deleted on both, no need to do anything.
+-
++/*
++ There are several different scenarios for a record on the Palm and its PC
++ counterpart. N means a new record, M flags a modified record, D a deleted
++ and - an unmodified record. First is the Palm record, second the
++ corresponding PC record:
++ (-,-) unchanged, just sync if first time or full sync
++ (N,-) no rec matching the Palm ID in the backupDB/calendar yet => add
++ KCal::Event
++ (M,-) record is in backupDB, unchanged in calendar => modify in calendar and
++ in backupDB
++ (D,-) deleted on Palm, exists in backupDB and calendar => just delete from
++ calendar and backupDB
++ (-,N) no or invalid pilotID set for the KCal::Event => just add to palm and
++ backupDB
++ (-,M) valid PilotID set => just modify on Palm
++ (-,D) Record in backupDB, but not in calendar => delete from Palm and
++ backupDB
++ (N,N) Can't find out (the two records are not correlated in any way, they
++ just have the same data!!
++ (M,M),(M,L),(L,M) (Record exists on Palm and the Event has the ID) CONFLICT,
++ ask the user what to do or use a config setting
++ (L,L) already deleted on both, no need to do anything.
+
+ The sync process is as follows (for a fast sync):
+- 1) slotPalmRecToPC goes through all records on Palm (just the modified one are necessary), find it
+- in the backupDB. The following handles ([NMD],*)
+- a) if it doesn't exist and was not deleted, add it to the calendar and the backupDB
+- b) if it exists and was not deleted,
+- A) if it is unchanged in the calendar, just modify in the calendar
+- c) if it exists and was deleted, delete it from the calendar if necessary
+- 2) slotEvent goes through all KCale::Events in the calendar (just modified, this is the modification
+- time is later than the last sync time). This handles (-,N),(-,M)
+- a) if it does not have a pilotID, add it to the palm and backupDB, store the PalmID
++ 1) HHToPCState goes through all records on Palm (just the modified one
++ are necessary), find it in the backupDB. The following handles ([NMD],*)
++ a) if it doesn't exist and was not deleted, add it to the calendar and
++ the backupDB
++ b) if it exists, is unchanged in the calendar and was not deleted,
++ just modify in the calendar
++ c) if it exists and was deleted, delete it from the calendar if
++ necessary
++ 2) PCToHHState goes through all KCale::Events in the calendar (just
++ modified, this is the modification time is later than the last sync time
++ ). This handles (-,N),(-,M)
++ a) if it does not have a pilotID, add it to the palm and backupDB,
++ store the PalmID
+ b) if it has a valid pilotID, update the Palm record and the backup
+- 3) finally, deleteRecord goes through all records (which don't have the deleted flag) of the backup db
+- and if one does not exist in the Calendar, it was deleted there, so delete it from the Palm, too.
+- This handles the last remaining case of (-,D)
+-
+-
+-In addition to the fast sync, where the last sync was done with this very PC and calendar file,
+-there are two special cases: a full and a first sync.
+--) a full sync goes through all records, not just the modified ones. The pilotID setting of the calendar
+- records is used to determine if the record already exists. if yes, the record is just modified
+--) a first sync completely ignores the pilotID setting of the calendar events. All records are added,
+- so there might be duplicates. The add function for the calendar should check if a similar record already
+- exists, but this is not done yet.
+-
+-
+--) a full sync is done if
+- a) there is a backupdb and a calendar, but the PC id number changed
+- b) it was explicitly requested by pressing the full sync button in KPilot
+- c) the setting "always full sync" was selected in the configuration dlg
+--) a first sync is done if
+- a) either the calendar or the backup DB does not exist.
+- b) the calendar and the backup DB exists, but the sync is done for a different User name
+- c) it was explicitly requested in KPilot
+-
++ 3) DeletedUnsyncedHHState goes through all palm records (which don't
++ have the deleted flag) of the palm db and if one does not exist in the
++ Calendar, it was deleted there, so delete it from the Palm and backup,
++ too. This handles the case of (-,D)
++ 4) DeletedUnsyncedPCState goes through all KCal::Events in the calendar and
++ looks for a corresponding event in the palm database. If it does not
++ exist, that means that it was deleted on the palm, so we need to also
++ delete it from the local calendar. This handles the case of (D,-).
++
++ In addition to the fast sync, where the last sync was done with this very
++ PC and calendar file, there are two special cases: a full and a first sync.
++ -) a full sync goes through all records, not just the modified ones. The
++ pilotID setting of the calendar records is used to determine if the
++ record already exists. if yes, the record is just modified.
++ -) a first sync completely ignores the pilotID setting of the calendar
++ events. All records are added, so there might be duplicates. The add
++ function for the calendar should check if a similar record already
++ exists, but this is not done yet.
++
++ -) a full sync is done if
++ a) there is a backupdb and a calendar, but the PC id number changed
++ b) it was explicitly requested by pressing the full sync button in KPilot
++ c) the setting "always full sync" was selected in the configuration dlg
++ -) a first sync is done if
++ a) either the calendar or the backup DB does not exist.
++ b) the calendar and the backup DB exists, but the sync is done for a
++ different User name
++ c) it was explicitly requested in KPilot
+ */
+
+ /* virtual */ bool VCalConduitBase::exec()
+@@ -154,56 +172,64 @@ there are two special cases: a full and
+
+ // TODO: Check Full sync and First sync
+ bool retrieved = false;
+- if (!openCalendar() ) goto error;
+- if (!openDatabases(dbname(), &retrieved) ) goto error;
++ if ( !openDatabases( dbname(), &retrieved ) ) goto error;
+ setFirstSync( retrieved );
+- preSync();
+-
++
++ // If we are in testmode we don't need the local calendar. Else a
++ // calendar *must* be opened, we want to sync something don't we?
++ if (!syncMode().isTest() && !openCalendar() ) goto error;
+
+-#ifdef DEBUG
+- DEBUGCONDUIT<<fname<<": fullsync="<<isFullSync()<<", firstSync="<<isFirstSync()<<endl;
+- DEBUGCONDUIT<<fname<<": syncAction=" << syncMode().name() <<
+- ", conflictResolution = "<<getConflictResolution()<<", archive = "<<config()->syncArchived()<<endl;
+-#endif
+-
+- pilotindex=0;
+- switch (syncMode().mode())
+- {
+- case SyncMode::eCopyPCToHH:
+- // TODO: Clear the palm and backup database??? Or just add the new items ignore
+- // the Palm->PC side and leave the existing items on the palm?
+- emit logMessage(i18n("Copying records to Pilot ..."));
+- QTimer::singleShot(0, this, SLOT(slotPCRecToPalm()));
+- break;
+- case SyncMode::eCopyHHToPC:
+- // TODO: Clear the backup database and the calendar, update fP
+- // or just add the palm items and leave the PC ones there????
+- default:
+- emit logMessage(i18n("Copying records to PC ..."));
+- QTimer::singleShot(0, this, SLOT(slotPalmRecToPC()));
+- }
++ // Start processing the sync
++ QTimer::singleShot(0, this, SLOT(slotProcess()));
+ return true;
+
+ error:
+-
+- emit logError(i18n("Could not open the calendar databases."));
++ emit logError( i18n( "Could not open the calendar databases." ) );
+
+ KPILOT_DELETE(fCalendar);
+ KPILOT_DELETE(fP);
++ KPILOT_DELETE(fState);
+ return false;
+ }
+
++void VCalConduitBase::slotProcess() {
++ FUNCTIONSETUP;
+
++ // start the current state if necessary
++ if( fState && !fState->started() ) {
++ fState->startSync( this );
++ }
++
++ // Process next record if applicable
++ if( hasNextRecord )
++ {
++ fState->handleRecord( this );
++ QTimer::singleShot( 0, this, SLOT( slotProcess() ) );
++ }
++ // Else finish the current state if there is one
++ else if( fState )
++ {
++ fState->finishSync( this );
++ QTimer::singleShot( 0, this, SLOT( slotProcess() ) );
++ }
++ // No state so sync is finished
++ else
++ {
++ DEBUGCONDUIT << fname << ": Sync finished." << endl;
++ delayDone();
++ }
++}
+
+ /* virtual */ void VCalConduitBase::readConfig()
+ {
+ config()->readConfig();
+- SyncAction::ConflictResolution res=(SyncAction::ConflictResolution)(config()->conflictResolution());
+- setConflictResolution(res);
++ SyncAction::ConflictResolution res = (SyncAction::ConflictResolution)
++ (config()->conflictResolution());
++ setConflictResolution( res );
+ }
+
+ #ifdef DEBUG
+-static void listResources(KCal::CalendarResources *p)
++static void listResources( KCal::CalendarResources *p )
+ {
+ FUNCTIONSETUP;
+ KCal::CalendarResourceManager *manager = p->resourceManager();
+@@ -222,71 +248,64 @@ static void listResources(KCal::Calendar
+ FUNCTIONSETUP;
+
+ KConfig korgcfg( locate( "config", CSL1("korganizerrc") ) );
++
+ // this part taken from adcalendarbase.cpp:
+ korgcfg.setGroup( "Time & Date" );
+ QString tz(korgcfg.readEntry( "TimeZoneId" ) );
+-#ifdef DEBUG
++
+ DEBUGCONDUIT << fname << ": KOrganizer's time zone = " << tz << endl;
+-#endif
+
+ // Need a subclass ptr. for the ResourceCalendar methods
+ KCal::CalendarResources *rescal = 0L;
+
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname << ": Got calendar type " << config()->calendarType() << endl;
+-#endif
++ DEBUGCONDUIT << fname << ": Got calendar type " << config()->calendarType()
++ << endl;
+
+ switch(config()->calendarType())
+ {
+ case VCalConduitSettings::eCalendarLocal:
+ {
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
+- << "Using CalendarLocal, file="
++ DEBUGCONDUIT << fname << "Using CalendarLocal, file = "
+ << config()->calendarFile() << endl;
+-#endif
+- if (config()->calendarFile().isEmpty() )
++
++ if ( config()->calendarFile().isEmpty() )
+ {
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
+- << "Empty calendar file name."
+- << endl;
+-#endif
+- emit logError(i18n("You selected to sync with the a iCalendar file, "
+- "but did not give a filename. Please select a valid file name in "
+- "the conduit's configuration dialog"));
++ DEBUGCONDUIT << fname << "Empty calendar file name." << endl;
++
++ emit logError( i18n( "You selected to sync with an iCalendar"
++ " file, but did not give a filename. Please select a"
++ " valid file name in the conduit's configuration"
++ " dialog" ) );
+ return false;
+ }
+
+- fCalendar = new KCal::CalendarLocal(tz);
+- if ( !fCalendar)
++ fCalendar = new KCal::CalendarLocal( tz );
++ if ( !fCalendar )
+ {
+ kdWarning() << k_funcinfo
+ << "Cannot initialize calendar object for file "
+ << config()->calendarFile() << endl;
+ return false;
+ }
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
+- << "Calendar's timezone: "
++
++ DEBUGCONDUIT << fname << "Calendar's timezone: "
+ << fCalendar->timeZoneId() << endl;
+- DEBUGCONDUIT << fname
+- << "Calendar is local time: "
++ DEBUGCONDUIT << fname << "Calendar is local time: "
+ << fCalendar->isLocalTime() << endl;
+-#endif
++
+ emit logMessage( fCalendar->isLocalTime() ?
+- i18n("Using local time zone: %1").arg(tz) :
+- i18n("Using non-local time zone: %1").arg(tz) );
++ i18n( "Using local time zone: %1" ).arg( tz ) :
++ i18n( "Using non-local time zone: %1" ).arg( tz ) );
+
+- KURL kurl(config()->calendarFile());
+- if(!KIO::NetAccess::download(config()->calendarFile(), fCalendarFile, 0L) &&
+- !kurl.isLocalFile())
++ KURL kurl( config()->calendarFile() );
++ if( !KIO::NetAccess::download( config()->calendarFile(),
++ fCalendarFile, 0L ) && !kurl.isLocalFile() )
+ {
+- emit logError(i18n("You chose to sync with the file \"%1\", which "
+- "cannot be opened. Please make sure to supply a "
+- "valid file name in the conduit's configuration dialog. "
+- "Aborting the conduit.").arg(config()->calendarFile()));
+- KIO::NetAccess::removeTempFile(fCalendarFile);
++ emit logError(i18n( "You chose to sync with the file \"%1\", which "
++ "cannot be opened. Please make sure to supply a "
++ "valid file name in the conduit's configuration dialog. "
++ "Aborting the conduit." ).arg( config()->calendarFile() ) );
++ KIO::NetAccess::removeTempFile( fCalendarFile );
+ return false;
+ }
+
+@@ -294,41 +313,34 @@ static void listResources(KCal::Calendar
+ // the calendar is initialized, so nothing more to do...
+ if (!dynamic_cast<KCal::CalendarLocal*>(fCalendar)->load(fCalendarFile) )
+ {
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
+- << "Calendar file "
+- << fCalendarFile
+- << " could not be opened. "
+- "Will create a new one"
+- << endl;
+-#endif
++ DEBUGCONDUIT << fname << "Calendar file " << fCalendarFile
++ << " could not be opened. Will create a new one" << endl;
++
+ // Try to create empty file. if it fails,
+ // no valid file name was given.
+ QFile fl(fCalendarFile);
+ if (!fl.open(IO_WriteOnly | IO_Append))
+ {
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
+- << "Invalid calendar file name "
++ DEBUGCONDUIT << fname << "Invalid calendar file name "
+ << fCalendarFile << endl;
+-#endif
+- emit logError(i18n("You chose to sync with the file \"%1\", which "
+- "cannot be opened or created. Please make sure to supply a "
+- "valid file name in the conduit's configuration dialog. "
+- "Aborting the conduit.").arg(config()->calendarFile()));
++
++ emit logError( i18n( "You chose to sync with the file \"%1\", which "
++ "cannot be opened or created. Please make sure to supply a "
++ "valid file name in the conduit's configuration dialog. "
++ "Aborting the conduit." ).arg( config()->calendarFile() ) );
+ return false;
+ }
+ fl.close();
+ setFirstSync( true );
+ }
+- addSyncLogEntry(i18n("Syncing with file \"%1\"").arg(config()->calendarFile()));
++ addSyncLogEntry( i18n( "Syncing with file \"%1\"" )
++ .arg( config()->calendarFile() ) );
+ break;
+ }
+
+ case VCalConduitSettings::eCalendarResource:
+-#ifdef DEBUG
+ DEBUGCONDUIT << "Using CalendarResource!" << endl;
+-#endif
++
+ rescal = new KCal::CalendarResources( tz );
+ #ifdef DEBUG
+ listResources(rescal);
+@@ -336,39 +348,42 @@ static void listResources(KCal::Calendar
+ fCalendar = rescal;
+ if ( !fCalendar)
+ {
+- kdWarning() << k_funcinfo << "Cannot initialize calendar "<<
+- "object for ResourceCalendar"<<endl;
++ kdWarning() << k_funcinfo << "Cannot initialize calendar " <<
++ "object for ResourceCalendar" << endl;
+ return false;
+ }
++
+ #if LIBKCAL_IS_VERSION(1,1,0)
+ rescal->readConfig();
+ rescal->load();
+ #else
+ #warning "Timezone bug is present."
+ #endif
+- addSyncLogEntry(i18n("Syncing with standard calendar resource."));
++ addSyncLogEntry( i18n( "Syncing with standard calendar resource." ) );
+ emit logMessage( fCalendar->isLocalTime() ?
+- i18n("Using local time zone: %1").arg(tz) :
+- i18n("Using non-local time zone: %1").arg(tz) );
++ i18n( "Using local time zone: %1" ).arg( tz ) :
++ i18n( "Using non-local time zone: %1" ).arg( tz ) );
+ break;
+ default:
+ break;
+-
+ }
+
+- if (!fCalendar)
++ if ( !fCalendar )
+ {
+- kdWarning() <<k_funcinfo << "Unable to initialize calendar object. Please check the conduit's setup."<<endl;
+- emit logError(i18n("Unable to initialize the calendar object. Please check the conduit's setup"));
++ kdWarning() <<k_funcinfo << "Unable to initialize calendar object."
++ << " Please check the conduit's setup." << endl;
++ emit logError( i18n( "Unable to initialize the calendar object. Please"
++ " check the conduit's setup") );
+ return false;
+ }
+- fP = newVCalPrivate(fCalendar);
+- if (!fP)
++ fP = newVCalPrivate( fCalendar );
++ if ( !fP )
+ {
+ return false;
+ }
+ fP->updateIncidences();
+- if (fP->count()<1)
++
++ if ( fP->count() < 1 )
+ {
+ setFirstSync( true );
+ }
+@@ -376,303 +391,59 @@ static void listResources(KCal::Calendar
+ return true;
+ }
+
+-
+-
+-void VCalConduitBase::slotPalmRecToPC()
++KCal::Incidence* VCalConduitBase::addRecord( PilotRecord *r )
+ {
+ FUNCTIONSETUP;
+
+- PilotRecord *r;
+- if (isFullSync())
+- {
+- r = fDatabase->readRecordByIndex(pilotindex++);
+- }
+- else
+- {
+- r = fDatabase->readNextModifiedRec();
+- }
+- PilotRecord *s = 0L;
+-
+- if (!r)
+- {
+- fP->updateIncidences();
+- if ( syncMode()==SyncMode::eCopyHHToPC )
+- {
+- emit logMessage(i18n("Cleaning up ..."));
+- QTimer::singleShot(0, this, SLOT(cleanup()));
+- return;
+- }
+- else
+- {
+- emit logMessage(i18n("Copying records to Pilot ..."));
+- QTimer::singleShot(0 ,this,SLOT(slotPCRecToPalm()));
+- return;
+- }
+- }
+-
+- // let subclasses do something with the record before we try to sync
+- preRecord(r);
+-
+-// DEBUGCONDUIT<<fname<<": Event: "<<e->dtStart()<<" until "<<e->dtEnd()<<endl;
+-// DEBUGCONDUIT<<fname<<": Time: "<<e->dtStart()<<" until "<<e->dtEnd()<<endl;
+- bool archiveRecord=(r->isArchived());
+-
+- s = fLocalDatabase->readRecordById(r->id());
+- if (!s || isFirstSync())
+- {
++ recordid_t id = fLocalDatabase->writeRecord( r );
+ #ifdef DEBUG
+- if (r->id()>0 && !s)
+- {
+- DEBUGCONDUIT<<"---------------------------------------------------------------------------"<<endl;
+- DEBUGCONDUIT<< fname<<": Could not read palm record with ID "<<r->id()<<endl;
+- }
+-#endif
+- if (!r->isDeleted() || (config()->syncArchived() && archiveRecord))
+- {
+- KCal::Incidence*e=addRecord(r);
+- if (config()->syncArchived() && archiveRecord) {
+- e->setSyncStatus(KCal::Incidence::SYNCDEL);
+- }
+- }
+- }
+- else
+- {
+- if (r->isDeleted())
+- {
+- if (config()->syncArchived() && archiveRecord)
+- {
+- changeRecord(r,s);
+- }
+- else
+- {
+- deleteRecord(r,s);
+- }
+- }
+- else
+- {
+- changeRecord(r,s);
+- }
+- }
+-
+- KPILOT_DELETE(r);
+- KPILOT_DELETE(s);
+-
+- QTimer::singleShot(0,this,SLOT(slotPalmRecToPC()));
+-}
+-
+-
+-void VCalConduitBase::slotPCRecToPalm()
+-{
+- FUNCTIONSETUP;
+- KCal::Incidence*e=0L;
+- if (isFullSync()) e=fP->getNextIncidence();
+- else e=fP->getNextModifiedIncidence();
+-
+- if (!e)
+- {
+- pilotindex=0;
+- // if we are asked to copy HH to PC, we shouldn't look for deleted records
+- // on the Palm, since we've just copied them all. =:) Otherwise, look for
+- // data on the palm that shouldn't be there and delete it if we find it....
+- if ( syncMode()==SyncMode::eCopyHHToPC )
+- {
+- QTimer::singleShot(0, this, SLOT(cleanup()));
+- }
+- else
+- {
+- QTimer::singleShot(0,this,SLOT(slotDeletedIncidence()));
+- }
+- return;
+- }
+-
+- // let subclasses do something with the event
+- preIncidence(e);
+-
+- // find the corresponding index on the palm and sync. If there is none, create it.
+- recordid_t ix=e->pilotId();
+-#ifdef DEBUG
+- DEBUGCONDUIT<<fname<<": found PC entry with pilotID "<<ix<<endl;
+- DEBUGCONDUIT<<fname<<": Description: "<<e->summary()<<endl;
+- DEBUGCONDUIT<<fname<<": Time: "<<e->dtStart().toString()<<" until "<<e->dtEnd().toString()<<endl;
+-#endif
+- PilotRecord *s=0L;
+- if (ix>0 && (s=fDatabase->readRecordById(ix)))
+- {
+- if (e->syncStatus()==KCal::Incidence::SYNCDEL)
+- {
+- deletePalmRecord(e, s);
+- }
+- else
+- {
+- changePalmRecord(e, s);
+- }
+- KPILOT_DELETE(s);
+- } else {
+-#ifdef DEBUG
+- if (ix>0)
+- {
+- DEBUGCONDUIT<<"---------------------------------------------------------------------------"<<endl;
+- DEBUGCONDUIT<< fname<<": Could not read palm record with ID "<<ix<<endl;
+- }
+-#endif
+- addPalmRecord(e);
+- }
+- QTimer::singleShot(0, this, SLOT(slotPCRecToPalm()));
+-}
+-
+-
+-void VCalConduitBase::slotDeletedIncidence()
+-{
+- FUNCTIONSETUP;
+-
+- PilotRecord *r = fLocalDatabase->readRecordByIndex(pilotindex++);
+- if (!r || (syncMode()==SyncMode::eCopyHHToPC) )
+- {
+- QTimer::singleShot(0 ,this,SLOT(cleanup()));
+- return;
+- }
+-
+- KCal::Incidence *e = fP->findIncidence(r->id());
+- if (!e)
+- {
+-#ifdef DEBUG
+- DEBUGCONDUIT<<"didn't find incidence with id="<<r->id()<<", deleting it"<<endl;
+-#endif
+- // entry was deleted from Calendar, so delete it from the palm
+-// PilotRecord*s=fLocalDatabase->readRecordById(r->id());
+-// if (s)
+-// {
+-// // delete the record from the palm
+-// s->setDeleted();
+-//// s->setAttrib(s->getAttrib() & ~dlpRecAttrDeleted & ~dlpRecAttrDirty);
+-// fDatabase->writeRecord(s);
+-// KPILOT_DELETE(s);
+-// }
+- deletePalmRecord(NULL, r);
+-// r->setDeleted();
+-//// r->setAttrib(r->getAttrib() & ~dlpRecAttrDeleted & ~dlpRecAttrDirty);
+-// fLocalDatabase->writeRecord(r);
+-// fDatabase->writeRecord(r);
+- }
+-
+- KPILOT_DELETE(r);
+- QTimer::singleShot(0,this,SLOT(slotDeletedIncidence()));
+-}
+-
+-
+-void VCalConduitBase::cleanup()
+-{
+- FUNCTIONSETUP;
+- postSync();
+-
+- if (fDatabase)
+- {
+- fDatabase->resetSyncFlags();
+- fDatabase->cleanup();
+- }
+- if (fLocalDatabase)
+- {
+- fLocalDatabase->resetSyncFlags();
+- fLocalDatabase->cleanup();
+- }
+- KPILOT_DELETE(fDatabase);
+- KPILOT_DELETE(fLocalDatabase);
+- if (fCalendar)
+- {
+- KURL kurl(config()->calendarFile());
+- switch(config()->calendarType())
+- {
+- case VCalConduitSettings::eCalendarLocal:
+- dynamic_cast<KCal::CalendarLocal*>(fCalendar)->save(fCalendarFile);
+- if(!kurl.isLocalFile())
+- {
+- if(!KIO::NetAccess::upload(fCalendarFile, config()->calendarFile(), 0L)) {
+- emit logError(i18n("An error occurred while uploading \"%1\". You can try to upload "
+- "the temporary local file \"%2\" manually.")
+- .arg(config()->calendarFile()).arg(fCalendarFile));
+- }
+- else {
+- KIO::NetAccess::removeTempFile(fCalendarFile);
+- }
+- QFile backup(fCalendarFile + CSL1("~"));
+- backup.remove();
+- }
+- break;
+- case VCalConduitSettings::eCalendarResource:
+- fCalendar->save();
+- break;
+- default:
+- break;
+- }
+- fCalendar->close();
+- }
+- KPILOT_DELETE(fCalendar);
+- KPILOT_DELETE(fP);
+-
+- emit syncDone(this);
+-}
+-
+-
+-
+-void VCalConduitBase::postSync()
+-{
+- FUNCTIONSETUP;
+-}
+-
+-
+-KCal::Incidence* VCalConduitBase::addRecord(PilotRecord *r)
+-{
+- FUNCTIONSETUP;
+-
+- recordid_t id=fLocalDatabase->writeRecord(r);
+-#ifdef DEBUG
+- DEBUGCONDUIT<<fname<<": Pilot Record ID="<<r->id()<<", backup ID="<<id<<endl;
++ DEBUGCONDUIT<<fname<<": Pilot Record ID = " << r->id() << ", backup ID = "
++ << id << endl;
+ #else
+ Q_UNUSED(id);
+ #endif
+
+- PilotAppCategory *de=newPilotEntry(r);
+- KCal::Incidence*e =0L;
++ PilotAppCategory *de = newPilotEntry( r );
++ KCal::Incidence*e = 0L;
+
+- if (de)
++ if ( de )
+ {
+- e=fP->findIncidence(r->id());
+- if (!e)
++ e = fP->findIncidence( r->id() );
++ if ( !e )
+ {
+ // no corresponding entry found, so create, copy and insert it.
+- e=newIncidence();
+- incidenceFromRecord(e,de);
+- fP->addIncidence(e);
++ e = newIncidence();
++ incidenceFromRecord( e, de );
++ fP->addIncidence( e );
+ }
+ else
+ {
+ // similar entry found, so just copy, no need to insert again
+- incidenceFromRecord(e,de);
++ incidenceFromRecord( e, de );
+ }
+ }
+- KPILOT_DELETE(de);
++ KPILOT_DELETE( de );
+ return e;
+ }
+
+-// return how to resolve conflicts. for now PalmOverrides=0=false, PCOverrides=1=true, Ask=2-> ask the user using a messagebox
+-int VCalConduitBase::resolveConflict(KCal::Incidence*e, PilotAppCategory*de) {
+- if (getConflictResolution()==SyncAction::eAskUser)
++int VCalConduitBase::resolveConflict( KCal::Incidence *e, PilotAppCategory *de ) {
++ if ( getConflictResolution() == SyncAction::eAskUser )
+ {
+ // TODO: This is messed up!!!
+- QString query = i18n("The following item was modified "
+- "both on the Handheld and on your PC:\nPC entry:\n\t");
++ QString query = i18n( "The following item was modified "
++ "both on the Handheld and on your PC:\nPC entry:\n\t" );
+ query += e->summary();
+- query += i18n("\nHandheld entry:\n\t");
+- query += getTitle(de);
+- query += i18n("\n\nWhich entry do you want to keep? It will "
+- "overwrite the other entry.");
++ query += i18n( "\nHandheld entry:\n\t" );
++ query += getTitle( de );
++ query += i18n( "\n\nWhich entry do you want to keep? It will "
++ "overwrite the other entry." );
+
+ return KMessageBox::No == questionYesNo(
+ query,
+- i18n("Conflicting Entries"),
++ i18n( "Conflicting Entries" ),
+ QString::null,
+ 0 /* Never timeout */,
+- i18n("Handheld"), i18n("PC"));
++ i18n( "Handheld" ), i18n( "PC" ));
+ }
+ return getConflictResolution();
+ }
+@@ -681,41 +452,43 @@ KCal::Incidence*VCalConduitBase::changeR
+ {
+ FUNCTIONSETUP;
+
+- PilotAppCategory*de=newPilotEntry(r);
+- KCal::Incidence *e = fP->findIncidence(r->id());
+-#ifdef DEBUG
+- DEBUGCONDUIT<<fname<<": Pilot Record ID: ["<<r->id() << "]" <<endl;
+-#endif
++ PilotAppCategory *de = newPilotEntry( r );
++ KCal::Incidence *e = fP->findIncidence( r->id() );
+
+- if (e && de)
++ DEBUGCONDUIT << fname << ": Pilot Record ID: [" << r->id() << "]" << endl;
++
++ if ( e && de )
+ {
+ // TODO: check for conflict, and if there is one, ask for resolution
+- if ( (e->syncStatus()!=KCal::Incidence::SYNCNONE) && (r->isDirty() ) )
++ if ( ( e->syncStatus() != KCal::Incidence::SYNCNONE )
++ && r->isModified() )
+ {
+ // TODO: I have not yet found a way to complete ignore an item
+- if (resolveConflict(e, de))
++ if (resolveConflict( e, de ) )
+ {
+ // PC record takes precedence:
+- KPILOT_DELETE(de);
++ KPILOT_DELETE( de );
+ return e;
+ }
+ }
+ // no conflict or conflict resolution says, Palm overwrites, so do it:
+- incidenceFromRecord(e,de);
+- e->setSyncStatus(KCal::Incidence::SYNCNONE);
+- fLocalDatabase->writeRecord(r);
++ incidenceFromRecord( e, de );
++ e->setSyncStatus( KCal::Incidence::SYNCNONE );
++ fLocalDatabase->writeRecord( r );
+ }
+ else
+ {
+- kdWarning() << k_funcinfo << ": While changing record -- not found in iCalendar" << endl;
+- addRecord(r);
++ kdWarning() << k_funcinfo
++ << ": While changing record -- not found in iCalendar" << endl;
++ addRecord( r );
+ }
+- KPILOT_DELETE(de);
++
++ KPILOT_DELETE( de );
+ return e;
+ }
+
+
+-KCal::Incidence*VCalConduitBase::deleteRecord(PilotRecord *r, PilotRecord *)
++KCal::Incidence*VCalConduitBase::deleteRecord( PilotRecord *r, PilotRecord * )
+ {
+ FUNCTIONSETUP;
+
+@@ -725,84 +498,80 @@ KCal::Incidence*VCalConduitBase::deleteR
+ // RemoveEvent also takes it out of the calendar.
+ fP->removeIncidence(e);
+ }
+- fLocalDatabase->writeRecord(r);
++ fLocalDatabase->writeRecord( r );
+ return NULL;
+ }
+
+
+-void VCalConduitBase::addPalmRecord(KCal::Incidence*e)
++void VCalConduitBase::addPalmRecord( KCal::Incidence *e )
+ {
+ FUNCTIONSETUP;
+
+- PilotAppCategory*de=newPilotEntry(NULL);
+- updateIncidenceOnPalm(e, de);
+- KPILOT_DELETE(de);
++ PilotAppCategory *de = newPilotEntry( NULL );
++ updateIncidenceOnPalm( e, de );
++ KPILOT_DELETE( de );
+ }
+
+
+ void VCalConduitBase::changePalmRecord(KCal::Incidence*e, PilotRecord*s)
+ {
+- PilotAppCategory*de=newPilotEntry(s);
+- updateIncidenceOnPalm(e, de);
+- KPILOT_DELETE(de);
++ PilotAppCategory *de = newPilotEntry( s );
++ updateIncidenceOnPalm( e, de );
++ KPILOT_DELETE( de );
+ }
+
+
+-void VCalConduitBase::deletePalmRecord(KCal::Incidence*e, PilotRecord*s)
++void VCalConduitBase::deletePalmRecord( KCal::Incidence *e, PilotRecord *s )
+ {
+ FUNCTIONSETUP;
+- if (s)
++ if ( s )
+ {
+-#ifdef DEBUG
+ DEBUGCONDUIT << fname << ": deleting record " << s->id() << endl;
+-#endif
+ s->setDeleted();
+- fDatabase->writeRecord(s);
+- fLocalDatabase->writeRecord(s);
++ fDatabase->writeRecord( s );
++ fLocalDatabase->writeRecord( s );
+ }
+ else
+ {
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname << ": could not find record to delete (" << e->pilotId() << ")" << endl;
+-#endif
++ DEBUGCONDUIT << fname << ": could not find record to delete (";
++ DEBUGCONDUIT << e->pilotId() << ")" << endl;
+ }
+
+ Q_UNUSED(e);
+ }
+
+-
+ /* I have to use a pointer to an existing PilotDateEntry so that I can handle
+ new records as well (and to prevent some crashes concerning the validity
+ domain of the PilotRecord*r). In syncEvent this PilotDateEntry is created. */
+-void VCalConduitBase::updateIncidenceOnPalm(KCal::Incidence*e, PilotAppCategory*de)
++void VCalConduitBase::updateIncidenceOnPalm( KCal::Incidence *e
++ , PilotAppCategory *de )
+ {
+ FUNCTIONSETUP;
+- if (!de || !e ) {
+-#ifdef DEBUG
+- DEBUGCONDUIT<<fname<<": NULL event given... Skipping it"<<endl;
+-#endif
++ if ( !de || !e ) {
++ DEBUGCONDUIT << fname << ": NULL event given... Skipping it" << endl;
+ return;
+ }
+- if (e->syncStatus()==KCal::Incidence::SYNCDEL)
++
++ if ( e->syncStatus() == KCal::Incidence::SYNCDEL )
+ {
+-#ifdef DEBUG
+- DEBUGCONDUIT<<fname<<": don't write deleted incidence "<<e->summary()<<" to the palm"<<endl;
+-#endif
++ DEBUGCONDUIT << fname << ": don't write deleted incidence "
++ << e->summary() << " to the palm" << endl;
+ return;
+ }
+- PilotRecord*r=recordFromIncidence(de, e);
++
++ PilotRecord *r = recordFromIncidence( de, e );
+
+ // TODO: Check for conflict!
+- if (r)
++ if ( r )
+ {
+ recordid_t id=fDatabase->writeRecord(r);
+ r->setID(id);
+ // r->setAttrib(r->getAttrib() & ~dlpRecAttrDeleted);
+- fLocalDatabase->writeRecord(r);
++ fLocalDatabase->writeRecord( r );
+ // fDatabase->writeRecord(r);
+- e->setPilotId(id);
+- e->setSyncStatus(KCal::Incidence::SYNCNONE);
+- KPILOT_DELETE(r);
++ e->setPilotId( id );
++ e->setSyncStatus( KCal::Incidence::SYNCNONE );
++ KPILOT_DELETE( r );
+ }
+ }
+
+@@ -811,4 +580,25 @@ const QString VCalConduitBase::dbname()
+ return QString::null;
+ }
+
++PilotRecord *VCalConduitBase::readRecordByIndex( int index )
++{
++ FUNCTIONSETUP;
++ return fDatabase->readRecordByIndex( index );
++}
++
++KCal::Incidence *VCalConduitBase::incidenceFromRecord( PilotRecord *r )
++{
++ FUNCTIONSETUP;
++ PilotAppCategory *pac = newPilotEntry( r );
++ KCal::Incidence *i = newIncidence();
++ incidenceFromRecord( i, pac );
++
++ KPILOT_DELETE( pac );
++ return i;
++}
+
++void VCalConduitBase::setState( ConduitState *s )
++{
++ KPILOT_DELETE( fState );
++ fState = s;
++};
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/vcal-conduitbase.h kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/vcal-conduitbase.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/vcal-conduitbase.h 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/vcal-conduitbase.h 2006-11-19 22:21:12.000000000 +0100
+@@ -30,6 +30,8 @@
+ */
+
+ #include <plugin.h>
++#include <qstring.h>
++#include <libkcal/calendarlocal.h>
+
+
+ namespace KCal
+@@ -44,6 +46,7 @@ class PilotLocalDatabase;
+ class PilotAppCategory;
+ class VCalConduitSettings;
+
++class ConduitState;
+
+ class VCalConduitPrivateBase
+ {
+@@ -51,95 +54,148 @@ protected:
+ bool reading;
+ KCal::Calendar *fCalendar;
+ public:
+- VCalConduitPrivateBase(KCal::Calendar *buddy):fCalendar(buddy) { reading=false;};
+-
+- virtual int updateIncidences()=0;
+- virtual void addIncidence(KCal::Incidence*)=0;
+- virtual void removeIncidence(KCal::Incidence *)=0;
+- virtual KCal::Incidence *findIncidence(recordid_t)=0;
+- virtual KCal::Incidence *findIncidence(PilotAppCategory*tosearch)=0;
+- virtual KCal::Incidence *getNextIncidence()=0;
+- virtual KCal::Incidence *getNextModifiedIncidence()=0;
++ VCalConduitPrivateBase(KCal::Calendar *buddy) : fCalendar(buddy)
++ {
++ reading = false;
++ };
++
++ virtual ~VCalConduitPrivateBase() { } ;
++
++ virtual int updateIncidences() = 0;
++ virtual void addIncidence(KCal::Incidence*) = 0;
++ virtual void removeIncidence(KCal::Incidence*) = 0;
++ virtual KCal::Incidence *findIncidence(recordid_t) = 0;
++ virtual KCal::Incidence *findIncidence(PilotAppCategory *tosearch) = 0;
++ virtual KCal::Incidence *getNextIncidence() = 0;
++ virtual KCal::Incidence *getNextModifiedIncidence() = 0;
+ virtual int count()=0;
+ } ;
+
+-
+-
+ class VCalConduitBase : public ConduitAction
+ {
+ Q_OBJECT
+ public:
+- VCalConduitBase(KPilotDeviceLink *,
+- const char *name=0L,
++ VCalConduitBase(KPilotLink *,
++ const char *name = 0L,
+ const QStringList &args = QStringList());
+ virtual ~VCalConduitBase();
+
++/*********************************************************************
++ D A T A M E M B E R S , S E T T I N G S
++ *********************************************************************/
+ protected:
++ KCal::Calendar *fCalendar;
++ QString fCalendarFile;
++ VCalConduitPrivateBase *fP;
++ ConduitState *fState;
++ bool hasNextRecord;
++
++ virtual const QString dbname() = 0;
++ virtual const QString getTitle(PilotAppCategory *de) = 0;
++ virtual void readConfig();
++
+ virtual bool exec();
+
+ protected slots:
+ /**
+- * This function is called to sync modified records from the Pilot to KOrganizer.
+- */
+- void slotPalmRecToPC();
+- /**
+- * This function goes the other way around: KOrganizer -> Pilot.
+- */
+- void slotPCRecToPalm();
+- void slotDeletedIncidence();
+- void cleanup();
++ * This slot is used to execute the actions applicable to this conduit. What
++ * happens in this method is defined by the state the conduit has at the
++ * moment that this method is called. For more information about the actions
++ * that are executed, look at the classes that are implementing ConduitState.
++ */
++ void slotProcess();
+
++public:
++ // Maybe it's better to make this methods public in ConduitAction. They need
++ // to be public so that the state classes can access them.
++ const SyncMode &syncMode() const { return ConduitAction::syncMode(); };
++ bool isFullSync() const { return ConduitAction::isFullSync(); };
++ bool isFirstSync() const { return ConduitAction::isFirstSync(); };
++
++ /**
++ * Method used by state classes to indicatie if there are more records to
++ * deal with.
++ */
++ void setHasNextRecord( bool b) { hasNextRecord = b; };
++
++ /**
++ * Change the current state of the conduit. The state that the conduit has
++ * at the moment of the call will be deleted. The last state *must* set the
++ * state to 0L when finished.
++ */
++ void setState( ConduitState *s );
+
+-protected:
++ /**
++ * Returns the privatebase, that is used to for accessing the local calendar.
++ */
++ VCalConduitPrivateBase *privateBase() const { return fP; };
+
+- virtual int resolveConflict(KCal::Incidence*e, PilotAppCategory*de);
++ /**
++ * Returns the record at index from the palm or 0L if there is no record at
++ * index.
++ */
++ PilotRecord *readRecordByIndex( int index );
+
+- // add, change or delete events from the calendar
+- virtual KCal::Incidence* addRecord(PilotRecord *);
+- virtual KCal::Incidence* changeRecord(PilotRecord *,PilotRecord *);
+- virtual KCal::Incidence* deleteRecord(PilotRecord *,PilotRecord *);
++ /**
++ * Returns a KCal::Incidence constructed from PilotRecord r. If r is 0L the
++ * it will return a KCal::Incidence that is empty.
++ */
++ KCal::Incidence *incidenceFromRecord( PilotRecord *r );
++
++ virtual void preIncidence( KCal::Incidence* ) {};
++
++ // Getters
++ KCal::Calendar *calendar() const { return fCalendar; };
++ QString calendarFile() const { return fCalendarFile; };
++
++ virtual VCalConduitSettings *config() = 0;
++ virtual PilotDatabase *database() const { return fDatabase; };
++ virtual PilotDatabase *localDatabase() const { return fLocalDatabase; };
+
+ // add, change or delete records from the palm
+- virtual void addPalmRecord(KCal::Incidence*e);
+- virtual void changePalmRecord(KCal::Incidence*e, PilotRecord*s);
+- virtual void deletePalmRecord(KCal::Incidence*e, PilotRecord*s);
++ virtual void addPalmRecord( KCal::Incidence *e );
++ virtual void changePalmRecord( KCal::Incidence *e, PilotRecord *s );
++ virtual void deletePalmRecord( KCal::Incidence *e, PilotRecord *s );
+
+- virtual void updateIncidenceOnPalm(KCal::Incidence*e, PilotAppCategory*de);
+-
+- virtual void readConfig();
+- virtual bool openCalendar();
+-
+- // THESE NEED TO BE IMPLEMENTED BY CHILD CLASSES!!!!
+-
+- // create events from Palm records or vice versa
+- virtual PilotRecord*recordFromIncidence(PilotAppCategory*de, const KCal::Incidence*e)=0;
+- virtual KCal::Incidence *incidenceFromRecord(KCal::Incidence *e, const PilotAppCategory *de)=0;
+-
+- virtual PilotAppCategory*newPilotEntry(PilotRecord*r)=0;
+- virtual KCal::Incidence*newIncidence()=0;
+-
+-
+- // general settings, implemented by child classes for the conduits
+- virtual const QString dbname() = 0;
+-
+- virtual const QString getTitle(PilotAppCategory*de)=0;
+-
+- // THESE *CAN* BE IMPLEMTED BY CHILD CLASSES
+- // execute something at the beginning or end of the sync.
+- virtual void preSync(){};
+- virtual void postSync();
+- virtual void preRecord(PilotRecord*){};
+- virtual void preIncidence(KCal::Incidence *){};
++ // add, change or delete events from the calendar
++ virtual KCal::Incidence* changeRecord( PilotRecord*, PilotRecord* );
++ virtual KCal::Incidence* deleteRecord( PilotRecord*, PilotRecord* );
++ virtual KCal::Incidence* addRecord( PilotRecord * );
++
++/*********************************************************************
++ P R E - A N D P O S T S Y N C F U N C T I O N S
++ *********************************************************************/
++ virtual void preSync() {};
++ virtual void postSync() {};
++ virtual void preRecord(PilotRecord*) {};
+
+ protected:
+- KCal::Calendar *fCalendar;
+- int pilotindex;
+- QString fCalendarFile;
++ virtual void updateIncidenceOnPalm(KCal::Incidence *e, PilotAppCategory *de);
+
+-protected:
+- virtual VCalConduitSettings *config()=0;
+- VCalConduitPrivateBase*fP;
+- virtual VCalConduitPrivateBase* newVCalPrivate(KCal::Calendar *fCalendar)=0;
++/*********************************************************************
++ S Y N C F U N C T I O N S
++ for creating events from Palm records or vice versa
++ *********************************************************************/
++ virtual PilotRecord *recordFromIncidence(PilotAppCategory *de,
++ const KCal::Incidence *e) = 0;
++ virtual PilotAppCategory *newPilotEntry(PilotRecord *r) = 0;
++
++ virtual KCal::Incidence *newIncidence() = 0;
++ virtual KCal::Incidence *incidenceFromRecord(KCal::Incidence *e,
++ const PilotAppCategory *de) = 0;
++
++/*********************************************************************
++ M I S C F U N C T I O N S
++ *********************************************************************/
++ /**
++ * Return how to resolve conflicts. For now
++ * PalmOverrides=0=false,
++ * PCOverrides=1=true,
++ * Ask=2-> ask the user using a messagebox
++ */
++ virtual int resolveConflict(KCal::Incidence *e, PilotAppCategory *de);
++ virtual bool openCalendar();
++ virtual VCalConduitPrivateBase *newVCalPrivate(KCal::Calendar *fCalendar) = 0;
+ } ;
+
+ #endif
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/vcal-conduit.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/vcal-conduit.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/vcal-conduit.cc 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/vcal-conduit.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -31,17 +31,23 @@
+ #include <qtextcodec.h>
+ #include <libkcal/calendar.h>
+ #include <libkcal/recurrence.h>
++
+ #define Recurrence_t KCal::Recurrence
+ #include <pilotDateEntry.h>
+ #include <pilotDatabase.h>
++
+ #include "vcal-conduit.moc"
+-#include "vcal-factory.h"
++#include "vcalconduitSettings.h"
++
++// Include for testpurposes
++#include <libkcal/calendarlocal.h>
++#include <libkcal/vcalformat.h>
+
+ extern "C"
+ {
+
+ long version_conduit_vcal = KPILOT_PLUGIN_API;
+-const char *id_conduit_vcal = "$Id: vcal-conduit.cc 450417 2005-08-18 06:07:11Z vanrijn $";
++const char *id_conduit_vcal = "$Id: vcal-conduit.cc 247 adridg$";
+
+ }
+
+@@ -76,6 +82,10 @@ void VCalConduitPrivate::removeIncidence
+ fAllEvents.remove(dynamic_cast<KCal::Event*>(e));
+ if (!fCalendar) return;
+ fCalendar->deleteEvent(dynamic_cast<KCal::Event*>(e));
++ // now just in case we're in the middle of reading through our list
++ // and we delete something, set reading to false so we start at the
++ // top again next time and don't have problems with our iterator
++ reading = false;
+ }
+
+
+@@ -158,7 +168,7 @@ KCal::Incidence *VCalConduitPrivate::get
+ * VCalConduit class *
+ ****************************************************************************/
+
+-VCalConduit::VCalConduit(KPilotDeviceLink *d,
++VCalConduit::VCalConduit(KPilotLink *d,
+ const char *n,
+ const QStringList &a) : VCalConduitBase(d,n,a)
+ {
+@@ -185,8 +195,8 @@ void VCalConduit::_getAppInfo()
+ FUNCTIONSETUP;
+ // get the address application header information
+ unsigned char *buffer =
+- new unsigned char[PilotRecord::APP_BUFFER_SIZE];
+- int appLen = fDatabase->readAppBlock(buffer,PilotRecord::APP_BUFFER_SIZE);
++ new unsigned char[Pilot::MAX_APPINFO_SIZE];
++ int appLen = fDatabase->readAppBlock(buffer,Pilot::MAX_APPINFO_SIZE);
+
+ unpack_AppointmentAppInfo(&fAppointmentAppInfo, buffer, appLen);
+ delete[]buffer;
+@@ -247,6 +257,7 @@ PilotRecord*VCalConduit::recordFromIncid
+ setExceptions(de, e);
+ de->setDescription(e->summary());
+ de->setNote(e->description());
++ de->setLocation(e->location());
+ setCategory(de, e);
+ DEBUGCONDUIT<<"-------- "<<e->summary()<<endl;
+ return de->pack();
+@@ -292,6 +303,7 @@ KCal::Event *VCalConduit::incidenceFromR
+ DEBUGCONDUIT<<fname<<": DESCRIPTION: "<<de->getDescription()<<" ---------------------------------------------------"<<endl;
+ #endif
+ e->setDescription(de->getNote());
++ e->setLocation(de->getLocation());
+
+ // used by e.g. Agendus and Datebk
+ setCategory(e, de);
+@@ -777,10 +789,10 @@ void VCalConduit::setCategory(KCal::Even
+ // if this event only has one category associated with it, then we can
+ // safely assume that what we should be doing here is changing it to match
+ // the palm. if there's already more than one category in the event, however, we
+- // won't cause data loss--we'll just append what the palm has to the
++ // won't cause data loss--we'll just append what the palm has to the
+ // event's categories
+ if (cats.count() <=1) cats.clear();
+-
++
+ cats.append( newcat );
+ e->setCategories(cats);
+ }
+@@ -788,17 +800,31 @@ void VCalConduit::setCategory(KCal::Even
+ }
+
+
+-PilotAppCategory*VCalConduit::newPilotEntry(PilotRecord*r)
++PilotAppCategory* VCalConduit::newPilotEntry(PilotRecord*r)
+ {
+ if (r) return new PilotDateEntry(fAppointmentAppInfo,r);
+ else return new PilotDateEntry(fAppointmentAppInfo);
+ }
+
+-KCal::Incidence*VCalConduit::newIncidence()
++KCal::Incidence* VCalConduit::newIncidence()
+ {
+ return new KCal::Event;
+ }
+
++static VCalConduitSettings *config_vcal = 0L;
++
++VCalConduitSettings *VCalConduit::theConfig() {
++ if (!config_vcal)
++ {
++ config_vcal = new VCalConduitSettings(CSL1("Calendar"));
++ }
++
++ return config_vcal;
++}
++
+ VCalConduitSettings *VCalConduit::config() {
+- return VCalConduitFactory::config();
++ return theConfig();
+ }
++
++
++
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/vcal-conduit.h kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/vcal-conduit.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/vcal-conduit.h 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/vcal-conduit.h 2006-11-19 22:21:12.000000000 +0100
+@@ -52,7 +52,9 @@ public:
+ virtual void addIncidence(KCal::Incidence*);
+ virtual void removeIncidence(KCal::Incidence *);
+ virtual KCal::Incidence *findIncidence(recordid_t);
+- /** Find the incidence based on tosearch's description and date information. Returns 0L if no incidence could be found.
++ /**
++ * Find the incidence based on tosearch's description and date information.
++ * Returns 0L if no incidence could be found.
+ */
+ virtual KCal::Incidence *findIncidence(PilotAppCategory*tosearch);
+ virtual KCal::Incidence *getNextIncidence();
+@@ -66,7 +68,7 @@ class VCalConduit : public VCalConduitBa
+ {
+ Q_OBJECT
+ public:
+- VCalConduit(KPilotDeviceLink *,
++ VCalConduit(KPilotLink *,
+ const char *name=0L,
+ const QStringList &args = QStringList());
+ virtual ~VCalConduit();
+@@ -85,14 +87,16 @@ protected:
+ virtual KCal::Incidence*newIncidence();
+ virtual const QString getTitle(PilotAppCategory*de);
+ virtual VCalConduitSettings *config();
++public:
++ static VCalConduitSettings *theConfig();
+
+ protected:
+ virtual PilotRecord *recordFromIncidence(PilotAppCategory*de, const KCal::Incidence*e);
+ virtual PilotRecord *recordFromIncidence(PilotDateEntry*de, const KCal::Event*e);
+- virtual KCal::Incidence *incidenceFromRecord(KCal::Incidence *, const PilotAppCategory *);
++ virtual KCal::Incidence *incidenceFromRecord(KCal::Incidence *,
++ const PilotAppCategory *);
+ virtual KCal::Event *incidenceFromRecord(KCal::Event *, const PilotDateEntry *);
+
+-
+ void setStartEndTimes(KCal::Event *,const PilotDateEntry *);
+ void setAlarms(KCal::Event *,const PilotDateEntry *);
+ void setRecurrence(KCal::Event *,const PilotDateEntry *);
+@@ -106,7 +110,6 @@ protected:
+ void setCategory(PilotDateEntry *, const KCal::Event *);
+ void setCategory(KCal::Event *, const PilotDateEntry *);
+ struct AppointmentAppInfo fAppointmentAppInfo;
+-
+-} ;
++};
+
+ #endif
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/vcal-factorybase.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/vcal-factorybase.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/vcal-factorybase.cc 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/vcal-factorybase.cc 1970-01-01 01:00:00.000000000 +0100
+@@ -1,41 +0,0 @@
+-/* vcal-factory.cc KPilot
+-**
+-** Copyright (C) 2002-2003 Reinhold Kainhofer
+-** Copyright (C) 2001 by Dan Pilone
+-**
+-** This file defines the factory for the vcal-conduit plugin.
+-*/
+-
+-/*
+-** This program 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.
+-**
+-** This program 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 this program in a file called COPYING; if not, write to
+-** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+-** MA 02110-1301, USA.
+-*/
+-
+-/*
+-** Bug reports and questions can be sent to kde-pim at kde.org
+-*/
+-#include <kaboutdata.h>
+-
+-#include "vcal-factorybase.moc"
+-#include "options.h"
+-
+-KAboutData *VCalConduitFactoryBase::fAbout = 0L;
+-
+-
+-VCalConduitFactoryBase::~VCalConduitFactoryBase()
+-{
+- KPILOT_DELETE(fAbout);
+-}
+-
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/vcal-factorybase.h kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/vcal-factorybase.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/vcal-factorybase.h 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/vcal-factorybase.h 2006-11-19 22:21:12.000000000 +0100
+@@ -30,7 +30,6 @@
+ ** Bug reports and questions can be sent to kde-pim at kde.org
+ */
+
+-#include <klibloader.h>
+
+ #define RES_PALMOVERRIDES 0
+ #define RES_PCOVERRIDES 1
+@@ -41,24 +40,5 @@
+ #define SYNC_FULL 2
+ #define SYNC_MAX SYNC_FULL
+
+-class KAboutData;
+-class VCalConduitSettings;
+-
+-class VCalConduitFactoryBase : public KLibFactory
+-{
+- Q_OBJECT
+-
+-public:
+- VCalConduitFactoryBase(QObject * p= 0L,const char * n= 0L):KLibFactory(p,n){};
+- virtual ~VCalConduitFactoryBase();
+- static KAboutData *about() { return fAbout; };
+-
+-protected:
+- virtual QObject* createObject( QObject* parent = 0,
+- const char* name = 0,
+- const char* classname = "QObject",
+- const QStringList &args = QStringList() )=0;
+- static KAboutData *fAbout;
+-};
+
+ #endif
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/vcal-factory.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/vcal-factory.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/vcal-factory.cc 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/vcal-factory.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -31,120 +31,20 @@
+
+ #include <kaboutdata.h>
+
++#include "pluginfactory.h"
++
+ #include "vcal-setup.h"
+ #include "vcal-conduit.h"
+-#include "vcal-factory.moc"
+-#include "vcalconduitSettings.h"
+
+ extern "C"
+ {
+
+ void *init_conduit_vcal()
+ {
+- return new VCalConduitFactory;
+-}
+-
+-}
+-
+-
+-VCalConduitSettings* VCalConduitFactory::fConfig=0L;
+-
+-VCalConduitFactory::VCalConduitFactory(QObject *p, const char *n) :
+- VCalConduitFactoryBase(p,n)
+-{
+- FUNCTIONSETUP;
+-
+- fInstance = new KInstance("vcalconduit");
+- fAbout = new KAboutData("vcalConduit",
+- I18N_NOOP("VCal Conduit for KPilot"),
+- KPILOT_VERSION,
+- I18N_NOOP("Configures the VCal Conduit for KPilot"),
+- KAboutData::License_GPL,
+- "(C) 2001, Adriaan de Groot\n(C) 2002-2003, Reinhold Kainhofer");
+- fAbout->addAuthor("Adriaan de Groot",
+- I18N_NOOP("Maintainer"),
+- "groot at kde.org",
+- "http://www.cs.kun.nl/~adridg/kpilot");
+- fAbout->addAuthor("Reinhold Kainhofer",
+- I18N_NOOP("Maintainer"),
+- "reinhold at kainhofer.com",
+- "http://reinhold.kainhofer.com/Linux/");
+- fAbout->addAuthor("Dan Pilone",
+- I18N_NOOP("Original Author"));
+- fAbout->addAuthor("Preston Brown",
+- I18N_NOOP("Original Author"));
+- fAbout->addAuthor("Herwin-Jan Steehouwer",
+- I18N_NOOP("Original Author"));
+- fAbout->addCredit("Cornelius Schumacher",
+- I18N_NOOP("iCalendar port"));
+- fAbout->addCredit("Philipp Hullmann",
+- I18N_NOOP("Bugfixer"));
+-}
+-
+-VCalConduitFactory::~VCalConduitFactory()
+-{
+- FUNCTIONSETUP;
+-
+- KPILOT_DELETE(fInstance);
++ return new ConduitFactory<VCalWidgetSetup,VCalConduit>;
+ }
+
+-VCalConduitSettings* VCalConduitFactory::config()
+-{
+- if (!fConfig) {
+- fConfig = new VCalConduitSettings(CSL1("Calendar"));
+- if (fConfig) fConfig->readConfig();
+- }
+- return fConfig;
+ }
+
+-/* virtual */ QObject *VCalConduitFactory::createObject( QObject *p,
+- const char *n,
+- const char *c,
+- const QStringList &a)
+-{
+- FUNCTIONSETUP;
+
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
+- << ": Creating object of class "
+- << c
+- << endl;
+-#endif
+-
+- if (qstrcmp(c,"ConduitConfigBase")==0)
+- {
+- QWidget *w = dynamic_cast<QWidget *>(p);
+-
+- if (w)
+- {
+- return new VCalWidgetSetup(w,n);
+- }
+- else
+- {
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
+- << ": Couldn't cast parent to widget."
+- << endl;
+-#endif
+- return 0L;
+- }
+- }
+- else
+- if (qstrcmp(c,"SyncAction")==0)
+- {
+- KPilotDeviceLink *d = dynamic_cast<KPilotDeviceLink *>(p);
+-
+- if (d)
+- {
+- return new VCalConduit(d,n,a);
+- }
+- else
+- {
+- kdError() << k_funcinfo
+- << ": Couldn't cast to KPilotDeviceLink."
+- << endl;
+- }
+- }
+
+- return 0L;
+-}
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/vcal-factory.h kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/vcal-factory.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/vcal-factory.h 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/vcal-factory.h 2006-11-19 22:21:12.000000000 +0100
+@@ -30,30 +30,6 @@
+ ** Bug reports and questions can be sent to kde-pim at kde.org
+ */
+
+-#include "vcal-factorybase.h"
+-
+-class KInstance;
+-class KAboutData;
+-class VCalConduitSettings;
+-
+-class VCalConduitFactory : public VCalConduitFactoryBase
+-{
+- Q_OBJECT
+-
+-public:
+- VCalConduitFactory(QObject * = 0L,const char * = 0L);
+- virtual ~VCalConduitFactory();
+- static VCalConduitSettings*config();
+-
+-protected:
+- virtual QObject* createObject( QObject* parent = 0,
+- const char* name = 0,
+- const char* classname = "QObject",
+- const QStringList &args = QStringList() );
+-private:
+- KInstance *fInstance;
+- static VCalConduitSettings*fConfig;
+-};
+
+ extern "C"
+ {
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/vcal-setup.cc kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/vcal-setup.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/conduits/vcalconduit/vcal-setup.cc 2005-09-10 10:24:38.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/conduits/vcalconduit/vcal-setup.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -30,10 +30,10 @@
+ #include "options.h"
+
+ #include <qbuttongroup.h>
+-#include <klocale.h>
++#include <kaboutdata.h>
+
+ #include "korganizerConduit.h"
+-#include "vcal-factory.h"
++#include "vcal-conduit.h"
+ #include "vcal-setup.h"
+
+ #include "uiDialog.h"
+@@ -41,7 +41,32 @@
+ VCalWidgetSetup::VCalWidgetSetup(QWidget *w, const char *n) :
+ VCalWidgetSetupBase(w,n)
+ {
+- UIDialog::addAboutPage(fConfigWidget->tabWidget, VCalConduitFactoryBase::about());
++ KAboutData *fAbout = new KAboutData("vcalConduit",
++ I18N_NOOP("VCal Conduit for KPilot"),
++ KPILOT_VERSION,
++ I18N_NOOP("Configures the VCal Conduit for KPilot"),
++ KAboutData::License_GPL,
++ "(C) 2001, Adriaan de Groot\n(C) 2002-2003, Reinhold Kainhofer");
++ fAbout->addAuthor("Adriaan de Groot",
++ I18N_NOOP("Maintainer"),
++ "groot at kde.org",
++ "http://www.kpilot.org/");
++ fAbout->addAuthor("Reinhold Kainhofer",
++ I18N_NOOP("Maintainer"),
++ "reinhold at kainhofer.com",
++ "http://reinhold.kainhofer.com/Linux/");
++ fAbout->addAuthor("Dan Pilone",
++ I18N_NOOP("Original Author"));
++ fAbout->addAuthor("Preston Brown",
++ I18N_NOOP("Original Author"));
++ fAbout->addAuthor("Herwin-Jan Steehouwer",
++ I18N_NOOP("Original Author"));
++ fAbout->addCredit("Cornelius Schumacher",
++ I18N_NOOP("iCalendar port"));
++ fAbout->addCredit("Philipp Hullmann",
++ I18N_NOOP("Bugfixer"));
++
++ UIDialog::addAboutPage(fConfigWidget->tabWidget, fAbout);
+ fConfigWidget->fSyncDestination->setTitle(i18n("Calendar Destination"));
+ fConduitName=i18n("Calendar");
+
+@@ -51,4 +76,4 @@ VCalWidgetSetup::VCalWidgetSetup(QWidget
+ {
+ return new VCalWidgetSetup(w,n);
+ }
+-VCalConduitSettings*VCalWidgetSetup::config() { return VCalConduitFactory::config(); }
++VCalConduitSettings*VCalWidgetSetup::config() { return VCalConduit::theConfig(); }
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/config.h.cmake kdepim-3.5.5.dfsg.1/kpilot/config.h.cmake
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/config.h.cmake 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/config.h.cmake 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,19 @@
++#cmakedefine HAVE_STDINT_H
++#cmakedefine HAVE_ALLOCA_H
++#cmakedefine HAVE_SYS_TIME_H
++#cmakedefine HAVE_SYS_STAT_H
++#cmakedefine HAVE_CFSETSPEED
++#cmakedefine HAVE_STRDUP
++#cmakedefine HAVE_SETENV
++#cmakedefine HAVE_UNSETENV
++#cmakedefine HAVE_USLEEP
++#cmakedefine HAVE_RANDOM
++#cmakedefine HAVE_PUTENV
++#cmakedefine HAVE_SETEUID
++#cmakedefine HAVE_MKSTEMPS
++#cmakedefine HAVE_MKSTEMP
++#cmakedefine HAVE_MKDTEMP
++#cmakedefine HAVE_REVOKE
++#cmakedefine HAVE_STRLCPY
++#cmakedefine HAVE_STRLCAT
++#cmakedefine HAVE_INET_ATON
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/configure.in.bot kdepim-3.5.5.dfsg.1/kpilot/configure.in.bot
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/configure.in.bot 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/configure.in.bot 2006-11-19 22:21:12.000000000 +0100
+@@ -1,14 +1,16 @@
+ if test "$HAVE_PISOCK" = "0" ; then
+ echo ""
+- echo "You're missing the pisock library for kpilot."
++ echo "You're missing a compatible version of pilot-link for kpilot."
+ echo ""
+ all_tests=bad
+ else
+ if test "x$HAVE_BAD_PISOCK" = "xYES" ; then
+ echo ""
+- echo "You have a version of pilot-link < 0.11.8."
+- echo "This version is deprecated and KPilot will soon stop"
+- echo "working with it."
++ echo "You have a version of pilot-link < 0.12.1."
++ echo "This version is old and is known to cause problems"
++ echo "with KPilot. Please compile KPilot with "
++ echo "pilot-link version 0.12.1 or greater."
+ echo ""
++ all_tests=bad
+ fi
+ fi
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/configure.in.in kdepim-3.5.5.dfsg.1/kpilot/configure.in.in
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/configure.in.in 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/configure.in.in 2006-11-19 22:21:12.000000000 +0100
+@@ -129,15 +129,13 @@ if test "$HAVE_PISOCK" = "1" ; then
+ #include <pi-version.h>
+ int main()
+ { if (PILOT_LINK_VERSION==0) {
+- if ((PILOT_LINK_MAJOR==9) && (PILOT_LINK_MINOR>=5)) return (0);
+- if ((PILOT_LINK_MAJOR==10) || (PILOT_LINK_MAJOR==11)) return (0);
+- if ((PILOT_LINK_MAJOR==12)) return(0);
++ if ((PILOT_LINK_MAJOR==12) && (PILOT_LINK_MINOR>=1)) return (0);
+ }
+ return (1);
+ }
+ ]
+ ,
+- [AC_MSG_RESULT([pilot-link version >= 0.9.5 found])],
++ [AC_MSG_RESULT([pilot-link version >= 0.12.0 found])],
+ [AC_MSG_RESULT([Your version of pilot-link won't work with KPilot])]
+ HAVE_PISOCK="0"
+ ,
+@@ -145,25 +143,6 @@ if test "$HAVE_PISOCK" = "1" ; then
+ HAVE_PISOCK="0"
+ ])
+ fi
+-if test "$HAVE_PISOCK" = "1" ; then
+- AC_MSG_CHECKING([deprecated pilot-link version])
+- AC_TRY_RUN([
+- #include <pi-version.h>
+- int main()
+- { if (PILOT_LINK_VERSION==0) {
+- if ((PILOT_LINK_MAJOR<11)) return (0);
+- if ((PILOT_LINK_MAJOR==11) && (PILOT_LINK_MINOR<8)) return (0);
+- }
+- return (1);
+- }
+- ]
+- ,
+- [AC_MSG_RESULT([yes])
+- HAVE_BAD_PISOCK=YES
+- ],
+- [AC_MSG_RESULT([no])]
+- )
+-fi
+
+ if test "x$with_pilot_link" = "xCHECK" ; then
+
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/Documentation/ConduitProgrammingTutorial/index.tex kdepim-3.5.5.dfsg.1/kpilot/Documentation/ConduitProgrammingTutorial/index.tex
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/Documentation/ConduitProgrammingTutorial/index.tex 2005-11-08 23:33:41.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/Documentation/ConduitProgrammingTutorial/index.tex 2006-11-19 22:21:12.000000000 +0100
+@@ -742,7 +742,7 @@ database to not dirty.
+ \item\code{virtual int resetDBIndex()} ... Resets next record index to beginning
+ \item\code{virtual int cleanup()} ... Purges all Archived/Deleted records
+ from Palm Pilot database
+-\item\code{bool isDBOpen()} ... Returns false if the database could not be
++\item\code{bool isOpen()} ... Returns false if the database could not be
+ opened, e.g. no connection to the handheld or file could not be created.
+ \item\code{virtual QString dbPathName()} ... Returns some sensible human-readable
+ identifier for the database. Serial databases get Pilot:, local databases
+@@ -1322,14 +1322,14 @@ bool DOCConduit::doSync(docSyncInfo &sin
+ // instance which points either to a local database or a database on the handheld.
+ PilotDatabase *database = preSyncAction(sinfo);
+
+- if (database && ( !database->isDBOpen() ) ) {
++ if (database && ( !database->isOpen() ) ) {
+ DEBUGCONDUIT<<"Database "<<sinfo.dbinfo.name<<" does not yet exist. Creating it:"<<endl;
+ if (!database->createDatabase(dbcreator(), dbtype()) ) {
+ DEBUGCONDUIT<<"Failed"<<endl;
+ }
+ }
+
+- if (database && database->isDBOpen()) {
++ if (database && database->isOpen()) {
+ DOCConverter docconverter;
+ connect(&docconverter, SIGNAL(logError(const QString &)), SIGNAL(logError(const QString &)));
+ connect(&docconverter, SIGNAL(logMessage(const QString &)), SIGNAL(logMessage(const QString &)));
+@@ -1424,7 +1424,7 @@ bool DOCConduit::needsSync(docSyncInfo &
+
+ if (QFile::exists(sinfo.docfilename)) sinfo.fPCStatus=eStatNew;
+ else sinfo.fPCStatus=eStatDoesntExist;
+- if (docdb && docdb->isDBOpen()) sinfo.fPalmStatus=eStatNew;
++ if (docdb && docdb->isOpen()) sinfo.fPalmStatus=eStatNew;
+ else sinfo.fPalmStatus=eStatDoesntExist;
+ KPILOT_DELETE(docdb);
+
+@@ -1452,7 +1452,7 @@ bool DOCConduit::needsSync(docSyncInfo &
+ } else {
+ DEBUGCONDUIT<<"PC side has NOT changed!"<<endl;
+ }
+- if (!docdb || !docdb->isDBOpen()) sinfo.fPalmStatus=eStatDeleted;
++ if (!docdb || !docdb->isOpen()) sinfo.fPalmStatus=eStatDeleted;
+ else {
+ PilotRecord *firstRec = docdb->readRecordByIndex(0);
+ PilotDOCHead docHeader(firstRec);
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/Documentation/HOWTO-CODE.txt kdepim-3.5.5.dfsg.1/kpilot/Documentation/HOWTO-CODE.txt
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/Documentation/HOWTO-CODE.txt 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/Documentation/HOWTO-CODE.txt 2006-11-19 22:21:12.000000000 +0100
+@@ -13,7 +13,7 @@ KPilot works, see HOWTO-CONDUIT.txt)
+ C++ Source Code
+ ===============
+
+-There are coding guidelines for KDE somewhere. I think they say
++There are coding guidelines for KDE somewhere. I think they say
+ indent with 4 spaces, { on same line, } on separate line. I disagree,
+ so code I write -- and code I maintain -- slowly mutates to
+
+@@ -27,7 +27,7 @@ so code I write -- and code I maintain -
+ Whether or not anyone else follows is irrelevant, and I do try to
+ avoid gratuitous reformatting. Honest.
+
+-What I might do every now and then to get stuff "into shape" (and
++What I might do every now and then to get stuff "into shape" (and
+ I'd really appreciate it if you did so too before sending me patches)
+ is the following horrible invocation of indent:
+
+@@ -72,16 +72,40 @@ unfortunately, kpilotOptions.h is _KPILO
+ because the filename and the class don't always match up and not
+ every file contains a class of interest.
+
+-[I'm going to try to wrap all the #includes with the right #ifndef
+-to reduce the number of includes (for the preprocessor) and speed
+-up compilation just a little bit.] -- This paragraph has become
+-irrelevant since I found out that sensible C compilers (ie. gcc)
+-have support to handle multiple inclusion efficiently, without even
+-opening a header file more than once. It *does* mean that the #ifndef
+-needs to move to the top of the .h file, but that's no real problem.
+-
+
++DEBUG Output
++============
+
++There are macros defined in options.h (which every source file
++should include) that provide some uniform debugging output.
++These are:
++
++ * FUNCTIONSETUP - Use this at the beginning of every function
++ (or those that are vaguely interesting). This will print out
++ a call trace indicator when debugging is on. It also defines
++ a local symbol fname for use with DEBUG* below.
++ * FUNCTIONSETUPL(level) - Use this at the beginning of a function.
++ It is like FUNCTIONSETUP but only prints if the debug level
++ is at least @p level. This avoids excessive debug output from
++ common functions.
++
++For regular debugging output, use one of the three DEBUG* macros:
++
++ * DEBUGLIBRARY in code in lib/
++ * DEBUGKPILOT in code in kpilot/
++ * DEBUGCONDUIT in code in conduits/
++
++This sends the debug output to the appropriate debug area. A typical
++debug output stream looks like this:
++
++ DEBUGKPILOT << fname << ": "
++ << actual debug info
++ << endl;
++
++Here, DEBUGKPILOT depends on what bit of code is being debugged; fname
++is defined by FUNCTIONSETUP and takes care of proper indentation for
++the call trace, the colon is for consistency and the actual debug
++info can be whatever you want.
+
+ Adriaan de Groot
+ March 5th 2001
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/Documentation/patch-standalone kdepim-3.5.5.dfsg.1/kpilot/Documentation/patch-standalone
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/Documentation/patch-standalone 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/Documentation/patch-standalone 1970-01-01 01:00:00.000000000 +0100
+@@ -1,55 +0,0 @@
+-Index: conduits/vcalconduit/Makefile.am
+-===================================================================
+-RCS file: /home/kde/kdepim/kpilot/conduits/vcalconduit/Makefile.am,v
+-retrieving revision 1.51
+-diff -u -3 -p -r1.51 Makefile.am
+---- conduits/vcalconduit/Makefile.am 9 Jan 2005 18:57:11 -0000 1.51
+-+++ conduits/vcalconduit/Makefile.am 23 Apr 2005 20:05:31 -0000
+-@@ -21,16 +21,14 @@ libvcalconduit_shared_la_SOURCES = vcalc
+- vcal-conduitbase.cc
+-
+- conduit_vcal_la_SOURCES = vcal-conduit.cc vcal-factory.cc vcal-setup.cc
+--conduit_vcal_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+-+conduit_vcal_la_LDFLAGS = -module $(KDE_PLUGIN) -lkcal $(all_libraries)
+- conduit_vcal_la_LIBADD = ../../lib/libkpilot.la \
+-- ../../../libkcal/libkcal.la \
+- libvcalconduit_shared.la
+- conduit_vcal_la_COMPILE_FIRST = vcalconduitSettings.h korganizerConduit.h
+-
+- conduit_todo_la_SOURCES = todo-factory.cc todo-setup.cc todo-conduit.cc
+--conduit_todo_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+-+conduit_todo_la_LDFLAGS = -module $(KDE_PLUGIN) -lkcal $(all_libraries)
+- conduit_todo_la_LIBADD = ../../lib/libkpilot.la \
+-- ../../../libkcal/libkcal.la \
+- libvcalconduit_shared.la
+- conduit_todo_la_COMPILE_FIRST = vcalconduitSettings.h korganizerConduit.h
+-
+-Index: lib/options.h
+-===================================================================
+-RCS file: /home/kde/kdepim/kpilot/lib/options.h,v
+-retrieving revision 1.70
+-diff -u -3 -p -r1.70 options.h
+---- lib/options.h 10 Apr 2005 23:06:43 -0000 1.70
+-+++ lib/options.h 23 Apr 2005 20:05:31 -0000
+-@@ -62,7 +62,7 @@
+- // of to the KDE debugging facility (it does lose some niftiness then).
+- //
+- #ifndef DEBUG
+--// #define DEBUG (1)
+-+#define DEBUG (1)
+- #endif
+- // #define DEBUG_CERR (1)
+-
+-Index: lib/Makefile.am
+-===================================================================
+---- lib/Makefile.am (revision 437137)
+-+++ lib/Makefile.am (working copy)
+-@@ -25,7 +25,7 @@
+- recordConduit.cc
+-
+- libkpilot_la_LDFLAGS = -no-undefined $(PISOCK_LDFLAGS) $(all_libraries) $(KDE_EXTRA_RPATH) $(KDE_RPATH)
+--libkpilot_la_LIBADD = $(LIB_KDEUI) $(PISOCK_LIB) $(LIB_KABC) $(top_builddir)/libkcal/libkcal.la
+-+libkpilot_la_LIBADD = $(LIB_KDEUI) $(PISOCK_LIB) $(LIB_KABC) -lkcal
+-
+- kpilotincludedir = $(includedir)/kpilot
+- kpilotinclude_HEADERS = kpilotlink.h uiDialog.h plugin.h syncAction.h \
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/INSTALL kdepim-3.5.5.dfsg.1/kpilot/INSTALL
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/INSTALL 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/INSTALL 2006-11-19 22:21:12.000000000 +0100
+@@ -1,172 +1,34 @@
+ Basic Installation
+ ==================
+
+- These are generic installation instructions.
+
+- KPILOT IS NOT A SEPARATE PACKAGE. APPLY THESE INSTALL INSTRUCTIONS
+- TO THE PACKAGE kdepim, WHICH SHOULD BE THE DIRECTORY ABOVE THE ONE
+- CONTAINING KPILOT. YOU MAY make KPILOT BY ITSELF THOUGH, ONCE YOU
+- HAVE CONFIGURED kdepim ACCORDING TO THE INSTRUCTIONS BELOW.
+-
+- The `configure' shell script attempts to guess correct values for
+-various system-dependent variables used during compilation. It uses
+-those values to create a `Makefile' in each directory of the package.
+-It may also create one or more `.h' files containing system-dependent
+-definitions. Finally, it creates a shell script `config.status' that
+-you can run in the future to recreate the current configuration, a file
+-`config.cache' that saves the results of its tests to speed up
+-reconfiguring, and a file `config.log' containing compiler output
+-(useful mainly for debugging `configure').
+-
+- If you need to do unusual things to compile the package, please try
+-to figure out how `configure' could check whether to do them, and mail
+-diffs or instructions to the address given in the `README' so they can
+-be considered for the next release. If at some point `config.cache'
+-contains results you don't want to keep, you may remove or edit it.
+-
+- The file `configure.in' is used to create `configure' by a program
+-called `autoconf'. You only need `configure.in' if you want to change
+-it or regenerate `configure' using a newer version of `autoconf'.
+-
+-The simplest way to compile this package is:
+-
+- 1. `cd' to the directory containing the package's source code and type
+- `./configure' to configure the package for your system. If you're
+- using `csh' on an old version of System V, you might need to type
+- `sh ./configure' instead to prevent `csh' from trying to execute
+- `configure' itself.
+-
+- Running `configure' takes a while. While running, it prints some
+- messages telling which features it is checking for.
+-
+- 2. Type `make' to compile the package.
++KPilot uses the A-A-P build system ( http://www.a-a-p.org/ ) which is
++an SCons derivative. In consequence, the usualy configure, make, make
++install sequence which you may be used to does not hold. Instead,
++just run
+
+- 3. Type `make install' to install the programs and any data files and
+- documentation.
++ make
+
+- 4. You can remove the program binaries and object files from the
+- source code directory by typing `make clean'.
++in the KPilot source directory (that is the one containing this
++INSTALL file). This will run configure to determine some standard
++settings and create librool and then invoke A-A-P with the right arguments.
++Once compilation is finished, run
+
+-Compilers and Options
+-=====================
++ make install
+
+- Some systems require unusual options for compilation or linking that
+-the `configure' script does not know about. You can give `configure'
+-initial values for variables by setting them in the environment. Using
+-a Bourne-compatible shell, you can do that on the command line like
+-this:
+- CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+-
+-Or on systems that have the `env' program, you can do it like this:
+- env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+-
+-Compiling For Multiple Architectures
+-====================================
+-
+- You can compile the package for more than one kind of computer at the
+-same time, by placing the object files for each architecture in their
+-own directory. To do this, you must use a version of `make' that
+-supports the `VPATH' variable, such as GNU `make'. `cd' to the
+-directory where you want the object files and executables to go and run
+-the `configure' script. `configure' automatically checks for the
+-source code in the directory that `configure' is in and in `..'.
+-
+- If you have to use a `make' that does not supports the `VPATH'
+-variable, you have to compile the package for one architecture at a time
+-in the source code directory. After you have installed the package for
+-one architecture, use `make distclean' before reconfiguring for another
+-architecture.
++to install KPilot in the KDE directory.
+
+-Installation Names
+-==================
+
+- By default, `make install' will install the package's files in
+-`/usr/local/bin', `/usr/local/man', etc. You can specify an
+-installation prefix other than `/usr/local' by giving `configure' the
+-option `--prefix=PATH'.
+-
+- You can specify separate installation prefixes for
+-architecture-specific files and architecture-independent files. If you
+-give `configure' the option `--exec-prefix=PATH', the package will use
+-PATH as the prefix for installing programs and libraries.
+-Documentation and other data files will still use the regular prefix.
+-
+- If the package supports it, you can cause programs to be installed
+-with an extra prefix or suffix on their names by giving `configure' the
+-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+-
+-Optional Features
+-=================
+-
+- Some packages pay attention to `--enable-FEATURE' options to
+-`configure', where FEATURE indicates an optional part of the package.
+-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+-is something like `gnu-as' or `x' (for the X Window System). The
+-`README' should mention any `--enable-' and `--with-' options that the
+-package recognizes.
+-
+- For packages that use the X Window System, `configure' can usually
+-find the X include and library files automatically, but if it doesn't,
+-you can use the `configure' options `--x-includes=DIR' and
+-`--x-libraries=DIR' to specify their locations.
+-
+-Specifying the System Type
+-==========================
+-
+- There may be some features `configure' can not figure out
+-automatically, but needs to determine by the type of host the package
+-will run on. Usually `configure' can figure that out, but if it prints
+-a message saying it can not guess the host type, give it the
+-`--host=TYPE' option. TYPE can either be a short name for the system
+-type, such as `sun4', or a canonical name with three fields:
+- CPU-COMPANY-SYSTEM
+-
+-See the file `config.sub' for the possible values of each field. If
+-`config.sub' isn't included in this package, then this package doesn't
+-need to know the host type.
+-
+- If you are building compiler tools for cross-compiling, you can also
+-use the `--target=TYPE' option to select the type of system they will
+-produce code for and the `--build=TYPE' option to select the type of
+-system on which you are compiling the package.
+-
+-Sharing Defaults
+-================
+-
+- If you want to set default values for `configure' scripts to share,
+-you can create a site shell script called `config.site' that gives
+-default values for variables like `CC', `cache_file', and `prefix'.
+-`configure' looks for `PREFIX/share/config.site' if it exists, then
+-`PREFIX/etc/config.site' if it exists. Or, you can set the
+-`CONFIG_SITE' environment variable to the location of the site script.
+-A warning: not all `configure' scripts look for a site script.
+
+-Operation Controls
+-==================
+
+- `configure' recognizes the following options to control how it
+-operates.
+-
+-`--cache-file=FILE'
+- Use and save the results of the tests in FILE instead of
+- `./config.cache'. Set FILE to `/dev/null' to disable caching, for
+- debugging `configure'.
+-
+-`--help'
+- Print a summary of the options to `configure', and exit.
+-
+-`--quiet'
+-`--silent'
+-`-q'
+- Do not print messages saying which checks are being made.
+-
+-`--srcdir=DIR'
+- Look for the package's source code in directory DIR. Usually
+- `configure' can determine that directory automatically.
+-
+-`--version'
+- Print the version of Autoconf used to generate the `configure'
+- script, and exit.
++Advanced Installation
++=====================
+
+-`configure' also accepts some other, not widely useful, options.
++You can influence where the results are installed by setting DESTDIR
++in your environment before building (it must not change between build
++and install, or everything gets compiled *again*):
++
++ export DESTDIR=/tmp
++ make
++ make install
+
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/addressEditor.cc kdepim-3.5.5.dfsg.1/kpilot/kpilot/addressEditor.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/addressEditor.cc 2006-05-22 20:11:07.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/addressEditor.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -19,7 +19,7 @@
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with this program in a file called COPYING; if not, write to
+-** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ ** MA 02110-1301, USA.
+ */
+
+@@ -52,18 +52,18 @@
+ #include "addressEditor.moc"
+
+ static const char *addressEditor_id =
+- "$Id: addressEditor.cc 529452 2006-04-13 14:05:00Z mueller $";
++ "$Id: addressEditor.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ AddressEditor::AddressEditor(PilotAddress * p,
+- struct AddressAppInfo *appInfo,
++ PilotAddressInfo *appInfo,
+ QWidget * parent,
+ const char *name) :
+ KDialogBase(KDialogBase::Plain,
+ i18n("Address Editor"),
+ Ok | Cancel, Cancel,
+ parent, name, false /* non-modal */ ),
+- fDeleteOnCancel(p == 0L),
+- fAddress(p),
++ fDeleteOnCancel(p == 0L),
++ fAddress(p),
+ fAppInfo(appInfo)
+ {
+ FUNCTIONSETUP;
+@@ -116,7 +116,7 @@ QString AddressEditor::phoneLabelText(Pi
+
+ if (idx >= 0 && idx < 8) // hard-coded, no constant in pi-address.h
+ {
+- if ((s = fAppInfo->phoneLabels[idx]))
++ if ((s = fAppInfo->info()->phoneLabels[idx]))
+ {
+ ret = s;
+ ret += CSL1(":");
+@@ -134,7 +134,7 @@ void AddressEditor::fillFields()
+
+ if (fAddress == 0L)
+ {
+- fAddress = new PilotAddress(*fAppInfo);
++ fAddress = new PilotAddress(fAppInfo);
+ fDeleteOnCancel = true;
+ }
+
+@@ -256,7 +256,6 @@ void AddressEditor::initLayout()
+ fAddress->setField(entryCustom4, fCustom4Field->text());
+
+ emit(recordChangeComplete(fAddress));
+- fDeleteOnCancel = false;
+ KDialogBase::slotOk();
+ }
+
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/addressEditor.h kdepim-3.5.5.dfsg.1/kpilot/kpilot/addressEditor.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/addressEditor.h 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/addressEditor.h 2006-11-19 22:21:12.000000000 +0100
+@@ -19,7 +19,7 @@
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with this program in a file called COPYING; if not, write to
+-** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ ** MA 02110-1301, USA.
+ */
+
+@@ -32,22 +32,23 @@
+
+ #include <kdialogbase.h>
+
++#include <pilotAddress.h>
++
+ class QLineEdit;
+ class PilotAddress;
+-struct AddressAppInfo;
+
+-class AddressEditor : public KDialogBase
++class AddressEditor : public KDialogBase
+ {
+ Q_OBJECT
+
+
+ public:
+ AddressEditor(PilotAddress *address,
+- struct AddressAppInfo *appInfo,
++ PilotAddressInfo *appInfo,
+ QWidget *parent, const char *name=0L);
+ ~AddressEditor();
+
+-
++
+ signals:
+ void recordChangeComplete ( PilotAddress* );
+
+@@ -60,7 +61,7 @@ private:
+ bool fDeleteOnCancel;
+
+ PilotAddress* fAddress;
+- struct AddressAppInfo *fAppInfo;
++ PilotAddressInfo *fAppInfo;
+ // entry fields
+ QLineEdit *fCustom4Field;
+ QLineEdit *fCustom3Field;
+@@ -78,7 +79,7 @@ private:
+ QLineEdit *fLastNameField;
+ // phone labels (changing!)
+ QLabel *m_phoneLabel[5];
+-
++
+ void initLayout();
+ void fillFields();
+ QString phoneLabelText(PilotAddress *, int i);
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/addressWidget.cc kdepim-3.5.5.dfsg.1/kpilot/kpilot/addressWidget.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/addressWidget.cc 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/addressWidget.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -29,7 +29,7 @@
+ ** Bug reports and questions can be sent to kde-pim at kde.org
+ */
+ static const char *addresswidget_id =
+- "$Id: addressWidget.cc 450284 2005-08-17 20:49:09Z adridg $";
++ "$Id: addressWidget.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+
+
+@@ -146,7 +146,7 @@ void AddressWidget::showComponent()
+
+ fAddressList.clear();
+
+- if (addressDB->isDBOpen())
++ if (addressDB->isOpen())
+ {
+ KPILOT_DELETE(fAddressAppInfo);
+ fAddressAppInfo = new PilotAddressInfo(addressDB);
+@@ -447,7 +447,7 @@ void AddressWidget::slotEditRecord()
+ }
+
+ AddressEditor *editor = new AddressEditor(selectedRecord,
+- fAddressAppInfo->info(), this);
++ fAddressAppInfo, this);
+
+ connect(editor, SIGNAL(recordChangeComplete(PilotAddress *)),
+ this, SLOT(slotUpdateRecord(PilotAddress *)));
+@@ -470,7 +470,7 @@ void AddressWidget::slotCreateNewRecord(
+ //
+ PilotDatabase *myDB = new PilotLocalDatabase(dbPath(), CSL1("AddressDB"));
+
+- if (!myDB || !myDB->isDBOpen())
++ if (!myDB || !myDB->isOpen())
+ {
+ #ifdef DEBUG
+ DEBUGKPILOT << fname
+@@ -480,7 +480,7 @@ void AddressWidget::slotCreateNewRecord(
+ << " and got pointer @"
+ << (long) myDB
+ << " with status "
+- << ( myDB ? myDB->isDBOpen() : false )
++ << ( myDB ? myDB->isOpen() : false )
+ << endl;
+ #endif
+
+@@ -497,7 +497,7 @@ void AddressWidget::slotCreateNewRecord(
+ }
+
+ AddressEditor *editor = new AddressEditor(0L,
+- fAddressAppInfo->info(), this);
++ fAddressAppInfo, this);
+
+ connect(editor, SIGNAL(recordChangeComplete(PilotAddress *)),
+ this, SLOT(slotAddRecord(PilotAddress *)));
+@@ -636,7 +636,7 @@ void AddressWidget::writeAddress(PilotAd
+ PilotDatabase *myDB = addressDB;
+ bool usemyDB = false;
+
+- if (myDB == 0L || !myDB->isDBOpen())
++ if (myDB == 0L || !myDB->isOpen())
+ {
+ myDB = new PilotLocalDatabase(dbPath(), CSL1("AddressDB"));
+ usemyDB = true;
+@@ -645,7 +645,7 @@ void AddressWidget::writeAddress(PilotAd
+ // Still no valid address database...
+ //
+ //
+- if (!myDB->isDBOpen())
++ if (!myDB->isOpen())
+ {
+ #ifdef DEBUG
+ DEBUGKPILOT << fname << ": Address database is not open" <<
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/CMakeLists.txt kdepim-3.5.5.dfsg.1/kpilot/kpilot/CMakeLists.txt
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/CMakeLists.txt 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,167 @@
++link_directories(${CMAKE_BINARY_DIR}/lib ${CMAKE_CURRENT_BINARY_DIR})
++
++set(settings_SRC
++ kpilotConfig.cc
++)
++
++kde3_add_kcfg_files(settings_SRC kpilotSettings.kcfgc)
++
++set(shared_SRCS
++ ${settings_SRC}
++ syncStack.cc
++ hotSync.cc
++ interactiveSync.cc
++ logWidget.cc
++ pilotComponent.cc
++)
++
++set(shared_STUBS
++ loggerDCOP.h
++)
++
++kde3_add_dcop_skels(shared_SRCS ${shared_STUBS})
++kde3_add_dcop_stubs(shared_SRCS ${shared_STUBS})
++
++set(kcmpilot_SRCS
++ ${settings_SRC}
++ kpilotConfigWizard.cc
++ dbSelectionDialog.cc
++ kpilotConfigDialog.cc
++ conduitConfigDialog.cc
++ kpilotProbeDialog.cc
++)
++
++set(kcmpilot_KCFGS
++ kpilotConfigWizard_address.kcfgc
++ kpilotConfigWizard_notes.kcfgc
++ kpilotConfigWizard_vcal.kcfgc
++)
++
++set(kcmpilot_UIS
++ kpilotConfigDialog_device.ui
++ kpilotConfigDialog_sync.ui
++ kpilotConfigDialog_startup.ui
++ kpilotConfigDialog_viewers.ui
++ kpilotConfigDialog_backup.ui
++ kpilotConfigWizard_user.ui
++ kpilotConfigWizard_app.ui
++ dbSelection_base.ui
++)
++
++set(kcmpilot_STUBS
++ pilotDaemonDCOP.h
++)
++
++# Don't forget to include output directory, otherwise
++# the UI file won't be wrapped!
++include_directories(
++ ${CMAKE_BINARY_DIR}/lib
++ ${CMAKE_SOURCE_DIR}/lib
++ ${CMAKE_CURRENT_BINARY_DIR}
++)
++
++kde3_add_ui_files(kcmpilot_SRCS ${kcmpilot_UIS})
++kde3_add_kcfg_files(kcmpilot_SRCS ${kcmpilot_KCFGS})
++kde3_add_dcop_skels(kcmpilot_SRCS ${kcmpilot_STUBS})
++kde3_add_dcop_stubs(kcmpilot_SRCS ${kcmpilot_STUBS})
++kde3_automoc(${kcmpilot_SRCS})
++
++# Now add these generated files to the ADD_LIBRARY step
++# If this is NOT done, then the ui_*.h files will not be generated
++add_library(kcm_kpilot SHARED ${kcmpilot_SRCS})
++set_target_properties(kcm_kpilot PROPERTIES LOCATION ${KDE3_PLUGIN_INSTALL_DIR}
++ PREFIX ""
++)
++
++set(kpilotTest_SRCS
++ ${shared_SRCS}
++ main-test.cc
++)
++
++kde3_automoc(${kpilotTest_SRCS})
++add_executable(kpilotTest ${kpilotTest_SRCS})
++target_link_libraries(kpilotTest ${QT_LIBRARIES} kpilot)
++kpilot_rpath(kpilotTest)
++
++set(kpilotDaemon_SRCS
++ ${shared_SRCS}
++ fileInstaller.cc
++ internalEditorAction.cc
++ logFile.cc
++ pilotDaemon.cc
++)
++
++set(kpilot_STUBS
++ kpilotDCOP.h
++ pilotDaemonDCOP.h
++)
++
++kde3_add_dcop_skels(kpilotDaemon_SRCS ${kpilot_STUBS})
++kde3_add_dcop_stubs(kpilotDaemon_SRCS ${kpilot_STUBS})
++kde3_automoc(${kpilotDaemon_SRCS})
++add_executable(kpilotDaemon ${kpilotDaemon_SRCS})
++target_link_libraries(kpilotDaemon ${QT_LIBRARIES} kpilot)
++kpilot_rpath(kpilotDaemon)
++
++set(kpilot_SRCS
++ ${shared_SRCS}
++ kpilot.cc
++ dbviewerWidget.cc
++ dbFlagsEditor.cc
++ dbRecordEditor.cc
++ dbAppInfoEditor.cc
++ memoWidget.cc
++ addressWidget.cc
++ addressEditor.cc
++ datebookWidget.cc
++ todoWidget.cc
++ todoEditor.cc
++ fileInstaller.cc
++ fileInstallWidget.cc
++ listItems.cc
++)
++
++set(kpilot_UIS
++ dbFlagsEditor_base.ui
++ todoEditor_base.ui
++)
++
++kde3_add_ui_files(kpilot_SRCS ${kpilot_UIS})
++kde3_add_dcop_skels(kpilot_SRCS ${kpilot_STUBS})
++kde3_add_dcop_stubs(kpilot_SRCS ${kpilot_STUBS})
++kde3_automoc(${kpilot_SRCS})
++add_executable(kpilot_bin ${kpilot_SRCS})
++target_link_libraries(kpilot_bin ${QT_LIBRARIES} kpilot kutils)
++kpilot_rpath(kpilot_bin)
++set_target_properties(kpilot_bin PROPERTIES
++ OUTPUT_NAME kpilot
++)
++
++######################### INSTALL STUFF #######################################
++
++kde3_install_libtool_file(kcm_kpilot)
++
++install(
++ TARGETS kcm_kpilot kpilot_bin kpilotDaemon
++ LIBRARY DESTINATION ${KDE3_PLUGIN_INSTALL_DIR}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
++ RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
++)
++
++install(
++ FILES kpilot.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share
++)
++
++install(
++ FILES kpilotdaemon.desktop DESTINATION ${KDE3_XDG_APPS_DIR}
++)
++
++install(
++ FILES kpilotconduit.desktop DESTINATION ${KDE3_SERVICETYPES_DIR}
++)
++
++install(
++ FILES kpilot_config.desktop DESTINATION ${KDE3_SERVICES_DIR}
++)
++
++add_subdirectory(Icons)
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/conduitConfigDialog.cc kdepim-3.5.5.dfsg.1/kpilot/kpilot/conduitConfigDialog.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/conduitConfigDialog.cc 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/conduitConfigDialog.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -29,7 +29,7 @@
+ */
+
+ static const char *conduitconfigdialog_id =
+- "$Id: conduitConfigDialog.cc 437980 2005-07-23 19:53:57Z kainhofe $";
++ "$Id: conduitConfigDialog.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ #include "options.h"
+
+@@ -78,11 +78,13 @@ extern "C"
+ {
+ KDE_EXPORT KCModule *create_kpilotconfig( QWidget *parent, const char * )
+ {
++ FUNCTIONSETUP;
+ return new ConduitConfigWidget( parent, "kcmkpilotconfig" );
+ }
+
+ KDE_EXPORT ConfigWizard *create_wizard(QWidget *parent, int m)
+ {
++ FUNCTIONSETUP;
+ return new ConfigWizard(parent,"Wizard", m);
+ }
+ }
+@@ -217,6 +219,8 @@ ConduitConfigWidgetBase::ConduitConfigWi
+ fConfigureKontact(0L),
+ fActionDescription(0L)
+ {
++ FUNCTIONSETUP;
++
+ QWidget *w = 0L; // For spacing purposes only.
+ QHBox *btns = 0L;
+
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/dbFlagsEditor_base.ui kdepim-3.5.5.dfsg.1/kpilot/kpilot/dbFlagsEditor_base.ui
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/dbFlagsEditor_base.ui 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/dbFlagsEditor_base.ui 2006-11-19 22:21:12.000000000 +0100
+@@ -370,9 +370,7 @@
+ </tabstops>
+ <includes>
+ <include location="local" impldecl="in implementation">dbFlagsEditor_base.ui.h</include>
++ <include location="system" impldecl="in implementation">kdatewidget.h</include>
+ </includes>
+ <layoutdefaults spacing="6" margin="11"/>
+-<includehints>
+- <includehint>kdatewidget.h</includehint>
+-</includehints>
+ </UI>
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/dbFlagsEditor.cc kdepim-3.5.5.dfsg.1/kpilot/kpilot/dbFlagsEditor.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/dbFlagsEditor.cc 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/dbFlagsEditor.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -25,7 +25,9 @@
+ ** Bug reports and questions can be sent to kde-pim at kde.org
+ */
+
++#include <config.h>
+ #include "options.h"
++#include "fakes.h"
+
+ #include <pi-dlp.h>
+
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/dbSelection_base.ui kdepim-3.5.5.dfsg.1/kpilot/kpilot/dbSelection_base.ui
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/dbSelection_base.ui 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/dbSelection_base.ui 2006-11-19 22:21:12.000000000 +0100
+@@ -71,10 +71,10 @@
+ </connection>
+ </connections>
+ <layoutdefaults spacing="6" margin="11"/>
+-<includehints>
+- <includehint>klistview.h</includehint>
+- <includehint>kpushbutton.h</includehint>
+- <includehint>klineedit.h</includehint>
+- <includehint>kpushbutton.h</includehint>
+-</includehints>
++<includes>
++ <include location="system" impldecl="in implementation">klistview.h</include>
++ <include location="system" impldecl="in implementation">kpushbutton.h</include>
++ <include location="system" impldecl="in implementation">klineedit.h</include>
++ <include location="system" impldecl="in implementation">kpushbutton.h</include>
++</includes>
+ </UI>
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/dbviewerWidget.cc kdepim-3.5.5.dfsg.1/kpilot/kpilot/dbviewerWidget.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/dbviewerWidget.cc 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/dbviewerWidget.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -184,7 +184,7 @@ void GenericDBWidget::slotSelected(const
+ currentDB.remove( QRegExp(CSL1(".(pdb|PDB)$")) );
+
+ fDB=new PilotLocalDatabase(dbPath(), currentDB, false);
+- if (!fDB || !fDB->isDBOpen())
++ if (!fDB || !fDB->isOpen())
+ {
+ fDBInfo->setText(i18n("<B>Warning:</B> Cannot read "
+ "database file %1.").arg(currentDB));
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/fileInstaller.cc kdepim-3.5.5.dfsg.1/kpilot/kpilot/fileInstaller.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/fileInstaller.cc 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/fileInstaller.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -30,7 +30,7 @@
+ */
+
+ static const char *fileinstaller_id =
+- "$Id: fileInstaller.cc 437980 2005-07-23 19:53:57Z kainhofe $";
++ "$Id: fileInstaller.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+
+ #include "options.h"
+@@ -116,7 +116,7 @@ void FileInstaller::deleteFiles(const QS
+ }
+
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": Copying " << s << endl;
++ DEBUGKPILOT << fname << ": Copying " << s << endl;
+ #endif
+
+ KURL srcName;
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/hotSync.cc kdepim-3.5.5.dfsg.1/kpilot/kpilot/hotSync.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/hotSync.cc 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/hotSync.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -2,6 +2,7 @@
+ **
+ ** Copyright (C) 2001 by Dan Pilone
+ ** Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold at kainhofer.com>
++** Copyright (C) 2006 Adriaan de Groot <groot at kde.org>
+ **
+ ** This file defines SyncActions, which are used to perform some specific
+ ** task during a HotSync. Conduits are not included here, nor are
+@@ -31,7 +32,7 @@
+ */
+
+ static const char *hotsync_id =
+- "$Id: hotSync.cc 449697 2005-08-16 13:19:47Z adridg $";
++ "$Id: hotSync.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ #include "options.h"
+
+@@ -40,6 +41,7 @@ static const char *hotsync_id =
+ #include <stdio.h>
+
+ #include <pi-file.h>
++#include <pi-util.h>
+
+ #include <qtimer.h>
+ #include <qfile.h>
+@@ -64,7 +66,7 @@ static const char *hotsync_id =
+
+ #include "hotSync.moc"
+
+-TestLink::TestLink(KPilotDeviceLink * p) :
++TestLink::TestLink(KPilotLink * p) :
+ SyncAction(p, "testLink")
+ {
+ FUNCTIONSETUP;
+@@ -83,26 +85,15 @@ TestLink::TestLink(KPilotDeviceLink * p)
+
+ addSyncLogEntry(i18n("Testing.\n"));
+
+-#ifdef BRUTE_FORCE
+- for (i=0; i<32; i++)
+-#else
+- while ((i = fHandle->getNextDatabase(dbindex,&db)) > 0)
+-#endif
++ while ((i = deviceLink()->getNextDatabase(dbindex,&db)) > 0)
+ {
+-#ifdef BRUTE_FORCE
+- if (fHandle->getNextDatabase(i,&db) < 1)
+- {
+- DEBUGCONDUIT << fname << ": No database index " << i << endl;
+- continue;
+- }
+-#endif
+-
+ count++;
+ dbindex = db.index + 1;
+
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname << ": Read database " << db.name << endl;
+-#endif
++ DEBUGKPILOT << fname
++ << ": Read database " << db.name
++ << " with index " << db.index
++ << endl;
+
+ // Let the Pilot User know what's happening
+ openConduit();
+@@ -119,19 +110,32 @@ TestLink::TestLink(KPilotDeviceLink * p)
+ return true;
+ }
+
+-BackupAction::BackupAction(KPilotDeviceLink * p, bool full) :
++class BackupAction::Private
++{
++public:
++ Private() : fTimer(0L) { }
++
++ QTimer *fTimer;
++ bool fFullBackup;
++ QStringList fNoBackupDBs;
++ QValueList<unsigned long> fNoBackupCreators;
++ QStringList fDeviceDBs;
++
++ QString fPreferBackupDir; /**< Directory towrite backup in, overrides default */
++
++ // Remainder is used to hand around info during sync
++
++ int fDBIndex; /**< Database number we're now doing */
++ QString fBackupDir; /**< Directory to write backup in.*/
++} ;
++
++BackupAction::BackupAction(KPilotLink * p, bool full) :
+ SyncAction(p, "backupAction"),
+- fFullBackup(full)
++ fP( new Private )
+ {
+ FUNCTIONSETUP;
+
+- fDatabaseDir = KGlobal::dirs()->saveLocation("data",
+- CSL1("kpilot/DBBackup/"));
+-
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname << ": Will write to " << fDatabaseDir << endl;
+- DEBUGCONDUIT << fname << ": Full sync? " << full << endl;
+-#endif
++ fP->fFullBackup = full;
+ }
+
+ /* virtual */ QString BackupAction::statusString() const
+@@ -171,6 +175,15 @@ BackupAction::BackupAction(KPilotDeviceL
+ return s;
+ }
+
++void BackupAction::setDirectory( const QString &p )
++{
++ fP->fPreferBackupDir = p;
++ if (!p.endsWith(CSL1("/")))
++ {
++ fP->fPreferBackupDir.append(CSL1("/"));
++ }
++}
++
+ static inline bool dontBackup(struct DBInfo *info,
+ const QStringList &dbnames,
+ const QValueList<unsigned long> &dbcreators)
+@@ -223,8 +236,7 @@ static inline void initNoBackup(QStringL
+ }
+ }
+
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname << ": Will skip databases "
++ DEBUGKPILOT << fname << ": Will skip databases "
+ << dbnames.join(CSL1(",")) << endl;
+ QString creatorids;
+ for (QValueList<unsigned long>::const_iterator i = dbcreators.begin();
+@@ -232,35 +244,39 @@ static inline void initNoBackup(QStringL
+ {
+ creatorids.append(CSL1("[%1]").arg(*i,0,16));
+ }
+- DEBUGCONDUIT << fname << ": Will skip creators " << creatorids << endl;
+-#endif
++ DEBUGKPILOT << fname << ": Will skip creators " << creatorids << endl;
+ }
+
+ /* virtual */ bool BackupAction::exec()
+ {
+ FUNCTIONSETUP;
+
+- mDeviceDBs = KPilotSettings::deviceDBs();
++ fP->fDeviceDBs = KPilotSettings::deviceDBs();
+
+- fBackupDir =
+- fDatabaseDir +
+- PilotAppCategory::codec()->toUnicode(fHandle->getPilotUser()->getUserName()) +
+- CSL1("/");
++ if (fP->fPreferBackupDir.isEmpty())
++ {
++ fP->fBackupDir =
++ KGlobal::dirs()->saveLocation("data",CSL1("kpilot/DBBackup/")) +
++ PilotAppCategory::codec()->toUnicode(deviceLink()->getPilotUser().getUserName()) +
++ CSL1("/");
++ }
++ else
++ {
++ fP->fBackupDir = fP->fPreferBackupDir;
++ }
+
+- logMessage(i18n("Backup directory: %1.").arg(fBackupDir));
++ logMessage(i18n("Backup directory: %1.").arg(fP->fBackupDir));
+
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
++ DEBUGKPILOT << fname
+ << ": This Pilot user's name is \""
+- << fHandle->getPilotUser()->getUserName() << "\"" << endl;
+- DEBUGCONDUIT << fname
+- << ": Using backup dir: " << fBackupDir << endl;
+- DEBUGCONDUIT << fname
+- << ": Full Backup? " << fFullBackup << endl;
+-#endif
++ << deviceLink()->getPilotUser().getUserName() << "\"" << endl;
++ DEBUGKPILOT << fname
++ << ": Using backup dir: " << fP->fBackupDir << endl;
++ DEBUGKPILOT << fname
++ << ": Full Backup? " << fP->fFullBackup << endl;
+
+
+- if (fFullBackup)
++ if (fP->fFullBackup)
+ {
+ fActionStatus = FullBackup;
+ addSyncLogEntry(i18n("Full backup started."));
+@@ -271,7 +287,7 @@ static inline void initNoBackup(QStringL
+ addSyncLogEntry(i18n("Fast backup started"));
+ }
+
+- if (!checkBackupDirectory(fBackupDir))
++ if (!checkBackupDirectory(fP->fBackupDir))
+ {
+ fActionStatus=BackupIncomplete;
+ // Don't issue an error message, checkBackupDirectory
+@@ -279,51 +295,56 @@ static inline void initNoBackup(QStringL
+ return false;
+ }
+
+- initNoBackup( fNoBackupDBs, fNoBackupCreators );
++ initNoBackup( fP->fNoBackupDBs, fP->fNoBackupCreators );
+
+- fTimer = new QTimer( this );
+- QObject::connect( fTimer, SIGNAL( timeout() ),
++ fP->fTimer = new QTimer( this );
++ QObject::connect( fP->fTimer, SIGNAL( timeout() ),
+ this, SLOT( backupOneDB() ) );
+
+- fDBIndex = 0;
++ fP->fDBIndex = 0;
+
+- fTimer->start( 0, false );
++ fP->fTimer->start( 0, false );
+ return true;
+ }
+
+-bool BackupAction::checkBackupDirectory(QString backupDir)
++bool BackupAction::checkBackupDirectory( const QString &backupDir )
+ {
+ FUNCTIONSETUP;
+ QFileInfo fi(backupDir);
+
+- if (!(fi.exists() && fi.isDir()))
++ if (fi.exists() && fi.isDir())
+ {
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
+- << ": Need to create backup directory for user "
+- << fHandle->getPilotUser()->getUserName() << endl;
+-#endif
+-
+- fi = QFileInfo(fDatabaseDir);
+- if (!(fi.exists() && fi.isDir()))
+- {
+- kdError() << k_funcinfo
+- << ": Database backup directory "
+- << "doesn't exist."
+- << endl;
+- return false;
+- }
++ return true;
++ }
+
+- QDir databaseDir(backupDir);
++ if (fi.exists() && !fi.isDir())
++ {
++ kdWarning() << k_funcinfo
++ << ": Requested backup directory "
++ << backupDir
++ << " exists but is not a directory."
++ << endl;
++ return false;
++ }
+
+- if (!databaseDir.mkdir(backupDir, true))
+- {
+- kdError() << k_funcinfo
+- << ": Can't create backup directory." << endl;
+- return false;
+- }
++ if ( !backupDir.endsWith("/") )
++ {
++ kdWarning() << k_funcinfo
++ << ": Backup dir does not end with a / "
++ << endl;
++ return false;
+ }
+- return true;
++
++ Q_ASSERT(!fi.exists());
++
++ DEBUGKPILOT << fname
++ << ": Creating directory " << backupDir << endl;
++
++ KStandardDirs::makeDir( backupDir );
++
++ fi = QFileInfo(backupDir);
++
++ return fi.exists() && fi.isDir();
+ }
+
+ /* slot */ void BackupAction::backupOneDB()
+@@ -332,15 +353,10 @@ bool BackupAction::checkBackupDirectory(
+
+ struct DBInfo info;
+
+- emit logProgress(QString::null, fDBIndex);
++ emit logProgress(QString::null, fP->fDBIndex);
+
+ if (openConduit() < 0)
+ {
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
+- << ": openConduit failed. User cancel?" << endl;
+-#endif
+-
+ addSyncLogEntry(i18n("Exiting on cancel."));
+ endBackup();
+ fActionStatus = BackupIncomplete;
+@@ -348,14 +364,10 @@ bool BackupAction::checkBackupDirectory(
+ }
+
+ // TODO: Is there a way to skip unchanged databases?
+- int res = fHandle->getNextDatabase( fDBIndex, &info );
++ int res = deviceLink()->getNextDatabase( fP->fDBIndex, &info );
+ if (res < 0)
+ {
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname << ": Backup complete." << endl;
+-#endif
+-
+- if ( fFullBackup )
++ if ( fP->fFullBackup )
+ addSyncLogEntry( i18n("Full backup complete.") );
+ else
+ addSyncLogEntry( i18n("Fast backup complete.") );
+@@ -364,7 +376,7 @@ bool BackupAction::checkBackupDirectory(
+ return;
+ }
+
+- fDBIndex = info.index + 1;
++ fP->fDBIndex = info.index + 1;
+
+ char buff[8];
+ memset(buff, 0, 8);
+@@ -375,24 +387,20 @@ bool BackupAction::checkBackupDirectory(
+ QString creator = QString::fromLatin1( buff );
+ info.name[33]='\0';
+ QString dbname = QString::fromLatin1( info.name );
+- if ( !mDeviceDBs.contains( creator ) )
+- mDeviceDBs << creator;
+- if ( !mDeviceDBs.contains( dbname ) )
+- mDeviceDBs << dbname;
++ if ( !fP->fDeviceDBs.contains( creator ) )
++ fP->fDeviceDBs << creator;
++ if ( !fP->fDeviceDBs.contains( dbname ) )
++ fP->fDeviceDBs << dbname;
+
+
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname << ": Checking to see if we should backup database " << info.name
++ DEBUGKPILOT << fname << ": Checking to see if we should backup database " << info.name
+ << " [" << QString::number(info.creator,16) << "]" << endl;
+-#endif
+
+ // see if user told us not to back this creator or database up...
+- if (dontBackup(&info,fNoBackupDBs,fNoBackupCreators))
++ if (dontBackup(&info,fP->fNoBackupDBs,fP->fNoBackupCreators))
+ {
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname << ": Skipping database " << info.name
++ DEBUGKPILOT << fname << ": Skipping database " << info.name
+ << " (database in no-backup list)" << endl;
+-#endif
+ QString s = i18n("Skipping %1")
+ .arg(PilotAppCategory::codec()->toUnicode(info.name));
+ addSyncLogEntry(s);
+@@ -400,12 +408,10 @@ bool BackupAction::checkBackupDirectory(
+ }
+
+ // don't backup resource databases...
+- if ( (!fFullBackup) && PilotDatabase::isResource(&info))
++ if ( (!fP->fFullBackup) && PilotDatabase::isResource(&info))
+ {
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname << ": Skipping database " << info.name
++ DEBUGKPILOT << fname << ": Skipping database " << info.name
+ << " (resource database)" << endl;
+-#endif
+ // Just skip resource DBs during an update hotsync.
+ return;
+ }
+@@ -447,22 +453,23 @@ bool BackupAction::createLocalDatabase(D
+ bool doBackup = true;
+
+ // make sure that our directory is available...
+- if (!checkBackupDirectory(fBackupDir)) return false;
++ if (!checkBackupDirectory( fP->fBackupDir )) return false;
+
+ // we always need to open the database on the pilot because if we're going to sync
+ // it, we need to reset the "dirty" flags, etc.
+- PilotSerialDatabase*serial=new PilotSerialDatabase(pilotSocket(), databaseName);
+- if (!serial->isDBOpen())
++ PilotDatabase *serial=deviceLink()->database(databaseName);
++ if (!serial->isOpen())
+ {
+-#ifdef DEBUG
+- DEBUGCONDUIT<<"Unable to open database "<<info->name<<" to check for modified records and reset sync flags."<<endl;
+-#endif
++ DEBUGKPILOT << fname << ": Unable to open database "<<info->name
++ << " to check for modified records and reset sync flags." << endl;
++ KPILOT_DELETE(serial);
++ return false;
+ }
+
+ // now we look to see if the database on the pilot has at least one changed record
+ // in it. we do this so that we don't waste time backing up a database that has
+ // not changed. note: don't bother with this check if we're doing a full backup.
+- if (!fFullBackup && serial->isDBOpen())
++ if (!fP->fFullBackup && serial->isOpen())
+ {
+ int index=0;
+ PilotRecord*rec=serial->readNextModifiedRec(&index);
+@@ -492,7 +499,7 @@ bool BackupAction::createLocalDatabase(D
+ // checks and proceed....
+ databaseName.replace('/', CSL1("_"));
+
+- QString fullBackupName = fBackupDir + databaseName;
++ QString fullBackupName = fP->fBackupDir + databaseName;
+
+ if (PilotDatabase::isResource(info))
+ {
+@@ -515,8 +522,8 @@ bool BackupAction::createLocalDatabase(D
+
+ // if we've backed this one up, clean it up so we won't do it again next
+ // sync unless it's truly changed
+- serial=new PilotSerialDatabase(pilotSocket(), databaseName);
+- if (backedUp && serial->isDBOpen())
++ serial=deviceLink()->database(databaseName);
++ if (backedUp && serial->isOpen())
+ {
+ serial->cleanup();
+ serial->resetSyncFlags();
+@@ -530,26 +537,26 @@ void BackupAction::endBackup()
+ {
+ FUNCTIONSETUP;
+
+- KPILOT_DELETE(fTimer);
+- fDBIndex = (-1);
++ KPILOT_DELETE(fP->fTimer);
++ fP->fDBIndex = (-1);
+ fActionStatus = BackupEnded;
+- mDeviceDBs.sort();
++ fP->fDeviceDBs.sort();
+ QString old( QString::null );
+- QStringList::Iterator itr = mDeviceDBs.begin();
+- while ( itr != mDeviceDBs.end() ) {
++ QStringList::Iterator itr = fP->fDeviceDBs.begin();
++ while ( itr != fP->fDeviceDBs.end() ) {
+ if ( old == *itr ) {
+- itr = mDeviceDBs.remove( itr );
++ itr = fP->fDeviceDBs.remove( itr );
+ } else {
+ old = *itr;
+ ++itr;
+ }
+ }
+- KPilotSettings::setDeviceDBs( mDeviceDBs );
++ KPilotSettings::setDeviceDBs( fP->fDeviceDBs );
+
+ emit syncDone(this);
+ }
+
+-FileInstallAction::FileInstallAction(KPilotDeviceLink * p,
++FileInstallAction::FileInstallAction(KPilotLink * p,
+ const QString & d) :
+ SyncAction(p, "fileInstall"),
+ fDBIndex(-1),
+@@ -574,7 +581,7 @@ FileInstallAction::~FileInstallAction()
+ fList = installDir.entryList(QDir::Files |
+ QDir::NoSymLinks | QDir::Readable);
+ #ifdef DEBUG
+- DEBUGCONDUIT << fname
++ DEBUGKPILOT << fname
+ << ": Installing " << fList.count() << " files" << endl;
+ #endif
+
+@@ -608,7 +615,7 @@ FileInstallAction::~FileInstallAction()
+ Q_ASSERT((unsigned) fDBIndex <= fList.count());
+
+ #ifdef DEBUG
+- DEBUGCONDUIT << fname
++ DEBUGKPILOT << fname
+ << ": Installing file index "
+ << fDBIndex << " (of " << fList.count() << ")" << endl;
+ #endif
+@@ -616,7 +623,7 @@ FileInstallAction::~FileInstallAction()
+ if ((!fList.count()) || ((unsigned) fDBIndex >= fList.count()))
+ {
+ #ifdef DEBUG
+- DEBUGCONDUIT << fname
++ DEBUGKPILOT << fname
+ << ": Peculiar file index, bailing out." << endl;
+ #endif
+ KPILOT_DELETE(fTimer);
+@@ -632,7 +639,7 @@ FileInstallAction::~FileInstallAction()
+ fDBIndex++;
+
+ #ifdef DEBUG
+- DEBUGCONDUIT << fname << ": Installing file " << filePath << endl;
++ DEBUGKPILOT << fname << ": Installing file " << filePath << endl;
+ #endif
+
+ QString m = i18n("Installing %1").arg(fileName);
+@@ -749,7 +756,7 @@ bool FileInstallAction::resourceOK(const
+ }
+ }
+
+-CleanupAction::CleanupAction(KPilotDeviceLink *p) : SyncAction(p,"cleanupAction")
++CleanupAction::CleanupAction(KPilotLink *p) : SyncAction(p,"cleanupAction")
+ {
+ FUNCTIONSETUP;
+ }
+@@ -758,7 +765,7 @@ CleanupAction::~CleanupAction()
+ {
+ #ifdef DEBUG
+ FUNCTIONSETUP;
+- DEBUGCONDUIT << fname
++ DEBUGKPILOT << fname
+ << ": Deleting @" << (long)this << endl;
+ #endif
+ }
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/hotSync.h kdepim-3.5.5.dfsg.1/kpilot/kpilot/hotSync.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/hotSync.h 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/hotSync.h 2006-11-19 22:21:12.000000000 +0100
+@@ -4,6 +4,7 @@
+ **
+ ** Copyright (C) 2001 by Dan Pilone
+ ** Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold at kainhofer.com>
++** Copyright (C) 2006 Adriaan de Groot <groot at kde.org>
+ **
+ ** This file defines SyncActions, which are used to perform some specific
+ ** task during a HotSync. Conduits are not included here, nor are
+@@ -36,14 +37,13 @@
+ class QTimer;
+
+ #include "syncAction.h"
+-#include "syncStack.h"
+
+ class TestLink : public SyncAction
+ {
+ Q_OBJECT
+
+ public:
+- TestLink(KPilotDeviceLink *);
++ TestLink(KPilotLink *);
+
+ protected:
+ virtual bool exec();
+@@ -54,7 +54,15 @@ class BackupAction : public SyncAction
+ Q_OBJECT
+
+ public:
+- BackupAction(KPilotDeviceLink *, bool full);
++ /** Constructor. Back up all the databases on
++ * the link to a directory on the local disk.
++ * If @p full is @c true, then a full backup,
++ * including applications, is done. Otherwise,
++ * only user data is backed-up.
++ *
++ * @see setDirectory()
++ */
++ BackupAction(KPilotLink *, bool full);
+
+ enum Status { Init,
+ Error,
+@@ -66,35 +74,53 @@ public:
+ } ;
+ virtual QString statusString() const;
+
++ /** By default, a path based on the user name (either
++ * on the handheld or set in KPilot) is used to
++ * determine the backup directory name ( generally
++ * $KDEHOME/share/apps/kpilot/DBBackup/_user_name_ ).
++ * Use setDirectory() to change that and use a given
++ * @p path as target for the backup. Use an empty
++ * @p path to restore the default behavior of using
++ * the username.
++ */
++ void setDirectory( const QString &path );
++
+ protected:
+ virtual bool exec();
+
+ private:
+- /**
+- * All manner of support functions for full backup.
+- */
++ /** Finish the backup and clean up resources. */
+ void endBackup();
+- bool createLocalDatabase(DBInfo *);
+- bool checkBackupDirectory(QString backupDir);
++
++ /** Copy the database indicated by @p info to the local
++ * disk; returns @c false on failure.
++ */
++ bool createLocalDatabase(DBInfo *info);
++
++ /** Make sure that the backup directory @p backupDir
++ * exists and is a directory; returns @c false
++ * if this is not the case. This method will try
++ * to create the directory if it doesn't exist yet.
++ */
++ static bool checkBackupDirectory( const QString &backupDir );
+
+ private slots:
++ /** Implementation detail: databases get backed-up
++ * one at a time because the backup function in
++ * pilot-link isn't threaded.
++ */
+ void backupOneDB();
+
+ private:
+- QTimer *fTimer;
+- int fDBIndex;
+- QString fBackupDir, fDatabaseDir;
+- bool fFullBackup;
+- QStringList fNoBackupDBs;
+- QValueList<unsigned long> fNoBackupCreators;
+- QStringList mDeviceDBs;
++ class Private;
++ Private *fP;
+ } ;
+
+ class FileInstallAction : public SyncAction
+ {
+ Q_OBJECT
+ public:
+- FileInstallAction(KPilotDeviceLink *,
++ FileInstallAction(KPilotLink *,
+ const QString &fileDir);
+ virtual ~FileInstallAction();
+
+@@ -120,7 +146,7 @@ private:
+ class CleanupAction : public SyncAction
+ {
+ public:
+- CleanupAction(KPilotDeviceLink * p);
++ CleanupAction(KPilotLink * p);
+ virtual ~CleanupAction();
+
+ protected:
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/Icons/CMakeLists.txt kdepim-3.5.5.dfsg.1/kpilot/kpilot/Icons/CMakeLists.txt
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/Icons/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/Icons/CMakeLists.txt 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,4 @@
++
++kde3_install_icons_custom( hicolor )
++
++install( FILES kpilot-splash.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/apps/kpilot/pics/)
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/interactiveSync.cc kdepim-3.5.5.dfsg.1/kpilot/kpilot/interactiveSync.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/interactiveSync.cc 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/interactiveSync.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -2,6 +2,7 @@
+ **
+ ** Copyright (C) 2001 by Dan Pilone
+ ** Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold at kainhofer.com>
++** Copyright (C) 2006 Adriaan de Groot <groot at kde.org>
+ **
+ ** This file specializes SyncAction to a kind that can have interaction
+ ** with the user without the Sync timing out.
+@@ -29,7 +30,7 @@
+ */
+
+ static const char *interactivesync_id =
+- "$Id: interactiveSync.cc 437980 2005-07-23 19:53:57Z kainhofe $";
++ "$Id: interactiveSync.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ #include "options.h"
+
+@@ -68,7 +69,7 @@ static const char *interactivesync_id =
+ #include "interactiveSync.moc"
+
+
+-CheckUser::CheckUser(KPilotDeviceLink * p, QWidget * vp):
++CheckUser::CheckUser(KPilotLink * p, QWidget * vp):
+ SyncAction(p, vp, "userCheck")
+ {
+ FUNCTIONSETUP;
+@@ -87,7 +88,7 @@ CheckUser::~CheckUser()
+
+ QString guiUserName = KPilotSettings::userName();
+ QString pilotUserName = PilotAppCategory::codec()->
+- toUnicode(fHandle->getPilotUser()->getUserName());
++ toUnicode(fHandle->getPilotUser().getUserName());
+ bool pilotUserEmpty = pilotUserName.isEmpty();
+ // 4 cases to handle:
+ // guiUserName empty / not empty
+@@ -111,8 +112,8 @@ CheckUser::~CheckUser()
+ KMessageBox::Yes)
+ {
+ KPilotSettings::setUserName(defaultUserName);
+- fHandle->getPilotUser()->
+- setUserName(PilotAppCategory::codec()->fromUnicode(defaultUserName));
++ fHandle->getPilotUser()
++ .setUserName(PilotAppCategory::codec()->fromUnicode(defaultUserName));
+ guiUserName=defaultUserName;
+ pilotUserName=defaultUserName;
+ }
+@@ -146,14 +147,14 @@ CheckUser::~CheckUser()
+ KMessageBox::Yes)
+ {
+ #ifdef DEBUG
+- DEBUGDAEMON << fname
++ DEBUGKPILOT << fname
+ << ": Setting user name in pilot to "
+ << guiUserName << endl;
+ #endif
+
+ QCString l1 = PilotAppCategory::codec()->fromUnicode(guiUserName);
+
+- fHandle->getPilotUser()->setUserName(l1.data());
++ fHandle->getPilotUser().setUserName(l1.data());
+ pilotUserName=guiUserName;
+ }
+ }
+@@ -179,7 +180,7 @@ CheckUser::~CheckUser()
+ switch (r)
+ {
+ case KMessageBox::Yes:
+- fHandle->getPilotUser()->setUserName(
++ fHandle->getPilotUser().setUserName(
+ PilotAppCategory::codec()->fromUnicode(guiUserName));
+ pilotUserName=guiUserName;
+ break;
+@@ -198,11 +199,11 @@ CheckUser::~CheckUser()
+
+
+ #ifdef DEBUG
+- DEBUGCONDUIT << fname
++ DEBUGKPILOT << fname
+ << ": User name set to gui<"
+ << guiUserName
+ << "> hh<"
+- << fHandle->getPilotUser()->getUserName() << ">" << endl;
++ << fHandle->getPilotUser().getUserName() << ">" << endl;
+ #endif
+
+ KPilotSettings::writeConfig();
+@@ -227,47 +228,68 @@ CheckUser::~CheckUser()
+ class RestoreInfo
+ {
+ public:
+- struct db DBInfo;
++ struct DBInfo DBInfo;
+ QString path;
+ } ;
+
+-class RestoreAction::RestoreActionPrivate
++class RestoreAction::Private
+ {
+ public:
+- QString fDatabaseDir;
+- QValueList<RestoreInfo *> fDBList;
++ QString fPreferRestoreDir; /**< Preference setting where to get data from. */
++
++ QValueList<RestoreInfo> fDBList;
+ QTimer fTimer;
+- QValueList<RestoreInfo *>::ConstIterator fDBIterator;
++ QValueList<RestoreInfo>::ConstIterator fDBIterator;
+ int fDBIndex;
+ };
+
+
+-RestoreAction::RestoreAction(KPilotDeviceLink * p, QWidget * visible ) :
++RestoreAction::RestoreAction(KPilotLink * p, QWidget * visible ) :
+ SyncAction(p, visible, "restoreAction")
+ {
+ FUNCTIONSETUP;
+
+- fP = new RestoreActionPrivate;
+- fP->fDatabaseDir = KGlobal::dirs()->saveLocation("data",
+- CSL1("kpilot/DBBackup/"));
++ fP = new Private;
++}
++
++void RestoreAction::setDirectory( const QString &path )
++{
++ fP->fPreferRestoreDir = path;
+ }
+
+ /* virtual */ bool RestoreAction::exec()
+ {
+ FUNCTIONSETUP;
+
++ QString dirname;
++ if (fP->fPreferRestoreDir.isEmpty())
++ {
++ dirname = PilotLocalDatabase::getDBPath();
++ }
++ else
++ {
++ dirname = fP->fPreferRestoreDir;
++ }
++
+ #ifdef DEBUG
+- DEBUGDAEMON << fname
+- << ": Restoring from base directory "
+- << *(PilotLocalDatabase::getDBPath()) << endl;
++ DEBUGKPILOT << fname << ": Restoring user " << dirname << endl;
+ #endif
+
+- QString dirname = *(PilotLocalDatabase::getDBPath());
++ QDir dir(dirname, QString::null, QDir::Name,
++ QDir::Files | QDir::Readable | QDir::NoSymLinks);
+
+-#ifdef DEBUG
+- DEBUGDAEMON << fname << ": Restoring user " << dirname << endl;
+-#endif
++ if (!dir.exists())
++ {
++ kdWarning() << k_funcinfo
++ << ": Restore directory "
++ << dirname << " does not exist." << endl;
++ fActionStatus = Error;
++ addSyncLogEntry(i18n("Restore directory does not exist.") +
++ CSL1(" ") + i18n("Restore not performed."));
++ return false;
++ }
+
++ dirname = dir.absPath();
+ if (questionYesNo(i18n("<qt>Are you sure you want to completely "
+ "restore your Pilot from the backup directory "
+ "(<i>%1</i>)? This will erase any information "
+@@ -279,63 +301,32 @@ RestoreAction::RestoreAction(KPilotDevic
+
+ addSyncLogEntry(i18n("Canceled by user.") + CSL1(" ") +
+ i18n("Restore not performed."));
+- emit syncDone(this);
+
++ // You might call this an error, but that causes
++ // a frightening message in the log .. and the
++ // user already _knows_ the restore didn't happen.
++ // So instead, act as if everything was ok.
++ delayDone();
+ return true;
+ }
+
+- QDir dir(dirname, QString::null, QDir::Name,
+- QDir::Files | QDir::Readable | QDir::NoSymLinks);
+-
+- if (!dir.exists())
+- {
+- kdWarning() << k_funcinfo
+- << ": Restore directory "
+- << dirname << " does not exist." << endl;
+- fActionStatus = Error;
+- addSyncLogEntry(i18n("Restore directory does not exist.") +
+- CSL1(" ") + i18n("Restore not performed."));
+- return false;
+- }
+
+ emit logProgress(i18n("Restoring %1...").arg(QString::null),1);
+
+ for (unsigned int i = 0; i < dir.count(); i++)
+ {
+ QString s;
+- RestoreInfo *dbi;
+- struct DBInfo info;
+- struct pi_file *f;
++ RestoreInfo info;
+
+- s = dir[i];
++ s = dirname + QDir::separator() + dir[i];
+
+-#ifdef DEBUG
+- DEBUGDAEMON << fname
++ DEBUGKPILOT << fname
+ << ": Adding " << s << " to restore list." << endl;
+-#endif
+-
+- char * fileName = qstrdup( QFile::encodeName(dirname + s) );
+- f = pi_file_open( fileName );
+- delete fileName;
+- if (!f)
+- {
+- kdWarning() << k_funcinfo
+- << ": Can't open " << s << endl;
+- logMessage(i18n("File '%1' cannot be read.").arg(s));
+- continue;
+- }
+
+-#if PILOT_LINK_NUMBER < PILOT_LINK_0_12_0
+- if (!pi_file_get_info(f, &info))
+-#else
+- pi_file_get_info(f,&info);
+- if (true)
+-#endif
++ if ( PilotLocalDatabase::infoFromFile( s, &info.DBInfo ) )
+ {
+- dbi = new RestoreInfo;
+- memcpy(&dbi->DBInfo,&info,sizeof(struct DBInfo));
+- dbi->path = dirname + s;
+- fP->fDBList.append(dbi);
++ info.path = s;
++ fP->fDBList.append(info);
+ }
+ else
+ {
+@@ -343,41 +334,17 @@ RestoreAction::RestoreAction(KPilotDevic
+ << ": Can't open " << s << endl;
+ logMessage(i18n("File '%1' cannot be read.").arg(s));
+ }
+-
+- pi_file_close(f);
+- f = 0L;
+ }
+
+ fP->fDBIndex = 0;
+ fP->fDBIterator = fP->fDBList.begin();
+- fActionStatus = GettingFileInfo;
+-
+- QObject::connect(&(fP->fTimer), SIGNAL(timeout()),
+- this, SLOT(getNextFileInfo()));
+-
+- fP->fTimer.start(0, false);
+- return true;
+-}
+-
+-/* slot */ void RestoreAction::getNextFileInfo()
+-{
+- FUNCTIONSETUP;
+-
+- Q_ASSERT(fActionStatus == GettingFileInfo);
+-
+- QObject::disconnect(&(fP->fTimer), SIGNAL(timeout()),
+- this, SLOT(getNextFileInfo()));
+- fP->fTimer.stop();
+-
+- qBubbleSort(fP->fDBList);
+-
+- fP->fDBIndex = 0;
+- fP->fDBIterator = fP->fDBList.begin();
+ fActionStatus = InstallingFiles;
+
+ QObject::connect(&(fP->fTimer), SIGNAL(timeout()),
+ this, SLOT(installNextFile()));
++
+ fP->fTimer.start(0, false);
++ return true;
+ }
+
+ /* slot */ void RestoreAction::installNextFile()
+@@ -386,12 +353,9 @@ RestoreAction::RestoreAction(KPilotDevic
+
+ Q_ASSERT(fActionStatus == InstallingFiles);
+
+- const RestoreInfo *dbi = 0L;
+
+ if (fP->fDBIterator == fP->fDBList.end())
+ {
+- QObject::disconnect(&(fP->fTimer), SIGNAL(timeout()),
+- this, SLOT(getNextFileInfo()));
+ fP->fTimer.stop();
+
+ fActionStatus = Done;
+@@ -400,12 +364,11 @@ RestoreAction::RestoreAction(KPilotDevic
+ return;
+ }
+
+- dbi = *fP->fDBIterator;
++ const RestoreInfo dbi = *(fP->fDBIterator);
+ ++(fP->fDBIterator);
+ ++(fP->fDBIndex);
+-#ifdef DEBUG
+- DEBUGDAEMON << fname << ": Trying to install " << dbi->path << endl;
+-#endif
++
++ DEBUGKPILOT << fname << ": Trying to install " << dbi.path << endl;
+
+ if (openConduit() < 0)
+ {
+@@ -418,38 +381,18 @@ RestoreAction::RestoreAction(KPilotDevic
+ return;
+ }
+
+- QFileInfo databaseInfo(dbi->path);
++ QFileInfo databaseInfo(dbi.path);
+ addSyncLogEntry(databaseInfo.fileName());
+ emit logProgress(i18n("Restoring %1...").arg(databaseInfo.fileName()),
+ (100*fP->fDBIndex) / (fP->fDBList.count()+1)) ;
+
+- char * fileName = qstrdup( dbi->path.utf8() );
+- pi_file *f = pi_file_open( fileName );
+- delete fileName;
+-
+- if (!f)
++ if ( !deviceLink()->installFiles( dbi.path, false /* don't delete */ ) )
+ {
+ kdWarning() << k_funcinfo
+- << ": Can't open "
+- << dbi->path << " for restore." << endl;
+- logError(i18n("Cannot open file `%1' for restore.")
+- .arg(databaseInfo.fileName()));
+- return;
+- }
+-
+-#if PILOT_LINK_NUMBER < PILOT_LINK_0_12_0
+- if (pi_file_install(f, pilotSocket(), 0) < 0)
+-#else
+- if (pi_file_install(f, pilotSocket(), 0, NULL) < 0)
+-#endif
+- {
+- kdWarning() << k_funcinfo
+- << ": Couldn't restore " << dbi->path << endl;
++ << ": Couldn't restore " << dbi.path << endl;
+ logError(i18n("Cannot restore file `%1'.")
+ .arg(databaseInfo.fileName()));
+ }
+-
+- pi_file_close(f);
+ }
+
+ /* virtual */ QString RestoreAction::statusString() const
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/interactiveSync.h kdepim-3.5.5.dfsg.1/kpilot/kpilot/interactiveSync.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/interactiveSync.h 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/interactiveSync.h 2006-11-19 22:21:12.000000000 +0100
+@@ -4,6 +4,7 @@
+ **
+ ** Copyright (C) 2001 by Dan Pilone
+ ** Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold at kainhofer.com>
++** Copyright (C) 2006 Adriaan de Groot <groot at kde.org>
+ **
+ ** This file specializes SyncAction to a kind that can have interaction
+ ** with the user without the Sync timing out.
+@@ -38,7 +39,7 @@ class QTimer;
+ class CheckUser : public SyncAction
+ {
+ public:
+- CheckUser(KPilotDeviceLink *p,QWidget *w=0L);
++ CheckUser(KPilotLink *p,QWidget *w=0L);
+ virtual ~CheckUser();
+
+ protected:
+@@ -49,26 +50,31 @@ class RestoreAction : public SyncAction
+ {
+ Q_OBJECT
+ public:
+- RestoreAction(KPilotDeviceLink *,QWidget *w=0L);
++ RestoreAction(KPilotLink *,QWidget *w=0L);
+
+ typedef enum { InstallingFiles, GettingFileInfo,Done } Status;
+ virtual QString statusString() const;
+
++ /** By default, a path based on the user name (either
++ * on the handheld or set in KPilot) is used to
++ * determine the restory directory name ( generally
++ * $KDEHOME/share/apps/kpilot/DBBackup/_user_name_ ).
++ * Use setDirectory() to change that and use a given
++ * @p path as target for the source. Use an empty
++ * @p path to restore the default behavior of using
++ * the username.
++ */
++ void setDirectory( const QString &path );
++
+ protected:
+ virtual bool exec();
+
+ protected slots:
+- void getNextFileInfo();
+ void installNextFile();
+
+ private:
+- // Use a private-d pointer for once (well, in KPilot
+- // parlance it'd be fd, which is confusing, so it's
+- // become a private fP) since we need QList or QPtrList.
+- //
+- //
+- class RestoreActionPrivate;
+- RestoreActionPrivate *fP;
++ class Private;
++ Private *fP;
+ } ;
+
+ #endif
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/internalEditorAction.cc kdepim-3.5.5.dfsg.1/kpilot/kpilot/internalEditorAction.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/internalEditorAction.cc 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/internalEditorAction.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -52,7 +52,7 @@
+ using namespace KHE;
+ #endif
+
+-InternalEditorAction::InternalEditorAction(KPilotDeviceLink * p) :
++InternalEditorAction::InternalEditorAction(KPilotLink * p) :
+ SyncAction(p, "internalSync")
+ {
+ FUNCTIONSETUP;
+@@ -97,8 +97,8 @@ void InternalEditorAction::syncDirtyDB()
+
+ PilotRecord*rec=0L;
+ PilotLocalDatabase*localDB=new PilotLocalDatabase(*dbIter, false);
+- PilotSerialDatabase*serialDB=new PilotSerialDatabase(pilotSocket(), *dbIter);
+- if (!localDB->isDBOpen() || !serialDB->isDBOpen())
++ PilotDatabase *serialDB= deviceLink()->database(*dbIter);
++ if (!localDB->isOpen() || !serialDB->isOpen())
+ {
+ emit logError(i18n("Unable to open the serial or local database for %1. "
+ "Skipping it.").arg(*dbIter));
+@@ -337,7 +337,7 @@ QTimer::singleShot(0, this, SLOT(syncApp
+ return;
+
+ PilotLocalDatabase*localDB=new PilotLocalDatabase(*dbIter, false);
+- PilotSerialDatabase*serialDB=new PilotSerialDatabase(pilotSocket(), *dbIter);
++ PilotDatabase *serialDB=deviceLink()->database(*dbIter);
+
+ // open the local and the serial database and copy the flags over
+ // TODO: Implement the copying
+@@ -374,7 +374,7 @@ void InternalEditorAction::syncAppBlockC
+ #endif
+
+ PilotLocalDatabase*localDB=new PilotLocalDatabase(*dbIter, false);
+- PilotSerialDatabase*serialDB=new PilotSerialDatabase(pilotSocket(), *dbIter);
++ PilotDatabase *serialDB=deviceLink()->database(*dbIter);
+
+ unsigned char*appBlock=new unsigned char[0xFFFF];
+ int len=localDB->readAppBlock(appBlock, 0xFFFF);
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/internalEditorAction.h kdepim-3.5.5.dfsg.1/kpilot/kpilot/internalEditorAction.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/internalEditorAction.h 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/internalEditorAction.h 2006-11-19 22:21:12.000000000 +0100
+@@ -38,7 +38,7 @@ class InternalEditorAction : public Sync
+ Q_OBJECT
+
+ public:
+- InternalEditorAction(KPilotDeviceLink *);
++ InternalEditorAction(KPilotLink *);
+ ~InternalEditorAction() {}
+
+ protected:
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/kpilot.cc kdepim-3.5.5.dfsg.1/kpilot/kpilot/kpilot.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/kpilot.cc 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/kpilot.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -30,10 +30,12 @@
+
+
+ static const char *kpilot_id =
+- "$Id: kpilot.cc 450702 2005-08-18 21:37:28Z adridg $";
++ "$Id: kpilot.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+
++#include <config.h>
+ #include "options.h"
++#include "fakes.h"
+
+ #include <qfile.h>
+ #include <qptrlist.h>
+@@ -421,14 +423,6 @@ void KPilotInstaller::slotHotSyncRequest
+ i18n("Please press the HotSync button."));
+ }
+
+-void KPilotInstaller::slotFastSyncRequested()
+-{
+- FUNCTIONSETUP;
+- setupSync(SyncAction::SyncMode::eFastSync,
+- i18n("Next sync will be a Fast Sync. ") +
+- i18n("Please press the HotSync button."));
+-}
+-
+ void KPilotInstaller::slotFullSyncRequested()
+ {
+ FUNCTIONSETUP;
+@@ -594,14 +588,6 @@ void KPilotInstaller::initMenu()
+ "should be a normal HotSync."));
+ syncPopup->insert(a);
+
+- a = new KAction(i18n("&FastSync"), CSL1("fastsync"), 0,
+- this, SLOT(slotFastSyncRequested()),
+- actionCollection(), "file_fastsync");
+- a->setToolTip(i18n("Next HotSync will be a FastSync."));
+- a->setWhatsThis(i18n("Tell the daemon that the next HotSync "
+- "should be a FastSync (run conduits only)."));
+- syncPopup->insert(a);
+-
+ a = new KAction(i18n("Full&Sync"), CSL1("fullsync"), 0,
+ this, SLOT(slotFullSyncRequested()),
+ actionCollection(), "file_fullsync");
+@@ -1119,7 +1105,7 @@ int main(int argc, char **argv)
+ "pilone at slac.com" );
+ about.addAuthor("Adriaan de Groot",
+ I18N_NOOP("Maintainer"),
+- "groot at kde.org", "http://www.cs.kun.nl/~adridg/");
++ "groot at kde.org", "http://www.kpilot.org/");
+ about.addAuthor("Reinhold Kainhofer",
+ I18N_NOOP("Core and conduits developer"), "reinhold at kainhofer.com", "http://reinhold.kainhofer.com/Linux/");
+ about.addCredit("Preston Brown", I18N_NOOP("VCal conduit"));
+@@ -1222,6 +1208,7 @@ int main(int argc, char **argv)
+ CSL1("share/apps/kpilot/DBBackup"));
+ tp->show();
+ a.setMainWidget(tp);
++ DEBUGKPILOT << fname << ": MINIICON = " << a.miniIconName() << endl;
+ return a.exec();
+ }
+
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/kpilotConfigDialog_backup.ui kdepim-3.5.5.dfsg.1/kpilot/kpilot/kpilotConfigDialog_backup.ui
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/kpilotConfigDialog_backup.ui 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/kpilotConfigDialog_backup.ui 2006-11-19 22:21:12.000000000 +0100
+@@ -1,4 +1,4 @@
+-<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
++<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+ <class>BackupConfigWidget</class>
+ <comment>A widget for editing HotSync-specific settings.</comment>
+ <author>David Bishop</author>
+@@ -10,21 +10,79 @@
+ <rect>
+ <x>0</x>
+ <y>0</y>
+- <width>593</width>
+- <height>328</height>
++ <width>549</width>
++ <height>424</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>KPilot Options</string>
+ </property>
+- <grid>
++ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+- <property name="margin">
+- <number>0</number>
+- </property>
+- <widget class="QGroupBox" row="0" column="0">
++ <widget class="QGroupBox">
++ <property name="name">
++ <cstring>GroupBox23_2</cstring>
++ </property>
++ <property name="title">
++ <string>Backup Frequency</string>
++ </property>
++ <hbox>
++ <property name="name">
++ <cstring>unnamed</cstring>
++ </property>
++ <widget class="QLabel">
++ <property name="name">
++ <cstring>TextLabel5_2</cstring>
++ </property>
++ <property name="sizePolicy">
++ <sizepolicy>
++ <hsizetype>5</hsizetype>
++ <vsizetype>5</vsizetype>
++ <horstretch>0</horstretch>
++ <verstretch>0</verstretch>
++ </sizepolicy>
++ </property>
++ <property name="minimumSize">
++ <size>
++ <width>100</width>
++ <height>0</height>
++ </size>
++ </property>
++ <property name="text">
++ <string>Do &backup:</string>
++ </property>
++ <property name="buddy" stdset="0">
++ <cstring>fBackupFrequency</cstring>
++ </property>
++ </widget>
++ <widget class="QComboBox">
++ <item>
++ <property name="text">
++ <string>On every HotSync</string>
++ </property>
++ </item>
++ <item>
++ <property name="text">
++ <string>On request only</string>
++ </property>
++ </item>
++ <property name="name">
++ <cstring>fBackupFrequency</cstring>
++ </property>
++ <property name="sizePolicy">
++ <sizepolicy>
++ <hsizetype>7</hsizetype>
++ <vsizetype>0</vsizetype>
++ <horstretch>0</horstretch>
++ <verstretch>0</verstretch>
++ </sizepolicy>
++ </property>
++ </widget>
++ </hbox>
++ </widget>
++ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>GroupBox23</cstring>
+ </property>
+@@ -39,6 +97,12 @@
+ <property name="name">
+ <cstring>TextLabel5</cstring>
+ </property>
++ <property name="minimumSize">
++ <size>
++ <width>100</width>
++ <height>0</height>
++ </size>
++ </property>
+ <property name="text">
+ <string>&No backup:</string>
+ </property>
+@@ -53,6 +117,12 @@
+ <property name="name">
+ <cstring>TextLabel6</cstring>
+ </property>
++ <property name="minimumSize">
++ <size>
++ <width>100</width>
++ <height>0</height>
++ </size>
++ </property>
+ <property name="text">
+ <string>Not &restored:</string>
+ </property>
+@@ -103,20 +173,23 @@
+ </widget>
+ </grid>
+ </widget>
+- <widget class="QCheckBox" row="1" column="0">
++ <widget class="QCheckBox">
+ <property name="name">
+ <cstring>fRunConduitsWithBackup</cstring>
+ </property>
+ <property name="text">
+- <string>Run &conduits during a backup sync</string>
++ <string>Run conduits durin&g a backup sync</string>
++ </property>
++ <property name="accel">
++ <string>Alt+G</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string><qt>Check this box to run the selected conduits before every backup. This makes sure the backup is up to date with the last changes from your PC.</qt></string>
+ </property>
+ </widget>
+- <spacer row="2" column="0">
++ <spacer>
+ <property name="name">
+- <cstring>spacer3</cstring>
++ <cstring>spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+@@ -127,11 +200,11 @@
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+- <height>131</height>
++ <height>41</height>
+ </size>
+ </property>
+ </spacer>
+- </grid>
++ </vbox>
+ </widget>
+ <layoutdefaults spacing="6" margin="11"/>
+ </UI>
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/kpilotConfigDialog.cc kdepim-3.5.5.dfsg.1/kpilot/kpilot/kpilotConfigDialog.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/kpilotConfigDialog.cc 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/kpilotConfigDialog.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -31,7 +31,7 @@
+ */
+
+ static const char *kpilotconfigdialog_id =
+- "$Id: kpilotConfigDialog.cc 438196 2005-07-24 15:42:44Z binner $";
++ "$Id: kpilotConfigDialog.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ #include "options.h"
+
+@@ -242,7 +242,7 @@ SyncConfigPage::SyncConfigPage(QWidget *
+
+ #define CM(a,b) connect(fConfigWidget->a,b,this,SLOT(modified()));
+ CM(fSpecialSync, SIGNAL(activated(int)));
+- CM(fFullBackupCheck, SIGNAL(toggled(bool)));
++ CM(fFullSyncCheck, SIGNAL(toggled(bool)));
+ CM(fScreenlockSecure, SIGNAL(toggled(bool)));
+ CM(fConflictResolution, SIGNAL(activated(int)));
+ #undef CM
+@@ -250,10 +250,9 @@ SyncConfigPage::SyncConfigPage(QWidget *
+ fConduitName = i18n("HotSync");
+ }
+
+-#define MENU_ITEM_COUNT (5)
++#define MENU_ITEM_COUNT (4)
+ static SyncAction::SyncMode::Mode syncTypeMap[MENU_ITEM_COUNT] = {
+ SyncAction::SyncMode::eHotSync,
+- SyncAction::SyncMode::eFastSync,
+ SyncAction::SyncMode::eFullSync,
+ SyncAction::SyncMode::eCopyPCToHH,
+ SyncAction::SyncMode::eCopyHHToPC
+@@ -281,7 +280,7 @@ void SyncConfigPage::load()
+ fConfigWidget->fSpecialSync->setCurrentItem(0); /* HotSync */
+ }
+
+- fConfigWidget->fFullBackupCheck->setChecked(KPilotSettings::fullSyncOnPCChange());
++ fConfigWidget->fFullSyncCheck->setChecked(KPilotSettings::fullSyncOnPCChange());
+ fConfigWidget->fConflictResolution->setCurrentItem(KPilotSettings::conflictResolution());
+ fConfigWidget->fScreenlockSecure->setChecked(KPilotSettings::screenlockSecure());
+
+@@ -305,7 +304,7 @@ void SyncConfigPage::load()
+ }
+
+ KPilotSettings::setSyncType(synctype);
+- KPilotSettings::setFullSyncOnPCChange(fConfigWidget->fFullBackupCheck->isChecked());
++ KPilotSettings::setFullSyncOnPCChange(fConfigWidget->fFullSyncCheck->isChecked());
+ KPilotSettings::setConflictResolution(fConfigWidget->fConflictResolution->currentItem());
+ KPilotSettings::setScreenlockSecure(fConfigWidget->fScreenlockSecure->isChecked());
+
+@@ -315,7 +314,6 @@ void SyncConfigPage::load()
+ }
+
+
+-
+ BackupConfigPage::BackupConfigPage(QWidget * w, const char *n ) : ConfigPage( w, n )
+ {
+ FUNCTIONSETUP;
+@@ -332,6 +330,7 @@ BackupConfigPage::BackupConfigPage(QWidg
+ #define CM(a,b) connect(fConfigWidget->a,b,this,SLOT(modified()));
+ CM(fBackupOnly, SIGNAL(textChanged(const QString &)));
+ CM(fSkipDB, SIGNAL(textChanged(const QString &)));
++ CM(fBackupFrequency, SIGNAL(activated(int)));
+ #undef CM
+
+ fConduitName = i18n("Backup");
+@@ -346,6 +345,11 @@ void BackupConfigPage::load()
+ fConfigWidget->fBackupOnly->setText(KPilotSettings::skipBackupDB().join(CSL1(",")));
+ fConfigWidget->fSkipDB->setText(KPilotSettings::skipRestoreDB().join(CSL1(",")));
+ fConfigWidget->fRunConduitsWithBackup->setChecked(KPilotSettings::runConduitsWithBackup());
++
++ int backupfreq=KPilotSettings::backupFrequency();
++
++ fConfigWidget->fBackupFrequency->setCurrentItem(backupfreq);
++
+ unmodified();
+ }
+
+@@ -359,6 +363,7 @@ void BackupConfigPage::load()
+ KPilotSettings::setSkipRestoreDB(
+ QStringList::split(CSL1(","),fConfigWidget->fSkipDB->text()));
+ KPilotSettings::setRunConduitsWithBackup(fConfigWidget->fRunConduitsWithBackup->isChecked());
++ KPilotSettings::setBackupFrequency(fConfigWidget->fBackupFrequency->currentItem());
+
+ KPilotConfig::updateConfigVersion();
+ KPilotSettings::self()->writeConfig();
+@@ -500,9 +505,9 @@ void StartExitConfigPage::load()
+ }
+
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": Autostart=" << autostart << endl;
+- DEBUGDAEMON << fname << ": desktop=" << desktopfile << endl;
+- DEBUGDAEMON << fname << ": location=" << location << endl;
++ DEBUGKPILOT << fname << ": Autostart=" << autostart << endl;
++ DEBUGKPILOT << fname << ": desktop=" << desktopfile << endl;
++ DEBUGKPILOT << fname << ": location=" << location << endl;
+ #endif
+
+ KPilotSettings::setStartDaemonAtLogin(fConfigWidget->fStartDaemonAtLogin->isChecked());
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/kpilotConfigDialog_sync.ui kdepim-3.5.5.dfsg.1/kpilot/kpilot/kpilotConfigDialog_sync.ui
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/kpilotConfigDialog_sync.ui 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/kpilotConfigDialog_sync.ui 2006-11-19 22:21:12.000000000 +0100
+@@ -1,4 +1,4 @@
+-<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
++<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+ <class>SyncConfigWidget</class>
+ <comment>A widget for editing HotSync-specific settings.</comment>
+ <author>David Bishop</author>
+@@ -26,29 +26,30 @@
+ </property>
+ <widget class="QCheckBox" row="1" column="1">
+ <property name="name">
+- <cstring>fFullBackupCheck</cstring>
++ <cstring>fFullSyncCheck</cstring>
+ </property>
+ <property name="text">
+- <string>&Do full backup when changing PCs</string>
++ <string>Do full sync when chan&ging PCs</string>
++ </property>
++ <property name="accel">
++ <string>Alt+G</string>
++ </property>
++ <property name="checked">
++ <bool>true</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+- <string><qt>Check this box to perform a full backup when your last sync was performed with another PC or system, to guarantee the completeness of your backup data.</qt></string>
++ <string><qt>Check this box to perform a full sync when your last sync was performed with another PC or system, to guarantee the completeness of your data.</qt></string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="0" column="1">
+ <item>
+ <property name="text">
+- <string>HotSync (sync all changes, update backup)</string>
+- </property>
+- </item>
+- <item>
+- <property name="text">
+- <string>FastSync (sync changes, no backup)</string>
++ <string>HotSync (sync all changes)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+- <string>FullSync (sync also unchanged records, full backup)</string>
++ <string>FullSync (sync also unchanged records)</string>
+ </property>
+ </item>
+ <item>
+@@ -65,7 +66,7 @@
+ <cstring>fSpecialSync</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+- <string><qt>Select in this list the synchronization type that KPilot will use as default. Possibly values are:<br>"HotSync", to run all selected conduits, and sync the databases with a modified flag set, updating the modified records only;<br>"FastSync", to only synchronize those databases that have conduits;<br>"FullSync" to run all selected conduits, and sync all databases, reading all records, and performing a full backup;<br>"Copy PC to handheld" to run all conduits and sync all databases, but instead of merging the information from both sources, copy the PC data to the handheld;<br>"Copy handheld to PC" to run all conduits and sync all databases, but instead of merging the information from both sources, copy the handheld data to the PC.</qt></string>
++ <string><qt>Select in this list the synchronization type that KPilot will use as default. Possible values are:<br>"HotSync", to run all selected conduits, and sync the databases with a modified flag set, updating the modified records only;<br>"FullSync" to run all selected conduits, and sync all databases, reading all records, and performing a full backup;<br>"Copy PC to handheld" to run all conduits and sync all databases, but instead of merging the information from both sources, copy the PC data to the handheld;<br>"Copy handheld to PC" to run all conduits and sync all databases, but instead of merging the information from both sources, copy the handheld data to the PC.</qt></string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/kpilotConfigWizard.cc kdepim-3.5.5.dfsg.1/kpilot/kpilot/kpilotConfigWizard.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/kpilotConfigWizard.cc 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/kpilotConfigWizard.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -27,7 +27,7 @@
+ */
+
+ static const char *conduitconfigwizard_id =
+- "$Id: kpilotConfigWizard.cc 437980 2005-07-23 19:53:57Z kainhofe $";
++ "$Id: kpilotConfigWizard.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ //#include "options.h"
+
+@@ -100,7 +100,7 @@ void ConfigWizard::accept()
+ app=(eSyncApp)( page3->fAppType->selectedId() );
+ bool keepPermanently( page2->fPilotRunningPermanently->isChecked() );
+ #ifdef DEBUG
+- DEBUGCONDUIT<<fname<<"Keep permanently: "<<keepPermanently<<endl;
++ DEBUGKPILOT<<fname<<"Keep permanently: "<<keepPermanently<<endl;
+ #endif
+
+ KPilotSettings::setPilotDevice( devicename );
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/kpilot.h kdepim-3.5.5.dfsg.1/kpilot/kpilot/kpilot.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/kpilot.h 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/kpilot.h 2006-11-19 22:21:12.000000000 +0100
+@@ -102,7 +102,6 @@ public slots:
+ void slotRestoreRequested();
+ void slotBackupRequested();
+ void slotHotSyncRequested();
+- void slotFastSyncRequested();
+ void slotFullSyncRequested();
+ void slotHHtoPCRequested();
+ void slotPCtoHHRequested();
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/kpilot.kcfg kdepim-3.5.5.dfsg.1/kpilot/kpilot/kpilot.kcfg
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/kpilot.kcfg 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/kpilot.kcfg 2006-11-19 22:21:12.000000000 +0100
+@@ -108,13 +108,17 @@
+ </entry>
+ <entry name="SkipBackupDB" type="StringList">
+ <label>Which databases not to backup.</label>
+- <default>[Arng],[PmDB],[lnch],[a86k],FATFS,ImgFile-Foto,Jpeg-Foto</default>
++ <default>[Arng],[PmDB],[lnch],[a86k],FATFS,ImgFile-Foto,Jpeg-Foto,WifiCoreLib</default>
+ </entry>
+ <entry name="SkipRestoreDB" type="StringList">
+ <label>
+ </label>
+ <default>[AvGo]</default>
+ </entry>
++ <entry name="BackupFrequency" type="UInt">
++ <label></label>
++ <default>0</default>
++ </entry>
+ <entry name="RunConduitsWithBackup" type="Bool">
+ <label></label>
+ <default>false</default>
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/kpilotProbeDialog.cc kdepim-3.5.5.dfsg.1/kpilot/kpilot/kpilotProbeDialog.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/kpilotProbeDialog.cc 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/kpilotProbeDialog.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -48,12 +48,10 @@
+ #include "pilotUser.h"
+ #include "pilotSysInfo.h"
+ #include "options.h"
+-#include "kpilotlink.h"
++#include "kpilotdevicelink.h"
+
+ #include "kpilotProbeDialog.moc"
+-#ifndef __PILOTDAEMONDCOP_STUB__
+ #include "pilotDaemonDCOP_stub.h"
+-#endif
+
+ /*
+ We can't connect to /dev/ttyUSB0 and /dev/ttyUSB1 at the same time, because that
+@@ -277,10 +275,10 @@ void ProbeDialog::connection( KPilotDevi
+
+ mActiveLink = lnk;
+ if ( !mActiveLink ) return;
+- KPilotUser*usr( mActiveLink->getPilotUser() );
++ const KPilotUser &usr( mActiveLink->getPilotUser() );
+
+- mUserName = usr->getUserName();
+- mUID = usr->getUserID();
++ mUserName = usr.getUserName();
++ mUID = usr.getUserID();
+ mDevice = mActiveLink->pilotPath();
+
+ fStatus->setText( i18n("Found a connected device on %1").arg(mDevice) );
+@@ -296,23 +294,20 @@ void ProbeDialog::connection( KPilotDevi
+
+ void ProbeDialog::retrieveDBList()
+ {
+- QPtrList<DBInfo> dbs = mActiveLink->getDBList();
++ DBInfoList dbs = mActiveLink->getDBList();
+ mDBs.clear();
+- dbs.setAutoDelete( true );
+ char buff[7];
+ buff[0] = '[';
+
+- DBInfo *dbi;
+- for ( dbi = dbs.first(); dbi; dbi = dbs.next() ) {
+- if ( dbi ) {
+- set_long( &buff[1], dbi->creator );
+- buff[5] = ']';
+- buff[6] = '\0';
+- QString cr( buff );
+- mDBs << cr;
+- dbi->name[33]='\0';
+- mDBs << QString( dbi->name );
+- }
++ for ( DBInfoList::ConstIterator i = dbs.begin();
++ i != dbs.end(); ++i )
++ {
++ set_long( &buff[1], (*i).creator );
++ buff[5] = ']';
++ buff[6] = '\0';
++ QString cr( buff );
++ mDBs << cr;
++ mDBs << QString( (*i).name );
+ }
+ mDBs.sort();
+
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/kpilotui.rc kdepim-3.5.5.dfsg.1/kpilot/kpilot/kpilotui.rc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/kpilotui.rc 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/kpilotui.rc 2006-11-19 22:21:12.000000000 +0100
+@@ -5,7 +5,6 @@
+ <Menu name="file" noMerge="1"><text>&File</text>
+ <!-- Keep this list synchronized with pilotDaemon.cc and kpilot.cc -->
+ <Action name="file_hotsync" />
+- <Action name="file_fastsync" />
+ <Action name="file_fullsync" />
+ <Action name="file_backup" />
+ <Action name="file_restore" />
+@@ -28,7 +27,6 @@
+
+ <Menu name="rb_popup">
+ <Action name="file_hotsync" />
+- <Action name="file_fastsync" />
+ <Action name="file_backup" />
+ <Action name="file_restore" />
+ <Separator />
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/listCat.cc kdepim-3.5.5.dfsg.1/kpilot/kpilot/listCat.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/listCat.cc 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/listCat.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -29,7 +29,7 @@
+ */
+
+ static const char *listCat_id =
+- "$Id: listCat.cc 437980 2005-07-23 19:53:57Z kainhofe $";
++ "$Id: listCat.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ #include "options.h"
+
+@@ -240,7 +240,7 @@ void RichListViewItem::computeHeight(int
+ for (int i=0; i<fColumns; i++)
+ {
+ computeHeight(i);
+- h = QMAX(h,fRect[i].height()+2*RVPAD);
++ h = kMax(h,fRect[i].height()+2*RVPAD);
+ }
+
+ setHeight(h);
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/main-test.cc kdepim-3.5.5.dfsg.1/kpilot/kpilot/main-test.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/main-test.cc 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/main-test.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -30,7 +30,7 @@
+ ** Bug reports and questions can be sent to kde-pim at kde.org.
+ */
+ static const char *test_id =
+- "$Id: main-test.cc 449698 2005-08-16 13:24:56Z adridg $";
++ "$Id: main-test.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ #include "options.h"
+
+@@ -52,29 +52,43 @@ static const char *test_id =
+
+ #include <pi-version.h>
+
+-#include "logWidget.h"
+ #include "kpilotConfig.h"
+ #include "syncStack.h"
+ #include "hotSync.h"
+ #include "interactiveSync.h"
+
+-static KCmdLineOptions kpilotoptions[] = {
++#include "kpilotdevicelink.h"
++#include "kpilotlocallink.h"
++
++static KCmdLineOptions generalOptions[] = {
+ {"p",0,0},
+ {"port <device>",
+ I18N_NOOP("Path to Pilot device node"),
+ "/dev/pilot"},
+ {"l",0,0},
+- {"list", I18N_NOOP("List DBs (default)"), 0},
++ {"list", I18N_NOOP("List DBs"), 0},
+ {"b",0,0},
+- {"backup", I18N_NOOP("Backup instead of list DBs"), 0},
++ {"backup <dest dir>", I18N_NOOP("Backup Pilot to <dest dir>"), 0},
+ {"r",0,0},
+- {"restore", I18N_NOOP("Restore Pilot from backup"), 0},
+- {"L",0,0},
+- { "conduit-list", I18N_NOOP("List available conduits"), 0},
+- {"E",0,0},
+- { "conduit-exec <filename>",
++ {"restore <src dir>", I18N_NOOP("Restore Pilot from backup"), 0},
++ {"e",0,0},
++ { "exec <filename>",
+ I18N_NOOP("Run conduit from desktop file <filename>"),
+ 0 },
++ {"c",0,0},
++ { "check <what>",
++ I18N_NOOP("Run a specific check (with the device)"), "help"},
++ {"s",0,0},
++ { "show <what>",
++ I18N_NOOP("Show KPilot configuration information"), "help"},
++#ifdef DEBUG
++ { "debug <level>",
++ I18N_NOOP("Set the debug level"), "1" },
++#endif
++ KCmdLineLastOption
++} ;
++
++static KCmdLineOptions conduitOptions[] = {
+ { "T",0,0},
+ { "notest",
+ I18N_NOOP("*Really* run the conduit, not in test mode."),
+@@ -89,217 +103,155 @@ static KCmdLineOptions kpilotoptions[] =
+ { "PCtoHH",
+ I18N_NOOP("Copy Desktop to Pilot."),
+ 0 } ,
+- { "test-timeout",
+- I18N_NOOP("Run conduit specially designed to timeout."),
+- 0 } ,
+- { "test-usercheck",
+- I18N_NOOP("Run conduit just for user check."),
+- 0 } ,
+- { "dump-calendar",
+- I18N_NOOP("Dump calendar to stdout."),
++ { "loop",
++ I18N_NOOP("Repeated perform action - only useful for --list"),
+ 0 } ,
+-#ifdef DEBUG
+- {"debug <level>", I18N_NOOP("Set debugging level"), "0"},
+-#endif
+ KCmdLineLastOption
+-};
+-
+-
+-static LogWidget *logWidget = 0L;
+-static QPushButton *resetButton = 0L;
+-
+-
++} ;
+
+ /**
+ *** Conduits - sync actions - for testing specific scenarios.
+ **/
+
+-class TimeoutAction : public SyncAction
+-{
+-public:
+- TimeoutAction(KPilotDeviceLink *p) ;
+-protected:
+- virtual bool exec();
+-} ;
+
+-TimeoutAction::TimeoutAction(KPilotDeviceLink *p) :
+- SyncAction(p)
++
++KPilotLink *createLink( bool local )
+ {
+ FUNCTIONSETUP;
++ if (!local)
++ {
++ return new KPilotDeviceLink(0, "deviceLink");
++ }
++ else
++ {
++ return new KPilotLocalLink(0, "localLink");
++ }
+ }
+
+-bool TimeoutAction::exec()
++/** If @p loop is true, then instead of quitting at end of
++* sync, wait for a new sync just like the real daemon does.
++*/
++void connectStack( KPilotLink *l, ActionQueue *a, bool loop = false )
+ {
+ FUNCTIONSETUP;
+
+- for (int i = 0; i<3; i++)
++ if (l && a)
+ {
+- logMessage( CSL1("Hup two %1").arg(i) );
+- fHandle->tickle();
+- qApp->processEvents();
+- sleep(1);
++ QObject::connect(a, SIGNAL(syncDone(SyncAction *)),
++ l, SLOT(close()));
++ if (!loop)
++ {
++ QObject::connect(a, SIGNAL(syncDone(SyncAction *)),
++ kapp, SLOT(quit()));
++ }
++ else
++ {
++ QObject::connect(a, SIGNAL(syncDone(SyncAction *)),
++ l, SLOT(reset()));
++ }
++ QObject::connect(l, SIGNAL(deviceReady(KPilotLink*)),
++ a, SLOT(execConduit()));
+ }
+-
+- logMessage( CSL1("Now sleeping 65") );
+- qApp->processEvents();
+- sleep(65);
+- return delayDone();
+ }
+
+
+
+-
+-
+-
+-
+-void createLogWidget()
+-{
+- LogWidget *w = new LogWidget(0L);
+-
+- w->resize(300, 300);
+- w->show();
+- w->setShowTime(true);
+- kapp->setMainWidget(w);
+- logWidget = w;
+-
+- resetButton = new QPushButton(i18n("Reset"),w->buttonBox());
+-}
+-
+-static KPilotDeviceLink *deviceLink = 0L;
+-
+-void createLink()
++int exec(const QString &device, const QString &what, KCmdLineArgs *p)
+ {
+ FUNCTIONSETUP;
+
+- deviceLink = new KPilotDeviceLink(0, "deviceLink");
++ // get --exec-conduit value
++ if (what.isEmpty()) return 1;
++ QStringList l;
++ l.append(what);
+
+- QObject::connect(deviceLink, SIGNAL(logError(const QString &)),
+- logWidget, SLOT(addError(const QString &)));
+- QObject::connect(deviceLink, SIGNAL(logMessage(const QString &)),
+- logWidget, SLOT(addMessage(const QString &)));
+- QObject::connect(deviceLink,SIGNAL(logProgress(const QString &,int)),
+- logWidget, SLOT(addProgress(const QString &,int)));
++ SyncAction::SyncMode::Mode syncMode = SyncAction::SyncMode::eHotSync;
++ if (p->isSet("HHtoPC")) syncMode = SyncAction::SyncMode::eCopyHHToPC;
++ if (p->isSet("PCtoHH")) syncMode = SyncAction::SyncMode::eCopyPCToHH;
++ SyncAction::SyncMode mode(syncMode,p->isSet("test"),p->isSet("local"));
+
++ KPilotLink *link = createLink( p->isSet("local") );
++ ActionQueue *syncStack = new ActionQueue( link );
++ syncStack->queueInit( ActionQueue::queueCheckUser );
++ syncStack->queueConduits(l,mode,false);
++ syncStack->queueCleanup();
++ connectStack(link,syncStack);
++ link->reset(device);
++ return kapp->exec();
+ }
+
+-static ActionQueue *syncStack = 0L;
+-
+-void connectStack()
++int backup(const QString &device, const QString &what, KCmdLineArgs *p)
+ {
+ FUNCTIONSETUP;
+-
+- QObject::connect(syncStack, SIGNAL(logError(const QString &)),
+- logWidget, SLOT(addError(const QString &)));
+- QObject::connect(syncStack, SIGNAL(logMessage(const QString &)),
+- logWidget, SLOT(addMessage(const QString &)));
+- QObject::connect(syncStack,SIGNAL(logProgress(const QString &,int)),
+- logWidget, SLOT(addProgress(const QString &,int)));
+- QObject::connect(syncStack, SIGNAL(syncDone(SyncAction *)),
+- logWidget, SLOT(syncDone()));
+-
+- if (deviceLink)
+- {
+- QObject::connect(syncStack, SIGNAL(syncDone(SyncAction *)),
+- deviceLink, SLOT(close()));
+- QObject::connect(deviceLink, SIGNAL(deviceReady(KPilotDeviceLink*)), syncStack, SLOT(execConduit()));
+- QObject::connect(resetButton,SIGNAL(clicked()),deviceLink,SLOT(reset()));
+- }
++ KPilotLink *link = createLink( p->isSet("local") );
++ ActionQueue *syncStack = new ActionQueue( link );
++ syncStack->queueInit();
++ BackupAction *ba = new BackupAction( link, true /* full backup */ );
++ ba->setDirectory( what );
++ syncStack->addAction( ba );
++ syncStack->queueCleanup();
++ connectStack(link,syncStack);
++ link->reset(device);
++ return kapp->exec();
+ }
+
+-void createConnection(KCmdLineArgs *p)
++int restore(const QString &device, const QString &what, KCmdLineArgs *p)
+ {
+ FUNCTIONSETUP;
+-
+- QString devicePath = p->getOption("port");
+-
+- if (devicePath.isEmpty())
+- {
+- devicePath = "/dev/pilot";
+- }
+-
+- deviceLink->reset(devicePath);
++ KPilotLink *link = createLink( p->isSet("local") );
++ ActionQueue *syncStack = new ActionQueue( link );
++ syncStack->queueInit();
++ RestoreAction *ra = new RestoreAction( link );
++ ra->setDirectory( what );
++ syncStack->addAction( ra );
++ syncStack->queueCleanup();
++ connectStack(link,syncStack);
++ link->reset(device);
++ return kapp->exec();
+ }
+
+-int syncTest(KCmdLineArgs *p)
++int listDB(const QString &device, KCmdLineArgs *p)
+ {
+ FUNCTIONSETUP;
+-
+- createLogWidget();
+- createLink();
+-
+- syncStack = new ActionQueue(deviceLink);
+-
+- if (p->isSet("backup"))
+- {
+- syncStack->queueInit();
+- syncStack->addAction(new BackupAction(deviceLink,true));
+- }
+- else if (p->isSet("restore"))
+- {
+- syncStack->queueInit(0);
+- syncStack->addAction(new RestoreAction(deviceLink));
+- }
+- else if (p->isSet("test-timeout"))
+- {
+- syncStack->queueInit();
+- syncStack->addAction( new TimeoutAction(deviceLink) );
+- syncStack->addAction( new TimeoutAction(deviceLink) );
+- }
+- else
+- {
+- syncStack->queueInit(p->isSet("test-usercheck") /* whether to run usercheck */);
+- syncStack->addAction(new TestLink(deviceLink));
+- }
++ KPilotLink *link = createLink( p->isSet("local") );
++ ActionQueue *syncStack = new ActionQueue( link );
++ syncStack->queueInit();
++ syncStack->addAction( new TestLink( link ) );
+ syncStack->queueCleanup();
+-
+- connectStack();
+- createConnection(p);
++ connectStack(link,syncStack, p->isSet("loop") );
++ link->reset(device);
+ return kapp->exec();
+ }
+
+-int execConduit(KCmdLineArgs *p)
++int check( const QString &device, const QString &what, KCmdLineArgs *p )
+ {
+ FUNCTIONSETUP;
+
+- // get --exec-conduit value
+- QString s = p->getOption("conduit-exec");
+- if (s.isEmpty()) return 1;
+- QStringList l;
+- l.append(s);
+-
+- createLogWidget();
+-
+- SyncAction::SyncMode::Mode syncMode = SyncAction::SyncMode::eHotSync;
+- if (p->isSet("HHtoPC")) syncMode = SyncAction::SyncMode::eCopyHHToPC;
+- if (p->isSet("PCtoHH")) syncMode = SyncAction::SyncMode::eCopyPCToHH;
+- SyncAction::SyncMode mode(syncMode,p->isSet("test"),p->isSet("local"));
+-
+- if (!p->isSet("local"))
+- {
+- createLink();
+-
+- syncStack = new ActionQueue(deviceLink);
+- syncStack->queueInit();
+- syncStack->queueConduits(l,mode,false);
+- syncStack->queueCleanup();
+- connectStack();
+- createConnection(p);
+- }
+- else
++ if ( "help" == what )
+ {
+- syncStack = new ActionQueue( 0L );
+- syncStack->queueInit();
+- syncStack->queueConduits(l,mode,false);
++ std::cout <<
++"You can use the --check option to kpilotTest to run various\n"
++"small checks that require the use of the device. These are:\n"
++"\thelp - show this help\n"
++"\tuser - check the user name on the handheld\n"
++ << std::endl;
++ return 0;
++ }
++
++ if ( "user" == what )
++ {
++ KPilotLink *link = createLink( p->isSet("local") );
++ ActionQueue *syncStack = new ActionQueue( link );
++ syncStack->queueInit( ActionQueue::queueCheckUser ); // Creates usercheck
+ syncStack->queueCleanup();
+- connectStack();
+- QTimer::singleShot(100,syncStack,SLOT(execConduit()));
++ connectStack(link,syncStack);
++ link->reset(device);
++ return kapp->exec();
+ }
+
+-
+- return kapp->exec();
+ }
+
+-int listConduits(KCmdLineArgs *)
++void listConduits()
+ {
+ FUNCTIONSETUP;
+
+@@ -315,23 +267,78 @@ int listConduits(KCmdLineArgs *)
+ {
+ KSharedPtr < KService > o = (*availList).service();
+
+- std::cout << o->desktopEntryName().latin1() << std::endl;
+- std::cout << "\t" << o->name().latin1() << std::endl;
++ std::cout << "File: " << o->desktopEntryName().latin1() << std::endl;
++ std::cout << " Desc: " << o->name().latin1() << std::endl;
+ if (!o->library().isEmpty())
+ {
+- std::cout << "\tIn "
++ std::cout << " Lib : "
+ << o->library().latin1()
+ << std::endl;
+ }
+
+ ++availList;
+ }
++}
++
++int show( const QString &what )
++{
++ FUNCTIONSETUP;
++
++ if ( "help" == what )
++ {
++ std::cout <<
++"Displays various bits of KPilot's internal settings. This\n"
++"does not require a device connection or a running KDE desktop.\n"
++"No change to data takes place. The following options are available\n"
++"for display:\n"
++"\thelp - displays this help\n"
++"\tconduits - displays the list of available conduits\n"
++"\tuser - displays the user name KPilot expects\n"
++"\tdevice - displays the device settings in KPilot\n"
++"\tdebug - displays internal numbers\n"
++ << std::endl;
++ return 0;
++ }
++
++ if ( "conduits" == what )
++ {
++ listConduits();
++ return 0;
++ }
++
++ if ( "user" == what )
++ {
++ std::cout << "User: " << KPilotSettings::userName() << std::endl;
++ return 0;
++ }
++
++ if ( "device" == what )
++ {
++ std::cout << "Device: " << KPilotSettings::pilotDevice()
++ << "\nSpeed: " << KPilotSettings::pilotSpeed()
++ << "\nEncoding: " << KPilotSettings::encoding()
++ << "\nQuirks: " << KPilotSettings::workarounds()
++ << std::endl;
++ return 0;
++ }
+
+- return 0;
++ if ( "debug" == what )
++ {
++ std::cout << "Debug: " << KPilotSettings::debug()
++ << "\nConfig: " << KPilotSettings::configVersion()
++ << std::endl;
++ return 0;
++ }
++
++ std::cerr << "Unknown --show argument, use --show help for help.\n";
++ return 1;
+ }
+
+ int main(int argc, char **argv)
+ {
++#ifdef DEBUG
++ debug_level = 1;
++#endif
+ FUNCTIONSETUP;
+ KAboutData about("kpilotTest",
+ I18N_NOOP("KPilotTest"),
+@@ -340,41 +347,89 @@ int main(int argc, char **argv)
+ KAboutData::License_GPL, "(C) 2001-2004, Adriaan de Groot");
+ about.addAuthor("Adriaan de Groot",
+ I18N_NOOP("KPilot Maintainer"),
+- "groot at kde.org", "http://www.cs.kun.nl/~adridg/kpilot/");
++ "groot at kde.org", "http://www.kpilot.org/");
+
+ KCmdLineArgs::init(argc, argv, &about);
+- KCmdLineArgs::addCmdLineOptions(kpilotoptions, "kpilottest");
++ KCmdLineArgs::addCmdLineOptions(generalOptions,
++ I18N_NOOP("General"));
++ KCmdLineArgs::addCmdLineOptions(conduitOptions,
++ I18N_NOOP("Conduit Actions"),"conduit");
++
+ KApplication::addCmdLineOptions();
+
+ KCmdLineArgs *p = KCmdLineArgs::parsedArgs();
+
++ bool needGUI = false;
+
+- KApplication a;
++ // Some versions need a GUI
++ needGUI |= (p->isSet("check"));
++ needGUI |= (p->isSet("exec")); // assume worst wrt. conduits
++ needGUI |= (p->isSet("restore"));
++
++ KApplication a(needGUI,needGUI);
+ #ifdef DEBUG
+ KPilotConfig::getDebugLevel(p);
++ DEBUGKPILOT << fname << "Created KApplication." << endl;
+ #endif
+
+- if ( p->isSet("backup") ||
+- p->isSet("restore") ||
+- p->isSet("list") ||
+- p->isSet("test-timeout") ||
+- p->isSet("test-usercheck") )
++
++ unsigned int count = 0;
++ QString device( "/dev/pilot" );
++
++ if ( p->isSet("port") )
++ {
++ device = p->getOption("port");
++ }
++
++ if ( p->isSet("check") )
++ {
++ return check( device, p->getOption("check"),
++ KCmdLineArgs::parsedArgs("conduit") );
++ }
++
++ if ( p->isSet("show") )
++ {
++ return show( p->getOption("show") );
++ }
++
++ if ( p->isSet("exec") )
++ {
++ return exec( device, p->getOption("exec"),
++ KCmdLineArgs::parsedArgs("conduit") );
++ }
++
++ if ( p->isSet("list") )
+ {
+- return syncTest(p);
++ return listDB( device,
++ KCmdLineArgs::parsedArgs("conduit") );
+ }
+
+- if (p->isSet("conduit-list"))
++ if ( p->isSet("backup") )
+ {
+- return listConduits(p);
++ return backup( device, p->getOption("backup"),
++ KCmdLineArgs::parsedArgs("conduit") );
+ }
+
+- if (p->isSet("conduit-exec"))
++ if ( p->isSet("restore") )
+ {
+- return execConduit(p);
++ return restore( device, p->getOption("restore"),
++ KCmdLineArgs::parsedArgs("conduit") );
+ }
+
+- // The default is supposed to be "list"
+- return syncTest(p);
++
++
++ std::cout <<
++"Usage: kpilotTest [--port devicename] action\n\n"
++"Where action can be one of:\n"
++"\t--list - list the databases on the handheld\n"
++"\t--show (help | conduits | ...) - show configuration\n"
++"\t--check (help | user | ...) - check device\n"
++"\t--exec conduit - run a single conduit\n"
++"\t--backup - backup the device\n"
++"\t--restore - restore the device from backup\n"
++ << std::endl;
++ return 1;
++
+ /* NOTREACHED */
+ (void) test_id;
+ }
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/memoWidget.cc kdepim-3.5.5.dfsg.1/kpilot/kpilot/memoWidget.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/memoWidget.cc 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/memoWidget.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -28,9 +28,11 @@
+ ** Bug reports and questions can be sent to kde-pim at kde.org
+ */
+ static const char *memowidget_id =
+- "$Id: memoWidget.cc 444756 2005-08-10 13:35:01Z mlaurent $";
++ "$Id: memoWidget.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
++#include <config.h>
+ #include "options.h"
++#include "fakes.h"
+
+ #include <time.h>
+
+@@ -178,7 +180,7 @@ void MemoWidget::showComponent()
+ //
+ PilotLocalDatabase *memoDB =
+ new PilotLocalDatabase(dbPath(), CSL1("MemoDB"));
+- if (memoDB == NULL || !memoDB->isDBOpen())
++ if (memoDB == NULL || !memoDB->isOpen())
+ {
+ kdWarning() << k_funcinfo <<
+ ": Can't open local database MemoDB\n";
+@@ -366,7 +368,7 @@ void MemoWidget::slotDeleteMemo()
+ DEBUGKPILOT << fname << ": Searching for record to delete (it's fresh)" << endl;
+ #endif
+ PilotLocalDatabase *memoDB = new PilotLocalDatabase(dbPath(), CSL1("MemoDB"));
+- if (!memoDB || (!memoDB->isDBOpen()))
++ if (!memoDB || (!memoDB->isOpen()))
+ {
+ // Err.. peculiar.
+ kdWarning() << k_funcinfo << ": Can't open MemoDB" << endl;
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/pilotDaemon.cc kdepim-3.5.5.dfsg.1/kpilot/kpilot/pilotDaemon.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/pilotDaemon.cc 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/pilotDaemon.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -29,7 +29,7 @@
+ ** Bug reports and questions can be sent to kde-pim at kde.org
+ */
+ static const char *pilotdaemon_id =
+- "$Id: pilotDaemon.cc 437980 2005-07-23 19:53:57Z kainhofe $";
++ "$Id: pilotDaemon.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ #include "options.h"
+
+@@ -59,6 +59,8 @@ static const char *pilotdaemon_id =
+ #include "fileInstaller.h"
+ #include "pilotUser.h"
+ #include "pilotDatabase.h"
++#include "kpilotlink.h"
++#include "kpilotdevicelink.h"
+
+ #include "hotSync.h"
+ #include "interactiveSync.h"
+@@ -149,7 +151,7 @@ void PilotDaemonTray::setupWidget()
+ FUNCTIONSETUP;
+
+ KGlobal::iconLoader()->addAppDir( CSL1("kpilot") );
+- icons[Normal] = loadIcon( CSL1("kpilot") );
++ icons[Normal] = loadIcon( CSL1("kpilotDaemon") );
+ icons[Busy] = loadIcon( CSL1("busysync") );
+ icons[NotListening] = loadIcon( CSL1("nosync") );
+
+@@ -176,7 +178,6 @@ void PilotDaemonTray::setupWidget()
+
+ // Keep this synchronized with kpilotui.rc and kpilot.cc if at all possible.
+ MI(eHotSync);
+- MI(eFastSync);
+ MI(eFullSync);
+ MI(eBackup);
+ MI(eRestore);
+@@ -197,7 +198,7 @@ void PilotDaemonTray::setupWidget()
+
+
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": Finished getting icons" << endl;
++ DEBUGKPILOT << fname << ": Finished getting icons" << endl;
+ #endif
+ }
+
+@@ -318,7 +319,7 @@ PilotDaemon::PilotDaemon() :
+ fNextSyncType.setMode( KPilotSettings::syncType() );
+
+ #ifdef DEBUG
+- DEBUGDAEMON << fname
++ DEBUGKPILOT << fname
+ << ": The daemon is ready with status "
+ << statusString() << " (" << (int) fDaemonStatus << ")" << endl;
+ #endif
+@@ -377,7 +378,7 @@ int PilotDaemon::getPilotSpeed()
+ }
+
+ #ifdef DEBUG
+- DEBUGDAEMON << fname
++ DEBUGKPILOT << fname
+ << ": Speed set to "
+ << speedname << " (" << speed << ")" << endl;
+ #endif
+@@ -395,7 +396,7 @@ void PilotDaemon::showTray()
+ if (!fTray)
+ {
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": No tray icon to display!" << endl;
++ DEBUGKPILOT << fname << ": No tray icon to display!" << endl;
+ #endif
+
+ return;
+@@ -407,7 +408,7 @@ void PilotDaemon::showTray()
+ fTray->show();
+
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": Tray icon displayed." << endl;
++ DEBUGKPILOT << fname << ": Tray icon displayed." << endl;
+ #endif
+
+ updateTrayStatus();
+@@ -453,11 +454,11 @@ void PilotDaemon::showTray()
+ (void) PilotAppCategory::setupPilotCodec(KPilotSettings::encoding());
+
+ #ifdef DEBUG
+- DEBUGDAEMON << fname
++ DEBUGKPILOT << fname
+ << ": Got configuration "
+ << KPilotSettings::pilotDevice()
+ << endl;
+- DEBUGDAEMON << fname
++ DEBUGKPILOT << fname
+ << ": Got conduit list "
+ << (KPilotSettings::installedConduits().join(CSL1(",")))
+ << endl;
+@@ -469,7 +470,7 @@ void PilotDaemon::showTray()
+ if (fPilotLink)
+ {
+ #ifdef DEBUG
+- DEBUGDAEMON << fname
++ DEBUGKPILOT << fname
+ << ": Resetting with device "
+ << KPilotSettings::pilotDevice()
+ << endl;
+@@ -477,7 +478,7 @@ void PilotDaemon::showTray()
+
+ fPilotLink->reset( KPilotSettings::pilotDevice() );
+ #ifdef DEBUG
+- DEBUGDAEMON << fname
++ DEBUGKPILOT << fname
+ << ": Using workarounds "
+ << KPilotSettings::workarounds()
+ << endl;
+@@ -485,7 +486,7 @@ void PilotDaemon::showTray()
+ if ( KPilotSettings::workarounds() == KPilotSettings::eWorkaroundUSB )
+ {
+ #ifdef DEBUG
+- DEBUGDAEMON << fname
++ DEBUGKPILOT << fname
+ << ": Using Zire31 USB workaround." << endl;
+ #endif
+ fPilotLink->setWorkarounds(true);
+@@ -604,8 +605,8 @@ bool PilotDaemon::setupPilotLink()
+ return false;
+ }
+
+- QObject::connect(fPilotLink, SIGNAL(deviceReady(KPilotDeviceLink*)),
+- this, SLOT(startHotSync(KPilotDeviceLink*)));
++ QObject::connect(fPilotLink, SIGNAL(deviceReady(KPilotLink*)),
++ this, SLOT(startHotSync(KPilotLink*)));
+ // connect the signals emitted by the pilotDeviceLink
+ QObject::connect(fPilotLink, SIGNAL(logError(const QString &)),
+ this, SLOT(logError(const QString &)));
+@@ -649,11 +650,6 @@ bool PilotDaemon::setupPilotLink()
+ requestSync(SyncAction::SyncMode::eHotSync);
+ }
+
+-/* DCOP ASYNC */ void PilotDaemon::requestFastSyncNext()
+-{
+- requestSync(SyncAction::SyncMode::eFastSync);
+-}
+-
+
+ /* DCOP ASYNC */ void PilotDaemon::requestSync(int mode)
+ {
+@@ -674,7 +670,7 @@ bool PilotDaemon::setupPilotLink()
+
+ if (fTray && (fTray->fSyncTypeMenu))
+ {
+- for (int i=((int)SyncAction::SyncMode::eFastSync);
++ for (int i=((int)SyncAction::SyncMode::eHotSync);
+ i<=((int)SyncAction::SyncMode::eRestore) /* Restore */ ;
+ ++i)
+ {
+@@ -692,7 +688,6 @@ bool PilotDaemon::setupPilotLink()
+
+ // This checks unique prefixes of the names of the various sync types.
+ if (s.startsWith(CSL1("H"))) requestSync(SyncAction::SyncMode::eHotSync);
+- else if (s.startsWith(CSL1("Fa"))) requestSync(SyncAction::SyncMode::eFastSync);
+ else if (s.startsWith(CSL1("Fu"))) requestSync(SyncAction::SyncMode::eFullSync);
+ else if (s.startsWith(CSL1("B"))) requestSync(SyncAction::SyncMode::eBackup);
+ else if (s.startsWith(CSL1("R"))) requestSync(SyncAction::SyncMode::eRestore);
+@@ -869,7 +864,7 @@ static void informOthers(KPilotDCOP_stub
+ }
+
+ static bool isSyncPossible(ActionQueue *fSyncStack,
+- KPilotDeviceLink *pilotLink,
++ KPilotLink *pilotLink,
+ KPilotDCOP_stub &kpilot)
+ {
+ FUNCTIONSETUP;
+@@ -886,12 +881,12 @@ static bool isSyncPossible(ActionQueue *
+ #ifdef DEBUG
+ if (callstatus != DCOPStub::CallSucceeded)
+ {
+- DEBUGDAEMON << fname <<
++ DEBUGKPILOT << fname <<
+ ": Could not call KPilot for status." << endl;
+ }
+ else
+ {
+- DEBUGDAEMON << fname << ": KPilot status " << kpilotstatus << endl;
++ DEBUGKPILOT << fname << ": KPilot status " << kpilotstatus << endl;
+ }
+ #endif
+ /**
+@@ -942,7 +937,7 @@ static void queueInstaller(ActionQueue *
+ }
+ }
+
+-static void queueEditors(ActionQueue *fSyncStack, KPilotDeviceLink *pilotLink)
++static void queueEditors(ActionQueue *fSyncStack, KPilotLink *pilotLink)
+ {
+ if (KPilotSettings::internalEditors())
+ {
+@@ -963,20 +958,59 @@ static void queueConduits(ActionQueue *f
+ }
+ }
+
+-/* slot */ void PilotDaemon::startHotSync(KPilotDeviceLink *pilotLink)
++bool PilotDaemon::shouldBackup()
++{
++
++ FUNCTIONSETUP;
++
++ bool ret = false;
++ int backupfreq = KPilotSettings::backupFrequency();
++
++#ifdef DEBUG
++ DEBUGKPILOT << fname << ": Backup Frequency is: [" << backupfreq <<
++ "]. " << endl;
++#endif
++
++ if ( (fNextSyncType == SyncAction::SyncMode::eHotSync) ||
++ (fNextSyncType == SyncAction::SyncMode::eFullSync) )
++ {
++ /** If we're doing a Hot or Full sync, see if our user has
++ * configured us to or to not always do a backup.
++ */
++ if ( backupfreq == SyncAction::eOnRequestOnly )
++ {
++#ifdef DEBUG
++ DEBUGKPILOT << fname << ": Should not do backup..." << endl;
++#endif
++ ret = false;
++ }
++ else if ( backupfreq == SyncAction::eEveryHotSync )
++ {
++#ifdef DEBUG
++ DEBUGKPILOT << fname << ": Should do backup..." << endl;
++#endif
++ ret = true;
++ }
++ }
++
++ return ret;
++
++}
++
++
++/* slot */ void PilotDaemon::startHotSync(KPilotLink *pilotLink)
+ {
+ FUNCTIONSETUP;
+
+ bool pcchanged=false; // If last PC to sync was a different one (implies full sync, normally)
+ QStringList conduits ; // list of conduits to run
+ QString s; // a generic string for stuff
+- KPilotUser *usr = 0L; // Pointer to user data on Pilot
+
+ #ifdef DEBUG
+- DEBUGDAEMON << fname
++ DEBUGKPILOT << fname
+ << ": Starting Sync with type "
+ << fNextSyncType.name() << endl;
+- DEBUGDAEMON << fname << ": Status is " << shortStatusString() << endl;
++ DEBUGKPILOT << fname << ": Status is " << shortStatusString() << endl;
+ (void) PilotDatabase::count();
+ #endif
+
+@@ -1003,19 +1037,35 @@ static void queueConduits(ActionQueue *f
+ // want to sync with a blank palm and then back up the result over her stored backup files,
+ // do a Full Sync when changing the PC or using a different Palm Desktop app.
+ if (fNextSyncType.mode() != SyncAction::SyncMode::eRestore)
+- {
+- // Use gethostid to determine , since JPilot uses 1+(2000000000.0*random()/(RAND_MAX+1.0))
++ { // Use gethostid to determine , since JPilot uses 1+(2000000000.0*random()/(RAND_MAX+1.0))
+ // as PC_ID, so using JPilot and KPilot is the same as using two different PCs
+- usr = pilotLink->getPilotUser();
+- pcchanged = usr->getLastSyncPC() !=(unsigned long) gethostid();
+- if (pcchanged && KPilotSettings::fullSyncOnPCChange() )
++ KPilotUser &usr = pilotLink->getPilotUser();
++ pcchanged = usr.getLastSyncPC() !=(unsigned long) gethostid();
++
++ if (pcchanged)
+ {
+- fNextSyncType = SyncAction::SyncMode::eFullSync;
++#ifdef DEBUG
++ DEBUGKPILOT << fname << ": PC changed. Last sync PC: [" << usr.getLastSyncPC()
++ << "], me: [" << (unsigned long) gethostid() << "]" << endl;
++#endif
++ if ( KPilotSettings::fullSyncOnPCChange() )
++ {
++#ifdef DEBUG
++ DEBUGKPILOT << fname << ": Setting sync mode to full sync. " << endl;
++#endif
++ fNextSyncType = SyncAction::SyncMode::eFullSync;
++ }
++ else
++ {
++#ifdef DEBUG
++ DEBUGKPILOT << fname << ": Not changing sync mode because of settings. " << endl;
++#endif
++ }
+ }
+ }
+
+ // Normal case: regular sync.
+- fSyncStack->queueInit(true);
++ fSyncStack->queueInit( ActionQueue::queueCheckUser );
+
+ conduits = KPilotSettings::installedConduits() ;
+
+@@ -1039,7 +1089,6 @@ static void queueConduits(ActionQueue *f
+ queueInstaller(fSyncStack,fInstaller,conduits);
+ break;
+ case SyncAction::SyncMode::eFullSync:
+- case SyncAction::SyncMode::eFastSync:
+ case SyncAction::SyncMode::eHotSync:
+ // first install the files, and only then do the conduits
+ // (conduits might want to sync a database that will be installed
+@@ -1049,8 +1098,7 @@ static void queueConduits(ActionQueue *f
+ // After running the conduits, install new databases
+ queueInstaller(fSyncStack,fInstaller,conduits);
+ // And sync the remaining databases if needed.
+- if ( (fNextSyncType == SyncAction::SyncMode::eHotSync) ||
+- (fNextSyncType == SyncAction::SyncMode::eFullSync))
++ if (shouldBackup())
+ {
+ fSyncStack->addAction(new BackupAction(pilotLink, (fNextSyncType == SyncAction::SyncMode::eFullSync)));
+ }
+@@ -1145,7 +1193,7 @@ launch:
+ }
+ else
+ {
+- QTimer::singleShot(5000,fPilotLink,SLOT(reset()));
++ QTimer::singleShot(10000,fPilotLink,SLOT(reset()));
+ }
+
+ fPostSyncAction = None;
+@@ -1184,7 +1232,7 @@ void PilotDaemon::slotRunKPilot()
+ else
+ {
+ #ifdef DEBUG
+- DEBUGDAEMON << fname
++ DEBUGKPILOT << fname
+ << ": Started KPilot with DCOP name "
+ << kpilotDCOP << " (pid " << kpilotPID << ")" << endl;
+ #endif
+@@ -1285,7 +1333,7 @@ int main(int argc, char **argv)
+ "pilone at slac.com");
+ about.addAuthor("Adriaan de Groot",
+ I18N_NOOP("Maintainer"),
+- "groot at kde.org", "http://www.cs.kun.nl/~adridg/");
++ "groot at kde.org", "http://www.kpilot.org/");
+ about.addAuthor("Reinhold Kainhofer",
+ I18N_NOOP("Developer"),
+ "reinhold at kainhofer.com", "http://reinhold.kainhofer.com/Linux/");
+@@ -1338,7 +1386,7 @@ int main(int argc, char **argv)
+ }
+
+ #ifdef DEBUG
+- DEBUGDAEMON << fname
++ DEBUGKPILOT << fname
+ << ": Configuration version "
+ << KPilotSettings::configVersion() << endl;
+ #endif
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/pilotDaemonDCOP.h kdepim-3.5.5.dfsg.1/kpilot/kpilot/pilotDaemonDCOP.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/pilotDaemonDCOP.h 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/pilotDaemonDCOP.h 2006-11-19 22:21:12.000000000 +0100
+@@ -55,8 +55,6 @@ k_dcop:
+ */
+ virtual ASYNC requestSyncType(QString) = 0;
+ /** Shortcut for using requestSync(1) */
+- virtual ASYNC requestFastSyncNext() = 0;
+- /** Shortcut for using requestSync(2) */
+ virtual ASYNC requestRegularSyncNext() = 0;
+ /** Query what type is set most recently. */
+ virtual int nextSyncType() const = 0;
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/pilotDaemon.h kdepim-3.5.5.dfsg.1/kpilot/kpilot/pilotDaemon.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/pilotDaemon.h 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/pilotDaemon.h 2006-11-19 22:21:12.000000000 +0100
+@@ -48,6 +48,9 @@ class LoggerDCOP_stub;
+ class KPilotDCOP_stub;
+ class LogFile;
+
++class KPilotLink;
++class KPilotDeviceLink;
++
+ class PilotDaemonTray : public KSystemTray
+ {
+ Q_OBJECT
+@@ -163,7 +166,6 @@ public slots:
+ virtual ASYNC requestSync(int);
+ public:
+ virtual ASYNC requestSyncType(QString);
+- virtual ASYNC requestFastSyncNext();
+ virtual ASYNC requestRegularSyncNext();
+ virtual int nextSyncType() const;
+ virtual ASYNC requestSyncOptions(bool,bool);
+@@ -196,7 +198,7 @@ protected:
+ int fPostSyncAction;
+
+ protected slots:
+- void startHotSync( KPilotDeviceLink* lnk );
++ void startHotSync( KPilotLink* lnk );
+ void endHotSync();
+
+ void logMessage(const QString &);
+@@ -206,6 +208,14 @@ protected slots:
+ private:
+ int getPilotSpeed();
+
++ /**
++ * Check whether we should do a backup. This is based on the
++ * KPilotSettings::backupFrequency and uses
++ * SyncAction::BackupFrequency. This will be expanded, hopefully,
++ * to provide backup scheduling at some point.
++ */
++ bool shouldBackup();
++
+ bool setupPilotLink();
+
+ KPilotDeviceLink &getPilotLink() { return *fPilotLink; }
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/syncStack.cc kdepim-3.5.5.dfsg.1/kpilot/kpilot/syncStack.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/syncStack.cc 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/syncStack.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -29,7 +29,7 @@
+ */
+ #include "options.h"
+
+-static const char *syncStack_id = "$Id: syncStack.cc 449694 2005-08-16 13:07:41Z adridg $";
++static const char *syncStack_id = "$Id: syncStack.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ #include <unistd.h>
+
+@@ -55,7 +55,7 @@ static const char *syncStack_id = "$Id:
+
+
+
+-WelcomeAction::WelcomeAction(KPilotDeviceLink *p) :
++WelcomeAction::WelcomeAction(KPilotLink *p) :
+ SyncAction(p,"welcomeAction")
+ {
+ FUNCTIONSETUP;
+@@ -74,7 +74,7 @@ WelcomeAction::WelcomeAction(KPilotDevic
+ return true;
+ }
+
+-SorryAction::SorryAction(KPilotDeviceLink *p, const QString &s) :
++SorryAction::SorryAction(KPilotLink *p, const QString &s) :
+ SyncAction(p,"sorryAction"),
+ fMessage(s)
+ {
+@@ -93,7 +93,7 @@ bool SorryAction::exec()
+ return delayDone();
+ }
+
+-LocalBackupAction::LocalBackupAction(KPilotDeviceLink *p, const QString &d) :
++LocalBackupAction::LocalBackupAction(KPilotLink *p, const QString &d) :
+ SyncAction(p,"LocalBackupAction"),
+ fDir(d)
+ {
+@@ -106,7 +106,7 @@ bool LocalBackupAction::exec()
+ startTickle();
+
+ QString dirname = fDir +
+- PilotAppCategory::codec()->toUnicode(fHandle->getPilotUser()->getUserName()) +
++ PilotAppCategory::codec()->toUnicode(fHandle->getPilotUser().getUserName()) +
+ CSL1("/");
+ QDir dir(dirname,QString::null,QDir::Unsorted,QDir::Files);
+
+@@ -135,7 +135,7 @@ bool LocalBackupAction::exec()
+ }
+
+
+-ConduitProxy::ConduitProxy(KPilotDeviceLink *p,
++ConduitProxy::ConduitProxy(KPilotLink *p,
+ const QString &name,
+ const SyncAction::SyncMode &m) :
+ ConduitAction(p,name.latin1(),m.list()),
+@@ -173,23 +173,51 @@ ConduitProxy::ConduitProxy(KPilotDeviceL
+ << endl;
+ #endif
+
+- KLibFactory *factory = KLibLoader::self()->factory(
++ KLibrary *library = KLibLoader::self()->library(
+ QFile::encodeName(fLibraryName));
+- if (!factory)
++ if (!library)
+ {
+ kdWarning() << k_funcinfo
+ << ": Can't load library "
+ << fLibraryName
++ << " - "
++ << KLibLoader::self()->lastErrorMessage()
+ << endl;
+ addSyncLogEntry(i18n("Could not load conduit %1.").arg(fDesktopName));
+ emit syncDone(this);
+ return true;
+ }
+
++ long version = PluginUtility::pluginVersion(library);
++ if ( KPILOT_PLUGIN_API != version )
++ {
++ kdWarning() << k_funcinfo
++ << ": Library "
++ << fLibraryName
++ << " has version "
++ << version
++ << endl;
++ addSyncLogEntry(i18n("Conduit %1 has wrong version (%2).").arg(fDesktopName).arg(version));
++ emit syncDone(this);
++ return true;
++ }
++
++ KLibFactory *factory = library->factory();
++ if (!factory)
++ {
++ kdWarning() << k_funcinfo
++ << ": Can't find factory in library "
++ << fLibraryName
++ << endl;
++ addSyncLogEntry(i18n("Could not initialize conduit %1.").arg(fDesktopName));
++ emit syncDone(this);
++ return true;
++ }
++
+ QStringList l = syncMode().list();
+
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": Flags: " << syncMode().name() << endl;
++ DEBUGKPILOT << fname << ": Flags: " << syncMode().name() << endl;
+ #endif
+
+ QObject *object = factory->create(fHandle,name(),"SyncAction",l);
+@@ -254,7 +282,7 @@ void ConduitProxy::execDone(SyncAction *
+ }
+
+
+-ActionQueue::ActionQueue(KPilotDeviceLink *d) :
++ActionQueue::ActionQueue(KPilotLink *d) :
+ SyncAction(d,"ActionQueue"),
+ fReady(false)
+ // The string lists have default constructors
+@@ -268,13 +296,13 @@ ActionQueue::~ActionQueue()
+ }
+
+
+-void ActionQueue::queueInit(bool checkUser)
++void ActionQueue::queueInit( ActionQueue::InitFlags checkUser)
+ {
+ FUNCTIONSETUP;
+
+ addAction(new WelcomeAction(fHandle));
+
+- if (checkUser)
++ if ( ActionQueue::queueCheckUser == checkUser)
+ {
+ addAction(new CheckUser(fHandle));
+ }
+@@ -294,14 +322,14 @@ void ActionQueue::queueConduits(const QS
+ if ((*it).startsWith(CSL1("internal_")))
+ {
+ #ifdef DEBUG
+- DEBUGDAEMON << fname <<
++ DEBUGKPILOT << fname <<
+ ": Ignoring conduit " << *it << endl;
+ #endif
+ continue;
+ }
+
+ #ifdef DEBUG
+- DEBUGDAEMON << fname
++ DEBUGKPILOT << fname
+ << ": Creating proxy with mode=" << m.name() << endl;
+ #endif
+ ConduitProxy *cp = new ConduitProxy(fHandle,*it,m);
+@@ -332,7 +360,7 @@ void ActionQueue::actionCompleted(SyncAc
+ if (b)
+ {
+ #ifdef DEBUG
+- DEBUGDAEMON << fname
++ DEBUGKPILOT << fname
+ << ": Completed action "
+ << b->name()
+ << endl;
+@@ -369,7 +397,7 @@ void ActionQueue::actionCompleted(SyncAc
+ }
+
+ #ifdef DEBUG
+- DEBUGDAEMON << fname
++ DEBUGKPILOT << fname
+ << ": Will run action "
+ << a->name()
+ << endl;
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/syncStack.h kdepim-3.5.5.dfsg.1/kpilot/kpilot/syncStack.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/syncStack.h 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/syncStack.h 2006-11-19 22:21:12.000000000 +0100
+@@ -52,7 +52,7 @@
+ * ActionQueue.
+ *
+ * An ActionQueue is constructed with a @p device. As usual, you should connect
+-* the device's deviceReady(KPilotDeviceLink*) signal with the exec() slot --
++* the device's deviceReady(KPilotLink*) signal with the exec() slot --
+ * or something to that effect.
+ * The ActionQueue will then run all the actions in the queue in sequence.
+ *
+@@ -65,7 +65,7 @@ public:
+ /** Constructor. Pass in a KPilot device link for it to act on.
+ * It is legal to pass in 0 (NULL) as a device.
+ */
+- ActionQueue(KPilotDeviceLink *device);
++ ActionQueue(KPilotLink *device);
+
+ virtual ~ActionQueue();
+
+@@ -91,6 +91,14 @@ protected:
+ QStringList fConduits;
+
+ public:
++ /** Enum values for queueInit(), specifying what
++ * standard actions to queue automatically.
++ */
++ enum InitFlags {
++ queueNone=0,
++ queueCheckUser
++ } ;
++
+ /**
+ * Call these queue*() functions to append standard functional
+ * blocks. You should at least call queueInit() and
+@@ -106,7 +114,7 @@ public:
+ * of files to install (checked at exec() time).
+ */
+
+- void queueInit(bool checkUser = false);
++ void queueInit( InitFlags checkUser = queueNone );
+ void queueConduits(const QStringList &conduits,const SyncAction::SyncMode &e, bool local=false);
+ void queueInstaller(const QString &dir);
+ void queueCleanup();
+@@ -129,7 +137,7 @@ protected slots:
+ class WelcomeAction : public SyncAction
+ {
+ public:
+- WelcomeAction(KPilotDeviceLink *);
++ WelcomeAction(KPilotLink *);
+
+ protected:
+ virtual bool exec();
+@@ -143,7 +151,7 @@ protected:
+ class SorryAction : public SyncAction
+ {
+ public:
+- SorryAction(KPilotDeviceLink *, const QString &s=QString::null);
++ SorryAction(KPilotLink *, const QString &s=QString::null);
+
+ protected:
+ virtual bool exec();
+@@ -160,7 +168,7 @@ protected:
+ class LocalBackupAction : public SyncAction
+ {
+ public:
+- LocalBackupAction(KPilotDeviceLink *, const QString &);
++ LocalBackupAction(KPilotLink *, const QString &);
+ protected:
+ virtual bool exec();
+ QString fDir;
+@@ -177,7 +185,7 @@ class ConduitProxy : public ConduitActio
+ Q_OBJECT
+
+ public:
+- ConduitProxy(KPilotDeviceLink *,
++ ConduitProxy(KPilotLink *,
+ const QString &desktopName,
+ const SyncAction::SyncMode &m);
+
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/todoEditor_base.ui kdepim-3.5.5.dfsg.1/kpilot/kpilot/todoEditor_base.ui
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/todoEditor_base.ui 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/todoEditor_base.ui 2006-11-19 22:21:12.000000000 +0100
+@@ -174,7 +174,7 @@
+ </connection>
+ </connections>
+ <layoutdefaults spacing="6" margin="11"/>
+-<includehints>
+- <includehint>kdatewidget.h</includehint>
+-</includehints>
++<includes>
++ <include location="system" impldecl="in implementation">kdatewidget.h</include>
++</includes>
+ </UI>
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/todoEditor.cc kdepim-3.5.5.dfsg.1/kpilot/kpilot/todoEditor.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/todoEditor.cc 2006-05-22 20:11:07.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/todoEditor.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -44,7 +44,7 @@
+ #include "todoEditor.moc"
+
+ static const char *todoEditor_id =
+- "$Id: todoEditor.cc 529452 2006-04-13 14:05:00Z mueller $";
++ "$Id: todoEditor.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ TodoEditor::TodoEditor(PilotTodoEntry * p, struct ToDoAppInfo *appInfo,
+ QWidget * parent, const char *name) :
+@@ -149,7 +149,6 @@ void TodoEditor::fillFields()
+ fTodo->setNote(fWidget->fNote->text());
+
+ emit(recordChangeComplete(fTodo));
+- fDeleteOnCancel = false;
+ KDialogBase::slotOk();
+ }
+
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/todoWidget.cc kdepim-3.5.5.dfsg.1/kpilot/kpilot/todoWidget.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/kpilot/todoWidget.cc 2005-09-10 10:24:39.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/kpilot/todoWidget.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -27,7 +27,7 @@
+ ** Bug reports and questions can be sent to kde-pim at kde.org
+ */
+ static const char *todowidget_id =
+- "$Id: todoWidget.cc 444649 2005-08-10 13:21:07Z mlaurent $";
++ "$Id: todoWidget.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+
+ #include "options.h"
+@@ -144,7 +144,7 @@ void TodoWidget::showComponent()
+
+ fTodoList.clear();
+
+- if (fTodoDB->isDBOpen())
++ if (fTodoDB->isOpen())
+ {
+ KPILOT_DELETE(fTodoAppInfo);
+ fTodoAppInfo = new PilotToDoInfo(fTodoDB);
+@@ -397,7 +397,7 @@ void TodoWidget::slotCreateNewRecord()
+ //
+ PilotDatabase *myDB = new PilotLocalDatabase(dbPath(), CSL1("ToDoDB"));
+
+- if (!myDB || !myDB->isDBOpen())
++ if (!myDB || !myDB->isOpen())
+ {
+ #ifdef DEBUG
+ DEBUGKPILOT << fname
+@@ -407,7 +407,7 @@ void TodoWidget::slotCreateNewRecord()
+ << " and got pointer @"
+ << (void *) myDB
+ << " with status "
+- << ( myDB ? myDB->isDBOpen() : false )
++ << ( myDB ? myDB->isOpen() : false )
+ << endl;
+ #endif
+
+@@ -555,7 +555,7 @@ void TodoWidget::writeTodo(PilotTodoEntr
+ PilotDatabase *myDB = todoDB;
+ bool usemyDB = false;
+
+- if (myDB == 0L || !myDB->isDBOpen())
++ if (myDB == 0L || !myDB->isOpen())
+ {
+ myDB = new PilotLocalDatabase(dbPath(), CSL1("ToDoDB"));
+ usemyDB = true;
+@@ -564,7 +564,7 @@ void TodoWidget::writeTodo(PilotTodoEntr
+ // Still no valid todo database...
+ //
+ //
+- if (!myDB->isDBOpen())
++ if (!myDB->isOpen())
+ {
+ #ifdef DEBUG
+ DEBUGKPILOT << fname << ": Todo database is not open" <<
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/CMakeLists.txt kdepim-3.5.5.dfsg.1/kpilot/lib/CMakeLists.txt
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/CMakeLists.txt 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,75 @@
++include(CheckIncludeFiles)
++include(CheckFunctionExists)
++
++check_include_files( stdint.h HAVE_STDINT_H )
++check_include_files( alloca.h HAVE_ALLOCA_H )
++check_include_files( "sys/time.h" HAVE_SYS_TIME_H )
++check_include_files( "sys/stat.h" HAVE_SYS_STAT_H )
++check_function_exists( cfsetspeed HAVE_CFSETSPEED )
++check_function_exists( strdup HAVE_STRDUP )
++check_function_exists( setenv HAVE_SETENV )
++check_function_exists( unsetenv HAVE_UNSETENV )
++check_function_exists( usleep HAVE_USLEEP )
++check_function_exists( random HAVE_RANDOM )
++check_function_exists( putenv HAVE_PUTENV )
++check_function_exists( seteuid HAVE_SETEUID )
++check_function_exists( mkstemps HAVE_MKSTEMPS )
++check_function_exists( mkstemp HAVE_MKSTEMP )
++check_function_exists( mkdtemp HAVE_MKDTEMP )
++check_function_exists( revoke HAVE_REVOKE )
++check_function_exists( strlcpy HAVE_STRLCPY )
++check_function_exists( strlcat HAVE_STRLCAT )
++check_function_exists( inet_aton HAVE_INET_ATON )
++
++configure_file(
++ ${CMAKE_SOURCE_DIR}/config.h.cmake
++ ${CMAKE_CURRENT_BINARY_DIR}/config.h
++)
++
++include_directories(${CMAKE_CURRENT_BINARY_DIR})
++
++set(lib_SRCS
++ options.cc
++ uiDialog.cc
++ plugin.cc
++ syncAction.cc
++ kpilotlink.cc
++ pilotRecord.cc
++ pilotDatabase.cc
++ pilotLocalDatabase.cc
++ pilotSerialDatabase.cc
++ pilotMemo.cc
++ pilotAddress.cc
++ pilotDateEntry.cc
++ pilotTodoEntry.cc
++ pilotStruct.cc
++)
++
++kde3_automoc(${lib_SRCS})
++kde3_add_kcfg_files(lib_SRCS kpilotlibSettings.kcfgc)
++add_library(kpilot SHARED ${lib_SRCS})
++target_link_libraries(kpilot ${PILOTLINK_LIBRARY} ${QT_LIBRARIES} kabc kdeui)
++kpilot_rpath(kpilot)
++
++#---------- INSTALL -----------------------*
++set(kpilotinclude_HEADERS
++ kpilotlink.h
++ uiDialog.h
++ plugin.h
++ pluginfactory.h
++ syncAction.h
++ pilotRecord.h
++ pilotDatabase.h
++ pilotLocalDatabase.h
++ pilotSerialDatabase.h
++)
++
++install(
++ TARGETS kpilot
++ LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
++)
++
++install(
++ FILES ${kpilotinclude_HEADERS}
++ DESTINATION ${CMAKE_INSTALL_PREFIX}/include/kpilot
++)
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/data/MemoDB.pdb kdepim-3.5.5.dfsg.1/kpilot/lib/data/MemoDB.pdb
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/data/MemoDB.pdb 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/data/MemoDB.pdb 1970-01-01 01:00:00.000000000 +0100
+@@ -1 +0,0 @@
+-MemoDB ¼73½,1
½)D , X DATAmemo r F0 Unfiled Business Aardvar Lochem-haaksbergen. langs kanaal richting goor.2-de brug rechtsaf. bij de rotondes centrum aanhouden. 3-de rotnde L hengelose str. 2-de R kortenaar. 2-de L tromp. 1-ste R con.jol.
+\ No newline at end of file
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/fakes.c kdepim-3.5.5.dfsg.1/kpilot/lib/fakes.c
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/fakes.c 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/fakes.c 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,367 @@
++/* This file is part of the KDE libraries
++ Copyright (c) 2000 The KDE Project
++
++ unsetenv() taken from the GNU C Library.
++ Copyright (C) 1992,1995-1999,2000-2002 Free Software Foundation, Inc.
++
++ This library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Library 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
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public License
++ along with this library; see the file COPYING.LIB. If not, write to
++ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ Boston, MA 02110-1301, USA.
++*/
++
++
++#include <config.h>
++
++#define KDE_open open
++#define KDE_mkdir mkdir
++
++#ifndef HAVE_SETENV
++
++#ifdef HAVE_ALLOCA_H
++#include <alloca.h>
++#endif
++
++#include <string.h>
++#include <stdlib.h>
++#include <unistd.h>
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++ int setenv(const char *name, const char *value, int overwrite) {
++ int i;
++ char * a;
++
++ if (!overwrite && getenv(name)) return 0;
++
++ i = strlen(name) + strlen(value) + 2;
++ a = (char*)malloc(i);
++ if (!a) return 1;
++
++ strcpy(a, name);
++ strcat(a, "=");
++ strcat(a, value);
++
++ return putenv(a);
++}
++#endif /* !HAVE_SETENV */
++
++#ifndef HAVE_UNSETENV
++
++#ifdef HAVE_ALLOCA_H
++#include <alloca.h>
++#endif
++
++#include <string.h>
++#include <stdlib.h>
++#include <errno.h>
++#include <unistd.h>
++
++#ifndef environ
++extern char ** environ;
++#endif
++
++ void unsetenv (name)
++ const char *name;
++{
++ size_t len;
++ char **ep;
++
++ if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
++ {
++ errno = EINVAL;
++ return;
++ }
++
++ len = strlen (name);
++
++ ep = environ;
++ while (*ep != NULL)
++ if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
++ {
++ /* Found it. Remove this pointer by moving later ones back. */
++ char **dp = ep;
++
++ do
++ dp[0] = dp[1];
++ while (*dp++);
++ /* Continue the loop in case NAME appears again. */
++ }
++ else
++ ++ep;
++
++}
++
++#endif /* !HAVE_UNSETENV */
++
++#ifndef HAVE_USLEEP
++
++#if TIME_WITH_SYS_TIME
++# include <sys/time.h>
++# include <time.h>
++#else
++# if defined(HAVE_SYS_TIME_H)
++# include <sys/time.h>
++# else
++# include <time.h>
++# endif
++#endif
++
++#ifdef HAVE_SYS_SELECT_H
++#include <sys/select.h>
++#endif
++
++#ifdef __cplusplus /* this is supposed to be a C source file but still.. */
++extern "C" {
++#endif
++
++void usleep(unsigned int usec) {
++ struct timeval _usleep_tv;
++ _usleep_tv.tv_sec = usec/1000000;
++ _usleep_tv.tv_usec = usec%1000000;
++ select(0,0,0,0,&_usleep_tv);
++}
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif /* !HAVE_USLEEP */
++
++#ifndef HAVE_RANDOM
++long int random()
++{
++ return lrand48();
++}
++
++void srandom(unsigned int seed)
++{
++ srand48(seed);
++}
++#endif
++
++#ifndef HAVE_SETEUID
++int seteuid(uid_t euid)
++{
++ setreuid(-1, euid); /* Well, if you have neither you are in trouble :) */
++}
++#endif
++
++#ifndef HAVE_MKSTEMPS
++#include <sys/types.h>
++#ifdef HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#include <fcntl.h>
++#include <string.h>
++#include <strings.h>
++#include <stdlib.h>
++
++/* this is based on code taken from the GNU libc, distributed under the LGPL license */
++
++/* Generate a unique temporary file name from TEMPLATE.
++
++ TEMPLATE has the form:
++
++ <path>/ccXXXXXX<suffix>
++
++ SUFFIX_LEN tells us how long <suffix> is (it can be zero length).
++
++ The last six characters of TEMPLATE before <suffix> must be "XXXXXX";
++ they are replaced with a string that makes the filename unique.
++
++ Returns a file descriptor open on the file for reading and writing. */
++
++ int mkstemps (char* _template, int suffix_len)
++{
++ static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
++ char *XXXXXX;
++ int len;
++ int count;
++ int value;
++
++ len = strlen (_template);
++
++ if ((int) len < 6 + suffix_len || strncmp (&_template[len - 6 - suffix_len], "XXXXXX", 6))
++ return -1;
++
++ XXXXXX = &_template[len - 6 - suffix_len];
++
++ value = rand();
++ for (count = 0; count < 256; ++count)
++ {
++ int v = value;
++ int fd;
++
++ /* Fill in the random bits. */
++ XXXXXX[0] = letters[v % 62];
++ v /= 62;
++ XXXXXX[1] = letters[v % 62];
++ v /= 62;
++ XXXXXX[2] = letters[v % 62];
++ v /= 62;
++ XXXXXX[3] = letters[v % 62];
++ v /= 62;
++ XXXXXX[4] = letters[v % 62];
++ v /= 62;
++ XXXXXX[5] = letters[v % 62];
++
++ fd = KDE_open (_template, O_RDWR|O_CREAT|O_EXCL, 0600);
++ if (fd >= 0)
++ /* The file does not exist. */
++ return fd;
++
++ /* This is a random value. It is only necessary that the next
++ TMP_MAX values generated by adding 7777 to VALUE are different
++ with (module 2^32). */
++ value += 7777;
++ }
++ /* We return the null string if we can't find a unique file name. */
++ _template[0] = '\0';
++ return -1;
++}
++
++#endif /* !HAVE_MKSTEMPS */
++
++#ifndef HAVE_MKSTEMP
++ int mkstemp (char* _template)
++{
++ return mkstemps( _template, 0 );
++}
++#endif
++
++#ifndef HAVE_MKDTEMP
++
++#ifndef HAVE_MKSTEMPS
++#include <sys/types.h>
++#ifdef HAVE_SYS_STAT_H
++#include <sys/stat.h>
++#endif
++#endif
++
++/* Generate a unique temporary directory name from TEMPLATE.
++
++ TEMPLATE has the form:
++
++ <path>/ccXXXXXX
++
++
++ The last six characters of TEMPLATE must be "XXXXXX";
++ they are replaced with a string that makes the filename unique.
++
++ Returns a file descriptor open on the file for reading and writing. */
++
++ char* mkdtemp (char* _template)
++{
++ static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
++ char *XXXXXX;
++ int len;
++ int count;
++ int value;
++
++ len = strlen (_template);
++
++ if ((int) len < 6 || strncmp (&_template[len - 6], "XXXXXX", 6))
++ return 0;
++
++ XXXXXX = &_template[len - 6];
++
++ value = rand();
++ for (count = 0; count < 256; ++count)
++ {
++ int v = value;
++
++ /* Fill in the random bits. */
++ XXXXXX[0] = letters[v % 62];
++ v /= 62;
++ XXXXXX[1] = letters[v % 62];
++ v /= 62;
++ XXXXXX[2] = letters[v % 62];
++ v /= 62;
++ XXXXXX[3] = letters[v % 62];
++ v /= 62;
++ XXXXXX[4] = letters[v % 62];
++ v /= 62;
++ XXXXXX[5] = letters[v % 62];
++
++ /* This is a random value. It is only necessary that the next
++ TMP_MAX values generated by adding 7777 to VALUE are different
++ with (module 2^32). */
++ value += 7777;
++
++ if (!KDE_mkdir(_template,0700))
++ return _template;
++ }
++ return 0;
++}
++#endif /* !HAVE_MKDTEMP */
++
++#ifndef HAVE_REVOKE
++#include <errno.h>
++#ifndef ENOTSUP
++#define ENOTSUP 134 /* Not supported */
++#endif
++ int revoke(const char *tty)
++{
++ errno = ENOTSUP;
++ return -1;
++}
++#endif
++
++#ifndef HAVE_STRLCPY
++ unsigned long strlcpy(char* d, const char* s, unsigned long bufsize)
++{
++ unsigned long len, ret = strlen(s);
++
++ if (ret >= bufsize) {
++ if (bufsize) {
++ len = bufsize - 1;
++ memcpy(d, s, len);
++ d[len] = '\0';
++ }
++ } else
++ memcpy(d, s, ret + 1);
++
++ return ret;
++}
++#endif
++
++#ifndef HAVE_STRLCAT
++ unsigned long strlcat(char* d, const char* s, unsigned long bufsize)
++{
++ char *cp;
++ unsigned long ret, len1, len2 = strlen(s);
++
++ cp = (char *)memchr (d, '\0', bufsize);
++ if (!cp)
++ return bufsize + len2;
++ len1 = cp - d;
++ ret = len1 + len2;
++ if (ret >= bufsize) {
++ len2 = bufsize - len1 - 1;
++ memcpy(cp, s, len2);
++ cp[len2] = '\0';
++ } else
++ memcpy(cp, s, len2 + 1);
++
++ return ret;
++}
++#endif
++
++
++#ifdef __cplusplus
++}
++#endif
++
++
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/fakes.h kdepim-3.5.5.dfsg.1/kpilot/lib/fakes.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/fakes.h 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/fakes.h 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,75 @@
++/* This file is part of the KDE libraries
++ Copyright (c) 2000 The KDE Project
++
++ unsetenv() taken from the GNU C Library.
++ Copyright (C) 1992,1995-1999,2000-2002 Free Software Foundation, Inc.
++
++ This library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Library 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
++ Library General Public License for more details.
++
++ You should have received a copy of the GNU Library General Public License
++ along with this library; see the file COPYING.LIB. If not, write to
++ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ Boston, MA 02110-1301, USA.
++*/
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++#ifndef HAVE_SETENV
++int setenv(const char *name, const char *value, int overwrite);
++#endif /* !HAVE_SETENV */
++
++#ifndef HAVE_UNSETENV
++void unsetenv (const char *name);
++#endif /* !HAVE_UNSETENV */
++
++#ifndef HAVE_USLEEP
++void usleep(unsigned int usec);
++#endif /* !HAVE_USLEEP */
++
++#ifndef HAVE_RANDOM
++long int random();
++void srandom(unsigned int seed);
++#endif
++
++#ifndef HAVE_SETEUID
++int seteuid(uid_t euid);
++#endif
++
++#ifndef HAVE_MKSTEMPS
++int mkstemps (char* _template, int suffix_len);
++#endif /* !HAVE_MKSTEMPS */
++
++#ifndef HAVE_MKSTEMP
++int mkstemp (char* _template);
++#endif
++
++#ifndef HAVE_MKDTEMP
++char* mkdtemp (char* _template);
++#endif /* !HAVE_MKDTEMP */
++
++#ifndef HAVE_REVOKE
++int revoke(const char *tty);
++#endif
++
++#ifndef HAVE_STRLCPY
++unsigned long strlcpy(char* d, const char* s, unsigned long bufsize);
++#endif
++
++#ifndef HAVE_STRLCAT
++unsigned long strlcat(char* d, const char* s, unsigned long bufsize);
++#endif
++
++#ifdef __cplusplus
++}
++#endif
++
++
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/kpilotdevicelink.h kdepim-3.5.5.dfsg.1/kpilot/lib/kpilotdevicelink.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/kpilotdevicelink.h 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/kpilotdevicelink.h 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,219 @@
++#ifndef KPILOT_KPILOTDEVICELINK_H
++#define KPILOT_KPILOTDEVICELINK_H
++/* kpilotdevicelink.h KPilot
++**
++** Copyright (C) 1998-2001 by Dan Pilone
++** Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold at kainhofer.com>
++** Copyright (C) 2006 Adriaan de Groot <groot at kde.org>
++**
++*/
++
++/*
++** 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.1 of the License, or
++** (at your option) any later version.
++**
++** This program 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 program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include "kpilotlink.h"
++
++/** @file Definition of the device link class; implemented in kpilotlink.cc */
++
++/** Implementation of the device link class for physical
++* handheld devices, which communicate with the PC
++* using DLP / SLP via the pilot-link library.
++*/
++class KDE_EXPORT KPilotDeviceLink : public KPilotLink
++{
++// friend class SyncAction;
++friend class PilotSerialDatabase;
++Q_OBJECT
++
++/*
++** Constructors and destructors.
++*/
++public:
++ /**
++ * Creates a pilot link that can sync to the pilot.
++ *
++ * Call reset() on it to start looking for a device.
++ */
++ KPilotDeviceLink( QObject *parent = 0, const char *name = 0, const QString &tempDevice = QString::null );
++ /** Destructor. This rudely ends the communication with the handheld. */
++ virtual ~KPilotDeviceLink();
++
++
++ /**
++ * The link behaves like a state machine most of the time:
++ * it waits for the actual device to become available, and
++ * then becomes ready to handle syncing.
++ */
++ typedef enum {
++ Init,
++ WaitingForDevice,
++ FoundDevice,
++ CreatedSocket,
++ DeviceOpen,
++ AcceptedDevice,
++ SyncDone,
++ PilotLinkError,
++ WorkaroundUSB
++ } LinkStatus;
++
++ /** Get the status (state enum) of this link.
++ * @return The LinkStatus enum for the link's current state.
++ */
++ LinkStatus status() const { return fLinkStatus; } ;
++ /** Get a human-readable string for the given status @p l. */
++ static QString statusString(LinkStatus l);
++
++
++ virtual QString statusString() const;
++ virtual bool isConnected() const;
++ virtual void reset( const QString & );
++ virtual void close();
++ virtual void reset();
++ virtual bool tickle();
++ virtual const KPilotCard *getCardInfo(int card);
++ virtual void endOfSync();
++ virtual void finishSync();
++ virtual int openConduit();
++ virtual int getNextDatabase(int index,struct DBInfo *);
++ virtual int findDatabase(const char *name, struct DBInfo*,
++ int index=0, long type=0, long creator=0);
++ virtual bool retrieveDatabase(const QString &path, struct DBInfo *db);
++ virtual DBInfoList getDBList(int cardno=0, int flags=dlpDBListRAM);
++ virtual PilotDatabase *database( const QString &name );
++
++protected:
++ virtual bool installFile(const QString &, const bool deleteFile);
++ virtual void addSyncLogEntryImpl( const QString &s );
++ virtual int pilotSocket() const { return fCurrentPilotSocket; } ;
++
++
++private:
++ LinkStatus fLinkStatus;
++
++
++
++
++
++public:
++
++ /**
++ * Special-cases. Call this after a reset to set device-
++ * specific workarounds; the only one currently known
++ * is the Zire 31/72 T5 quirk of doing a non-HotSync
++ * connect when it's switched on.
++ */
++ void setWorkarounds(bool usb)
++ {
++ fWorkaroundUSB = usb;
++ } ;
++
++ /**
++ * sets an additional device, which should be tried as fallback
++ * usefull for hotplug enviroments
++ */
++ void setTempDevice( const QString &device );
++
++private:
++ bool fWorkaroundUSB;
++ QTimer *fWorkaroundUSBTimer;
++
++private slots:
++ void workaroundUSB();
++
++protected slots:
++ /**
++ * Attempt to open the device. Called regularly to check
++ * if the device exists (to handle USB-style devices).
++ */
++ void openDevice();
++
++ /**
++ * Called when the device is opened *and* activity occurs on the
++ * device. This indicates the beginning of a hotsync.
++ */
++ void acceptDevice();
++
++protected:
++ /**
++ * Does the low-level opening of the device and handles the
++ * pilot-link library initialisation.
++ */
++ bool open( QString device = QString::null );
++
++ /**
++ * Check for device permissions and existence, emitting
++ * warnings for weird situations. This is primarily intended
++ * to inform the user.
++ */
++ void checkDevice();
++
++ /**
++ * Some messages are only printed once and are suppressed
++ * after that. These are indicated by flag bits in
++ * messages.
++ */
++ enum { OpenMessage=1, OpenFailMessage=2 } ;
++ int messages;
++ int messagesMask;
++ static const int messagesType;
++
++ void shouldPrint(int,const QString &);
++
++
++
++private:
++ /**
++ * Path with resolved symlinks, to prevent double binding
++ * to the same device.
++ */
++ QString fRealPilotPath;
++
++ /**
++ * For transient devices: how often have we tried pi_bind()?
++ */
++ int fRetries;
++
++ /**
++ * Timers and Notifiers for detecting activity on the device.
++ */
++ QTimer *fOpenTimer;
++ QSocketNotifier *fSocketNotifier;
++ bool fSocketNotifierActive;
++
++ /**
++ * Pilot-link library handles for the device once it's opened.
++ */
++ int fPilotMasterSocket;
++ int fCurrentPilotSocket;
++ QString fTempDevice;
++
++ /**
++ * Handle cases where we can't accept or open the device,
++ * and data remains available on the pilot socket.
++ */
++ int fAcceptedCount;
++
++private:
++ class KPilotDeviceLinkPrivate;
++} ;
++
++#endif
++
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/kpilotlink.cc kdepim-3.5.5.dfsg.1/kpilot/lib/kpilotlink.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/kpilotlink.cc 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/kpilotlink.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -2,6 +2,7 @@
+ **
+ ** Copyright (C) 1998-2001 by Dan Pilone
+ ** Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold at kainhofer.com>
++** Copyright (C) 2006 Adriaan de Groot <groot at kde.org>
+ **
+ */
+
+@@ -25,9 +26,11 @@
+ /*
+ ** Bug reports and questions can be sent to kde-pim at kde.org
+ */
+-static const char *kpilotlink_id = "$Id: kpilotlink.cc 444649 2005-08-10 13:21:07Z mlaurent $";
++static const char *kpilotlink_id = "$Id: kpilotlink.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
++#include <config.h>
+ #include "options.h"
++#include "fakes.h"
+
+
+
+@@ -44,9 +47,7 @@ static const char *kpilotlink_id = "$Id:
+ #include <pi-socket.h>
+ #include <pi-dlp.h>
+ #include <pi-file.h>
+-#if !(PILOT_LINK_NUMBER < PILOT_LINK_0_12_0)
+ #include <pi-buffer.h>
+-#endif
+
+ #include <qdir.h>
+ #include <qtimer.h>
+@@ -58,13 +59,224 @@ static const char *kpilotlink_id = "$Id:
+ #include <kconfig.h>
+ #include <kmessagebox.h>
+ #include <kstandarddirs.h>
++#include <kurl.h>
++#include <kio/netaccess.h>
+
+ #include "pilotUser.h"
+ #include "pilotSysInfo.h"
+ #include "pilotCard.h"
+ #include "pilotAppCategory.h"
++#include "pilotSerialDatabase.h"
++#include "pilotLocalDatabase.h"
+
+ #include "kpilotlink.moc"
++#include "kpilotdevicelink.moc"
++#include "kpilotlocallink.moc"
++
++/** Class that handles periodically tickling the handheld through
++* the virtual tickle() method; deals with cancels through the
++* shared fDone variable.
++*/
++class TickleThread : public QThread
++{
++public:
++ TickleThread(KPilotLink *d, bool *done, int timeout) :
++ QThread(),
++ fHandle(d),
++ fDone(done),
++ fTimeout(timeout)
++ { };
++ virtual ~TickleThread();
++
++ virtual void run();
++
++ static const int ChecksPerSecond = 5;
++ static const int SecondsPerTickle = 5;
++ static const unsigned int TickleTimeoutEvent = 1066;
++
++private:
++ KPilotLink *fHandle;
++ bool *fDone;
++ int fTimeout;
++} ;
++
++TickleThread::~TickleThread()
++{
++}
++
++void TickleThread::run()
++{
++ FUNCTIONSETUP;
++ int subseconds = ChecksPerSecond;
++ int ticktock = SecondsPerTickle;
++ int timeout = fTimeout;
++#ifdef DEBUG_CERR
++ DEBUGLIBRARY << fname << ": Running for " << timeout << " seconds." << endl;
++ DEBUGLIBRARY << fname << ": Done @" << (void *) fDone << endl;
++#endif
++ while (!(*fDone))
++ {
++ QThread::msleep(1000/ChecksPerSecond);
++ if (!(--subseconds))
++ {
++#ifdef DEBUG_CERR
++// Don't dare use kdDebug() here, we're in a separate thread
++ DEBUGLIBRARY << fname << ": One second." << endl;
++#endif
++ if (timeout)
++ {
++ if (!(--timeout))
++ {
++ QApplication::postEvent(fHandle, new QEvent(static_cast<QEvent::Type>(TickleTimeoutEvent)));
++ break;
++ }
++ }
++ subseconds=ChecksPerSecond;
++ if (!(--ticktock))
++ {
++#ifdef DEBUG_CERR
++ DEBUGLIBRARY << fname << ": Kietel kietel!." << endl;
++#endif
++ ticktock=SecondsPerTickle;
++ fHandle->tickle();
++ }
++ }
++ }
++#ifdef DEBUG_CERR
++ DEBUGLIBRARY << fname << ": Finished." << endl;
++#endif
++}
++
++
++
++
++
++
++
++
++KPilotLink::KPilotLink( QObject *parent, const char *name ) :
++ QObject( parent, name ),
++ fPilotPath(QString::null),
++ fPilotUser(0L),
++ fPilotSysInfo(0L),
++ fTickleDone(true),
++ fTickleThread(0L)
++
++{
++ FUNCTIONSETUP;
++
++ fPilotUser = new KPilotUser();
++ fPilotUser->setUserName( "Henk Westbroek" );
++ fPilotUser->setLastSuccessfulSyncDate( 1139171019 );
++
++ fPilotSysInfo = new KPilotSysInfo();
++ fPilotSysInfo->setProductID( "LocalLink" );
++}
++
++KPilotLink::~KPilotLink()
++{
++ FUNCTIONSETUP;
++ KPILOT_DELETE(fPilotUser);
++ KPILOT_DELETE(fPilotSysInfo);
++}
++
++/* virtual */ bool KPilotLink::event(QEvent *e)
++{
++ if (e->type() == TickleThread::TickleTimeoutEvent)
++ {
++ stopTickle();
++ emit timeout();
++ return true;
++ }
++ else return QObject::event(e);
++}
++
++/*
++Start a tickle thread with the indicated timeout.
++*/
++void KPilotLink::startTickle(unsigned int timeout)
++{
++ FUNCTIONSETUP;
++
++ Q_ASSERT(fTickleDone);
++
++ /*
++ ** We've told the thread to finish up, but it hasn't
++ ** done so yet - so wait for it to do so, should be
++ ** only 200ms at most.
++ */
++ if (fTickleDone && fTickleThread)
++ {
++ fTickleThread->wait();
++ KPILOT_DELETE(fTickleThread);
++ }
++
++#ifdef DEBUG
++ DEBUGLIBRARY << fname << ": Done @" << (void *) (&fTickleDone) << endl;
++#endif
++ fTickleDone = false;
++ fTickleThread = new TickleThread(this,&fTickleDone,timeout);
++ fTickleThread->start();
++}
++
++void KPilotLink::stopTickle()
++{
++ FUNCTIONSETUP;
++ fTickleDone = true;
++ if (fTickleThread)
++ {
++ fTickleThread->wait();
++ KPILOT_DELETE(fTickleThread);
++ }
++}
++
++unsigned int KPilotLink::installFiles(const QStringList & l, const bool deleteFiles)
++{
++ FUNCTIONSETUP;
++
++ QStringList::ConstIterator i,e;
++ unsigned int k = 0;
++ unsigned int n = 0;
++ unsigned int total = l.count();
++
++ for (i = l.begin(), e = l.end(); i != e; ++i)
++ {
++ emit logProgress(QString::null,
++ (int) ((100.0 / total) * (float) n));
++
++ if (installFile(*i, deleteFiles))
++ k++;
++ n++;
++ }
++ emit logProgress(QString::null, 100);
++
++ return k;
++}
++
++void KPilotLink::addSyncLogEntry(const QString & entry, bool log)
++{
++ FUNCTIONSETUP;
++ if (entry.isEmpty()) return;
++
++ addSyncLogEntryImpl(entry);
++ if (log)
++ {
++ emit logMessage(entry);
++ }
++}
++
++
++/* virtual */ int KPilotLink::openConduit()
++{
++ return 0;
++}
++
++/* virtual */ int KPilotLink::pilotSocket() const
++{
++ return -1;
++}
++
++
+
+
+ // singleton helper class
+@@ -77,19 +289,19 @@ public:
+ return mThis;
+ }
+
+- bool canBind( QString device )
++ bool canBind( const QString &device )
+ {
+ showList();
+ return !mBoundDevices.contains( device );
+ }
+
+- void bindDevice( QString device )
++ void bindDevice( const QString &device )
+ {
+ mBoundDevices.append( device );
+ showList();
+ }
+
+- void unbindDevice( QString device )
++ void unbindDevice( const QString &device )
+ {
+ mBoundDevices.remove( device );
+ showList();
+@@ -105,9 +317,10 @@ protected:
+ private:
+ inline void showList() const
+ {
++ if ( !(mBoundDevices.count() > 0) ) return;
+ #ifdef DEBUG
+ FUNCTIONSETUPL(3);
+- DEBUGDAEMON << fname << "Bound devices: "
++ DEBUGLIBRARY << fname << ": Bound devices: "
+ << ((mBoundDevices.count() > 0) ? mBoundDevices.join(CSL1(", ")) : CSL1("<none>")) << endl;
+ #endif
+ }
+@@ -117,27 +330,22 @@ KPilotDeviceLink::KPilotDeviceLinkPrivat
+
+
+ KPilotDeviceLink::KPilotDeviceLink(QObject * parent, const char *name, const QString &tempDevice) :
+- QObject(parent, name),
++ KPilotLink(parent, name),
+ fLinkStatus(Init),
+- fTickleDone(true),
+- fTickleThread(0L),
+ fWorkaroundUSB(false),
+ fWorkaroundUSBTimer(0L),
+- fPilotPath(QString::null),
+ fRetries(0),
+ fOpenTimer(0L),
+ fSocketNotifier(0L),
+ fSocketNotifierActive(false),
+ fPilotMasterSocket(-1),
+ fCurrentPilotSocket(-1),
+- fTempDevice(tempDevice),
+- fPilotUser(0L),
+- fPilotSysInfo(0L)
++ fTempDevice(tempDevice)
+ {
+ FUNCTIONSETUP;
+
+ #ifdef DEBUG
+- DEBUGDAEMON << fname
++ DEBUGLIBRARY << fname
+ << ": Pilot-link version " << PILOT_LINK_NUMBER
+ << endl;
+ #endif
+@@ -156,6 +364,12 @@ KPilotDeviceLink::~KPilotDeviceLink()
+ KPILOT_DELETE(fPilotUser);
+ }
+
++/* virtual */ bool KPilotDeviceLink::isConnected() const
++{
++ return fLinkStatus == AcceptedDevice;
++}
++
++
+ void KPilotDeviceLink::close()
+ {
+ FUNCTIONSETUP;
+@@ -165,7 +379,7 @@ void KPilotDeviceLink::close()
+ KPILOT_DELETE(fSocketNotifier);
+ fSocketNotifierActive=false;
+ #ifdef DEBUG
+- DEBUGDAEMON << fname
++ DEBUGLIBRARY << fname
+ << ": Closing sockets "
+ << fCurrentPilotSocket
+ << " and "
+@@ -348,16 +562,11 @@ bool KPilotDeviceLink::open(QString devi
+ if (fPilotMasterSocket == -1)
+ {
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": Typing to open " << fRealPilotPath << endl;
++ DEBUGLIBRARY << fname << ": Typing to open " << fRealPilotPath << endl;
+ #endif
+
+-#if PILOT_LINK_NUMBER < PILOT_LINK_0_10_0
+- fPilotMasterSocket = pi_socket(PI_AF_SLP,
+- PI_SOCK_STREAM, PI_PF_PADP);
+-#else
+ fPilotMasterSocket = pi_socket(PI_AF_PILOT,
+ PI_SOCK_STREAM, PI_PF_DLP);
+-#endif
+
+ if (fPilotMasterSocket<1)
+ {
+@@ -368,7 +577,7 @@ bool KPilotDeviceLink::open(QString devi
+ }
+
+ #ifdef DEBUG
+- DEBUGDAEMON << fname
++ DEBUGLIBRARY << fname
+ << ": Got master " << fPilotMasterSocket << endl;
+ #endif
+
+@@ -378,23 +587,10 @@ bool KPilotDeviceLink::open(QString devi
+ Q_ASSERT(fLinkStatus == CreatedSocket);
+
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": Binding to path " << fPilotPath << endl;
++ DEBUGLIBRARY << fname << ": Binding to path " << fPilotPath << endl;
+ #endif
+
+-#if PILOT_LINK_NUMBER < PILOT_LINK_0_12_0
+- struct pi_sockaddr addr;
+-#if PILOT_LINK_NUMBER < PILOT_LINK_0_10_0
+- addr.pi_family = PI_AF_SLP;
+-#else
+- addr.pi_family = PI_AF_PILOT;
+-#endif
+- strlcpy(addr.pi_device, QFile::encodeName(device),sizeof(addr.pi_device));
+-
+- ret = pi_bind(fPilotMasterSocket,
+- (struct sockaddr *) &addr, sizeof(addr));
+-#else
+ ret = pi_bind(fPilotMasterSocket, QFile::encodeName(device));
+-#endif
+
+ if (ret >= 0)
+ {
+@@ -408,11 +604,11 @@ bool KPilotDeviceLink::open(QString devi
+ QObject::connect(fSocketNotifier, SIGNAL(activated(int)),
+ this, SLOT(acceptDevice()));
+ fSocketNotifierActive=true;
+-
++
+ if (fWorkaroundUSB)
+ {
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": Adding Z31 workaround." << endl;
++ DEBUGLIBRARY << fname << ": Adding Z31 workaround." << endl;
+ #endif
+ // Special case for Zire 31, 72, Tungsten T5,
+ // all of which may make a non-HotSync connection
+@@ -423,24 +619,15 @@ bool KPilotDeviceLink::open(QString devi
+ this,SLOT(workaroundUSB()));
+ fWorkaroundUSBTimer->start(5000,true);
+ }
+-
++
+ return true;
+ }
+ else
+ {
+ #ifdef DEBUG
+-#if PILOT_LINK_NUMBER < PILOT_LINK_0_12_0
+- DEBUGDAEMON << fname
+- << ": Tried "
+- << addr.pi_device
+- << " and got "
+- << strerror(errno)
+- << endl;
+-#else
+- DEBUGDAEMON << fname
++ DEBUGLIBRARY << fname
+ << ": Tried " << device << " and got " << strerror(errno) << endl;
+ #endif
+-#endif
+
+ if (fRetries < 5)
+ {
+@@ -536,9 +723,9 @@ void KPilotDeviceLink::acceptDevice()
+ }
+
+ #ifdef DEBUG
+- DEBUGDAEMON << fname
++ DEBUGLIBRARY << fname
+ << ": Found connection on device "<<pilotPath().latin1()<<endl;
+- DEBUGDAEMON << fname
++ DEBUGLIBRARY << fname
+ << ": Current status "
+ << statusString()
+ << " and master " << fPilotMasterSocket << endl;
+@@ -604,14 +791,10 @@ void KPilotDeviceLink::acceptDevice()
+ #ifdef DEBUG
+ else
+ {
+- DEBUGDAEMON << fname
++ DEBUGLIBRARY << fname
+ << ": RomVersion=" << fPilotSysInfo->getRomVersion()
+ << " Locale=" << fPilotSysInfo->getLocale()
+-#if PILOT_LINK_NUMBER < PILOT_LINK_0_10_0
+- /* No prodID member */
+-#else
+ << " Product=" << fPilotSysInfo->getProductID()
+-#endif
+ << endl;
+ }
+ #endif
+@@ -623,17 +806,22 @@ void KPilotDeviceLink::acceptDevice()
+
+ /* Ask the pilot who it is. And see if it's who we think it is. */
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": Reading user info @"
+- << (long) fPilotUser << endl;
+- DEBUGDAEMON << fname << ": Buffer @"
+- << (long) fPilotUser->pilotUser() << endl;
++ DEBUGLIBRARY << fname << ": Reading user info @"
++ << (void *) fPilotUser << endl;
++ DEBUGLIBRARY << fname << ": Buffer @"
++ << (void *) fPilotUser->pilotUser() << endl;
+ #endif
+
+ dlp_ReadUserInfo(fCurrentPilotSocket, fPilotUser->pilotUser());
+
+ #ifdef DEBUG
+- DEBUGDAEMON << fname
+- << ": Read user name " << fPilotUser->getUserName() << endl;
++ const char *n = fPilotUser->getUserName();
++ DEBUGLIBRARY << fname
++ << ": Read user name "
++ << ( (!n || !*n) ?
++ "<empty>" :
++ fPilotUser->getUserName() )
++ << endl;
+ #endif
+
+ emit logProgress(i18n("Checking last PC..."), 90);
+@@ -642,16 +830,10 @@ void KPilotDeviceLink::acceptDevice()
+ if ((ret=dlp_OpenConduit(fCurrentPilotSocket)) < 0)
+ {
+ #ifdef DEBUG
+- DEBUGDAEMON << k_funcinfo
++ DEBUGLIBRARY << k_funcinfo
+ << ": dlp_OpenConduit returned " << ret << endl;
+ #endif
+
+-#if 0
+- fLinkStatus = SyncDone;
+- emit logMessage(i18n
+- ("Exiting on cancel. All data not restored."));
+- return;
+-#endif
+ emit logError(i18n("Could not read user information from the Pilot. "
+ "Perhaps you have a password set on the device?"));
+ }
+@@ -665,14 +847,14 @@ void KPilotDeviceLink::acceptDevice()
+ void KPilotDeviceLink::workaroundUSB()
+ {
+ FUNCTIONSETUP;
+-
++
+ Q_ASSERT((fLinkStatus == DeviceOpen) || (fLinkStatus == WorkaroundUSB));
+ if (fLinkStatus == DeviceOpen)
+ {
+ reset();
+ }
+ fLinkStatus = WorkaroundUSB;
+-
++
+ if (!QFile::exists(fRealPilotPath))
+ {
+ // Fake connection has vanished again.
+@@ -688,158 +870,17 @@ void KPilotDeviceLink::workaroundUSB()
+ QTimer::singleShot(1000,this,SLOT(workaroundUSB()));
+ }
+
+-bool KPilotDeviceLink::tickle() const
++/* virtual */ bool KPilotDeviceLink::tickle()
+ {
+ // No FUNCTIONSETUP here because it may be called from
+ // a separate thread.
+ return pi_tickle(pilotSocket()) >= 0;
+ }
+
+-class TickleThread : public QThread
+-{
+-public:
+- TickleThread(KPilotDeviceLink *d, bool *done, int timeout) :
+- QThread(),
+- fHandle(d),
+- fDone(done),
+- fTimeout(timeout)
+- { };
+- virtual ~TickleThread();
+-
+- virtual void run();
+-
+- static const int ChecksPerSecond = 5;
+- static const int SecondsPerTickle = 5;
+-
+-private:
+- KPilotDeviceLink *fHandle;
+- bool *fDone;
+- int fTimeout;
+-} ;
+-
+-TickleThread::~TickleThread()
+-{
+-}
+-
+-void TickleThread::run()
+-{
+- FUNCTIONSETUP;
+- int subseconds = ChecksPerSecond;
+- int ticktock = SecondsPerTickle;
+- int timeout = fTimeout;
+-#ifdef DEBUG_CERR
+- DEBUGDAEMON << fname << ": Running for " << timeout << " seconds." << endl;
+- DEBUGDAEMON << fname << ": Done @" << (void *) fDone << endl;
+-#endif
+- while (!(*fDone))
+- {
+- QThread::msleep(1000/ChecksPerSecond);
+- if (!(--subseconds))
+- {
+-#ifdef DEBUG_CERR
+-// Don't dare use kdDebug() here, we're in a separate thread
+- DEBUGDAEMON << fname << ": One second." << endl;
+-#endif
+- if (timeout)
+- {
+- if (!(--timeout))
+- {
+- QApplication::postEvent(fHandle, new QEvent((QEvent::Type)(KPilotDeviceLink::TickleTimeoutEvent)));
+- break;
+- }
+- }
+- subseconds=ChecksPerSecond;
+- if (!(--ticktock))
+- {
+-#ifdef DEBUG_CERR
+- DEBUGDAEMON << fname << ": Kietel kietel!." << endl;
+-#endif
+- ticktock=SecondsPerTickle;
+- fHandle->tickle();
+- }
+- }
+- }
+-#ifdef DEBUG_CERR
+- DEBUGDAEMON << fname << ": Finished." << endl;
+-#endif
+-}
+-
+-/*
+-** Deal with events, especially the ones used to signal a timeout
+-** in a tickle thread.
+-*/
+-
+-/* virtual */ bool KPilotDeviceLink::event(QEvent *e)
+-{
+- if (e->type() == TickleTimeoutEvent)
+- {
+- stopTickle();
+- emit timeout();
+- return true;
+- }
+- else return QObject::event(e);
+-}
+-
+-/*
+-Start a tickle thread with the indicated timeout.
+-*/
+-void KPilotDeviceLink::startTickle(unsigned int timeout)
++/* virtual */ void KPilotDeviceLink::addSyncLogEntryImpl( const QString &entry )
+ {
+- FUNCTIONSETUP;
+-
+- Q_ASSERT(fTickleDone);
+-
+- /*
+- ** We've told the thread to finish up, but it hasn't
+- ** done so yet - so wait for it to do so, should be
+- ** only 200ms at most.
+- */
+- if (fTickleDone && fTickleThread)
+- {
+- fTickleThread->wait();
+- KPILOT_DELETE(fTickleThread);
+- }
+-
+-#ifdef DEBUG
+- DEBUGDAEMON << fname << ": Done @" << (void *) (&fTickleDone) << endl;
+-#endif
+- fTickleDone = false;
+- fTickleThread = new TickleThread(this,&fTickleDone,timeout);
+- fTickleThread->start();
+-}
+-
+-void KPilotDeviceLink::stopTickle()
+-{
+- FUNCTIONSETUP;
+- fTickleDone = true;
+- if (fTickleThread)
+- {
+- fTickleThread->wait();
+- KPILOT_DELETE(fTickleThread);
+- }
+-}
+-
+-
+-int KPilotDeviceLink::installFiles(const QStringList & l, const bool deleteFiles)
+-{
+- FUNCTIONSETUP;
+-
+- QStringList::ConstIterator i;
+- int k = 0;
+- int n = 0;
+-
+- for (i = l.begin(); i != l.end(); ++i)
+- {
+- emit logProgress(QString::null,
+- (int) ((100.0 / l.count()) * (float) n));
+-
+- if (installFile(*i, deleteFiles))
+- k++;
+- n++;
+- }
+- emit logProgress(QString::null, 100);
+-
+- return k;
++ dlp_AddSyncLogEntry(fCurrentPilotSocket,
++ const_cast<char *>((const char *)PilotAppCategory::codec()->fromUnicode(entry)));
+ }
+
+ bool KPilotDeviceLink::installFile(const QString & f, const bool deleteFile)
+@@ -847,7 +888,7 @@ bool KPilotDeviceLink::installFile(const
+ FUNCTIONSETUP;
+
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": Installing file " << f << endl;
++ DEBUGLIBRARY << fname << ": Installing file " << f << endl;
+ #endif
+
+ if (!QFile::exists(f))
+@@ -869,11 +910,7 @@ bool KPilotDeviceLink::installFile(const
+ return false;
+ }
+
+-#if PILOT_LINK_NUMBER < PILOT_LINK_0_12_0
+- if (pi_file_install(pf, fCurrentPilotSocket, 0) < 0)
+-#else
+ if (pi_file_install(pf, fCurrentPilotSocket, 0, 0L) < 0)
+-#endif
+ {
+ kdWarning() << k_funcinfo
+ << ": Cannot pi_file_install " << f << endl;
+@@ -890,25 +927,6 @@ bool KPilotDeviceLink::installFile(const
+ }
+
+
+-void KPilotDeviceLink::addSyncLogEntry(const QString & entry, bool log)
+-{
+- FUNCTIONSETUP;
+- if (entry.isEmpty()) return;
+-
+- QString t(entry);
+-
+-#if PILOT_LINK_NUMBER < PILOT_LINK_0_11_0
+- t.append("X");
+-#endif
+-
+- dlp_AddSyncLogEntry(fCurrentPilotSocket,
+- const_cast<char *>((const char *)PilotAppCategory::codec()->fromUnicode(entry)));
+- if (log)
+- {
+- emit logMessage(entry);
+- }
+-}
+-
+ int KPilotDeviceLink::openConduit()
+ {
+ return dlp_OpenConduit(fCurrentPilotSocket);
+@@ -969,14 +987,14 @@ void KPilotDeviceLink::finishSync()
+ {
+ FUNCTIONSETUP ;
+
+- getPilotUser()->setLastSyncPC((unsigned long) gethostid());
+- getPilotUser()->setLastSyncDate(time(0));
++ getPilotUser().setLastSyncPC((unsigned long) gethostid());
++ getPilotUser().setLastSyncDate(time(0));
++
+
+-
+-#ifdef DEBUG
+- DEBUGDAEMON << fname << ": Writing username " << getPilotUser()->getUserName() << endl;
++#ifdef DEBUG
++ DEBUGLIBRARY << fname << ": Writing username " << getPilotUser().getUserName() << endl;
+ #endif
+- dlp_WriteUserInfo(pilotSocket(),getPilotUser()->pilotUser());
++ dlp_WriteUserInfo(pilotSocket(),getPilotUser().pilotUser());
+ addSyncLogEntry(i18n("End of HotSync\n"));
+ endOfSync();
+ }
+@@ -985,9 +1003,6 @@ int KPilotDeviceLink::getNextDatabase(in
+ {
+ FUNCTIONSETUP;
+
+-#if PILOT_LINK_NUMBER < PILOT_LINK_0_12_0
+- return dlp_ReadDBList(pilotSocket(),0,dlpDBListRAM,index,dbinfo);
+-#else
+ pi_buffer_t buf = { 0,0,0 };
+ int r = dlp_ReadDBList(pilotSocket(),0,dlpDBListRAM,index,&buf);
+ if (r >= 0)
+@@ -995,7 +1010,6 @@ int KPilotDeviceLink::getNextDatabase(in
+ memcpy(dbinfo,buf.data,sizeof(struct DBInfo));
+ }
+ return r;
+-#endif
+ }
+
+ // Find a database with the given name. Info about the DB is stored into dbinfo (e.g. to be used later on with retrieveDatabase).
+@@ -1013,7 +1027,7 @@ bool KPilotDeviceLink::retrieveDatabase(
+ FUNCTIONSETUP;
+
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": Writing DB <" << info->name << "> "
++ DEBUGLIBRARY << fname << ": Writing DB <" << info->name << "> "
+ << " to " << fullBackupName << endl;
+ #endif
+
+@@ -1036,11 +1050,7 @@ bool KPilotDeviceLink::retrieveDatabase(
+ return false;
+ }
+
+-#if PILOT_LINK_NUMBER < PILOT_LINK_0_12_0
+- if (pi_file_retrieve(f, pilotSocket(), 0) < 0)
+-#else
+ if (pi_file_retrieve(f, pilotSocket(), 0, 0L) < 0)
+-#endif
+ {
+ kdWarning() << k_funcinfo
+ << ": Failed, unable to back up database" << endl;
+@@ -1054,26 +1064,13 @@ bool KPilotDeviceLink::retrieveDatabase(
+ }
+
+
+-QPtrList<DBInfo> KPilotDeviceLink::getDBList(int cardno, int flags)
++DBInfoList KPilotDeviceLink::getDBList(int cardno, int flags)
+ {
+ bool cont=true;
+- QPtrList<DBInfo>dbs;
++ DBInfoList dbs;
+ int index=0;
+ while (cont)
+ {
+-#if PILOT_LINK_NUMBER < PILOT_LINK_0_12_0
+- DBInfo*dbi=new DBInfo();
+- if (dlp_ReadDBList(pilotSocket(), cardno, flags, index, dbi)<0)
+- {
+- KPILOT_DELETE(dbi);
+- cont=false;
+- }
+- else
+- {
+- index=dbi->index+1;
+- dbs.append(dbi);
+- }
+-#else
+ pi_buffer_t buf = { 0,0,0 };
+ pi_buffer_clear(&buf);
+ // DBInfo*dbi=new DBInfo();
+@@ -1083,29 +1080,24 @@ QPtrList<DBInfo> KPilotDeviceLink::getDB
+ }
+ else
+ {
+- DBInfo *db_n = 0L;
++ DBInfo db_n;
+ DBInfo *db_it = (DBInfo *)buf.data;
+ int info_count = buf.used / sizeof(struct DBInfo);
+
+ while(info_count>0)
+ {
+- db_n = new DBInfo();
+- memcpy(db_n,db_it,sizeof(struct DBInfo));
++ memcpy(&db_n,db_it,sizeof(struct DBInfo));
+ ++db_it;
+ info_count--;
+ dbs.append(db_n);
+ }
+- if (db_n)
+- {
+- index=db_n->index+1;
+- }
++ index=db_n.index+1;
+ }
+-#endif
+ }
+ return dbs;
+ }
+
+-KPilotCard *KPilotDeviceLink::getCardInfo(int card)
++const KPilotCard *KPilotDeviceLink::getCardInfo(int card)
+ {
+ KPilotCard *cardinfo=new KPilotCard();
+ if (dlp_ReadStorageInfo(pilotSocket(), card, cardinfo->cardInfo())<0)
+@@ -1119,68 +1111,325 @@ KPilotCard *KPilotDeviceLink::getCardInf
+ return cardinfo;
+ }
+
+-QDateTime KPilotDeviceLink::getTime()
++/* static */ const int KPilotDeviceLink::messagesType=
++ (int)OpenFailMessage ;
++
++void KPilotDeviceLink::shouldPrint(int m,const QString &s)
+ {
+- QDateTime time;
+- time_t palmtime;
+- if (dlp_GetSysDateTime(pilotSocket(), &palmtime))
++ if (!(messages & m))
+ {
+- time.setTime_t(palmtime);
++ if (messagesType & m) { emit logError(s); }
++ else { emit logMessage(s); }
++ messages |= (m & messagesMask);
+ }
+- return time;
+ }
+
+-bool KPilotDeviceLink::setTime(const time_t &pctime)
++PilotDatabase *KPilotDeviceLink::database( const QString &name )
+ {
+-// struct tm time_tm=writeTm(time);
+-// time_t pctime=mktime(&time_tm);
+- return dlp_SetSysDateTime(pilotSocket(), pctime);
++ return new PilotSerialDatabase( this, name );
+ }
+
+
++typedef QPair<QString, struct DBInfo> DatabaseDescriptor;
++typedef QValueList<DatabaseDescriptor> DatabaseDescriptorList;
++
++class KPilotLocalLink::Private
++{
++public:
++ DatabaseDescriptorList fDBs;
++} ;
+
+-unsigned long KPilotDeviceLink::ROMversion() const
++unsigned int KPilotLocalLink::findAvailableDatabases( KPilotLocalLink::Private &info, const QString &path )
+ {
+- unsigned long rom;
+- dlp_ReadFeature(pilotSocket(),
+- makelong(const_cast<char *>("psys")), 1, &rom);
+- return rom;
++ FUNCTIONSETUP;
++
++ info.fDBs.clear();
++
++ QDir d(path);
++ if (!d.exists())
++ {
++ // Perhaps return an error?
++ return 0;
++ }
++
++ // Use this to fake indexes in the list of DBInfo structs
++ unsigned int counter = 0;
++
++ QStringList dbs = d.entryList( CSL1("*.pdb"), QDir::Files | QDir::NoSymLinks | QDir::Readable );
++ for ( QStringList::ConstIterator i = dbs.begin(); i != dbs.end() ; ++i)
++ {
++ struct DBInfo dbi;
++
++ // Remove the trailing 4 characters
++ QString dbname = (*i);
++ dbname.remove(dbname.length()-4,4);
++#ifdef DEBUG
++ QString dbnamecheck = (*i).left((*i).findRev(CSL1(".pdb")));
++ Q_ASSERT(dbname == dbnamecheck);
++#endif
++ if (PilotLocalDatabase::infoFromFile( path + CSL1("/") + (*i), &dbi))
++ {
++ DEBUGLIBRARY << fname << ": Loaded "
++ << dbname << endl;
++ dbi.index = counter;
++ info.fDBs.append( DatabaseDescriptor(dbname,dbi) );
++ ++counter;
++ }
++ }
++
++ DEBUGLIBRARY << fname << ": Total " << info.fDBs.count()
++ << " databases." << endl;
++ return info.fDBs.count();
+ }
+-unsigned long KPilotDeviceLink::majorVersion() const
++
++
++KPilotLocalLink::KPilotLocalLink( QObject *parent, const char *name ) :
++ KPilotLink(parent,name),
++ fReady(false),
++ d( new Private )
+ {
+- unsigned long rom=ROMversion();
+- return (((rom >> 28) & 0xf) * 10)+ ((rom >> 24) & 0xf);
++ FUNCTIONSETUP;
+ }
+-unsigned long KPilotDeviceLink::minorVersion() const
++
++KPilotLocalLink::~KPilotLocalLink()
+ {
+- unsigned long int rom=ROMversion();
+- return (((rom >> 20) & 0xf) * 10)+ ((rom >> 16) & 0xf);
++ FUNCTIONSETUP;
++ KPILOT_DELETE(d);
+ }
+
+-/* static */ const int KPilotDeviceLink::messagesType=
+- (int)OpenFailMessage ;
++/* virtual */ QString KPilotLocalLink::statusString() const
++{
++ return fReady ? CSL1("Ready") : CSL1("Waiting") ;
++}
+
+-void KPilotDeviceLink::shouldPrint(int m,const QString &s)
++/* virtual */ bool KPilotLocalLink::isConnected() const
+ {
+- if (!(messages & m))
++ return fReady;
++}
++
++/* virtual */ void KPilotLocalLink::reset( const QString &p )
++{
++ FUNCTIONSETUP;
++ fPath = p;
++ reset();
++}
++
++/* virtual */ void KPilotLocalLink::reset()
++{
++ FUNCTIONSETUP;
++ QFileInfo info( fPath );
++ fReady = !fPath.isEmpty() && info.exists() && info.isDir() ;
++ if (fReady)
+ {
+- if (messagesType & m) { emit logError(s); }
+- else { emit logMessage(s); }
+- messages |= (m & messagesMask);
++ findAvailableDatabases(*d, fPath);
++ QTimer::singleShot(500,this,SLOT(ready()));
++ }
++ else
++ {
++ kdWarning() << k_funcinfo << ": The local link path "
++ << fPath
++ << " does not exist or is not a direcotory. No sync will be done."
++ << endl;
+ }
+ }
+
+-bool operator < (const db & a, const db & b) {
+- if (a.creator == b.creator)
++/* virtual */ void KPilotLocalLink::close()
++{
++ fReady = false;
++}
++
++/* virtual */ bool KPilotLocalLink::tickle()
++{
++ return true;
++}
++
++/* virtual */ const KPilotCard *KPilotLocalLink::getCardInfo(int)
++{
++ return 0;
++}
++
++/* virtual */ void KPilotLocalLink::endOfSync()
++{
++}
++
++/* virtual */ void KPilotLocalLink::finishSync()
++{
++}
++
++/* virtual */ int KPilotLocalLink::openConduit()
++{
++ FUNCTIONSETUP;
++ return 0;
++}
++
++
++/* virtual */ int KPilotLocalLink::getNextDatabase( int index, struct DBInfo *info )
++{
++ FUNCTIONSETUP;
++
++ if ( (index<0) || (index>=d->fDBs.count()) )
++ {
++ kdWarning() << k_funcinfo << ": Index out of range." << endl;
++ return -1;
++ }
++
++ DatabaseDescriptor dd = d->fDBs[index];
++
++ DEBUGLIBRARY << fname << ": Getting database " << dd.first << endl;
++
++ if (info)
+ {
+- if (a.type != b.type)
++ *info = dd.second;
++ }
++
++ return index+1;
++}
++
++/* virtual */ int KPilotLocalLink::findDatabase(const char *name, struct DBInfo*info,
++ int index, long type, long creator)
++{
++ FUNCTIONSETUP;
++
++ if ( (index<0) || (index>=d->fDBs.count()) )
++ {
++ kdWarning() << k_funcinfo << ": Index out of range." << endl;
++ return -1;
++ }
++
++ if (!name)
++ {
++ kdWarning() << k_funcinfo << ": NULL name." << endl;
++ return -1;
++ }
++
++ QString desiredName = PilotAppCategory::codec()->toUnicode(name);
++ DEBUGLIBRARY << fname << ": Looking for DB " << desiredName << endl;
++ for ( DatabaseDescriptorList::ConstIterator i = d->fDBs.at(index);
++ i != d->fDBs.end(); ++i)
++ {
++ const DatabaseDescriptor &dd = *i;
++ if (dd.first == desiredName)
+ {
+- if (a.type == pi_mktag('a', 'p', 'p', 'l'))
+- return false;
+- else
+- return true;
++ if ( (!type || (type == dd.second.type)) &&
++ (!creator || (creator == dd.second.creator)) )
++ {
++ if (info)
++ {
++ *info = dd.second;
++ }
++ return index;
++ }
+ }
++
++ ++index;
++ }
++
++ return -1;
++}
++
++/* virtual */ void KPilotLocalLink::addSyncLogEntryImpl(QString const &s)
++{
++ FUNCTIONSETUP;
++ DEBUGLIBRARY << fname << ": " << s << endl ;
++}
++
++/* virtual */ bool KPilotLocalLink::installFile(QString const &path, bool deletefile)
++{
++ FUNCTIONSETUP;
++
++ QFileInfo srcInfo(path);
++ QString canonicalSrcPath = srcInfo.dir().canonicalPath() + CSL1("/") + srcInfo.fileName() ;
++ QString canonicalDstPath = fPath + CSL1("/") + srcInfo.fileName();
++
++ if (canonicalSrcPath == canonicalDstPath)
++ {
++ // That's a cheap copy operation
++ return true;
+ }
+
+- return a.maxblock < b.maxblock;
++ KURL src = KURL::fromPathOrURL( canonicalSrcPath );
++ KURL dst = KURL::fromPathOrURL( canonicalDstPath );
++
++ KIO::NetAccess::file_copy(src,dst,-1,true);
++
++ if (deletefile)
++ {
++ KIO::NetAccess::del(src, 0L);
++ }
++
++ return true;
+ }
++
++/* virtual */ bool KPilotLocalLink::retrieveDatabase( const QString &path, struct DBInfo *db )
++{
++ FUNCTIONSETUP;
++
++ QString dbname = PilotAppCategory::codec()->toUnicode(db->name) + CSL1(".pdb") ;
++ QString sourcefile = fPath + CSL1("/") + dbname ;
++ QString destfile = path ;
++
++ DEBUGLIBRARY << fname << ": src=" << sourcefile << endl;
++ DEBUGLIBRARY << fname << ": dst=" << destfile << endl;
++
++ QFile in( sourcefile );
++ if ( !in.exists() )
++ {
++ kdWarning() << k_funcinfo<< ": Source file " << sourcefile << " doesn't exist." << endl;
++ return false;
++ }
++ if ( !in.open( IO_ReadOnly | IO_Raw ) )
++ {
++ kdWarning() << k_funcinfo << ": Can't read source file " << sourcefile << endl;
++ return false;
++ }
++
++ QFile out( destfile );
++ if ( !out.open( IO_WriteOnly | IO_Truncate | IO_Raw ) )
++ {
++ kdWarning() << k_funcinfo << ": Can't write destination file " << destfile << endl;
++ return false;
++ }
++
++ const Q_ULONG BUF_SIZ = 8192 ;
++ char buf[BUF_SIZ];
++ Q_LONG r;
++
++ while ( (r=in.readBlock(buf,BUF_SIZ))>0 )
++ {
++ out.writeBlock(buf,r);
++ }
++ out.flush();
++ in.close();
++
++ return out.exists();
++}
++
++/* virtual */ DBInfoList KPilotLocalLink::getDBList( int, int )
++{
++ FUNCTIONSETUP;
++ DBInfoList l;
++ for ( DatabaseDescriptorList::ConstIterator i=d->fDBs.begin();
++ i != d->fDBs.end(); ++i)
++ {
++ l.append( (*i).second );
++ }
++ return l;
++}
++
++
++/* virtual */ PilotDatabase *KPilotLocalLink::database( const QString &name )
++{
++ FUNCTIONSETUP;
++ return new PilotLocalDatabase( fPath, name );
++}
++
++
++
++/* slot */ void KPilotLocalLink::ready()
++{
++ if (fReady)
++ {
++ emit deviceReady(this);
++ }
++}
++
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/kpilotlink.h kdepim-3.5.5.dfsg.1/kpilot/lib/kpilotlink.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/kpilotlink.h 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/kpilotlink.h 2006-11-19 22:21:12.000000000 +0100
+@@ -1,18 +1,13 @@
+-#ifndef _KPILOT_KPILOTLINK_H
+-#define _KPILOT_KPILOTLINK_H
++#ifndef KPILOT_KPILOTLINK_H
++#define KPILOT_KPILOTLINK_H
+ /* kpilotlink.h KPilot
+ **
+ ** Copyright (C) 1998-2001 by Dan Pilone
+ ** Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold at kainhofer.com>
++** Copyright (C) 2006 Adriaan de Groot <groot at kde.org>
+ **
+ */
+
+-/** @file
+-** Encapsulates all the communication with the pilot. Also
+-** does daemon-like polling of the Pilot. Interesting status
+-** changes are signalled.
+-*/
+-
+ /*
+ ** 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
+@@ -38,7 +33,7 @@
+ #include <pi-dlp.h>
+
+ #include <qobject.h>
+-#include <qptrlist.h>
++#include <qvaluelist.h>
+
+ class QTimer;
+ class QDateTime;
+@@ -47,35 +42,20 @@ class QThread;
+ class KPilotUser;
+ class KPilotSysInfo;
+ class KPilotCard;
++class PilotDatabase;
+ struct DBInfo;
+
+-/**
+-** The struct db is a description class for Pilot databases
+-** by Kenneth Albanowski. It's not really clear why it's *here*.
+-** The macro pi_mktag is meant to be given four char (8-bit)
+-** quantities, which are arranged into an unsigned long; for example
+-** pi_mktag('l','n','c','h'). This is called the creator tag
+-** of a database, and db.creator can be compared with such a
+-** tag. The tag lnch is used by the Pilot's launcher app. Some
+-** parts of KPilot require such a tag.
+-*/
+-struct db
+-{
+- char name[256];
+- int flags;
+- unsigned long creator;
+- unsigned long type;
+- int maxblock;
+-};
+-
+-#define pi_mktag(c1,c2,c3,c4) (((c1)<<24)|((c2)<<16)|((c3)<<8)|(c4))
+
+
+-
+-/** A class that handles some aspects of communication with the
+-** Handheld. A KPilotLink object represents a connection to a device
+-** (which may be active or inactive -- the latter in cases where
+-** the link is @e waiting for a device to show up). The object
++/** @file
++** Encapsulates all the communication with the pilot. Also
++** does daemon-like polling of the Pilot. Interesting status
++** changes are signalled.
++**
++** This file defines three classes; these handle some aspects of
++** communication with a Handheld. A KPilotLink object represents a
++** connection to a device (which may be active or inactive -- the latter in
++** cases where the link is @e waiting for a device to show up). The object
+ ** handles waiting, protocol initialization and some general
+ ** tasks such as getting system information or user data.
+ **
+@@ -83,73 +63,19 @@ struct db
+ ** PilotDatabase methods or use pilot-link dlp_* functions directly
+ ** on handle().
+ **
+-**
+ ** The KPilotLink class was originally a kind of C++ wrapper
+ ** for the pilot-link library. It grew and grew and mutated
+ ** until it was finally cleaned up again in 2001. In the meantime
+ ** it had become something that wrapped a lot more than just
+ ** pilot-link.
++**
++** This file defines an abstract base class KPilotLink, which may
++** be specialized for a real physical device that communicates
++** with DLP/SLP through the pilot-link library, or as a "fake"
++** device which uses data on the local filesystem to simulate
++** a device. These subclasses are KPilotDeviceLink and KPilotLocalLink.
+ */
+
+-class KDE_EXPORT KPilotDeviceLink : public QObject
+-{
+-friend class SyncAction;
+-Q_OBJECT
+-
+-/*
+-** Constructors and destructors.
+-*/
+-public:
+- /**
+- * Creates a pilot link that can sync to the pilot.
+- *
+- * Call reset() on it to start looking for a device.
+- */
+- KPilotDeviceLink( QObject *parent = 0, const char *name = 0, const QString &tempDevice = QString::null );
+- /** Destructor. This rudely ends the communication with the handheld. */
+- virtual ~KPilotDeviceLink();
+-
+-
+-/*
+-** Status information
+-*/
+-
+-public:
+- /**
+- * The link behaves like a state machine most of the time:
+- * it waits for the actual device to become available, and
+- * then becomes ready to handle syncing.
+- */
+- typedef enum {
+- Init,
+- WaitingForDevice,
+- FoundDevice,
+- CreatedSocket,
+- DeviceOpen,
+- AcceptedDevice,
+- SyncDone,
+- PilotLinkError,
+- WorkaroundUSB
+- } LinkStatus;
+-
+- /** Get the status (state enum) of this link.
+- * @return The LinkStatus enum for the link's current state.
+- */
+- LinkStatus status() const { return fLinkStatus; } ;
+- /** Get a human-readable string for the given status @p l. */
+- static QString statusString(LinkStatus l);
+- /** Get a human-readable string for the status of this object. */
+- virtual QString statusString() const;
+-
+- /**
+- * True if HotSync has been started but not finished yet
+- * (ie. the physical Pilot is waiting for sync commands)
+- */
+- bool getConnected() const { return fLinkStatus == AcceptedDevice; }
+-
+-private:
+- LinkStatus fLinkStatus;
+-
+ /**
+ * Tickle handling.
+ *
+@@ -213,270 +139,275 @@ private:
+ * with a non-zero timeout and that timeout has elapsed. The
+ * tickler is stopped before timeout is emitted.
+ */
+-public slots:
+- bool tickle() const;
+-protected:
+- void startTickle(unsigned int timeout=0);
+- void stopTickle();
+-public:
+- virtual bool event(QEvent *e);
+- static const unsigned int TickleTimeoutEvent = 1066;
+
+-signals:
+- void timeout();
++/** A list of DBInfo structures. */
++typedef QValueList<struct DBInfo> DBInfoList;
+
+-private:
+- bool fTickleDone;
+- QThread *fTickleThread;
++/** This is the abstract base class for Handheld interaction.
++* It tries to define all the behavior that we need; calls
++* to virtual *Impl() functions are used to implement the
++* specific behavior for subclasses.
++*/
++class KDE_EXPORT KPilotLink : public QObject
++{
++Q_OBJECT
++friend class SyncAction;
++public:
++ /** Constructor. Use reset() to start looking for a device. */
++ KPilotLink( QObject *parent = 0, const char *name = 0 );
++ /** Destructor. This rudely interrupts any communication in progress. */
++ virtual ~KPilotLink();
+
+
++ /** Provides a human-readable status string. */
++ virtual QString statusString() const = 0;
+
++ /**
++ * True if HotSync has been started but not finished yet
++ * (ie. the physical Pilot is waiting for sync commands)
++ */
++ virtual bool isConnected() const = 0;
+
+
+-/*
+-** Used for initially attaching to the device.
+-** deviceReady(KPilotDeviceLink*) is emitted when the device has been opened
+-** and a Sync can start.
+-*/
+-public:
+ /**
+ * Information on what kind of device we're dealing with.
++ * A link is associated with a path -- either the node in
++ * /dev that the physical device is attached to, or an
++ * IP address, or a filesystem path for local links.
++ * Whichever is being used, this function returns its
++ * name in a human-readable form.
+ */
+ QString pilotPath() const { return fPilotPath; } ;
+
+ /**
+ * Return the device link to the Init state and try connecting
+- * to the given device path (if it's non-empty).
++ * to the given device path (if it's non-empty). What the
++ * path means depends on the kind of link we're instantiating.
++ *
++ * @see reset()
++ * @see pilotPath()
+ */
+- void reset(const QString &pilotPath);
++ virtual void reset(const QString &pilotPath) = 0;
+
++ /** Implementation detail to handle tickle timeouts. */
++ virtual bool event(QEvent *e);
+
+- /**
+- * Special-cases. Call this after a reset to set device-
+- * specific workarounds; the only one currently known
+- * is the Zire 31/72 T5 quirk of doing a non-HotSync
+- * connect when it's switched on.
++ /** Install the list of files (full paths!) named by @p l
++ * onto the handheld (or whatever this link represents).
++ * If @p deleteFiles is true, the source files are removed.
++ *
++ * @return the number of files successfully installed.
+ */
+- void setWorkarounds(bool usb)
+- {
+- fWorkaroundUSB = usb;
+- } ;
++ unsigned int installFiles(const QStringList &l, const bool deleteFiles);
+
+ /**
+- * sets an additional device, which should be tried as fallback
+- * usefull for hotplug enviroments
++ * Write a log entry to the handheld. If @p log is true,
++ * then the signal logMessage() is also emitted. This
++ * function is supposed to @em only write to the handheld's
++ * log (with a physical device, that is what appears on
++ * screen at the end of a sync).
+ */
+- void setTempDevice( const QString &device );
+-
+-private:
+- bool fWorkaroundUSB;
+- QTimer *fWorkaroundUSBTimer;
++ void addSyncLogEntry(const QString &entry,bool log=true);
+
+-private slots:
+- void workaroundUSB();
++ /** Find a database with the given @p name (and optionally,
++ * type @p type and creator ID (from pi_mktag) @p creator,
++ * on searching from index @p index on the handheld.
++ * Fills in the DBInfo structure if found, returns < 0
++ * on error.
++ */
++ virtual int findDatabase(const char *name, struct DBInfo*,
++ int index=0, long type=0, long creator=0) = 0;
+
+-public slots:
+ /**
+- * Release all resources, including the master pilot socket,
+- * timers, notifiers, etc.
++ * Retrieve the database indicated by DBInfo @p *db into the
++ * local file @p path. This copies all the data, and you can
++ * create a PilotLocalDatabase from the resulting @p path .
++ *
++ * @return @c true on success
+ */
+- void close();
++ virtual bool retrieveDatabase(const QString &path, struct DBInfo *db) = 0;
+
+- /**
+- * Assuming things have been set up at least once already by
+- * a call to reset() with parameters, use this slot to re-start
+- * with the same settings.
++ /** Fill the DBInfo structure @p db with information about
++ * the next database (in some ordering) counting from
++ * @p index.
++ * @return < 0 on error
++ */
++ virtual int getNextDatabase(int index,struct DBInfo *db) = 0;
++
++ /** Returns a list of DBInfo structures describing all the
++ * databases available on the link (ie. device) with the
++ * given card number @p cardno and flags @p flags. No known
++ * handheld uses a cardno other than 0; use flags to
++ * indicate what kind of databases to fetch -- @c dlpDBListRAM
++ * or @c dlpDBListROM.
++ *
++ * @return list of DBInfo objects, one for each database
++ * @note ownership of the DBInfo objects is passed to the
++ * caller, who must delete the objects.
++ */
++ virtual DBInfoList getDBList(int cardno=0, int flags=dlpDBListRAM) = 0;
++
++ /** Return a database object for manipulating the database with
++ * name @p name on the link. This database may be local or
++ * remote, depending on the kind of link in use.
++ *
++ * @return pointer to database object, or 0 on error.
++ * @note ownership of the database object is given to the caller,
++ * who must delete the object in time.
+ */
+- void reset();
++ virtual PilotDatabase *database( const QString &name ) = 0;
+
+-protected slots:
+ /**
+- * Attempt to open the device. Called regularly to check
+- * if the device exists (to handle USB-style devices).
++ * Retrieve the user information from the device. Ownership
++ * is kept by the link, and at the end of a sync the user
++ * information is synced back to the link -- so it may be
++ * modified, but don't make local copies of it.
++ *
++ * @note Do not call this before the sync begins!
+ */
+- void openDevice();
++ KPilotUser &getPilotUser() { return *fPilotUser; }
+
+ /**
+- * Called when the device is opened *and* activity occurs on the
+- * device. This indicates the beginning of a hotsync.
++ * System information about the handheld. Ownership is kept
++ * by the link. For non-device links, something fake is
++ * returned.
++ *
++ * @note Do not call this before the sync begins!
+ */
+- void acceptDevice();
++ const KPilotSysInfo &getSysInfo() { return *fPilotSysInfo; }
+
+-protected:
+ /**
+- * Does the low-level opening of the device and handles the
+- * pilot-link library initialisation.
++ * Retrieve information about the data card @p card;
++ * I don't think that any pilot supports card numbers
++ * other than 0. Non-device links return something fake.
++ *
++ * This function may return NULL (non-device links or
++ * on error).
++ *
++ * @note Ownership of the KPilotCard object is given
++ * to the caller, who must delete it.
+ */
+- bool open( QString device = QString::null );
++ virtual const KPilotCard *getCardInfo(int card=0) = 0;
+
+- /**
+- * Check for device permissions and existence, emitting
+- * warnings for weird situations. This is primarily intended
+- * to inform the user.
++ /** End the sync in a gracuful manner. */
++ virtual void endOfSync() = 0;
++ /** End the sync in a graceful manner @em and update
++ * the last-sync time and user information on the handheld.
+ */
+- void checkDevice();
++ virtual void finishSync() = 0;
+
+- /**
+- * Some messages are only printed once and are suppressed
+- * after that. These are indicated by flag bits in
+- * messages.
++signals:
++ /** A timeout associated with tickling has occurred. Each
++ * time startTickle() is called, you can state how long
++ * tickling should last (at most) before timing out.
++ *
++ * You can only get a timeout when the Qt event loop is
++ * running, which somewhat limits the usefulness of timeouts.
+ */
+- enum { OpenMessage=1, OpenFailMessage=2 } ;
+- int messages;
+- int messagesMask;
+- static const int messagesType;
++ void timeout();
+
+- void shouldPrint(int,const QString &);
++ /** Signal that a message has been written to the sync log. */
++ void logMessage(const QString &);
++ /** Signal that an error has occurred, for logging. */
++ void logError(const QString &);
++ /** Signal that progress has been made, for logging purposes.
++ * @p p is the percentage completed (0 <= s <= 100).
++ * The string @p s is logged as well, if non-Null.
++ */
++ void logProgress(const QString &s, int p);
+
+-signals:
+ /**
+ * Emitted once the user information has been read and
+ * the HotSync is really ready to go.
+ */
+- void deviceReady( KPilotDeviceLink* );
+-
+-protected:
+- int pilotSocket() const { return fCurrentPilotSocket; } ;
++ void deviceReady( KPilotLink* );
+
+
+-private:
+- /**
+- * Path of the device special file that will be used.
+- * Usually /dev/pilot, /dev/ttySx, or /dev/usb/x.
+- */
+- QString fPilotPath;
++public slots:
+ /**
+- * Path with resolved symlinks, to prevent double binding
+- * to the same device.
++ * Release all resources, including the master pilot socket,
++ * timers, notifiers, etc.
+ */
+- QString fRealPilotPath;
++ virtual void close() = 0;
+
+ /**
+- * For transient devices: how often have we tried pi_bind()?
++ * Assuming things have been set up at least once already by
++ * a call to reset() with parameters, use this slot to re-start
++ * with the same settings.
+ */
+- int fRetries;
++ virtual void reset() = 0;
+
+- /**
+- * Timers and Notifiers for detecting activity on the device.
+- */
+- QTimer *fOpenTimer;
+- QSocketNotifier *fSocketNotifier;
+- bool fSocketNotifierActive;
++ /** Tickle the underlying device exactly once. */
++ virtual bool tickle() = 0;
+
++protected:
+ /**
+- * Pilot-link library handles for the device once it's opened.
++ * Path of the device special file that will be used.
++ * Usually /dev/pilot, /dev/ttySx, or /dev/usb/x. May be
++ * a filesystem path for local links.
+ */
+- int fPilotMasterSocket;
+- int fCurrentPilotSocket;
+- QString fTempDevice;
++ QString fPilotPath;
+
+- /**
+- * Handle cases where we can't accept or open the device,
+- * and data remains available on the pilot socket.
+- */
+- int fAcceptedCount;
+-signals:
+- /**
+- * Whenever a conduit adds a Sync log entry (actually,
+- * KPilotLink itself adds some log entries itself),
+- * this signal is emitted.
++ /** Start tickling the Handheld (every few seconds). This
++ * lasts until @p timeout seconds have passed (or forever
++ * if @p timeout is zero).
++ *
++ * @note Do not call startTickle() twice with no intervening
++ * stopTickle().
+ */
+- void logEntry(const char *);
++ void startTickle(unsigned int timeout=0);
+
+-/*
+-** File installation.
+-*/
+-public:
+- int installFiles(const QStringList &, const bool deleteFiles=true);
+-protected:
+- bool installFile(const QString &, const bool deleteFile=true);
++ /** Stop tickling the Handheld. This may block for some
++ * time (less than a second) to allow the tickle thread
++ * to finish.
++ */
++ void stopTickle();
+
+- /**
+- * Write a log entry to the pilot. Note that the library
+- * function takes a char *, not const char * (which is
+- * highly dubious). Causes signal logEntry(const char *)
+- * to be emitted if @p log is true.
++ /** Install a single file onto the device link. Full pathname
++ * @p f is used; in addition, if @p deleteFile is true remove
++ * the source file. Returns @c true if the install succeeded.
++ *
++ * The default
+ */
+- void addSyncLogEntry(const QString &entry,bool log=true);
++ virtual bool installFile( const QString &f, const bool deleteFile ) = 0;
+
+-signals:
+ /**
+- * Whenever a conduit adds a Sync log entry (actually,
+- * KPilotLink itself adds some log entries itself),
+- * this signal is emitted.
++ * Notify the Pilot user that a conduit is running now.
++ * On real devices, this prints out (on screen) which database
++ * is now opened; useful for progress reporting.
++ *
++ * @return -1 on error
++ * @note the default implementation returns 0
+ */
+- void logMessage(const QString &);
+- void logError(const QString &);
+- void logProgress(const QString &, int);
++ virtual int openConduit();
+
++ /** Returns a file handle for raw operations. Not recommended.
++ * On links with no physical device backing, returns -1.
++ *
++ * @note the default implementation returns -1
++ */
++ virtual int pilotSocket() const;
+
+-/*
+-** Pilot User Identity functions.
+-*/
+-protected:
+- KPilotUser *fPilotUser;
+- KPilotSysInfo *fPilotSysInfo;
+-public:
+- /**
+- * Returns the user information as set in the KPilot settings dialog.
+- * The user information can also be set by the Pilot, and at the
+- * end of a HotSync the two user informations can be synced as well
+- * with finishSync -- this writes fPilotUser again, so don't make
+- * local copies of the KPilotUser structure and modify them.
+- */
+- KPilotUser *getPilotUser() { return fPilotUser; }
+- KPilotSysInfo *getSysInfo() { return fPilotSysInfo; }
+- KPilotCard *getCardInfo(int card=0);
+- void endOfSync();
+- void finishSync();
++ /** Actually write an entry to the device link. The message
++ * @p s is guaranteed to be non-Null.
++ */
++ virtual void addSyncLogEntryImpl( const QString &s ) = 0;
+
+-/*
+-** Actions intended just to abstract away the pilot-link library interface.
+-*/
+-protected:
+- /**
+- * Notify the Pilot user which conduit is running now.
++ /** User information structure. Should be filled in when a sync
++ * starts, so that conduits can use the information.
+ */
+- int openConduit();
+-public:
+- int getNextDatabase(int index,struct DBInfo *);
+- int findDatabase(const char *name, struct DBInfo*,
+- int index=0, long type=0, long creator=0);
++ KPilotUser *fPilotUser;
+
+- /**
+- * Retrieve the database indicated by DBInfo *db into the
+- * local file @p path.
++ /** System information about the device. Filled in when the
++ * sync starts. Non-device links need to fake something.
+ */
+- bool retrieveDatabase(const QString &path, struct DBInfo *db);
+- QPtrList<DBInfo> getDBList(int cardno=0, int flags=dlpDBListRAM);
++ KPilotSysInfo *fPilotSysInfo;
+
+-public:
+- /**
+- * Get the time from the handheld device into a QDateTime
+- */
+- QDateTime getTime();
+- /**
+- * Set the time on the handheld to the give QDateTime
+- */
+- bool setTime(const time_t &pctime);
+-
+- /**
+- * Get the version number from the handheld
+- */
+- unsigned long ROMversion() const;
+- /**
+- * Get the major PalmOS version number
+- */
+- unsigned long majorVersion() const;
+- /**
+- * Get the minor PalmOS version number
+- */
+- unsigned long minorVersion() const;
+
+ private:
+- class KPilotDeviceLinkPrivate;
+-} ;
++ bool fTickleDone;
++ QThread *fTickleThread;
+
+-bool operator < ( const struct db &, const struct db &) ;
++} ;
+
+ #endif
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/kpilotlocallink.h kdepim-3.5.5.dfsg.1/kpilot/lib/kpilotlocallink.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/kpilotlocallink.h 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/kpilotlocallink.h 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,84 @@
++#ifndef KPILOT_KPILOTLOCALLINK_H
++#define KPILOT_KPILOTLOCALLINK_H
++/* kpilotlocallink.h KPilot
++**
++** Copyright (C) 1998-2001 by Dan Pilone
++** Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold at kainhofer.com>
++** Copyright (C) 2006 Adriaan de Groot <groot at kde.org>
++**
++*/
++
++/*
++** 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.1 of the License, or
++** (at your option) any later version.
++**
++** This program 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 program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include "kpilotlink.h"
++
++/** @file Definition of the local link class; implemented in kpilotlink.cc */
++
++
++/** Implementation of the device link for file-system backed (ie. local, fake)
++* devices. Uses a directory specified in the reset() call to serve databases.
++*/
++class KDE_EXPORT KPilotLocalLink : public KPilotLink
++{
++Q_OBJECT
++public:
++ KPilotLocalLink( QObject *parent=0L, const char *name=0L );
++ virtual ~KPilotLocalLink();
++
++ virtual QString statusString() const;
++ virtual bool isConnected() const;
++ virtual void reset( const QString & );
++ virtual void close();
++ virtual void reset();
++ virtual bool tickle();
++ virtual const KPilotCard *getCardInfo(int card);
++ virtual void endOfSync();
++ virtual void finishSync();
++ virtual int openConduit();
++ virtual int getNextDatabase(int index,struct DBInfo *);
++ virtual int findDatabase(const char *name, struct DBInfo*,
++ int index=0, long type=0, long creator=0);
++ virtual bool retrieveDatabase(const QString &path, struct DBInfo *db);
++ virtual DBInfoList getDBList(int cardno=0, int flags=dlpDBListRAM);
++ virtual PilotDatabase *database( const QString &name );
++
++public slots:
++ void ready();
++
++protected:
++ virtual bool installFile(const QString &, const bool deleteFile);
++ virtual void addSyncLogEntryImpl( const QString &s );
++ virtual int pilotSocket() const { return -1; } ;
++
++protected:
++ bool fReady;
++ QString fPath;
++
++ class Private;
++ Private *d;
++
++ unsigned int findAvailableDatabases( Private &, const QString &path );
++} ;
++
++
++#endif
++
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/Makefile.am kdepim-3.5.5.dfsg.1/kpilot/lib/Makefile.am
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/Makefile.am 2005-11-19 11:56:43.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/Makefile.am 2006-11-19 22:21:12.000000000 +0100
+@@ -22,42 +22,25 @@ libkpilot_la_SOURCES = kpilotlibSettings
+ pilotLocalDatabase.cc pilotSerialDatabase.cc \
+ pilotMemo.cc pilotAddress.cc \
+ pilotDateEntry.cc pilotTodoEntry.cc \
+- recordConduit.cc
++ pilotStruct.cc
+
+-libkpilot_la_LDFLAGS = -no-undefined $(PISOCK_LDFLAGS) $(all_libraries) $(KDE_EXTRA_RPATH) $(KDE_RPATH)
+-libkpilot_la_LIBADD = $(LIB_KDEUI) $(PISOCK_LIB) $(LIB_KABC) $(top_builddir)/libkcal/libkcal.la
++libkpilot_la_LDFLAGS = $(PISOCK_LDFLAGS) -no-undefined $(all_libraries) $(KDE_EXTRA_RPATH) $(KDE_RPATH)
++libkpilot_la_LIBADD = $(PISOCK_LIB) $(LIB_KDEUI) $(LIB_KABC) $(top_builddir)/libkcal/libkcal.la
+
+ kpilotincludedir = $(includedir)/kpilot
+ kpilotinclude_HEADERS = kpilotlink.h uiDialog.h \
+ plugin.h pluginfactory.h syncAction.h \
+ pilotRecord.h pilotDatabase.h \
+- pilotLocalDatabase.h pilotSerialDatabase.h \
+- pilotLinkVersion.h
++ pilotLocalDatabase.h pilotSerialDatabase.h
+
+ kde_kcfg_DATA = kpilotlib.kcfg
+
+-check_PROGRAMS = testactions testconstants testdatabase
+-TESTS = testactions testconstants testdatabase
+-
+-testactions_SOURCES = testactions.cc
+-testactions_LDFLAGS = $(PISOCK_LDFLAGS) $(all_libraries) $(KDE_RPATH)
+-testactions_LDADD = libkpilot.la $(PISOCK_LIB)
+-
+-testconstants_SOURCES = testconstants.cc
+-testconstants_LDFLAGS = $(PISOCK_LDFLAGS) $(all_libraries) $(KDE_RPATH)
+-testconstants_LDADD = libkpilot.la $(PISOCK_LIB)
+-
+-testdatabase_SOURCES = testdatabase.cc
+-testdatabase_LDFLAGS = $(PISOCK_LDFLAGS) $(all_libraries) $(KDE_RPATH)
+-testdatabase_LDADD = libkpilot.la $(PISOCK_LIB)
+-testdatabase_CXXFLAGS = '-DSOURCE="$(srcdir)"'
+-
+ check-local:
+ rm -f FAILED
+ for i in $(srcdir)/*.h ; do \
+ ( echo "#include <kdemacros.h>" ; echo "#include \"$$i\"" ; echo "int main(int argc,char **argv){return 0;}" ) > header-test.cc; \
+ echo "$$i" ; \
+- g++ $(all_includes) $(PISOCK_INCLUDE) -c header-test.cc || echo "$$i" >> FAILED; \
++ g++ $(all_includes) -c header-test.cc || echo "$$i" >> FAILED; \
+ done
+ test ! -e FAILED
+
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/options.cc kdepim-3.5.5.dfsg.1/kpilot/lib/options.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/options.cc 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/options.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -29,24 +29,13 @@
+
+
+ static const char *options_id =
+- "$Id: options.cc 449050 2005-08-14 05:03:22Z vanrijn $";
++ "$Id: options.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ #include "options.h"
+
+
+ #include <iostream>
+
+-#if TIME_WITH_SYS_TIME
+-# include <sys/time.h>
+-# include <time.h>
+-#else
+-# if HAVE_SYS_TIME_H
+-# include <sys/time.h>
+-# else
+-# include <time.h>
+-# endif
+-#endif
+-
+ #include <qsize.h>
+
+ #include <kconfig.h>
+@@ -57,7 +46,11 @@ static const char *options_id =
+ // to align FUNCTIONSETUP output.
+ //
+ //
++#ifdef DEBUG
++int debug_level = 1;
++#else
+ int debug_level = 0;
++#endif
+ const char *debug_spaces =
+ " ";
+ QString rtExpand(const QString &s, bool richText)
+@@ -75,51 +68,41 @@ QString rtExpand(const QString &s, bool
+
+ QDateTime readTm(const struct tm &t)
+ {
+- QDateTime dt;
+- dt.setDate(QDate(1900 + t.tm_year, t.tm_mon + 1, t.tm_mday));
+- dt.setTime(QTime(t.tm_hour, t.tm_min, t.tm_sec));
+- return dt;
++ QDateTime dt;
++ dt.setDate(QDate(1900 + t.tm_year, t.tm_mon + 1, t.tm_mday));
++ dt.setTime(QTime(t.tm_hour, t.tm_min, t.tm_sec));
++ return dt;
+ }
+
+
+
+ struct tm writeTm(const QDateTime &dt)
+ {
+- struct tm t;
++ struct tm t;
+
+- t.tm_wday = 0; // unimplemented
+- t.tm_yday = 0; // unimplemented
+- t.tm_isdst = 0; // unimplemented
+- t.tm_zone = 0; // unimplemented
++ t.tm_wday = 0; // unimplemented
++ t.tm_yday = 0; // unimplemented
++ t.tm_isdst = 0; // unimplemented
++#ifdef HAVE_STRUCT_TM_TM_ZONE
++ t.tm_zone = 0; // unimplemented
++#endif
+
+- t.tm_year = dt.date().year() - 1900;
+- t.tm_mon = dt.date().month() - 1;
+- t.tm_mday = dt.date().day();
+- t.tm_hour = dt.time().hour();
+- t.tm_min = dt.time().minute();
+- t.tm_sec = dt.time().second();
++ t.tm_year = dt.date().year() - 1900;
++ t.tm_mon = dt.date().month() - 1;
++ t.tm_mday = dt.date().day();
++ t.tm_hour = dt.time().hour();
++ t.tm_min = dt.time().minute();
++ t.tm_sec = dt.time().second();
+
+- return t;
++ return t;
+ }
+
+
+
+-struct tm writeTm(const QDate &dt)
++struct tm writeTm(const QDate &d)
+ {
+- struct tm t;
+-
+- t.tm_wday = 0; // unimplemented
+- t.tm_yday = 0; // unimplemented
+- t.tm_isdst = 0; // unimplemented
+-
+- t.tm_year = dt.year() - 1900;
+- t.tm_mon = dt.month() - 1;
+- t.tm_mday = dt.day();
+- t.tm_hour = 0;
+- t.tm_min = 0;
+- t.tm_sec = 0;
+-
+- return t;
++ QDateTime dt(d);
++ return writeTm(dt);
+ }
+
+ #ifdef DEBUG
+@@ -131,7 +114,8 @@ KPilotDepthCount::KPilotDepthCount(int a
+ if (debug_level>=fLevel)
+ {
+ #ifdef DEBUG_CERR
+- DEBUGKPILOT
++ Q_UNUSED(area);
++ DEBUGLIBRARY
+ #else
+ debug(area)
+ #endif
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/options.h kdepim-3.5.5.dfsg.1/kpilot/lib/options.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/options.h 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/options.h 2006-11-19 22:21:12.000000000 +0100
+@@ -52,19 +52,16 @@
+
+ // Switch _on_ debugging if it's not off.
+ //
+-#ifndef NDEBUG
+-#ifndef DEBUG
+-#define DEBUG (1)
+-#endif
+-#endif
++#undef NDEBUG
+
+ // Switch on debugging explicitly. Perhaps send debug to stderr instead
+-// of to the KDE debugging facility (it does lose some niftiness then).
++// of to the KDE debugging facility (it does lose some niftiness then), but
++// it seems to be required with FC6 and others possibly.
+ //
+ #ifndef DEBUG
+-// #define DEBUG (1)
++#define DEBUG (1)
+ #endif
+-// #define DEBUG_CERR (1)
++#define DEBUG_CERR (1)
+
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+@@ -72,19 +69,21 @@
+
+ #include <unistd.h> /* For size_t for pilot-link */
+ #include <qglobal.h>
+-// For KDE_EXPORT with kdelibs 3.3.x
+-#include <kdepimmacros.h>
+
+-#if (QT_VERSION < 0x030200)
+-#error "This is KPilot for KDE3.3 and won't compile with Qt < 3.2.0"
++#if (QT_VERSION < 0x030300)
++#error "This is KPilot for KDE3.5 and won't compile with Qt < 3.3.0"
+ #endif
+
+ #ifndef KDE_VERSION
+ #include <kdeversion.h>
+ #endif
+
+-#if !(KDE_IS_VERSION(3,3,0))
+-#error "This is KPilot for KDE 3.3 and won't compile with KDE < 3.3.0"
++#if !(KDE_IS_VERSION(3,4,0))
++#error "This is KPilot for (really) KDE 3.5 and won't compile with KDE < 3.4.0"
++#endif
++
++#if !(KDE_IS_VERSION(3,5,0))
++#warning "This is KPilot for KDE 3.5 and might not compile with KDE < 3.5.0"
+ #endif
+
+ #include "pilotLinkVersion.h"
+@@ -116,7 +115,7 @@ extern KDE_EXPORT int debug_level;
+ #define DEBUGAREA 0
+
+ #define DEBUGAREA_KPILOT 5510
+-#define DEBUGAREA_DAEMON 5511
++#define DEBUGAREA_LIBRARY 5511
+ #define DEBUGAREA_CONDUIT 5512
+ #define DEBUGAREA_DB 5513
+
+@@ -151,7 +150,7 @@ protected:
+ #ifdef DEBUG_CERR
+ #include <iostream>
+ #define DEBUGKPILOT std::cerr
+-#define DEBUGDAEMON std::cerr
++#define DEBUGLIBRARY std::cerr
+ #define DEBUGCONDUIT std::cerr
+ #define DEBUGDB std::cerr
+
+@@ -173,7 +172,7 @@ inline std::ostream& operator <<(std::os
+ //
+ //
+ #define DEBUGKPILOT fname.debug(DEBUGAREA_KPILOT)
+-#define DEBUGDAEMON fname.debug(DEBUGAREA_DAEMON)
++#define DEBUGLIBRARY fname.debug(DEBUGAREA_LIBRARY)
+ #define DEBUGCONDUIT fname.debug(DEBUGAREA_CONDUIT)
+ #define DEBUGDB fname.debug(DEBUGAREA_DB)
+
+@@ -188,7 +187,7 @@ inline kdbgstream& operator <<(kdbgstrea
+ #else
+ #define DEBUGSTREAM kndbgstream
+ #define DEBUGKPILOT kndDebug()
+-#define DEBUGDAEMON kndDebug()
++#define DEBUGLIBRARY kndDebug()
+ #define DEBUGCONDUIT kndDebug()
+ #define DEBUGDB kndDebug()
+
+@@ -199,7 +198,7 @@ inline kdbgstream& operator <<(kdbgstrea
+ #define FUNCTIONSETUPL(a) const int fname = a; Q_UNUSED(fname);
+ #endif
+
+-#define KPILOT_VERSION "4.6.0 (blivit)"
++#define KPILOT_VERSION "4.9.0 (depth9)"
+
+
+ // Function to expand newlines in rich text to <br>\n
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotAddress.cc kdepim-3.5.5.dfsg.1/kpilot/lib/pilotAddress.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotAddress.cc 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilotAddress.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -29,11 +29,12 @@
+
+
+ static const char *pilotadress_id =
+- "$Id: pilotAddress.cc 450284 2005-08-17 20:49:09Z adridg $";
++ "$Id: pilotAddress.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+-#ifndef _KPILOT_OPTIONS_H
++#include <config.h>
+ #include "options.h"
+-#endif
++#include "fakes.h"
++
+
+ #include <stdlib.h>
+ #include <assert.h>
+@@ -46,43 +47,6 @@ static const char *pilotadress_id =
+
+ #define MAXFIELDS 19
+
+-PilotAddress::PilotAddress(struct AddressAppInfo &appInfo,
+- PilotRecord * rec) :
+- PilotAppCategory(rec),
+- fAppInfo(appInfo),
+- fAddressInfo()
+-{
+- FUNCTIONSETUPL(4);
+-#if PILOT_LINK_NUMBER >= PILOT_LINK_0_12_0
+- pi_buffer_t b;
+- b.data = (unsigned char *) rec->getData();
+- b.allocated = b.used = rec->size();
+- if (rec) unpack_Address(&fAddressInfo, &b, address_v1);
+-#else
+- if (rec) unpack_Address(&fAddressInfo, (unsigned char *) rec->data(), rec->size());
+-#endif
+- (void) pilotadress_id;
+- _loadMaps();
+-}
+-
+-PilotAddress::PilotAddress(struct AddressAppInfo &appInfo) :
+- PilotAppCategory(),
+- fAppInfo(appInfo)
+-{
+- FUNCTIONSETUPL(4);
+- reset();
+-
+- // assign the phoneLabel so it doesn't appear in the pilot as
+- // work for all fields, but at least shows other fields
+- fAddressInfo.phoneLabel[0] = (int) eWork;
+- fAddressInfo.phoneLabel[1] = (int) eHome;
+- fAddressInfo.phoneLabel[2] = (int) eOther;
+- fAddressInfo.phoneLabel[3] = (int) eMobile;
+- fAddressInfo.phoneLabel[4] = (int) eEmail;
+-
+- _loadMaps();
+-}
+-
+ PilotAddress::PilotAddress(PilotAddressInfo *info, PilotRecord *rec) :
+ PilotAppCategory(rec),
+ fAppInfo(*(info->info())),
+@@ -93,14 +57,10 @@ PilotAddress::PilotAddress(PilotAddressI
+
+ if (rec)
+ {
+-#if PILOT_LINK_NUMBER >= PILOT_LINK_0_12_0
+ pi_buffer_t b;
+- b.data = (unsigned char *) rec->getData();
++ b.data = (unsigned char *) rec->data();
+ b.allocated = b.used = rec->size();
+ unpack_Address(&fAddressInfo, &b, address_v1);
+-#else
+- unpack_Address(&fAddressInfo, (unsigned char *) rec->data(), rec->size());
+-#endif
+ }
+ else
+ {
+@@ -320,7 +280,7 @@ QStringList PilotAddress::getEmails() co
+ }
+
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": returning: ["
++ DEBUGLIBRARY << fname << ": returning: ["
+ << list.size() << "] e-mail addresses." << endl;
+ #endif
+ return list;
+@@ -335,7 +295,7 @@ KABC::PhoneNumber::List PilotAddress::ge
+
+ int shownPhone = getShownPhone() + entryPhone1;
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": preferred pilot index is: ["
++ DEBUGLIBRARY << fname << ": preferred pilot index is: ["
+ << shownPhone << "], preferred phone number is: ["
+ << getField(shownPhone) << "]" << endl;
+ #endif
+@@ -359,7 +319,7 @@ KABC::PhoneNumber::List PilotAddress::ge
+ if (shownPhone == i) {
+ phoneType |= KABC::PhoneNumber::Pref;
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": found preferred pilot index: ["
++ DEBUGLIBRARY << fname << ": found preferred pilot index: ["
+ << i << "], text: [" << test << "]" << endl;
+ #endif
+ }
+@@ -367,7 +327,7 @@ KABC::PhoneNumber::List PilotAddress::ge
+ list.append(ph);
+ } else {
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": whoopsie. pilot phone number: ["
++ DEBUGLIBRARY << fname << ": whoopsie. pilot phone number: ["
+ << test << "], index: [" << i << "], type: ["
+ << ind << "], has no corresponding PhoneNumber type." << endl;
+ #endif
+@@ -376,7 +336,7 @@ KABC::PhoneNumber::List PilotAddress::ge
+ }
+ }
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": returning: ["
++ DEBUGLIBRARY << fname << ": returning: ["
+ << list.size() << "] phone numbers" << endl;
+ #endif
+ return list;
+@@ -420,7 +380,7 @@ void PilotAddress::setPhoneNumbers(KABC:
+ if ( phone.type() & phoneKey)
+ {
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": found pilot type: ["
++ DEBUGLIBRARY << fname << ": found pilot type: ["
+ << pilotKey << "] ("
+ << fAppInfo.phoneLabels[pilotKey]
+ << ") for PhoneNumber: ["
+@@ -436,7 +396,7 @@ void PilotAddress::setPhoneNumbers(KABC:
+ // if this is the preferred phone number, then set it as such
+ if (phone.type() & KABC::PhoneNumber::Pref) {
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": found preferred PhoneNumber. "
++ DEBUGLIBRARY << fname << ": found preferred PhoneNumber. "
+ << "setting showPhone to index: ["
+ << fieldSlot << "], PhoneNumber: ["
+ << phone.number() << "]" << endl;
+@@ -446,7 +406,7 @@ void PilotAddress::setPhoneNumbers(KABC:
+ }
+
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": Pilot's showPhone now: ["
++ DEBUGLIBRARY << fname << ": Pilot's showPhone now: ["
+ << fAddressInfo.showPhone << "]." << endl;
+ #endif
+
+@@ -455,7 +415,7 @@ void PilotAddress::setPhoneNumbers(KABC:
+ QString pref = getField(fAddressInfo.showPhone + entryPhone1);
+ if (fAddressInfo.showPhone < 0 || fAddressInfo.showPhone > 4 || pref.isEmpty()) {
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": Pilot's showPhone: ["
++ DEBUGLIBRARY << fname << ": Pilot's showPhone: ["
+ << fAddressInfo.showPhone
+ << "] not properly set to a default. trying to set a sensible one."
+ << endl;
+@@ -471,7 +431,7 @@ void PilotAddress::setPhoneNumbers(KABC:
+ }
+ }
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": Pilot's showPhone now: ["
++ DEBUGLIBRARY << fname << ": Pilot's showPhone now: ["
+ << fAddressInfo.showPhone << "], and that's final." << endl;
+ #endif
+ }
+@@ -706,15 +666,15 @@ void *PilotAddress::pack_(void *buf, int
+ FUNCTIONSETUPL(4);
+ int i;
+
+-#if PILOT_LINK_NUMBER >= PILOT_LINK_0_12_0
+ pi_buffer_t b = { 0,0,0 } ;
+ i = pack_Address(&fAddressInfo, &b, address_v1);
++ if (i<0)
++ {
++ return 0;
++ }
++ i = b.used;
+ memcpy(buf,b.data,kMin(i,*len));
+ *len = kMin(i,*len);
+-#else
+- i = pack_Address(&fAddressInfo, (unsigned char *) buf, *len);
+- *len = i;
+-#endif
+ return buf;
+ }
+
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotAddress.h kdepim-3.5.5.dfsg.1/kpilot/lib/pilotAddress.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotAddress.h 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilotAddress.h 2006-11-19 22:21:12.000000000 +0100
+@@ -86,8 +86,6 @@ public:
+ ePager, eMobile
+ };
+
+- PilotAddress(struct AddressAppInfo &appInfo) KDE_DEPRECATED ;
+- PilotAddress(struct AddressAppInfo &appInfo, PilotRecord* rec) KDE_DEPRECATED ;
+ PilotAddress(PilotAddressInfo *appinfo, PilotRecord *rec = 0L);
+ PilotAddress(const PilotAddress ©From);
+ PilotAddress& operator=( const PilotAddress &r );
+@@ -119,17 +117,17 @@ public:
+ void setField(int field, const QString &text);
+ QString getField(int field) const;
+
+- /**
+- Return list of all email addresses. This will search through our "phone"
+- fields and will return only those which are e-mail addresses.
+- */
+- QStringList getEmails() const;
++ /**
++ * Return list of all email addresses. This will search through our "phone"
++ * fields and will return only those which are e-mail addresses.
++ */
++ QStringList getEmails() const;
+ void setEmails(QStringList emails);
+
+- /**
+- Return list of all phone numbers. This will search through our "phone"
+- fields and will return only those which are not e-mail addresses.
+- */
++ /**
++ * Return list of all phone numbers. This will search through our "phone"
++ * fields and will return only those which are not e-mail addresses.
++ */
+ KABC::PhoneNumber::List getPhoneNumbers() const;
+ void setPhoneNumbers(KABC::PhoneNumber::List list);
+
+@@ -178,8 +176,6 @@ public:
+ virtual void *pack_(void *, int *);
+ void unpack(const void *, int = 0) { }
+
+- static const int APP_BUFFER_SIZE;
+-
+ const struct Address *address() const { return &fAddressInfo; } ;
+
+ protected:
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotAppCategory.h kdepim-3.5.5.dfsg.1/kpilot/lib/pilotAppCategory.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotAppCategory.h 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilotAppCategory.h 2006-11-19 22:21:12.000000000 +0100
+@@ -158,8 +158,6 @@ public:
+ * @param label The label to look for.
+ */
+ bool setCategory(struct CategoryAppInfo &info,const QString &label);
+- bool KDE_DEPRECATED setCat(struct CategoryAppInfo &info,const QString &label)
+- { return setCategory(info,label); }
+
+ protected:
+ static QTextCodec *pilotCodec;
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotAppInfo.h kdepim-3.5.5.dfsg.1/kpilot/lib/pilotAppInfo.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotAppInfo.h 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilotAppInfo.h 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,97 @@
++#ifndef _KPILOT_PILOTAPPINFO_H
++#define _KPILOT_PILOTAPPINFO_H
++/* pilotAppInfo.h KPilot
++**
++** Copyright (C) 2005-2006 Adriaan de Groot <groot at kde.org>
++**
++*/
++
++/*
++** 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.1 of the License, or
++** (at your option) any later version.
++**
++** This program 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 program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include "pilot.h"
++
++/** A template class for reading and interpreting AppInfo blocks;
++* the idea is that it handles all the boilerplate code for reading
++* the app block, converting it to the right kind, and then unpacking
++* it. Template parameters are the type (struct, from pilot-link probably)
++* of the interpreted appinfo, and the pack and unpack functions for it
++* (again, from pilot-link).
++*/
++template <typename appinfo,
++ int(*unpack)(appinfo *, unsigned char *, PI_SIZE_T),
++ int(*pack)(appinfo *, unsigned char *, PI_SIZE_T)>
++class DatabaseInformation : public PilotDatabaseInfo
++{
++public:
++ /** Constructor. Read the appinfo from database @p d and
++ * interpret it.
++ */
++ PilotAppInfo(PilotDatabase *d) : PilotAppInfoBase()
++ {
++ int appLen = MAX_APPINFO_SIZE;
++ unsigned char buffer[MAX_APPINFO_SIZE];
++
++ memset(&fInfo,0,sizeof(fInfo));
++ if (d && d->isOpen())
++ {
++ appLen = d->readAppBlock(buffer,appLen);
++ (*unpack)(&fInfo, buffer, appLen);
++ // fInfo is just a struct, so we can point to it anyway.
++ init(&fInfo.category,appLen);
++ }
++ else
++ {
++ KPILOT_DELETE(fC);
++ fLen = 0;
++ }
++ } ;
++
++ /** Write this appinfo block to the database @p d; returns
++ * the number of bytes written or -1 on failure. This
++ * function is robust when called with a NULL database @p d.
++ */
++ int write(PilotDatabase *d)
++ {
++ unsigned char buffer[MAX_APPINFO_SIZE];
++ if (!d || !d->isOpen())
++ {
++ return -1;
++ }
++ int appLen = (*pack)(&fInfo, buffer, length());
++ if (appLen > 0)
++ {
++ d->writeAppBlock(buffer,appLen);
++ }
++ return appLen;
++ } ;
++
++ /** Returns a (correctly typed) pointer to the interpreted
++ * appinfo block.
++ */
++ appinfo *info() { return &fInfo; } ;
++
++protected:
++ appinfo fInfo;
++} ;
++
++
++#endif
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilot.cc kdepim-3.5.5.dfsg.1/kpilot/lib/pilot.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilot.cc 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilot.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,341 @@
++/* pilot.cc KPilot
++**
++** Copyright (C) 1998-2001 by Dan Pilone
++** Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold at kainhofer.com>
++** Copyright (C) 2003-2006 Adriaan de Groot <groot at kde.org>
++**
++** These are the base class structures that reside on the
++** handheld device -- databases and their parts.
++*/
++
++/*
++** 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.1 of the License, or
++** (at your option) any later version.
++**
++** This program 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 program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include "options.h"
++
++#include <qtextcodec.h>
++#include <kcharsets.h>
++#include <kglobal.h>
++
++#include "pilot.h"
++#include "pilotDatabase.h"
++#include "pilotAppInfo.h"
++#include "pilotRecord.h"
++
++
++namespace Pilot
++{
++static QTextCodec *codec = 0L;
++
++
++QString fromPilot( const char *c, int len )
++{
++ return codec->toUnicode(c,len);
++}
++
++QString fromPilot( const char *c )
++{
++ return codec->toUnicode(c);
++}
++
++QCString toPilot( const QString &s )
++{
++ return codec->fromUnicode(s);
++}
++
++int toPilot( const QString &s, char *buf, int len)
++{
++ int used = len;
++ QCString cbuf = codec->fromUnicode(s,used);
++ memset( buf, 0, len );
++ if (used > len) used=len;
++ memcpy( buf, cbuf.data(), used );
++ return used;
++}
++
++int toPilot( const QString &s, unsigned char *buf, int len)
++{
++ int used = len;
++ QCString cbuf = codec->fromUnicode(s,used);
++ memset( buf, 0, len );
++ if (used > len) used=len;
++ memcpy( buf, cbuf.data(), used );
++ return used;
++}
++
++bool setupPilotCodec(const QString &s)
++{
++ FUNCTIONSETUP;
++ QString encoding(KGlobal::charsets()->encodingForName(s));
++
++ DEBUGLIBRARY << fname << ": Using codec name " << s << endl;
++ DEBUGLIBRARY << fname << ": Creating codec " << encoding << endl;
++
++ // if the desired codec can't be found, latin1 will be returned anyway, no need to do this manually
++ codec = KGlobal::charsets()->codecForName(encoding);
++
++ if (codec)
++ {
++ DEBUGLIBRARY << fname << ": Got codec " << codec->name() << endl;
++ }
++
++ return codec;
++}
++
++QString codecName()
++{
++ return QString::fromLatin1(codec->name());
++}
++
++QString category(const struct CategoryAppInfo *info, unsigned int i)
++{
++ if (!info || (i>=CATEGORY_COUNT))
++ {
++ return QString::null;
++ }
++
++ return codec->toUnicode(info->name[i],CATEGORY_SIZE-1);
++}
++
++
++int findCategory(struct CategoryAppInfo *info,
++ const QString &selectedCategory,
++ bool unknownIsUnfiled)
++{
++ FUNCTIONSETUP;
++
++ if (!info)
++ {
++ kdError() << "Bad CategoryAppInfo pointer" << endl;
++ return -1;
++ }
++
++ int currentCatID = -1;
++ for (unsigned int i=0; i<CATEGORY_COUNT; i++)
++ {
++ if (!info->name[i][0]) continue;
++ if (selectedCategory == category(info, i))
++ {
++ currentCatID = i;
++ break;
++ }
++ }
++
++ if (-1 == currentCatID)
++ {
++ DEBUGLIBRARY << fname << ": Category name "
++ << selectedCategory << " not found." << endl;
++ }
++ else
++ {
++ DEBUGLIBRARY << fname << ": Matched category " << currentCatID << endl;
++ }
++
++ if ((currentCatID == -1) && unknownIsUnfiled)
++ currentCatID = 0;
++ return currentCatID;
++}
++
++void dumpCategories(const struct CategoryAppInfo *info)
++{
++ FUNCTIONSETUP;
++
++ if (!info)
++ {
++ kdWarning() << "! Dumping bad pointer." << endl;
++ return;
++ }
++
++ DEBUGLIBRARY << fname << " lastUniqueId: "
++ << (int) info->lastUniqueID << endl;
++ for (unsigned int i = 0; i < CATEGORY_COUNT; i++)
++ {
++ if (!info->name[i][0]) continue;
++ DEBUGLIBRARY << fname << ": " << i << " = "
++ << info->ID[i] << " <"
++ << info->name[i] << ">" << endl;
++ }
++}
++
++
++}
++
++
++
++PilotDatabaseInfo::PilotDatabaseInfo(PilotDatabase *d) : fC(new struct CategoryAppInfo), fLen(0), fOwn(true)
++{
++ FUNCTIONSETUP;
++ int appLen = Pilot::MAX_APPINFO_SIZE;
++ unsigned char buffer[Pilot::MAX_APPINFO_SIZE];
++
++ if (!d || !d->isOpen())
++ {
++ kdError() << "Bad database pointer." << endl;
++ fLen = 0;
++ KPILOT_DELETE( fC );
++ return;
++ }
++ fLen = appLen = d->readAppBlock(buffer,appLen);
++ unpack_CategoryAppInfo(fC, buffer, appLen);
++}
++
++PilotDatabaseInfo::~PilotDatabaseInfo()
++{
++ if (fOwn) delete fC;
++}
++
++bool PilotDatabaseInfo::setCategoryName(unsigned int i, const QString &s)
++{
++ if ( (i>=Pilot::CATEGORY_COUNT) || // bad category number
++ (!categoryInfo())) // Nowhere to write to
++ {
++ return false;
++ }
++
++ (void) Pilot::toPilot(s, categoryInfo()->name[i], Pilot::CATEGORY_SIZE - 1);
++ return true;
++}
++
++
++
++void PilotRecord::setData(const char *data, int len)
++{
++ FUNCTIONSETUP;
++ if (fBuffer)
++ {
++ pi_buffer_free(fBuffer);
++ }
++ fBuffer = pi_buffer_new( len+1 );
++ pi_buffer_append( fBuffer, data, len );
++}
++
++PilotRecord::PilotRecord(PilotRecord * orig) :
++ fAttrib( orig ? orig->attributes() : 0 ),
++ fCat( orig ? orig->category() : 0 ),
++ fID( orig ? orig->id() : 0 ),
++ fBuffer( 0L )
++{
++ FUNCTIONSETUPL(4);
++
++ if (orig && orig->buffer())
++ {
++ fBuffer = pi_buffer_new( orig->size()+1 );
++ pi_buffer_append_buffer( fBuffer, orig->buffer() );
++ }
++
++ fAllocated++;
++}
++
++PilotRecord & PilotRecord::operator = (PilotRecord & orig)
++{
++ FUNCTIONSETUP;
++ if (fBuffer)
++ {
++ pi_buffer_free(fBuffer);
++ fBuffer=0L;
++ }
++
++ setAttributes( orig.attributes() );
++ setCategory( orig.category() );
++ setID( orig.id() );
++
++ fBuffer = pi_buffer_new( orig.size()+1 );
++ pi_buffer_append_buffer( fBuffer, orig.buffer() );
++
++ return *this;
++}
++
++void PilotRecord::allocationInfo()
++{
++ FUNCTIONSETUP;
++ DEBUGLIBRARY << fname
++ << ": Allocated " << fAllocated
++ << " Deleted " << fDeleted << endl;
++}
++
++
++static int creationCount = 0;
++static QStringList *createdNames = 0L;
++
++PilotDatabase::PilotDatabase(const QString &s) :
++ fDBOpen(false),
++ fName(s)
++{
++ FUNCTIONSETUP;
++ creationCount++;
++ if (!createdNames)
++ {
++ createdNames = new QStringList();
++ }
++ createdNames->append(s.isEmpty() ? CSL1("<empty>") : s);
++}
++
++/* virtual */ PilotDatabase::~PilotDatabase()
++{
++ FUNCTIONSETUP;
++ creationCount--;
++ if (createdNames)
++ {
++ createdNames->remove(fName.isEmpty() ? CSL1("<empty>") : fName);
++ }
++}
++
++/* static */ void PilotDatabase::allocationInfo()
++{
++ FUNCTIONSETUP;
++ DEBUGLIBRARY << fname << ": " << creationCount << " databases." << endl;
++ if (createdNames)
++ {
++ DEBUGLIBRARY << fname << ": "
++ << createdNames->join(CSL1(",")) << endl;
++ }
++}
++
++/* virtual */ Pilot::RecordIDList PilotDatabase::idList()
++{
++ Pilot::RecordIDList l;
++
++ for (unsigned int i = 0 ; ; i++)
++ {
++ PilotRecord *r = readRecordByIndex(i);
++ if (!r) break;
++ l.append(r->id());
++ delete r;
++ }
++
++ return l;
++}
++
++/* virtual */ Pilot::RecordIDList PilotDatabase::modifiedIDList()
++{
++ Pilot::RecordIDList l;
++
++ resetDBIndex();
++ while(1)
++ {
++ PilotRecord *r = readNextModifiedRec();
++ if (!r) break;
++ l.append(r->id());
++ delete r;
++ }
++
++ return l;
++}
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotDatabase.cc kdepim-3.5.5.dfsg.1/kpilot/lib/pilotDatabase.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotDatabase.cc 2005-10-10 17:02:28.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilotDatabase.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -70,19 +70,19 @@ PilotDatabase::PilotDatabase(const QStri
+ {
+ FUNCTIONSETUP;
+ #ifdef DEBUG
+- DEBUGDAEMON << fname << ": " << creationCount << " databases." << endl;
++ DEBUGLIBRARY << fname << ": " << creationCount << " databases." << endl;
+ if (createdNames)
+ {
+- DEBUGDAEMON << fname << ": "
++ DEBUGLIBRARY << fname << ": "
+ << createdNames->join(CSL1(",")) << endl;
+ }
+ #endif
+ return creationCount;
+ }
+
+-/* virtual */ RecordIDList PilotDatabase::idList()
++/* virtual */ Pilot::RecordIDList PilotDatabase::idList()
+ {
+- RecordIDList l;
++ Pilot::RecordIDList l;
+
+ for (unsigned int i = 0 ; ; i++)
+ {
+@@ -95,9 +95,9 @@ PilotDatabase::PilotDatabase(const QStri
+ return l;
+ }
+
+-/* virtual */ RecordIDList PilotDatabase::modifiedIDList()
++/* virtual */ Pilot::RecordIDList PilotDatabase::modifiedIDList()
+ {
+- RecordIDList l;
++ Pilot::RecordIDList l;
+
+ resetDBIndex();
+ while(1)
+@@ -117,6 +117,13 @@ PilotAppInfoBase::PilotAppInfoBase(Pilot
+ int appLen = MAX_APPINFO_SIZE;
+ unsigned char buffer[MAX_APPINFO_SIZE];
+
++ if (!d || !d->isOpen())
++ {
++ kdError() << "Bad database pointer." << endl;
++ fLen = 0;
++ KPILOT_DELETE( fC );
++ return;
++ }
+ fLen = appLen = d->readAppBlock(buffer,appLen);
+ unpack_CategoryAppInfo(fC, buffer, appLen);
+ }
+@@ -132,12 +139,17 @@ int PilotAppInfoBase::findCategory(const
+ {
+ FUNCTIONSETUP;
+
++ if (!info)
++ {
++ kdError() << "Bad CategoryAppInfo pointer" << endl;
++ return -1;
++ }
++
+ int currentCatID = -1;
+ for (int i=0; i<PILOT_CATEGORY_MAX; i++)
+ {
+ if (!info->name[i][0]) continue;
+- if (selectedCategory ==
+- PilotAppCategory::codec()->toUnicode(info->name[i]))
++ if (selectedCategory == category(info, i))
+ {
+ currentCatID = i;
+ break;
+@@ -147,12 +159,12 @@ int PilotAppInfoBase::findCategory(const
+ #ifdef DEBUG
+ if (-1 == currentCatID)
+ {
+- DEBUGKPILOT << fname << ": Category name "
++ DEBUGLIBRARY << fname << ": Category name "
+ << selectedCategory << " not found." << endl;
+ }
+ else
+ {
+- DEBUGKPILOT << fname << ": Matched category " << currentCatID << endl;
++ DEBUGLIBRARY << fname << ": Matched category " << currentCatID << endl;
+ }
+ #endif
+
+@@ -165,12 +177,12 @@ void PilotAppInfoBase::dumpCategories(co
+ {
+ #ifdef DEBUG
+ FUNCTIONSETUP;
+- DEBUGCONDUIT << fname << " lastUniqueId"
+- << info.lastUniqueID << endl;
++ DEBUGLIBRARY << fname << " lastUniqueId: "
++ << (int) info.lastUniqueID << endl;
+ for (int i = 0; i < PILOT_CATEGORY_MAX; i++)
+ {
+ if (!info.name[i][0]) continue;
+- DEBUGCONDUIT << fname << ": " << i << " = "
++ DEBUGLIBRARY << fname << ": " << i << " = "
+ << info.ID[i] << " <"
+ << info.name[i] << ">" << endl;
+ }
+@@ -181,19 +193,35 @@ void PilotAppInfoBase::dumpCategories(co
+
+ void PilotAppInfoBase::dump() const
+ {
+- dumpCategories(*categoryInfo());
++ if (categoryInfo())
++ {
++ dumpCategories(*categoryInfo());
++ }
++ else
++ {
++ kdWarning() << "Dumping a broken PilotAppInfoBase" << endl;
++ }
+ }
+
+-
+-QString PilotAppInfoBase::category(unsigned int i)
++QString PilotAppInfoBase::category(const struct CategoryAppInfo *info, unsigned int i)
+ {
+- if (i>=PILOT_CATEGORY_MAX) return QString::null;
+- return PilotAppCategory::codec()->toUnicode(categoryInfo()->name[i],PILOT_CATEGORY_SIZE-1);
++ if (!info || (i>=PILOT_CATEGORY_MAX))
++ {
++ return QString::null;
++ }
++
++ return PilotAppCategory::codec()->toUnicode(info->name[i],PILOT_CATEGORY_SIZE-1);
+ }
+
++
+ bool PilotAppInfoBase::setCategoryName(unsigned int i, const QString &s)
+ {
+- if (i>=PILOT_CATEGORY_MAX) return false;
++ if ( (i>=PILOT_CATEGORY_MAX) || // bad category number
++ (!categoryInfo())) // Nowhere to write to
++ {
++ return false;
++ }
++
+ int len = PILOT_CATEGORY_SIZE - 1;
+ QCString t = PilotAppCategory::codec()->fromUnicode(s,len);
+ memset(categoryInfo()->name[i],0,PILOT_CATEGORY_SIZE);
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotDatabase.h kdepim-3.5.5.dfsg.1/kpilot/lib/pilotDatabase.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotDatabase.h 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilotDatabase.h 2006-11-19 22:21:12.000000000 +0100
+@@ -31,33 +31,7 @@
+ */
+
+
+-#include <qstring.h>
+-#include <qvaluelist.h>
+-
+-// Handle all time.h variations properly.
+-// Required because pi-macros.h sometimes forgets it.
+-//
+-#ifdef TIME_WITH_SYS_TIME
+-# include <sys/time.h>
+-# include <time.h>
+-#else
+-# ifdef HAVE_SYS_TIME_H
+-# include <sys/time.h>
+-# else
+-# include <time.h>
+-# endif
+-#endif
+-
+-#include "pilotLinkVersion.h"
+-
+-#include <pi-dlp.h>
+-
+-
+-class PilotRecord;
+-struct CategoryAppInfo;
+-
+-typedef QValueList<recordid_t> RecordIDList;
+-
++#include "pilot.h"
+
+
+ /**
+@@ -111,10 +85,11 @@ public:
+
+ /** Returns a QValueList of all record ids in the database.
+ This implementation is really bad. */
+- virtual RecordIDList idList();
++ virtual Pilot::RecordIDList idList();
++
+ /** Returns a list of all record ids that have been modified in the
+ database. This implementation is really bad. */
+- virtual RecordIDList modifiedIDList();
++ virtual Pilot::RecordIDList modifiedIDList();
+
+
+ /** Reads a record from database by id, returns record length */
+@@ -158,7 +133,7 @@ public:
+ /** Purges all Archived/Deleted records from Palm Pilot database */
+ virtual int cleanup() = 0;
+
+- bool isDBOpen() const { return fDBOpen; }
++ bool isOpen() const { return fDBOpen; }
+
+ /** Returns some sensible human-readable identifier for
+ * the database. Serial databases get Pilot:, local
+@@ -194,6 +169,35 @@ private:
+ /** Base class for all specific kinds of AppInfo. */
+ class KDE_EXPORT PilotAppInfoBase
+ {
++public:
++ /** For debugging, display category names for the given AppInfo
++ * structure. Called by dump(). You must pass a valid reference.
++ */
++ static void dumpCategories(const struct CategoryAppInfo &info);
++
++ /** Returns the QString for the requested category @p i
++ * in the category structure @p info. Returns @c QString::null
++ * on error (bad pointer or bad category number). May also
++ * return @c QString::null if the category name is empty.
++ */
++ static QString category(const struct CategoryAppInfo *info, unsigned int i);
++
++ /** Search for the given category @p name in the list
++ * of categories; returns the category number. If @p unknownIsUnfiled
++ * is true, then map unknown categories to Unfiled instead of returning
++ * an error number.
++ *
++ * @return >=0 is a specific category based on the text-to-
++ * category number mapping defined by the Pilot,
++ * where 0 is always the 'unfiled' category.
++ * @return -1 means unknown category selected when
++ * @p unknownIsUnfiled is false.
++ * @return 0 == Unfiled means unknown category selected when
++ * @p unknownIsUnfiled is true.
++ *
++ */
++ static int findCategory(const QString &name, bool unknownIsUnfiled, struct CategoryAppInfo *info);
++
+ protected:
+ /** Constructor. This is for use by derived classes (using the template below
+ * only, and says that the category info in the base class aliases data in
+@@ -210,9 +214,14 @@ protected:
+ fLen = len ;
+ } ;
+
++ struct CategoryAppInfo *fC;
++ PI_SIZE_T fLen;
++
+ public:
+ /** Maximum size of an AppInfo block, taken roughly from the pilot-link source. */
+ static const int MAX_APPINFO_SIZE=8192;
++ static const int MAX_CATEGORIES=16;
++ static const int MAX_CATEGORY_SIZE=16;
+
+ /** Constructor, intended for untyped access to the AppInfo only. This throws
+ * away everything but the category information. In this variety, the
+@@ -232,46 +241,24 @@ public:
+ /** Returns the length of the (whole) AppInfo block. */
+ PI_SIZE_T length() const { return fLen; } ;
+
+- /** Search for the given category @p name in the list
+- * of categories; returns the category number. If @p unknownIsUnfiled
+- * is true, then map unknown categories to Unfiled instead of returning
+- * an error number.
+- *
+- * @return >=0 is a specific category based on the text-to-
+- * category number mapping defined by the Pilot,
+- * where 0 is always the 'unfiled' category.
+- * @return -1 means unknown category selected when
+- * @p unknownIsUnfiled is false.
+- * @return 0 == Unfiled means unknown category selected when
+- * @p unknownIsUnfiled is true.
+- *
+- */
+- static int findCategory(const QString &name, bool unknownIsUnfiled, struct CategoryAppInfo *info);
+- /** Alternative to the above inconvenience function. */
+- int findCategory(const QString &name, bool unknownIsUnfiled = false)
++ /** @see findCategory(const QString &name, bool unknownIsUnfiled, struct CategoryAppInfo *info). */
++ inline int findCategory(const QString &name, bool unknownIsUnfiled = false)
+ { return findCategory(name,unknownIsUnfiled,categoryInfo()); } ;
+
+- /** For debugging, display all the category names */
+- void dump() const;
+-
+- /** For debugging, display category names for the given AppInfo
+- * structure. Called by dump().
+- */
+- static void dumpCategories(const struct CategoryAppInfo &info);
+-
+ /** Gets a single category name. Returns QString::null if there is no
+ * such category number @p i . */
+- QString category(unsigned int i);
+-
++ inline QString category(unsigned int i) const { return category(categoryInfo(),i); }
++
+ /** Sets a category name. @return true if this succeeded. @return false
+ * on failure, e.g. the index @p i was out of range or the category name
+ * was invalid. Category names that are too long are truncated to 15 characters.
+ */
+ bool setCategoryName(unsigned int i, const QString &s);
+
++ /** For debugging, display all the category names */
++ void dump() const;
++
+ private:
+- struct CategoryAppInfo *fC;
+- PI_SIZE_T fLen;
+ bool fOwn;
+ } ;
+
+@@ -297,13 +284,18 @@ public:
+ unsigned char buffer[MAX_APPINFO_SIZE];
+
+ memset(&fInfo,0,sizeof(fInfo));
+- if (d && d->isDBOpen())
++ if (d && d->isOpen())
+ {
+ appLen = d->readAppBlock(buffer,appLen);
+ (*unpack)(&fInfo, buffer, appLen);
++ // fInfo is just a struct, so we can point to it anyway.
++ init(&fInfo.category,appLen);
++ }
++ else
++ {
++ KPILOT_DELETE(fC);
++ fLen = 0;
+ }
+- // fInfo is just a struct, so we can point to it anyway.
+- init(&fInfo.category,appLen);
+ } ;
+
+ /** Write this appinfo block to the database @p d; returns
+@@ -313,7 +305,7 @@ public:
+ int write(PilotDatabase *d)
+ {
+ unsigned char buffer[MAX_APPINFO_SIZE];
+- if (!d || !d->isDBOpen())
++ if (!d || !d->isOpen())
+ {
+ return -1;
+ }
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotDateEntry.cc kdepim-3.5.5.dfsg.1/kpilot/lib/pilotDateEntry.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotDateEntry.cc 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilotDateEntry.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -27,12 +27,15 @@
+ ** Bug reports and questions can be sent to kde-pim at kde.org
+ */
+
++#include <config.h>
+ #include "options.h"
++#include "fakes.h"
+
+ #include <stdlib.h>
+
+ #include <qtextcodec.h>
+ #include <qdatetime.h>
++#include <qregexp.h>
+
+ #include <kglobal.h>
+ #include <kdebug.h>
+@@ -40,9 +43,7 @@
+
+ #include "pilotDateEntry.h"
+
+-static const char *pilotDateEntry_id = "$Id: pilotDateEntry.cc 437980 2005-07-23 19:53:57Z kainhofe $";
+-const int PilotDateEntry::APP_BUFFER_SIZE = 0xffff;
+-
++static const char *pilotDateEntry_id = "$Id: pilotDateEntry.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ PilotDateEntry::PilotDateEntry(struct AppointmentAppInfo &appInfo):PilotAppCategory(), fAppInfo(appInfo)
+ {
+@@ -58,15 +59,10 @@ PilotDateEntry::PilotDateEntry(struct Ap
+ ::memset(&fAppointmentInfo, 0, sizeof(fAppointmentInfo));
+ if (rec)
+ {
+-#if PILOT_LINK_NUMBER >= PILOT_LINK_0_12_0
+ pi_buffer_t b;
+- b.data = (unsigned char *) rec->getData();
++ b.data = (unsigned char *) rec->data();
+ b.allocated = b.used = rec->size();
+ unpack_Appointment(&fAppointmentInfo, &b, datebook_v1);
+-#else
+- unpack_Appointment(&fAppointmentInfo,
+- (unsigned char *) rec->data(), rec->size());
+-#endif
+ }
+ return;
+
+@@ -325,15 +321,18 @@ void *PilotDateEntry::pack_(void *buf, i
+ {
+ int i;
+
+-#if PILOT_LINK_NUMBER >= PILOT_LINK_0_12_0
+ pi_buffer_t b = { 0,0,0 } ;
+ i = pack_Appointment(&fAppointmentInfo, &b, datebook_v1);
++ if (i<0)
++ {
++ // Generic error from the pack_*() functions.
++ return 0;
++ }
++
++ i = b.used;
+ memcpy(buf,b.data,kMin(i,*len));
+ *len = kMin(i,*len);
+-#else
+- i = pack_Appointment(&fAppointmentInfo, (unsigned char *) buf, *len);
+- *len = i;
+-#endif
++
+ return buf;
+ }
+
+@@ -407,6 +406,54 @@ void PilotDateEntry::setNote(const QStri
+ setNoteP( t.data(),t.length() );
+ }
+
++void PilotDateEntry::setLocation(const QString &s)
++{
++ QString note = codec()->toUnicode(getNoteP());
++ QRegExp rxp = QRegExp("^[Ll]ocation:[^\n]+\n");
++
++ if( s.isNull() )
++ {
++ note.replace(rxp,"");
++ }
++ else
++ {
++ QString location = "Location: " + s + "\n";
++ int pos = note.find(rxp);
++
++ if(pos >= 0)
++ {
++ note.replace( rxp, location );
++ }
++ else
++ {
++ note = location + note;
++ setNote( note );
++ }
++ }
++}
++
++QString PilotDateEntry::getLocation() const
++{
++ // Read the complete note here and not the filtered
++ // one from PilotDateEntry::getNote();
++ QString note = codec()->toUnicode(getNoteP());
++ QRegExp rxp = QRegExp("^[Ll]ocation:[^\n]+\n");
++ int pos = note.find(rxp, 0);
++
++ if(pos >= 0)
++ {
++ QString location = rxp.capturedTexts().first();
++ rxp = QRegExp("^[Ll]ocation:[\\s|\t]*");
++ location.replace(rxp,"");
++ location.replace("\n", "");
++ return location;
++ }
++ else
++ {
++ return "";
++ }
++}
++
+ void PilotDateEntry::setDescription(const QString &s)
+ {
+ QCString t = codec()->fromUnicode(s);
+@@ -415,7 +462,10 @@ void PilotDateEntry::setDescription(cons
+
+ QString PilotDateEntry::getNote() const
+ {
+- return codec()->toUnicode(getNoteP());
++ QString note = codec()->toUnicode(getNoteP());
++ QRegExp rxp = QRegExp("^[Ll]ocation:[^\n]+\n");
++ note.replace(rxp, "" );
++ return note;
+ }
+
+ QString PilotDateEntry::getDescription() const
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotDateEntry.h kdepim-3.5.5.dfsg.1/kpilot/lib/pilotDateEntry.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotDateEntry.h 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilotDateEntry.h 2006-11-19 22:21:12.000000000 +0100
+@@ -82,8 +82,6 @@ public:
+ * time associated with it?.
+ */
+ inline bool isEvent() const { return doesFloat(); }
+- /** A synonym for isEvent, deprecated. */
+- int KDE_DEPRECATED getEvent() const { return doesFloat(); }
+
+ /** Sets this appointment's floating status.
+ *
+@@ -94,8 +92,6 @@ public:
+ * associated with it.
+ */
+ void setFloats(bool f) { fAppointmentInfo.event = (f ? 1 : 0) /* Force 1 or 0 */ ; }
+- /** Synonym for setFloats() */
+- void KDE_DEPRECATED setEvent(int event) { setFloats( event ); }
+
+ /** Get the start time of this appointment. See dtStart() for caveats. */
+ struct tm getEventStart() const { return fAppointmentInfo.begin; }
+@@ -130,10 +126,7 @@ public:
+ * causes the Pilot to beep (or whatever is set in the system preferences).
+ */
+ bool isAlarmEnabled() const { return fAppointmentInfo.alarm; }
+- /** Does this appointment have an alarm set? See isAlarmEnabled() */
+- int KDE_DEPRECATED getAlarm() const { return fAppointmentInfo.alarm; }
+- /** Set whether this appointment has an alarm. */
+- void KDE_DEPRECATED setAlarm(int alarm) { fAppointmentInfo.alarm = alarm; }
++
+ /** Set whether this appointment has an alarm. */
+ void setAlarmEnabled(bool b) { fAppointmentInfo.alarm = (b?1:0) /* Force to known int values */ ; }
+
+@@ -218,6 +211,18 @@ public:
+ /** Gets the note for this appointment. See setNote for meaning. */
+ QString getNote() const;
+
++ /**
++ * Sets the location for the appointment. For now it will be placed within
++ * the notes on the handheld. It will be placed on one line and starts with:
++ * Location: {location}. Everything on that line will be counted as location.
++ * TODO: Make distinguish between handhelds that support the location field
++ * and the ones that don't. (Shouldn't this be done in the pilot-link lib?)
++ */
++ void setLocation(const QString &);
++
++ /** Gets the location for this appointment. See setNote for meaning. */
++ QString getLocation() const;
++
+ protected:
+ void setDescriptionP(const char* desc, int l=-1);
+ const char* getDescriptionP() const { return fAppointmentInfo.description; }
+@@ -235,11 +240,10 @@ public:
+
+ QString getCategoryLabel() const;
+ inline bool setCategory(const QString &label) { return PilotAppCategory::setCategory(fAppInfo.category,label); } ;
+- static const int KDE_DEPRECATED APP_BUFFER_SIZE;
+
+ protected:
+ void *pack_(void *buf, int *size);
+- void unpack(const void *buf, int size = 0) { }
++ void unpack(const void *buf, int size = 0) { Q_UNUSED(buf); Q_UNUSED(size); }
+
+ private:
+ struct Appointment fAppointmentInfo;
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilot.h kdepim-3.5.5.dfsg.1/kpilot/lib/pilot.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilot.h 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilot.h 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,159 @@
++#ifndef _KPILOT_PILOT_H
++#define _KPILOT_PILOT_H
++/* pilot.h KPilot
++**
++** Copyright (C) 1998-2001 by Dan Pilone
++** Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold at kainhofer.com>
++** Copyright (C) 2003-2006 Adriaan de Groot <groot at kde.org>
++**
++** These are the base class structures that reside on the
++** handheld device -- databases and their parts.
++*/
++
++/*
++** 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.1 of the License, or
++** (at your option) any later version.
++**
++** This program 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 program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++class QTextCodec;
++
++class PilotDatabase; // A database
++class PilotRecord; // ... has records
++class PilotCategoryInfo; // ... and category information
++
++#include <pi-dlp.h>
++#include <pi-file.h>
++#include <pi-appinfo.h>
++#include <pi-buffer.h>
++
++#include <qstring.h>
++#include <qvaluelist.h>
++
++/**
++* The Pilot namespace holds constants that are global for
++* the handheld data structures. Also contains some global
++* functions that deal with pilot-link structures as well
++* as mapping user-visible strings from UTF8 (KDE side) to
++* the encoding used on the handheld.
++*/
++
++namespace Pilot
++{
++ /** Maximum size of an AppInfo block, taken roughly from the pilot-link source. */
++ static const int MAX_APPINFO_SIZE=8192;
++
++ /** Maximum number of categories the handheld has */
++ static const unsigned int CATEGORY_COUNT=16;
++
++ /** Maximum size of a category label */
++ static const unsigned int CATEGORY_SIZE=16;
++
++ /** Category number for unfiled records */
++ static const int Unfiled = 0;
++
++ /** Maximum size (in bytes) of a record's data */
++ static const int MAX_RECORD_SIZE = 65535;
++
++ typedef QValueList<recordid_t> RecordIDList;
++
++ /** Static translation function that maps handheld native (8 bit,
++ * usually latin1 but sometimes someting else) encoded data to
++ * a Unicode string. Converts the @p len characters in @p c
++ * to a Unicode string.
++ */
++ QString fromPilot( const char *c, int len );
++
++ /** Static translation function mapping a NUL-terminated
++ * string from the handheld's encoding to UTF-8.
++ * @param c the NUL-terminated string to decode
++ * @return QString (UTF-8) value of @p c
++ * @note NUL-terminated strings are rare on the handheld.
++ */
++ QString fromPilot( const char *c );
++
++ /** Static translation function that maps a QString onto the
++ * native 8 bit encoding of the handheld. Writes the result into
++ * the buffer @p buf which has size @p len. Returns the length
++ * of the result. Zero-fills the buffer as needed.
++ */
++ int toPilot( const QString &s, char *buf, int len);
++ int toPilot( const QString &s, unsigned char *buf, int len);
++
++ /** Static translation function that maps a QString onto the
++ * native 8 bit encoding of the handheld.
++ *
++ * @param s String to encode
++ * @return Encoded string in a QCString
++ */
++ QCString toPilot( const QString &s );
++
++ /** Create a codec for translating handheld native 8 bit to Unicode,
++ * using the given codec @p name -- this will often be latin1, but
++ * might be something else for, say, Russian-language Pilots.
++ * If @p name is empty, use latin1.
++ *
++ * @return @c true on success, @c false otherwise
++ */
++ bool setupPilotCodec(const QString &name);
++
++ /** Returns the name of the codec being used. */
++ QString codecName();
++
++ /** For debugging, display category names for the given AppInfo
++ * structure. Called by dump(). You must pass a valid reference.
++ */
++ void dumpCategories(const struct CategoryAppInfo *info);
++
++ /** Returns the QString for the requested category @p i
++ * in the category structure @p info. Returns @c QString::null
++ * on error (bad pointer or bad category number). May also
++ * return @c QString::null if the category name is empty.
++ */
++ QString categoryName(const struct CategoryAppInfo *info, unsigned int i);
++
++ /** Search for the given category @p name in the list
++ * of categories; returns the category number. If @p unknownIsUnfiled
++ * is true, then map unknown categories to Unfiled instead of returning
++ * an error number.
++ *
++ * @return >=0 is a specific category based on the text-to-
++ * category number mapping defined by the Pilot,
++ * where 0 is always the 'unfiled' category.
++ * @return -1 means unknown category selected when
++ * @p unknownIsUnfiled is false.
++ * @return 0 == Unfiled means unknown category selected when
++ * @p unknownIsUnfiled is true.
++ *
++ */
++ int findCategory(const struct CategoryAppInfo *info, const QString &name, bool unknownIsUnfiled);
++
++ /** The handheld also holds data about each database
++ * in a DBInfo structure; check if the database described
++ * by this structure is a resource database.
++ */
++ static inline bool isResource(struct DBInfo *info)
++ {
++ return (info->flags & dlpDBFlagResource);
++ }
++}
++
++
++
++#endif
++
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotLinkVersion.h kdepim-3.5.5.dfsg.1/kpilot/lib/pilotLinkVersion.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotLinkVersion.h 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilotLinkVersion.h 2006-11-19 22:21:12.000000000 +0100
+@@ -34,7 +34,7 @@
+ #include <pi-version.h>
+
+ #ifndef PILOT_LINK_VERSION
+-#error "You need at least pilot-link version 0.9.5"
++#error "You need at least pilot-link version 0.12.1"
+ #endif
+
+
+@@ -44,16 +44,13 @@
+ #define PILOT_LINK_0_11_0 (1100)
+ #define PILOT_LINK_0_11_8 (1108)
+ #define PILOT_LINK_0_12_0 (1200)
++#define PILOT_LINK_0_12_1 (1201)
+
+-#if PILOT_LINK_NUMBER < PILOT_LINK_0_11_8
+-#warning "You need at least pilot-link version 0.11.8 for modern devices"
++#if PILOT_LINK_NUMBER < PILOT_LINK_0_12_1
++#error "You need at least pilot-link version 0.12.1 for KPilot"
+ #endif
+
+-#if PILOT_LINK_NUMBER < PILOT_LINK_0_12_0
+-#define PI_SIZE_T int
+-#else
+ #define PI_SIZE_T size_t
+-#endif
+
+
+ #endif
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotLocalDatabase.cc kdepim-3.5.5.dfsg.1/kpilot/lib/pilotLocalDatabase.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotLocalDatabase.cc 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilotLocalDatabase.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -29,9 +29,11 @@
+
+
+ static const char *pilotlocaldatabase_id =
+- "$Id: pilotLocalDatabase.cc 452989 2005-08-24 21:20:38Z adridg $";
++ "$Id: pilotLocalDatabase.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
++#include <config.h>
+ #include "options.h"
++#include "fakes.h"
+
+ #include <stdio.h>
+ #include <unistd.h>
+@@ -49,6 +51,7 @@ static const char *pilotlocaldatabase_id
+ #include <kdebug.h>
+ #include <kglobal.h>
+ #include <kstandarddirs.h>
++#include <ksavefile.h>
+
+ #include "pilotAppCategory.h"
+ #include "pilotLocalDatabase.h"
+@@ -91,7 +94,7 @@ PilotLocalDatabase::PilotLocalDatabase(c
+ fixupDBName();
+ openDatabase();
+
+- if (!isDBOpen() && useDefaultPath)
++ if (!isOpen() && useDefaultPath)
+ {
+ if (fPathBase && !fPathBase->isEmpty())
+ {
+@@ -104,40 +107,16 @@ PilotLocalDatabase::PilotLocalDatabase(c
+ }
+ fixupDBName();
+ openDatabase();
+- if (!isDBOpen())
++ if (!isOpen())
++ {
+ fPathName=path;
++ }
+ }
+
+ /* NOTREACHED */
+ (void) pilotlocaldatabase_id;
+ }
+
+-PilotLocalDatabase::PilotLocalDatabase(const QString & dbName,
+- bool useConduitDBs) :
+- PilotDatabase(dbName),
+- fPathName(QString::null),
+- fDBName(dbName),
+- fAppInfo(0L),
+- fAppLen(0),
+- d(0L)
+-{
+- FUNCTIONSETUP;
+- if (fPathBase && !fPathBase->isEmpty() )
+- {
+- fPathName = *fPathBase;
+- if (useConduitDBs)
+- fPathName.replace(CSL1("DBBackup/"), CSL1("conduits/"));
+- }
+- else
+- {
+- fPathName = KGlobal::dirs()->saveLocation("data",
+- CSL1("kpilot/")+(useConduitDBs?CSL1("conduits/"):CSL1("DBBackup/")));
+- }
+-
+- fixupDBName();
+- openDatabase();
+-}
+-
+ PilotLocalDatabase::PilotLocalDatabase(const QString &dbName) :
+ PilotDatabase( QString() ),
+ fPathName( QString() ),
+@@ -184,15 +163,15 @@ bool PilotLocalDatabase::createDatabase(
+ FUNCTIONSETUP;
+
+ // if the database is already open, we cannot create it again. How about completely resetting it? (i.e. deleting it and the createing it again)
+- if (isDBOpen()) {
++ if (isOpen()) {
+ #ifdef DEBUG
+- DEBUGCONDUIT<<"Database "<<fDBName<<" already open. Cannot recreate it."<<endl;
++ DEBUGLIBRARY<<"Database "<<fDBName<<" already open. Cannot recreate it."<<endl;
+ #endif
+ return true;
+ }
+
+ #ifdef DEBUG
+- DEBUGCONDUIT<<"Creating database "<<fDBName<<endl;
++ DEBUGLIBRARY<<"Creating database "<<fDBName<<endl;
+ #endif
+
+ // Database names seem to be latin1.
+@@ -223,7 +202,7 @@ bool PilotLocalDatabase::createDatabase(
+ int PilotLocalDatabase::deleteDatabase()
+ {
+ FUNCTIONSETUP;
+- if (isDBOpen()) closeDatabase();
++ if (isOpen()) closeDatabase();
+
+ QString dbpath=dbPathName();
+ QFile fl(dbpath);
+@@ -242,7 +221,7 @@ int PilotLocalDatabase::readAppBlock(uns
+
+ size_t m = kMin((size_t)size,(size_t)fAppLen);
+
+- if (!isDBOpen())
++ if (!isOpen())
+ {
+ kdError() << k_funcinfo << ": DB not open!" << endl;
+ memset(buffer,0,m);
+@@ -257,7 +236,7 @@ int PilotLocalDatabase::writeAppBlock(un
+ {
+ FUNCTIONSETUP;
+
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdError() << k_funcinfo << ": DB not open!" << endl;
+ return -1;
+@@ -300,7 +279,7 @@ PilotRecord *PilotLocalDatabase::readRec
+ FUNCTIONSETUP;
+
+ d->pending = -1;
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdWarning() << k_funcinfo << fDBName << ": DB not open!" << endl;
+ return 0L;
+@@ -324,13 +303,13 @@ PilotRecord *PilotLocalDatabase::readRec
+ {
+ FUNCTIONSETUP;
+ d->pending = -1;
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdWarning() << k_funcinfo << ": DB not open!" << endl;
+ return 0L;
+ }
+ #ifdef DEBUG
+- DEBUGKPILOT << "Index=" << index << " Count=" << recordCount() << endl;
++ DEBUGLIBRARY << fname << ": Index=" << index << " Count=" << recordCount() << endl;
+ #endif
+ if (index >= recordCount())
+ return 0L;
+@@ -345,7 +324,7 @@ PilotRecord *PilotLocalDatabase::readNex
+ {
+ FUNCTIONSETUP;
+ d->pending = -1;
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdWarning() << k_funcinfo << ": DB not open!" << endl;
+ return 0L;
+@@ -369,13 +348,13 @@ const PilotRecord *PilotLocalDatabase::f
+ {
+ FUNCTIONSETUP;
+
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdWarning() << k_funcinfo << ": DB not open!" << endl;
+ return 0L;
+ }
+ #ifdef DEBUG
+- DEBUGKPILOT << fname << ": looking for new record from " << d->current << endl;
++ DEBUGLIBRARY << fname << ": looking for new record from " << d->current << endl;
+ #endif
+ // Should this also check for deleted?
+ while ((d->current < d->size())
+@@ -396,7 +375,7 @@ PilotRecord *PilotLocalDatabase::readNex
+ {
+ FUNCTIONSETUP;
+
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdWarning() << k_funcinfo << ": DB not open!" << endl;
+ return 0L;
+@@ -425,7 +404,7 @@ recordid_t PilotLocalDatabase::updateID(
+ {
+ FUNCTIONSETUP;
+
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdError() << k_funcinfo << ": DB not open!" << endl;
+ return 0;
+@@ -446,7 +425,7 @@ recordid_t PilotLocalDatabase::writeReco
+ {
+ FUNCTIONSETUP;
+
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdError() << k_funcinfo << ": DB not open!" << endl;
+ return 0;
+@@ -486,7 +465,7 @@ recordid_t PilotLocalDatabase::writeReco
+ int PilotLocalDatabase::deleteRecord(recordid_t id, bool all)
+ {
+ FUNCTIONSETUP;
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdError() << k_funcinfo <<": DB not open"<<endl;
+ return -1;
+@@ -524,7 +503,7 @@ int PilotLocalDatabase::resetSyncFlags()
+ {
+ FUNCTIONSETUP;
+
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdError() << k_funcinfo << ": DB not open!" << endl;
+ return -1;
+@@ -541,7 +520,7 @@ int PilotLocalDatabase::resetSyncFlags()
+ int PilotLocalDatabase::resetDBIndex()
+ {
+ FUNCTIONSETUP;
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdWarning() << k_funcinfo << ": DB not open!" << endl;
+ return -1;
+@@ -554,7 +533,7 @@ int PilotLocalDatabase::resetDBIndex()
+ int PilotLocalDatabase::cleanup()
+ {
+ FUNCTIONSETUP;
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdWarning() << k_funcinfo << ": DB not open!" << endl;
+ return -1;
+@@ -602,15 +581,13 @@ void PilotLocalDatabase::openDatabase()
+ pi_file *dbFile;
+
+ setDBOpen(false);
+- char buffer[PATH_MAX];
+- memset(buffer,0,PATH_MAX);
+- strlcpy(buffer,QFile::encodeName(dbPathName()),PATH_MAX);
+
+- dbFile = pi_file_open(buffer);
++ dbFile = pi_file_open( QFile::encodeName(dbPathName()) );
+ if (dbFile == 0L)
+ {
+ #ifdef DEBUG
+- DEBUGCONDUIT << fname << ": Failed to open " << dbPathName() << endl;
++ QString path = dbPathName();
++ DEBUGLIBRARY << fname << ": Failed to open " << path << endl;
+ #endif
+ return;
+ }
+@@ -642,6 +619,9 @@ void PilotLocalDatabase::openDatabase()
+ i++;
+ }
+ pi_file_close(dbFile); // We done with it once we've read it in.
++
++ KSaveFile::backupFile( dbPathName() );
++
+ setDBOpen(true);
+ }
+
+@@ -650,10 +630,12 @@ void PilotLocalDatabase::closeDatabase()
+ FUNCTIONSETUP;
+ pi_file *dbFile;
+
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ #ifdef DEBUG
+- DEBUGCONDUIT << fname << ": Database "<<fDBName<<" is not open. Cannot close and write it"<<endl;
++ DEBUGLIBRARY << fname << ": Database " << fDBName
++ << " is not open. Cannot close and write it"
++ << endl;
+ #endif
+ return;
+ }
+@@ -664,9 +646,10 @@ void PilotLocalDatabase::closeDatabase()
+ strlcpy(buf,QFile::encodeName(newName),PATH_MAX);
+
+ #ifdef DEBUG
+- DEBUGCONDUIT << fname
++ QString path = dbPathName();
++ DEBUGLIBRARY << fname
+ << ": Creating temp file " << buf
+- << " for the database file " << dbPathName() << endl;
++ << " for the database file " << path << endl;
+ #endif
+
+ dbFile = pi_file_create(buf,&fDBInfo);
+@@ -702,7 +685,7 @@ void PilotLocalDatabase::setDBPath(const
+ FUNCTIONSETUP;
+
+ #ifdef DEBUG
+- DEBUGDAEMON << fname
++ DEBUGLIBRARY << fname
+ << ": Setting default DB path to "
+ << s
+ << endl;
+@@ -723,3 +706,34 @@ void PilotLocalDatabase::setDBPath(const
+ return eLocalDB;
+ }
+
++
++/* static */ bool PilotLocalDatabase::infoFromFile( const QString &path, DBInfo *d )
++{
++ FUNCTIONSETUP;
++
++ pi_file *f = 0L;
++
++ if (!d)
++ {
++ return false;
++ }
++ if (!QFile::exists(path))
++ {
++ return false;
++ }
++
++ const char * fileName = QFile::encodeName( path );
++ f = pi_file_open( fileName );
++ if (!f)
++ {
++ kdWarning() << k_funcinfo
++ << ": Can't open " << path << endl;
++ return false;
++ }
++
++ pi_file_get_info(f,d);
++ pi_file_close(f);
++
++ return true;
++}
++
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotLocalDatabase.h kdepim-3.5.5.dfsg.1/kpilot/lib/pilotLocalDatabase.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotLocalDatabase.h 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilotLocalDatabase.h 2006-11-19 22:21:12.000000000 +0100
+@@ -47,20 +47,6 @@ public:
+ */
+ PilotLocalDatabase( const QString& path,
+ const QString& name, bool useDefaultPath=true);
+- /**
+- * Opens the local database. A default path is used
+- * ($KDEHOME/share/apps/kpilot/DBBackup)
+- * and if the file is found there, it is opened.
+- * Since a backup messes up the state of the conduits (i.e.
+- * changes on the handheld might no longer be detected after
+- * a backup run, since the conduit assumes the database to have
+- * the state of the previous conduit run, useConduitDBs=true
+- * opens the database in $KDEHOME/share/apps/kpilot/conduits
+- *
+- * TODO: Deprecate this one.
+- */
+- PilotLocalDatabase(const QString &name, bool useConduitDBs /* =false */);
+-
+
+ /**
+ * Opens the local database. This is primarily for testing
+@@ -152,7 +138,7 @@ public:
+ * Accessor functions for the application info block.
+ */
+ int appInfoSize() const
+- { if (isDBOpen()) return fAppLen; else return -1; } ;
++ { if (isOpen()) return fAppLen; else return -1; } ;
+ char *appInfo() { return fAppInfo; } ;
+
+ const struct DBInfo &getDBInfo() const { return fDBInfo; }
+@@ -160,6 +146,18 @@ public:
+
+ virtual DBType dbType() const;
+
++ /** Reads local file @p path and fills in the DBInfo
++ * structure @p d with the DBInfo from the file.
++ *
++ * @return @c false if d is NULL
++ * @return @c false if the file @p path does not exist
++ * @return @c true if reading the DBInfo succeeds
++ *
++ * @note Relatively expensive operation, since the pilot-link
++ * library doesn't provide a cheap way of getting this
++ * information.
++ */
++ static bool infoFromFile( const QString &path, DBInfo *d );
+
+ protected:
+ // Changes any forward slashes to underscores
+@@ -183,7 +181,7 @@ private:
+ */
+ public:
+ static void setDBPath(const QString &);
+- static const QString *getDBPath() { return fPathBase; } ;
++ static const QString &getDBPath() { return *fPathBase; } ;
+ private:
+ static QString *fPathBase;
+ };
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotMemo.cc kdepim-3.5.5.dfsg.1/kpilot/lib/pilotMemo.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotMemo.cc 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilotMemo.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -26,9 +26,11 @@
+ ** Bug reports and questions can be sent to kde-pim at kde.org
+ */
+ static const char *pilotMemo_id =
+- "$Id: pilotMemo.cc 437980 2005-07-23 19:53:57Z kainhofe $";
++ "$Id: pilotMemo.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
++#include <config.h>
+ #include "options.h"
++#include "fakes.h"
+
+ #include <qtextcodec.h>
+
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotRecord.cc kdepim-3.5.5.dfsg.1/kpilot/lib/pilotRecord.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotRecord.cc 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilotRecord.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -32,7 +32,9 @@
+ /*
+ ** Bug reports and questions can be sent to kde-pim at kde.org
+ */
++#include <config.h>
+ #include "options.h"
++#include "fakes.h"
+
+ #include <string.h>
+
+@@ -42,6 +44,8 @@
+ #include <kglobal.h>
+ #include <kcharsets.h>
+
++#include "pilot.h"
++
+ // PilotAppCategory includes pilotRecord and we
+ // provide its implementation here as well.
+ //
+@@ -50,7 +54,7 @@
+
+
+ static const char *pilotRecord_id =
+- "$Id: pilotRecord.cc 437980 2005-07-23 19:53:57Z kainhofe $";
++ "$Id: pilotRecord.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ /* static */ int PilotRecord::fAllocated = 0;
+ /* static */ int PilotRecord::fDeleted = 0;
+@@ -59,7 +63,7 @@ static const char *pilotRecord_id =
+ {
+ #ifdef DEBUG
+ FUNCTIONSETUP;
+- DEBUGKPILOT << fname
++ DEBUGLIBRARY << fname
+ << ": Allocated " << fAllocated
+ << " Deleted " << fDeleted << endl;
+ #endif
+@@ -68,11 +72,8 @@ static const char *pilotRecord_id =
+ PilotRecord::PilotRecord(void *data, int len, int attrib, int cat, recordid_t uid) :
+ PilotRecordBase(attrib,cat,uid),
+ fData(0L),
+- fLen(len)
+-#if PILOT_LINK_NUMBER >= PILOT_LINK_0_12_0
+- ,
++ fLen(len),
+ fBuffer(0L)
+-#endif
+ {
+ FUNCTIONSETUPL(4);
+ fData = new char[len];
+@@ -84,11 +85,8 @@ PilotRecord::PilotRecord(void *data, int
+ }
+
+ PilotRecord::PilotRecord(PilotRecord * orig) :
+- PilotRecordBase( orig->attributes(), orig->category(), orig->id() )
+-#if PILOT_LINK_NUMBER >= PILOT_LINK_0_12_0
+- ,
++ PilotRecordBase( orig->attributes(), orig->category(), orig->id() ) ,
+ fBuffer(0L)
+-#endif
+ {
+ FUNCTIONSETUPL(4);
+ fData = new char[orig->size()];
+@@ -101,14 +99,12 @@ PilotRecord::PilotRecord(PilotRecord * o
+ PilotRecord & PilotRecord::operator = (PilotRecord & orig)
+ {
+ FUNCTIONSETUP;
+-#if PILOT_LINK_NUMBER >= PILOT_LINK_0_12_0
+ if (fBuffer)
+ {
+ pi_buffer_free(fBuffer);
+ fBuffer=0L;
+ fData=0L;
+ }
+-#endif
+
+ if (fData)
+ delete[]fData;
+@@ -142,14 +138,14 @@ void PilotRecord::setData(const char *da
+ QString encoding(KGlobal::charsets()->encodingForName(s));
+
+ #ifdef DEBUG
+- DEBUGKPILOT << fname << ": Creating codec " << encoding << endl;
++ DEBUGLIBRARY << fname << ": Creating codec " << encoding << endl;
+ #endif
+
+ // if the desired codec can't be found, latin1 will be returned anyway, no need to do this manually
+ pilotCodec = KGlobal::charsets()->codecForName(encoding);
+
+ #ifdef DEBUG
+- DEBUGKPILOT << fname
++ DEBUGLIBRARY << fname
+ << ": Got codec " << codecName() << " for setting "
+ << s << endl;
+ #endif
+@@ -183,7 +179,7 @@ bool PilotAppCategory::setCategory(struc
+
+ PilotRecord *PilotAppCategory::pack()
+ {
+- int len = PilotRecord::APP_BUFFER_SIZE;
++ int len = Pilot::MAX_RECORD_SIZE;
+ void* buff = new unsigned char[len];
+ pack_(buff, &len);
+ PilotRecord* rec = new PilotRecord(buff, len, attributes(), category(), id());
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotRecord.h kdepim-3.5.5.dfsg.1/kpilot/lib/pilotRecord.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotRecord.h 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilotRecord.h 2006-11-19 22:21:12.000000000 +0100
+@@ -77,8 +77,6 @@ public:
+ inline int attributes() const { return fAttrib; }
+ /** Set the attributes of this record. */
+ inline void setAttributes(int attrib) { fAttrib = attrib; }
+- int KDE_DEPRECATED getAttrib() const { return attributes(); }
+- void KDE_DEPRECATED setAttrib(int attrib) { setAttributes(attrib); }
+
+ /** Returns the category number 0 <= < PILOT_CATEGORY_MAX of this record. */
+ int category() const { return fCat; }
+@@ -87,8 +85,6 @@ public:
+ * "Unfiled" (which is 0).
+ */
+ void setCategory(int cat) { if ( (cat<0) || (cat>=PILOT_CATEGORY_MAX)) cat=0; fCat = cat; }
+- int KDE_DEPRECATED getCat() const { return category(); }
+- void KDE_DEPRECATED setCat(int cat) { return setCategory(cat); }
+
+ /** Returns the record ID for this record. Record IDs are unique for a given
+ * handheld and database.
+@@ -98,7 +94,6 @@ public:
+ * the handheld by doing weird things here.
+ */
+ void setID(recordid_t id) { fID = id; }
+- recordid_t KDE_DEPRECATED getID() const { return id(); }
+
+ /** Accessor for one bit of the record's attributes. Is this record marked
+ * deleted (on the handheld) ? Deleted records are not removed from the
+@@ -121,7 +116,6 @@ public:
+ * Modified records are those that have been modified since the last HotSync.
+ */
+ inline bool isModified() const { return fAttrib & dlpRecAttrDirty; }
+- inline bool KDE_DEPRECATED isDirty() const { return isModified(); } ;
+
+ #define SETTER(a) {\
+ if (d) { fAttrib |= a; } \
+@@ -139,9 +133,6 @@ public:
+ /** Mark a record as modified (or not). */
+ inline void setModified(bool d=true) SETTER(dlpRecAttrDirty)
+
+- void KDE_DEPRECATED makeDeleted() { setDeleted(true); }
+- void KDE_DEPRECATED makeSecret() { setSecret(true); }
+- void KDE_DEPRECATED makeArchived() { setArchived(true); }
+ #undef SETTER
+
+ private:
+@@ -164,7 +155,6 @@ public:
+ */
+ PilotRecord(void* data, int length, int attrib, int cat, recordid_t uid);
+
+-#if PILOT_LINK_NUMBER >= PILOT_LINK_0_12_0
+ /** Constructor. Using the given buffer @p buf (which carries its
+ * own data and length), create a record. Otherwise much like the
+ * above constructor @em except that this record assumes ownership
+@@ -177,15 +167,18 @@ public:
+ fLen(buf->used),
+ fBuffer(buf)
+ { fAllocated++; }
+-#endif
+
+ /** Destructor. Dispose of the buffers in the right form. */
+ ~PilotRecord()
+ {
+-#if PILOT_LINK_NUMBER >= PILOT_LINK_0_12_0
+- if (fBuffer) { pi_buffer_free(fBuffer); } else
+-#endif
+- { delete [] fData; }
++ if (fBuffer)
++ {
++ pi_buffer_free(fBuffer);
++ }
++ else
++ {
++ delete [] fData;
++ }
+ fDeleted++;
+ }
+
+@@ -200,24 +193,23 @@ public:
+ */
+ char *data() const
+ {
+-#if PILOT_LINK_NUMBER >= PILOT_LINK_0_12_0
+- if (fBuffer) return (char *)(fBuffer->data); else
+-#endif
+- return fData;
++ if (fBuffer)
++ {
++ return (char *)(fBuffer->data);
++ }
++ else
++ {
++ return fData;
++ }
+ }
+- char *KDE_DEPRECATED getData() const { return data(); }
+
+ /** Returns the size of the data for this record. */
+ int size() const
+ {
+-#if PILOT_LINK_NUMBER >= PILOT_LINK_0_12_0
+ if (fBuffer) return fBuffer->used; else
+-#endif
+ return fLen;
+ }
+- int KDE_DEPRECATED getLen() const { return size(); }
+
+-#if PILOT_LINK_NUMBER >= PILOT_LINK_0_12_0
+ /** Returns the data buffer associated with this record. */
+ const pi_buffer_t *buffer() const { return fBuffer; }
+
+@@ -232,13 +224,6 @@ public:
+ fLen = b->used;
+ fBuffer = b;
+ }
+-#endif
+-
+- /** A constant, really left over from PalmOS 4 days, when records
+- * could be 64k in size at most. It is used in various places to
+- * dimension buffers, but should be considered deprecated.
+- */
+- enum { APP_BUFFER_SIZE = 0xffff } ;
+
+ /** Assignment operator. Makes a copy of the @p orig record. */
+ PilotRecord& operator=(PilotRecord& orig);
+@@ -249,9 +234,7 @@ public:
+ private:
+ char* fData;
+ int fLen;
+-#if PILOT_LINK_NUMBER >= PILOT_LINK_0_12_0
+ pi_buffer_t *fBuffer;
+-#endif
+
+ public:
+ /**
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotSerialDatabase.cc kdepim-3.5.5.dfsg.1/kpilot/lib/pilotSerialDatabase.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotSerialDatabase.cc 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilotSerialDatabase.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -27,7 +27,9 @@
+ /*
+ ** Bug reports and questions can be sent to kde-pim at kde.org
+ */
++#include <config.h>
+ #include "options.h"
++#include "fakes.h"
+
+ #include <time.h>
+ #include <iostream>
+@@ -43,16 +45,17 @@
+
+ #include "pilotAppCategory.h"
+ #include "pilotSerialDatabase.h"
++#include "kpilotdevicelink.h"
+
+ static const char *pilotSerialDatabase_id =
+- "$Id: pilotSerialDatabase.cc 437980 2005-07-23 19:53:57Z kainhofe $";
++ "$Id: pilotSerialDatabase.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+-PilotSerialDatabase::PilotSerialDatabase(int linksocket,
++PilotSerialDatabase::PilotSerialDatabase(KPilotDeviceLink *l,
+ const QString &dbName) :
+ PilotDatabase(dbName),
+ fDBName(QString::null),
+ fDBHandle(-1),
+- fDBSocket(linksocket)
++ fDBSocket(l->pilotSocket())
+ {
+ FUNCTIONSETUP;
+ fDBName = dbName;
+@@ -80,15 +83,11 @@ QString PilotSerialDatabase::dbPathName(
+ int PilotSerialDatabase::readAppBlock(unsigned char *buffer, int maxLen)
+ {
+ FUNCTIONSETUP;
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdError() << k_funcinfo << ": DB not open" << endl;
+ return -1;
+ }
+-#if PILOT_LINK_NUMBER < PILOT_LINK_0_12_0
+- return dlp_ReadAppBlock(fDBSocket, getDBHandle(), 0, (void *) buffer,
+- maxLen);
+-#else
+ pi_buffer_t *buf = pi_buffer_new(maxLen);
+ int r = dlp_ReadAppBlock(fDBSocket, getDBHandle(), 0 /* offset */, maxLen, buf);
+ if (r>=0)
+@@ -97,14 +96,13 @@ int PilotSerialDatabase::readAppBlock(un
+ }
+ pi_buffer_free(buf);
+ return r;
+-#endif
+ }
+
+ // Writes the application block info.
+ int PilotSerialDatabase::writeAppBlock(unsigned char *buffer, int len)
+ {
+ FUNCTIONSETUP;
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdError() << k_funcinfo << ": DB not open" << endl;
+ return -1;
+@@ -117,7 +115,7 @@ int PilotSerialDatabase::recordCount()
+ {
+ int idlen;
+ // dlp_ReadOpenDBInfo returns the number of bytes read and sets idlen to the # of recs
+- if (isDBOpen() && dlp_ReadOpenDBInfo(fDBSocket, getDBHandle(), &idlen)>0)
++ if (isOpen() && dlp_ReadOpenDBInfo(fDBSocket, getDBHandle(), &idlen)>0)
+ {
+ return idlen;
+ }
+@@ -158,7 +156,7 @@ PilotRecord *PilotSerialDatabase::readRe
+ FUNCTIONSETUPL(3);
+ int index, attr, category;
+
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdError() << k_funcinfo << ": DB not open" << endl;
+ return 0L;
+@@ -169,19 +167,11 @@ PilotRecord *PilotSerialDatabase::readRe
+ <<id<<endl;;
+ return 0L;
+ }
+-#if PILOT_LINK_NUMBER < PILOT_LINK_0_12_0
+- char buffer[PilotRecord::APP_BUFFER_SIZE];
+- PI_SIZE_T size;
+- if (dlp_ReadRecordById(fDBSocket, getDBHandle(), id, buffer, &index,
+- &size, &attr, &category) >= 0)
+- return new PilotRecord(buffer, size, attr, category, id);
+-#else
+ pi_buffer_t *b = pi_buffer_new(InitialBufferSize);
+ if (dlp_ReadRecordById(fDBSocket,getDBHandle(),id,b,&index,&attr,&category) >= 0)
+ {
+ return new PilotRecord(b, attr, category, id);
+ }
+-#endif
+ return 0L;
+ }
+
+@@ -190,7 +180,7 @@ PilotRecord *PilotSerialDatabase::readRe
+ {
+ FUNCTIONSETUPL(3);
+
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdError() << k_funcinfo << ": DB not open" << endl;
+ return 0L;
+@@ -200,22 +190,12 @@ PilotRecord *PilotSerialDatabase::readRe
+ recordid_t id;
+ PilotRecord *rec = 0L;
+
+-#if PILOT_LINK_NUMBER < PILOT_LINK_0_12_0
+- char buffer[PilotRecord::APP_BUFFER_SIZE];
+- PI_SIZE_T size;
+- if (dlp_ReadRecordByIndex(fDBSocket, getDBHandle(), index,
+- buffer, &id, &size, &attr, &category) >= 0)
+- {
+- rec = new PilotRecord(buffer, size, attr, category, id);
+- }
+-#else
+ pi_buffer_t *b = pi_buffer_new(InitialBufferSize);
+ if (dlp_ReadRecordByIndex(fDBSocket, getDBHandle(), index,
+ b, &id, &attr, &category) >= 0)
+ {
+ rec = new PilotRecord(b, attr, category, id);
+ }
+-#endif
+
+
+ return rec;
+@@ -228,23 +208,15 @@ PilotRecord *PilotSerialDatabase::readNe
+ int index, attr;
+ recordid_t id;
+
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdError() << k_funcinfo << ": DB not open" << endl;
+ return 0L;
+ }
+-#if PILOT_LINK_NUMBER < PILOT_LINK_0_12_0
+- char buffer[PilotRecord::APP_BUFFER_SIZE];
+- PI_SIZE_T size;
+- if (dlp_ReadNextRecInCategory(fDBSocket, getDBHandle(),
+- category, buffer, &id, &index, &size, &attr) >= 0)
+- return new PilotRecord(buffer, size, attr, category, id);
+-#else
+ pi_buffer_t *b = pi_buffer_new(InitialBufferSize);
+ if (dlp_ReadNextRecInCategory(fDBSocket, getDBHandle(),
+ category,b,&id,&index,&attr) >= 0)
+ return new PilotRecord(b, attr, category, id);
+-#endif
+ return 0L;
+ }
+
+@@ -255,28 +227,17 @@ PilotRecord *PilotSerialDatabase::readNe
+ int index, attr, category;
+ recordid_t id;
+
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdError() << k_funcinfo << ": DB not open" << endl;
+ return 0L;
+ }
+-#if PILOT_LINK_NUMBER < PILOT_LINK_0_12_0
+- char buffer[PilotRecord::APP_BUFFER_SIZE];
+- PI_SIZE_T size;
+- if (dlp_ReadNextModifiedRec(fDBSocket, getDBHandle(), (void *) buffer,
+- &id, &index, &size, &attr, &category) >= 0)
+- {
+- if (ind) *ind=index;
+- return new PilotRecord(buffer, size, attr, category, id);
+- }
+-#else
+ pi_buffer_t *b = pi_buffer_new(InitialBufferSize);
+ if (dlp_ReadNextModifiedRec(fDBSocket, getDBHandle(), b, &id, &index, &attr, &category) >= 0)
+ {
+ if (ind) *ind=index;
+ return new PilotRecord(b, attr, category, id);
+ }
+-#endif
+ return 0L;
+ }
+
+@@ -287,7 +248,7 @@ recordid_t PilotSerialDatabase::writeRec
+ recordid_t newid;
+ int success;
+
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdError() << k_funcinfo << ": DB not open" << endl;
+ return 0;
+@@ -316,7 +277,7 @@ recordid_t PilotSerialDatabase::writeRec
+ int PilotSerialDatabase::deleteRecord(recordid_t id, bool all)
+ {
+ FUNCTIONSETUP;
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdError() << k_funcinfo <<": DB not open"<<endl;
+ return -1;
+@@ -329,7 +290,7 @@ int PilotSerialDatabase::deleteRecord(re
+ int PilotSerialDatabase::resetSyncFlags()
+ {
+ FUNCTIONSETUP;
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdError() << k_funcinfo << ": DB not open" << endl;
+ return -1;
+@@ -341,7 +302,7 @@ int PilotSerialDatabase::resetSyncFlags(
+ int PilotSerialDatabase::resetDBIndex()
+ {
+ FUNCTIONSETUP;
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdError() << k_funcinfo << ": DB not open" << endl;
+ return -1;
+@@ -353,7 +314,7 @@ int PilotSerialDatabase::resetDBIndex()
+ int PilotSerialDatabase::cleanup()
+ {
+ FUNCTIONSETUP;
+- if (isDBOpen() == false)
++ if (!isOpen())
+ {
+ kdError() << k_funcinfo << ": DB not open" << endl;
+ return -1;
+@@ -409,7 +370,7 @@ bool PilotSerialDatabase::createDatabase
+ int db;
+
+ // if the database is already open, we cannot create it again. How about completely resetting it? (i.e. deleting it and the createing it again)
+- if (isDBOpen()) return true;
++ if (isOpen()) return true;
+ // The latin1 seems ok, database names are latin1.
+ int res=dlp_CreateDB(fDBSocket,
+ creator, type, cardno, flags, version,
+@@ -428,7 +389,7 @@ bool PilotSerialDatabase::createDatabase
+ void PilotSerialDatabase::closeDatabase()
+ {
+ FUNCTIONSETUP;
+- if (!isDBOpen() ) return;
++ if (!isOpen() ) return;
+
+ dlp_CloseDB(fDBSocket, getDBHandle());
+ setDBOpen(false);
+@@ -438,7 +399,7 @@ int PilotSerialDatabase::deleteDatabase(
+ {
+ FUNCTIONSETUP;
+
+- if (isDBOpen()) closeDatabase();
++ if (isOpen()) closeDatabase();
+
+ return dlp_DeleteDB(fDBSocket, 0, PilotAppCategory::codec()->fromUnicode(fDBName));
+ }
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotSerialDatabase.h kdepim-3.5.5.dfsg.1/kpilot/lib/pilotSerialDatabase.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotSerialDatabase.h 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilotSerialDatabase.h 2006-11-19 22:21:12.000000000 +0100
+@@ -35,11 +35,15 @@
+ #include "pilotDatabase.h"
+ #include "pilotRecord.h"
+
++class KPilotDeviceLink;
+
+ class KDE_EXPORT PilotSerialDatabase : public PilotDatabase
+ {
++friend class KPilotDeviceLink;
++protected:
++ PilotSerialDatabase( KPilotDeviceLink *l, const QString &dbName);
++
+ public:
+- PilotSerialDatabase(int linksocket, const QString &dbName);
+ virtual ~PilotSerialDatabase();
+
+ /** Reads the application block info, returns size */
+@@ -114,14 +118,12 @@ private:
+ QString fDBName;
+ int fDBHandle;
+ int fDBSocket;
+-#if PILOT_LINK_NUMBER >= PILOT_LINK_0_12_0
+ // Pilot-link 0.12 allocates buffers as needed and resizes them.
+ // Start with a buffer that is _probably_ big enough for most
+ // PIM records, but much smaller than the 64k that we use otherwise.
+ // Might want to add algorithm for trying to optimize the initial
+ // allocation for a given database.
+ static const int InitialBufferSize = 2048;
+-#endif
+ };
+
+ #endif
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotStruct.cc kdepim-3.5.5.dfsg.1/kpilot/lib/pilotStruct.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotStruct.cc 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilotStruct.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,58 @@
++/* pilotStruct.cc
++**
++** Copyright (C) 1998-2001 by Dan Pilone
++** Copyright (C) 2003 by Reinhold Kainhofer
++** Copyright (C) 2005 by Adriaan de Groot <groot at kde.org>
++**
++** Implementation for PilotUser and PilotSysInfo methods.
++**
++** Wrapper for the PilotUser struct from pilot-link, which describes
++** the user-data set in the Pilot.
++*/
++
++/*
++** 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.1 of the License, or
++** (at your option) any later version.
++**
++** This program 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 program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++#include <config.h>
++#include "options.h"
++#include "fakes.h"
++
++#include "pilotUser.h"
++#include "pilotSysInfo.h"
++
++
++
++void KPilotSysInfo::setProductID(char* prodid)
++{
++ strlcpy(fSysInfo.prodID, prodid, sizeof(fSysInfo.prodID));
++ boundsCheck();
++ fSysInfo.prodIDLength = strlen(fSysInfo.prodID);
++}
++
++void KPilotUser::setUserName(const char* name)
++{
++ memset(&fUser.username, 0, sizeof(fUser.username));
++ strlcpy(fUser.username, name,sizeof(fUser.username));
++}
++
++void KPilotUser::setPassword(char* password)
++{
++ memset(&fUser.password, 0, sizeof(fUser.password));
++ strlcpy(fUser.password, password,sizeof(fUser.password));
++ fUser.passwordLength = strlen(fUser.password);
++}
++
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotSysInfo.h kdepim-3.5.5.dfsg.1/kpilot/lib/pilotSysInfo.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotSysInfo.h 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilotSysInfo.h 2006-11-19 22:21:12.000000000 +0100
+@@ -59,48 +59,19 @@ public:
+ const unsigned long getLocale() const {return fSysInfo.locale;}
+ void setLocale(unsigned long newval) {fSysInfo.locale=newval;}
+
+-#if ( PILOT_LINK_VERSION < 1 ) && ( PILOT_LINK_MAJOR < 11 )
+-// Older pilot-link versions < 0.11.x don't have prodID, but name instead,
+-// and they also do not have the *Version members.
+- const int getProductIDLength() const { return fSysInfo.nameLength; }
+- const char* getProductID()
+- {
+- fSysInfo.name[fSysInfo.nameLength]='\0';
+- return fSysInfo.name;
+- }
+- void setProductID(char* prodid)
+- {
+- strlcpy(fSysInfo.name, prodid, sizeof(fSysInfo.name));
+- boundsCheck();
+- fSysInfo.nameLength = strlen(fSysInfo.name);
+- }
+-
+- const unsigned short getMajorVersion() const {return 0;}
+- const unsigned short getMinorVersion() const {return 0;}
+- const unsigned short getCompatMajorVersion() const {return 0;}
+- const unsigned short getCompatMinorVersion() const {return 0;}
+- const unsigned short getMaxRecSize() const {return 0;}
+-#else
+-// Newer pilot-link versions have these fields, so use them:
+ const int getProductIDLength() const { return fSysInfo.prodIDLength; }
+ const char* getProductID()
+ {
+ fSysInfo.prodID[fSysInfo.prodIDLength]='\0';
+ return fSysInfo.prodID;
+ }
+- void setProductID(char* prodid)
+- {
+- strlcpy(fSysInfo.prodID, prodid, sizeof(fSysInfo.prodID));
+- boundsCheck();
+- fSysInfo.prodIDLength = strlen(fSysInfo.prodID);
+- }
++ void setProductID(char* prodid);
+
+ const unsigned short getMajorVersion() const {return fSysInfo.dlpMajorVersion;}
+ const unsigned short getMinorVersion() const {return fSysInfo.dlpMinorVersion;}
+ const unsigned short getCompatMajorVersion() const {return fSysInfo.compatMajorVersion;}
+ const unsigned short getCompatMinorVersion() const {return fSysInfo.compatMinorVersion;}
+ const unsigned short getMaxRecSize() const {return fSysInfo.maxRecSize;}
+-#endif
+
+ private:
+ struct SysInfo fSysInfo;
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotTodoEntry.cc kdepim-3.5.5.dfsg.1/kpilot/lib/pilotTodoEntry.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotTodoEntry.cc 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilotTodoEntry.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -26,7 +26,10 @@
+ /*
+ ** Bug reports and questions can be sent to kde-pim at kde.org
+ */
++#include <config.h>
+ #include "options.h"
++#include "fakes.h"
++
+
+ #include <stdlib.h>
+
+@@ -39,7 +42,7 @@
+
+ #include "pilotTodoEntry.h"
+
+-static const char *pilotTodoEntry_id = "$Id: pilotTodoEntry.cc 450724 2005-08-18 22:12:19Z adridg $";
++static const char *pilotTodoEntry_id = "$Id: pilotTodoEntry.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+
+ PilotTodoEntry::PilotTodoEntry(struct ToDoAppInfo &appInfo):PilotAppCategory(), fAppInfo(appInfo)
+@@ -55,15 +58,10 @@ PilotTodoEntry::PilotTodoEntry(struct To
+ ::memset(&fTodoInfo, 0, sizeof(struct ToDo));
+ if (rec)
+ {
+-#if PILOT_LINK_NUMBER >= PILOT_LINK_0_12_0
+ pi_buffer_t b;
+- b.data = (unsigned char *) rec->getData();
++ b.data = (unsigned char *) rec->data();
+ b.allocated = b.used = rec->size();
+ unpack_ToDo(&fTodoInfo, &b, todo_v1);
+-#else
+- unpack_ToDo(&fTodoInfo, (unsigned char *) rec->data(),
+- rec->size());
+-#endif
+ }
+
+ (void) pilotTodoEntry_id;
+@@ -161,15 +159,15 @@ void *PilotTodoEntry::pack_(void *buf, i
+ {
+ int i;
+
+-#if PILOT_LINK_NUMBER >= PILOT_LINK_0_12_0
+ pi_buffer_t b = { 0,0,0 } ;
+ i = pack_ToDo(&fTodoInfo, &b, todo_v1);
++ if (i<0)
++ {
++ return 0;
++ }
++ i = b.used;
+ memcpy(buf,b.data,kMin(i,*len));
+ *len = kMin(i,*len);
+-#else
+- i = pack_ToDo(&fTodoInfo, (unsigned char *) buf, *len);
+- *len = i;
+-#endif
+ return buf;
+ }
+
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotTodoEntry.h kdepim-3.5.5.dfsg.1/kpilot/lib/pilotTodoEntry.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotTodoEntry.h 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilotTodoEntry.h 2006-11-19 22:21:12.000000000 +0100
+@@ -114,11 +114,9 @@ public:
+ */
+ inline bool setCategory(const QString &label) { return PilotAppCategory::setCategory(fAppInfo.category,label); };
+
+- // static const int APP_BUFFER_SIZE;
+-
+ protected:
+ void *pack_(void *buf, int *size);
+- void unpack(const void *buf, int size = 0) { } ;
++ void unpack(const void *buf, int size = 0) { Q_UNUSED(buf); Q_UNUSED(size); } ;
+
+ const char *getDescriptionP() const { return fTodoInfo.description; } ;
+ void setDescriptionP(const char *, int len=-1) ;
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotUser.h kdepim-3.5.5.dfsg.1/kpilot/lib/pilotUser.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pilotUser.h 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pilotUser.h 2006-11-19 22:21:12.000000000 +0100
+@@ -44,20 +44,11 @@ public:
+ PilotUser *pilotUser() { return &fUser; }
+
+ const char* getUserName() const { return fUser.username; }
+- void setUserName(const char* name)
+- {
+- memset(&fUser.username, 0, sizeof(fUser.username));
+- strlcpy(fUser.username, name,sizeof(fUser.username));
+- }
++ void setUserName(const char* name);
+
+ const int getPasswordLength() const { return fUser.passwordLength; }
+ const char* getPassword() const { return fUser.password; }
+- void setPassword(char* password)
+- {
+- memset(&fUser.password, 0, sizeof(fUser.password));
+- strlcpy(fUser.password, password,sizeof(fUser.password));
+- fUser.passwordLength = strlen(fUser.password);
+- }
++ void setPassword(char* password);
+
+ unsigned long getUserID() const { return fUser.userID; }
+ unsigned long getViewerID() const { return fUser.viewerID; }
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/plugin.cc kdepim-3.5.5.dfsg.1/kpilot/lib/plugin.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/plugin.cc 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/plugin.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -96,7 +96,7 @@ ConduitConfigBase::~ConduitConfigBase()
+ return true;
+ }
+
+-ConduitAction::ConduitAction(KPilotDeviceLink *p,
++ConduitAction::ConduitAction(KPilotLink *p,
+ const char *name,
+ const QStringList &args) :
+ SyncAction(p,name),
+@@ -120,10 +120,10 @@ ConduitAction::ConduitAction(KPilotDevic
+ it != args.end();
+ ++it)
+ {
+- DEBUGCONDUIT << fname << ": " << *it << endl;
++ DEBUGLIBRARY << fname << ": " << *it << endl;
+ }
+
+- DEBUGCONDUIT << fname << ": Direction=" << fSyncDirection.name() << endl;
++ DEBUGLIBRARY << fname << ": Direction=" << fSyncDirection.name() << endl;
+ #endif
+ }
+
+@@ -134,18 +134,23 @@ ConduitAction::ConduitAction(KPilotDevic
+ KPILOT_DELETE(fLocalDatabase);
+ }
+
+-bool ConduitAction::openDatabases_(const QString &name, bool *retrieved)
++bool ConduitAction::openDatabases(const QString &name, bool *retrieved)
+ {
+ FUNCTIONSETUP;
+
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
++ DEBUGLIBRARY << fname
+ << ": Trying to open database "
+ << name << endl;
+-#endif
++ DEBUGLIBRARY << fname
++ << ": Mode="
++ << (syncMode().isTest() ? "test " : "")
++ << (syncMode().isLocal() ? "local " : "")
++ << endl ;
+
+ KPILOT_DELETE(fLocalDatabase);
+- PilotLocalDatabase *localDB = new PilotLocalDatabase(name, true);
++
++ QString localPathName = PilotLocalDatabase::getDBPath() + name;
++ PilotLocalDatabase *localDB = new PilotLocalDatabase( localPathName );
+
+ if (!localDB)
+ {
+@@ -158,69 +163,58 @@ bool ConduitAction::openDatabases_(const
+ }
+
+ // if there is no backup db yet, fetch it from the palm, open it and set the full sync flag.
+- if (!localDB->isDBOpen() )
++ if (!localDB->isOpen() )
+ {
+ QString dbpath(localDB->dbPathName());
+ KPILOT_DELETE(localDB);
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
+- << ": Backup database "<< dbpath <<" could not be opened. Will fetch a copy from the palm and do a full sync"<<endl;
+-#endif
++ DEBUGLIBRARY << fname
++ << ": Backup database " << dbpath
++ << " not found." << endl;
+ struct DBInfo dbinfo;
+- if (fHandle->findDatabase(PilotAppCategory::codec()->fromUnicode( name ), &dbinfo)<0 )
++
++ if (deviceLink()->findDatabase(PilotAppCategory::codec()->fromUnicode( name ), &dbinfo)<0 )
+ {
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
+- << ": Could not get DBInfo for "<<name<<"! "<<endl;
+-#endif
++ kdWarning() << k_funcinfo
++ << ": Could not get DBInfo for " << name << endl;
+ if (retrieved) *retrieved = false;
+ return false;
+ }
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
+- << ": Found Palm database: "<<dbinfo.name<<endl
+- <<"type = "<< dbinfo.type<<endl
+- <<"creator = "<< dbinfo.creator<<endl
+- <<"version = "<< dbinfo.version<<endl
+- <<"index = "<< dbinfo.index<<endl;
+-#endif
++
++ DEBUGLIBRARY << fname
++ << ": Found Palm database: " << dbinfo.name <<endl
++ << fname << ": type = " << dbinfo.type
++ << " creator = " << dbinfo.creator
++ << " version = " << dbinfo.version
++ << " index = " << dbinfo.index << endl;
+ dbinfo.flags &= ~dlpDBFlagOpen;
+
+ // make sure the dir for the backup db really exists!
+ QFileInfo fi(dbpath);
+- QString path(QFileInfo(dbpath).dir(TRUE).absPath());
++ QString path(QFileInfo(dbpath).dir(true).absPath());
+ if (!path.endsWith(CSL1("/"))) path.append(CSL1("/"));
+ if (!KStandardDirs::exists(path))
+ {
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname << ": Trying to create path for database: <"
++ DEBUGLIBRARY << fname << ": Trying to create path for database: <"
+ << path << ">" << endl;
+-#endif
+ KStandardDirs::makeDir(path);
+ }
+ if (!KStandardDirs::exists(path))
+ {
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname << ": Database directory does not exist." << endl;
+-#endif
++ DEBUGLIBRARY << fname << ": Database directory does not exist." << endl;
+ if (retrieved) *retrieved = false;
+ return false;
+ }
+
+- if (!fHandle->retrieveDatabase(dbpath, &dbinfo) )
++ if (!deviceLink()->retrieveDatabase(dbpath, &dbinfo) )
+ {
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname << ": Could not retrieve database "<<name<<" from the handheld."<<endl;
+-#endif
++ kdWarning() << k_funcinfo << ": Could not retrieve database "<<name<<" from the handheld."<<endl;
+ if (retrieved) *retrieved = false;
+ return false;
+ }
+- localDB = new PilotLocalDatabase(name, true);
+- if (!localDB || !localDB->isDBOpen())
++ localDB = new PilotLocalDatabase( localPathName );
++ if (!localDB || !localDB->isOpen())
+ {
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname << ": local backup of database "<<name<<" could not be initialized."<<endl;
+-#endif
++ kdWarning() << k_funcinfo << ": local backup of database "<<name<<" could not be initialized."<<endl;
+ if (retrieved) *retrieved = false;
+ return false;
+ }
+@@ -228,7 +222,7 @@ bool ConduitAction::openDatabases_(const
+ }
+ fLocalDatabase = localDB;
+
+- fDatabase = new PilotSerialDatabase(pilotSocket(), name /* On pilot */);
++ fDatabase = deviceLink()->database( name );
+
+ if (!fDatabase)
+ {
+@@ -239,150 +233,58 @@ bool ConduitAction::openDatabases_(const
+ << endl;
+ }
+
+- return (fDatabase && fDatabase->isDBOpen() &&
+- fLocalDatabase && fLocalDatabase->isDBOpen() );
++ return (fDatabase && fDatabase->isOpen() &&
++ fLocalDatabase && fLocalDatabase->isOpen() );
+ }
+
+-// This whole function is for debugging purposes only.
+-bool ConduitAction::openDatabases_(const QString &dbName,const QString &localPath)
++
++bool ConduitAction::changeSync(SyncMode::Mode m)
+ {
+ FUNCTIONSETUP;
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname << ": Doing local test mode for " << dbName << endl;
+-#endif
+- if (localPath.isNull())
+- {
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
+- << ": local mode test for one database only."
+- << endl;
+-#endif
+- fDatabase = new PilotLocalDatabase(dbName,false);
+- fLocalDatabase = 0L;
+- return false;
+- }
+
+- fDatabase = new PilotLocalDatabase(localPath,dbName);
+- fLocalDatabase= new PilotLocalDatabase(dbName, true); // From default
+- if (!fLocalDatabase || !fDatabase)
+- {
+-#ifdef DEBUG
+- const QString *where2 = PilotLocalDatabase::getDBPath();
+-
+- QString none = CSL1("<null>");
+- DEBUGCONDUIT << fname
+- << ": Could not open both local copies of \""
+- << dbName
+- << "\"" << endl
+- << "Using \""
+- << (where2 ? *where2 : none)
+- << "\" and \""
+- << (localPath.isEmpty() ? localPath : none)
+- << "\""
+- << endl;
+-#endif
+- }
+-#ifdef DEBUG
+- if (fLocalDatabase)
+- {
+- DEBUGCONDUIT << fname
+- << ": Opened local database "
+- << fLocalDatabase->dbPathName()
+- << (fLocalDatabase->isDBOpen() ? " OK" : "")
+- << endl;
+- }
+- if (fDatabase)
++ if ( fSyncDirection.isSync() && SyncMode::eFullSync == m)
+ {
+- DEBUGCONDUIT << fname
+- << ": Opened database "
+- << fDatabase->dbPathName()
+- << (fDatabase->isDBOpen() ? " OK" : "")
+- << endl;
++ fSyncDirection.setMode(m);
++ return true;
+ }
+-#endif
+-
+- return (fDatabase && fLocalDatabase);
++ return false;
+ }
+
+-bool ConduitAction::openDatabases(const QString &dbName, bool *retrieved)
++
++namespace PluginUtility
++{
++
++QString findArgument(const QStringList &a, const QString &arg)
+ {
+ FUNCTIONSETUP;
+
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
+- << ": Mode="
+- << (syncMode().isTest() ? "test " : "")
+- << (syncMode().isLocal() ? "local " : "")
+- << endl ;
+-#endif
++ QString search;
+
+- if (syncMode().isLocal())
++ if (arg.startsWith( CSL1("--") ))
+ {
+- return openDatabases_(dbName,CSL1("/tmp/"));
++ search = arg;
+ }
+ else
+ {
+- return openDatabases_(dbName, retrieved);
+- }
+-}
+-
+-bool ConduitAction::changeSync(SyncMode::Mode m)
+-{
+- FUNCTIONSETUP;
+-
+- if ( fSyncDirection.isSync() && SyncMode::eFullSync == m)
+- {
+- fSyncDirection.setMode(m);
+- return true;
++ search = CSL1("--") + arg;
+ }
+- return false;
+-}
++ search.append( CSL1("=") );
+
+-int PluginUtility::findHandle(const QStringList &a)
+-{
+- FUNCTIONSETUP;
+
+- int handle = -1;
+- for (QStringList::ConstIterator i = a.begin();
+- i != a.end(); ++i)
++ QStringList::ConstIterator end = a.end();
++ for (QStringList::ConstIterator i = a.begin(); i != end; ++i)
+ {
+- if ((*i).left(7) == CSL1("handle="))
++ if ((*i).startsWith( search ))
+ {
+- QString s = (*i).mid(7);
+- if (s.isEmpty()) continue;
+-
+- handle = s.toInt();
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
+- << ": Got handle "
+- << handle
+- << endl;
+-#endif
+- if (handle<1)
+- {
+- kdWarning() << k_funcinfo
+- << ": Improbable handle value found."
+- << endl;
+- }
+- return handle;
++ QString s = (*i).mid(search.length());
++ return s;
+ }
+ }
+
+-#ifdef DEBUG
+- DEBUGCONDUIT << fname
+- << ": No handle= parameter found."
+- << endl;
+-#endif
+-
+- return -1;
++ return QString::null;
+ }
+
+-bool PluginUtility::isModal(const QStringList &a)
+-{
+- return a.contains(CSL1("modal"));
+-}
+-
+-/* static */ bool PluginUtility::isRunning(const QCString &n)
++/* static */ bool isRunning(const QCString &n)
+ {
+ DCOPClient *dcop = KApplication::kApplication()->dcopClient();
+ QCStringList apps = dcop->registeredApplications();
+@@ -390,7 +292,7 @@ bool PluginUtility::isModal(const QStrin
+ }
+
+
+-/* static */ long PluginUtility::pluginVersion(const KLibrary *lib)
++/* static */ long pluginVersion(const KLibrary *lib)
+ {
+ QString symbol = CSL1("version_");
+ symbol.append(lib->name());
+@@ -402,7 +304,7 @@ bool PluginUtility::isModal(const QStrin
+ }
+
+
+-/* static */ QString PluginUtility::pluginVersionString(const KLibrary *lib)
++/* static */ QString pluginVersionString(const KLibrary *lib)
+ {
+ QString symbol= CSL1("id_");
+ symbol.append(lib->name());
+@@ -413,3 +315,5 @@ bool PluginUtility::isModal(const QStrin
+ }
+
+
++}
++
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pluginfactory.h kdepim-3.5.5.dfsg.1/kpilot/lib/pluginfactory.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/pluginfactory.h 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/pluginfactory.h 2006-11-19 22:21:12.000000000 +0100
+@@ -33,7 +33,7 @@
+ #include <klibloader.h>
+ #include <kdebug.h>
+
+-class KPilotDeviceLink;
++class KPilotLink;
+
+ /** Template class that defines a conduit's factory. */
+
+@@ -68,8 +68,8 @@ protected:
+
+ if (qstrcmp(classname,"SyncAction")==0)
+ {
+- KPilotDeviceLink *d = 0L;
+- if (parent) d = dynamic_cast<KPilotDeviceLink *>(parent);
++ KPilotLink *d = 0L;
++ if (parent) d = dynamic_cast<KPilotLink *>(parent);
+
+ if (d || !parent)
+ {
+@@ -82,7 +82,7 @@ protected:
+ else
+ {
+ kdError() << k_funcinfo
+- << ": Couldn't cast parent to KPilotDeviceLink"
++ << ": Couldn't cast parent to KPilotLink"
+ << endl;
+ return 0L;
+ }
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/plugin.h kdepim-3.5.5.dfsg.1/kpilot/lib/plugin.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/plugin.h 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/plugin.h 2006-11-19 22:21:12.000000000 +0100
+@@ -41,7 +41,7 @@
+ class PilotDatabase;
+ class KLibrary;
+
+-#define KPILOT_PLUGIN_API (20050401)
++#define KPILOT_PLUGIN_API (20061118)
+
+ /**
+ * The first classe here: ConduitConfigBase is for configuration purposes.
+@@ -135,7 +135,7 @@ class KDE_EXPORT ConduitAction : public
+ {
+ Q_OBJECT
+ public:
+- ConduitAction(KPilotDeviceLink *,
++ ConduitAction(KPilotLink *,
+ const char *name=0L,
+ const QStringList &args = QStringList());
+ virtual ~ConduitAction();
+@@ -188,12 +188,16 @@ protected:
+ } ;
+ void setFirstSync(bool first) { fFirstSync=first; } ;
+
+- PilotDatabase *fDatabase,*fLocalDatabase;
++ PilotDatabase *fDatabase;
++ PilotDatabase *fLocalDatabase; // Guaranteed to be a PilotLocalDatabase
+
+ /**
+- * See openDatabases_ for info on the @p retrieved
+- * parameter. In local mode, @p retrieved is left
+- * unchanged.
++ * Open both the local copy of database @p dbName
++ * and the version on the Pilot. Return true only
++ * if both opens succeed. If the local copy of the database
++ * does not exist, it is retrieved from the handheld. In this
++ * case, retrieved is set to true, otherwise it is left alone
++ * (i.e. retains its value and is not explicitly set to false).
+ *
+ * @param dbName database name to open.
+ * @param retrieved indicator whether the database had to be loaded
+@@ -210,38 +214,14 @@ protected:
+ QString fConduitName;
+ private:
+ bool fFirstSync;
+-
+-private:
+- /**
+- * Open both the local copy of database @p dbName
+- * and the version on the Pilot. Return true only
+- * if both opens succeed. If the local copy of the database
+- * does not exist, it is retrieved from the handheld. In this
+- * case, retrieved is set to true, otherwise it is left alone
+- * (i.e. retains its value and is not explicitly set to false).
+- */
+- bool openDatabases_(const QString &dbName, bool*retrieved=0L);
+-
+- /**
+- * Open both databases, but get the fDatabase not from
+- * the Pilot, but from a local database in an alternate
+- * directory. For testing only.
+- *
+- * If @p localPath is QString::null, don't even try to open
+- * fDatabase (the one that is supposed to be on the HH).
+- * Just open the one inteded to be on the PC (fLocalDatabase).
+- */
+- bool openDatabases_(const QString &dbName,const QString &localPath);
+ } ;
+
+-/** A class containing only static helper methods. */
+-class KDE_EXPORT PluginUtility
++/** A namespace containing only static helper methods. */
++namespace PluginUtility
+ {
+-public:
+- /** Searches the string list for --handle=NN and returns the number. */
+- static int findHandle(const QStringList &);
+- /** Searches the string list for --modal and returns true if found. */
+- static bool isModal(const QStringList &a);
++ /** Searches the argument list for --foo=bar and returns bar, QString::null if not found.
++ * Don't include the -- in the argname. */
++ QString findArgument(const QStringList &a, const QString argname);
+
+ /**
+ * This function attempts to detect whether or not the given
+@@ -251,14 +231,14 @@ public:
+ * The current approach is to ask the DCOP server if the application
+ * has registered.
+ */
+- static bool isRunning(const QCString &appName);
++ bool isRunning(const QCString &appName);
+
+ /**
+ * Check a given library for its version, returning 0 if no
+ * version symbol is found.
+ */
+- static long pluginVersion(const KLibrary *);
+- static QString pluginVersionString(const KLibrary *);
++ long pluginVersion(const KLibrary *);
++ QString pluginVersionString(const KLibrary *);
+ } ;
+
+ /**
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/recordConduit.cc kdepim-3.5.5.dfsg.1/kpilot/lib/recordConduit.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/recordConduit.cc 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/recordConduit.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -54,7 +54,7 @@
+ extern "C"
+ {
+ long version_record_conduit = KPILOT_PLUGIN_API;
+-const char *id_record_conduit="$Id: recordConduit.cc 437980 2005-07-23 19:53:57Z kainhofe $";
++const char *id_record_conduit="$Id: recordConduit.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+ }
+
+
+@@ -79,7 +79,7 @@ const char *id_record_conduit="$Id: reco
+
+ fTimer = new QTimer(this);
+ connect(fTimer,SIGNAL(timeout()),this,SLOT(process()));
+- fTimer->start(0,true); // Fire as often as possible to prompt processing
++ fTimer->start(0,false); // Fire as often as possible to prompt processing
+ return true;
+ }
+
+@@ -88,6 +88,10 @@ const char *id_record_conduit="$Id: reco
+ FUNCTIONSETUP;
+ SyncProgress p = Error;
+
++#ifdef DEBUG
++ DEBUGLIBRARY << fname << ": From state " << name(fState) << endl;
++#endif
++
+ switch(fState)
+ {
+ case Initialize :
+@@ -96,11 +100,18 @@ const char *id_record_conduit="$Id: reco
+ case PalmToPC :
+ p = palmRecToPC();
+ break;
++ case PCToPalm :
++ p = pcRecToPalm();
++ break;
+ case Cleanup :
+ p = cleanup();
+ break;
+ }
+
++#ifdef DEBUG
++ DEBUGLIBRARY << fname << ": Step returned " << name(p) << endl;
++#endif
++
+ switch(p)
+ {
+ case Error :
+@@ -115,21 +126,36 @@ const char *id_record_conduit="$Id: reco
+ break;
+ }
+
++#ifdef DEBUG
++ DEBUGLIBRARY << fname << ": Step is done, moving to next state." << endl;
++#endif
++
+ // Here the previous call was done.
+ switch(fState)
+ {
+ case Initialize :
+- if ( ( syncMode().mode() == SyncMode::eCopyPCToHH ) ||
+- ( syncMode().mode() == SyncMode::eRestore ) )
+- {
+- fState = Cleanup;
+- }
+- else
++ switch (syncMode().mode())
+ {
++ case SyncMode::eRestore :
++ case SyncMode::eCopyPCToHH : /* These two don't copy Palm records to the PC */
++ fState = PCToPalm;
++ break;
++ default :
+ fState = PalmToPC;
+ }
+ break;
+ case PalmToPC :
++ switch (syncMode().mode())
++ {
++ case SyncMode::eBackup :
++ case SyncMode::eCopyHHToPC : /* These modes don't copy PC records back */
++ fState = Cleanup;
++ break;
++ default :
++ fState = PCToPalm;
++ }
++ break;
++ case PCToPalm :
+ fState = Cleanup;
+ break;
+ case Cleanup :
+@@ -138,6 +164,41 @@ const char *id_record_conduit="$Id: reco
+ // No change in state, timer stopped and we're done.
+ break;
+ }
++
++#ifdef DEBUG
++ DEBUGLIBRARY << fname << ": Next state is " << name(fState) << endl;
++#endif
++
++}
++
++
++QString RecordConduitBase::name(RecordConduitBase::SyncProgress s)
++{
++ switch(s)
++ {
++ case RecordConduitBase::NotDone:
++ return CSL1("NotDone");
++ case RecordConduitBase::Done:
++ return CSL1("Done");
++ case RecordConduitBase::Error:
++ return CSL1("Error");
++ }
++}
++
++
++QString RecordConduitBase::name(RecordConduitBase::States s)
++{
++ switch(s)
++ {
++ case RecordConduitBase::Initialize:
++ return CSL1("Initialize");
++ case RecordConduitBase::PalmToPC:
++ return CSL1("Handheld-to-PC");
++ case RecordConduitBase::PCToPalm:
++ return CSL1("PC-to-Handheld");
++ case RecordConduitBase::Cleanup:
++ return CSL1("Cleanup");
++ }
+ }
+
+
+@@ -174,7 +235,7 @@ bool RecordConduit::PCData::mapContactsT
+ ++it;
+ }
+ #ifdef DEBUG
+- DEBUGCONDUIT << fname << ": Loaded " << idContactMap.size() <<
++ DEBUGLIBRARY << fname << ": Loaded " << idContactMap.size() <<
+ " Entries on the pc and mapped them to records on the handheld. " << endl;
+ #endif
+ return true;
+@@ -197,7 +258,7 @@ RecordConduit::RecordConduit(QString nam
+ {
+ FUNCTIONSETUP;
+ #ifdef DEBUG
+- DEBUGCONDUIT << id_record_conduit << endl;
++ DEBUGLIBRARY << id_record_conduit << endl;
+ #endif
+ fConduitName = name;
+ }
+@@ -224,7 +285,7 @@ RecordConduit::~RecordConduit()
+ {
+ FUNCTIONSETUP;
+ #ifdef DEBUG
+- DEBUGCONDUIT << id_record_conduit << endl;
++ DEBUGLIBRARY << id_record_conduit << endl;
+ #endif
+
+ if ( !_prepare() ) return false;
+@@ -255,13 +316,13 @@ RecordConduit::~RecordConduit()
+ mPalmIndex = 0;
+
+ #ifdef DEBUG
+- DEBUGCONDUIT << fname << ": fullsync=" << isFullSync() << ", firstSync=" << isFirstSync() << endl;
+- DEBUGCONDUIT << fname << ": "
++ DEBUGLIBRARY << fname << ": fullsync=" << isFullSync() << ", firstSync=" << isFirstSync() << endl;
++ DEBUGLIBRARY << fname << ": "
+ << "syncDirection=" << getSyncDirection() << ", "
+ // << "archive = " << AbbrowserSettings::archiveDeleted()
+ << endl;
+- DEBUGCONDUIT << fname << ": conflictRes="<< getConflictResolution() << endl;
+-// DEBUGCONDUIT << fname << ": PilotStreetHome=" << AbbrowserSettings::pilotStreet() << ", PilotFaxHOme" << AbbrowserSettings::pilotFax() << endl;
++ DEBUGLIBRARY << fname << ": conflictRes="<< getConflictResolution() << endl;
++// DEBUGLIBRARY << fname << ": PilotStreetHome=" << AbbrowserSettings::pilotStreet() << ", PilotFaxHOme" << AbbrowserSettings::pilotFax() << endl;
+ #endif
+
+ if ( !isFirstSync() )
+@@ -361,7 +422,7 @@ void RecordConduit::slotPCRecToPalm()
+ if ( isArchived( pcEntry ) )
+ {
+ #ifdef DEBUG
+- DEBUGCONDUIT << fname << ": address with id " << pcEntry->uid() <<
++ DEBUGLIBRARY << fname << ": address with id " << pcEntry->uid() <<
+ " marked archived, so don't sync." << endl;
+ #endif
+ KPILOT_DELETE( pcEntry );
+@@ -383,7 +444,7 @@ void RecordConduit::slotPCRecToPalm()
+ if ( mSyncedIds.contains( recID ) )
+ {
+ #ifdef DEBUG
+- DEBUGCONDUIT << ": address with id " << recID << " already synced." << endl;
++ DEBUGLIBRARY << ": address with id " << recID << " already synced." << endl;
+ #endif
+ KPILOT_DELETE( pcEntry );
+ QTimer::singleShot( 0, this, SLOT( slotPCRecToPalm() ) );
+@@ -487,7 +548,7 @@ void RecordConduit::slotDeleteUnsyncedPC
+ if ( !uids.contains( *uidit ) )
+ {
+ #ifdef DEBUG
+- DEBUGCONDUIT << "Deleting PCEntry with uid " << (*uidit) << " from PC (is not on HH, and syncing with HH->PC direction)" << endl;
++ DEBUGLIBRARY << "Deleting PCEntry with uid " << (*uidit) << " from PC (is not on HH, and syncing with HH->PC direction)" << endl;
+ #endif
+ mPCData->removeEntry( *uidit );
+ }
+@@ -510,7 +571,7 @@ void RecordConduit::slotDeleteUnsyncedHH
+ if ( !mSyncedIds.contains(*it) )
+ {
+ #ifdef DEBUG
+- DEBUGCONDUIT << "Deleting record with ID " << *it << " from handheld (is not on PC, and syncing with PC->HH direction)" << endl;
++ DEBUGLIBRARY << "Deleting record with ID " << *it << " from handheld (is not on PC, and syncing with PC->HH direction)" << endl;
+ #endif
+ fDatabase->deleteRecord(*it);
+ fLocalDatabase->deleteRecord(*it);
+@@ -607,8 +668,8 @@ void RecordConduit::_getAppInfo()
+ {
+ FUNCTIONSETUP;
+ // get the address application header information
+- unsigned char *buffer = new unsigned char[PilotRecord::APP_BUFFER_SIZE];
+- int appLen=fDatabase->readAppBlock(buffer, PilotRecord::APP_BUFFER_SIZE);
++ unsigned char *buffer = new unsigned char[Pilot::MAX_APPINFO_SIZE];
++ int appLen=fDatabase->readAppBlock(buffer, Pilot::MAX_APPINFO_SIZE);
+
+ doUnpackAppInfo( buffer, appLen );
+ delete[] buffer;
+@@ -811,7 +872,7 @@ bool RecordConduit::syncEntry( PCEntry *
+ else if ( _equal( backupEntry, pcEntry ) )
+ {
+ #ifdef DEBUG
+- DEBUGCONDUIT << "Flags: " << palmEntry->getAttrib() << ", isDeleted=" <<
++ DEBUGLIBRARY << "Flags: " << palmEntry->getAttrib() << ", isDeleted=" <<
+ isDeleted( palmEntry ) << ", isArchived=" << isArchived( palmEntry )
+ << endl;
+ #endif
+@@ -852,14 +913,14 @@ bool RecordConduit::pcCopyToPalm( PCEntr
+ }
+ _copy( hhEntry, pcEntry );
+ #ifdef DEBUG
+- DEBUGCONDUIT << "palmEntry->id=" << hhEntry->id() << ", pcEntry.ID=" <<
++ DEBUGLIBRARY << "palmEntry->id=" << hhEntry->id() << ", pcEntry.ID=" <<
+ pcEntry->uid() << endl;
+ #endif
+
+ if( palmSaveEntry( hhEntry, pcEntry ) )
+ {
+ #ifdef DEBUG
+- DEBUGCONDUIT << "Entry palmEntry->id=" <<
++ DEBUGLIBRARY << "Entry palmEntry->id=" <<
+ hhEntry->id() << "saved to palm, now updating pcEntry->uid()=" << pcEntry->uid() << endl;
+ #endif
+ pcSaveEntry( pcEntry, backupEntry, hhEntry );
+@@ -899,13 +960,13 @@ bool RecordConduit::palmSaveEntry( Pilot
+ FUNCTIONSETUP;
+
+ #ifdef DEBUG
+- DEBUGCONDUIT << "Saving to pilot " << palmEntry->id() << endl;
++ DEBUGLIBRARY << "Saving to pilot " << palmEntry->id() << endl;
+ #endif
+
+ PilotRecord *pilotRec = palmEntry->pack();
+ recordid_t pilotId = fDatabase->writeRecord(pilotRec);
+ #ifdef DEBUG
+- DEBUGCONDUIT << "PilotRec nach writeRecord (" << pilotId <<
++ DEBUGLIBRARY << "PilotRec nach writeRecord (" << pilotId <<
+ ": ID=" << pilotRec->id() << endl;
+ #endif
+ fLocalDatabase->writeRecord( pilotRec );
+@@ -956,7 +1017,7 @@ bool RecordConduit::pcSaveEntry( PCEntry
+ FUNCTIONSETUP;
+
+ #ifdef DEBUG
+- DEBUGCONDUIT << "Before _savepcEntry, pcEntry->uid()=" <<
++ DEBUGLIBRARY << "Before _savepcEntry, pcEntry->uid()=" <<
+ pcEntry->uid() << endl;
+ #endif
+ if ( pcEntry->recid() != 0 )
+@@ -1007,7 +1068,7 @@ bool RecordConduit::pcDeleteEntry( PCEnt
+ if ( !pcEntry->isEmpty() )
+ {
+ #ifdef DEBUG
+- DEBUGCONDUIT << fname << " removing " << pcEntry->uid() << endl;
++ DEBUGLIBRARY << fname << " removing " << pcEntry->uid() << endl;
+ #endif
+ mPCData->removeEntry( pcEntry );
+ }
+@@ -1046,7 +1107,7 @@ RecordConduit::PCEntry *RecordConduit::f
+ {
+ QString id( mEntryMap[palmEntry->id()] );
+ #ifdef DEBUG
+- DEBUGCONDUIT << fname << ": PilotRecord has id " << palmEntry->id() << ", mapped to " << id << endl;
++ DEBUGLIBRARY << fname << ": PilotRecord has id " << palmEntry->id() << ", mapped to " << id << endl;
+ #endif
+ if( !id.isEmpty() )
+ {
+@@ -1054,7 +1115,7 @@ RecordConduit::PCEntry *RecordConduit::f
+ if ( !res && !res->isEmpty() ) return res;
+ KPILOT_DELETE( res );
+ #ifdef DEBUG
+- DEBUGCONDUIT << fname << ": PilotRecord has id " << palmEntry->id() <<
++ DEBUGLIBRARY << fname << ": PilotRecord has id " << palmEntry->id() <<
+ ", but could not be found on the PC side" << endl;
+ #endif
+ }
+@@ -1079,7 +1140,7 @@ RecordConduit::PCEntry *RecordConduit::f
+ KPILOT_DELETE( abEntry );
+ }
+ #ifdef DEBUG
+- DEBUGCONDUIT << fname << ": Could not find any entry matching Palm record with id " << QString::number( palmEntry->id() ) << endl;
++ DEBUGLIBRARY << fname << ": Could not find any entry matching Palm record with id " << QString::number( palmEntry->id() ) << endl;
+ #endif
+ return 0;
+ }
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/recordConduit.h kdepim-3.5.5.dfsg.1/kpilot/lib/recordConduit.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/recordConduit.h 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/recordConduit.h 2006-11-19 22:21:12.000000000 +0100
+@@ -70,19 +70,20 @@ public:
+ // delete fTimer; // Timer is a child object
+ } ;
+
+- /** The different directions that a pair of records (one on the PC, one
+- * on the Pilot) can be synced. These correspond to special sync directions
+- * and the most general "sync both ways". Values of this type are passed
+- * to the single-record syncer functions.
+- */
+- typedef enum { HHtoPC=0, PCtoHH=1, Both=2 } SyncDirection;
+-
+ /** Return values for the processing functions. Each should return
+ * NotDone if it needs to be called again (e.g. to process another record),
+ * Done if it is finished and something else should be done, and
+ * Error if the sync cannot be completed.
+ */
+- typedef enum { NotDone=0, Done=1, Error=2 } SyncProgress;
++ enum SyncProgress { NotDone=0, Done=1, Error=2 } ;
++
++ /** Returns a human-readable name for the progress indicator @p s */
++ static QString name(SyncProgress s);
++
++ /** State of the conduit's sync. This is changed by process(). */
++ enum States { Initialize, PalmToPC, PCToPalm, Cleanup } ;
++
++ static QString name(States s);
+
+ protected:
+ /** Function called at the beginning of a sync to load data from the PC.
+@@ -94,16 +95,24 @@ protected:
+ /** Function called repeatedly to fetch the next modified entry from the Palm and
+ * sync it with the PC by looking up the record, and calling the syncer for it.
+ *
+- * @return true when there are no more modified records on the Palm
+- * @see process
++ * @return Dome when there are no more modified records on the Palm
++ * @see process()
+ */
+ virtual SyncProgress palmRecToPC() = 0;
+
++ /** Function called repeatedly to fetch the next modified entry from the PC and
++ * sync it with the Palm by looking up the record and calling the syncer for it.
++ *
++ * @return Done when there are no more modified records on the PC
++ * @see process()
++ */
++ virtual SyncProgress pcRecToPalm() = 0;
++
+ /** Function called at the end of this conduit's sync, which should reset DB flags
+ * and write changed config data out to disk.
+ *
+- * @return true if the cleanup succeeds.
+- * @see process
++ * @return Done when the cleanup is complete.
++ * @see process()
+ */
+ virtual SyncProgress cleanup() = 0;
+
+@@ -120,10 +129,8 @@ private:
+ /** Timer to signal the process() slot. Used to keep the UI responsive. */
+ QTimer *fTimer;
+
+- /** State of the conduit's sync. This is changed by process. */
+- enum { Initialize, PalmToPC, Cleanup } fState;
++ States fState;
+
+- QMap<recordid_t,QString> fUIDMap;
+ RecordIDList fIDList;
+ RecordIDList::Iterator fIDListIterator;
+
+@@ -135,13 +142,12 @@ class RecordConduit : public RecordCondu
+ {
+ public:
+ /** Construct a record conduit on a given device link. */
+- RecordConduit(const QString &name /**< Name presented to user */,
++ RecordConduit(
+ KPilotDeviceLink *o /**< Connection to HH */,
+ const char *n /**< Name for QObject */,
+ const QStringList a = QStringList() /**< Flags */) :
+ RecordConduitBase(o,n,a)
+ {
+- fConduitName=name;
+ } ;
+ virtual ~RecordConduit()
+ {
+@@ -149,78 +155,23 @@ public:
+
+ virtual SyncProgress loadPC()
+ {
+- fAppInfo = new HHAppInfo(fDatabase) ;
+- fContainer = new PCContainer();
+- if (!fContainer->load())
+- {
+- emit logError(i18n("Unable to load the %1 database on the PC.").arg(fConduitName));
+- return Error;
+- }
+- if (fContainer->isEmpty()) setFirstSync(true); /* And leave UID map empty */
+- else fContainer->mapToRecords(fUIDMap);
+-
+ return Done;
+ } ;
+
+ virtual SyncProgress palmRecToPC()
+ {
+- if ( fIDListIterator == fIDList.end() )
+- {
+- return Done;
+- }
+-
+- recordid_t currentID = *fIDListIterator++;
+- PilotRecord *rec = fDatabase->readRecordById(currentID);
+- HHEntry *currentHH = 0;
+- PCEntry *currentPC = 0;
+- Q_ASSERT(rec);
+- if (fUIDMap.contains(currentID))
+- {
+- QString currentUID = fUIDMap[currentID];
+- // This is a modified entry or it is deleted on the HH
+- if (rec->isDeleted())
+- {
+- fContainer->remove(currentUID);
+- }
+- else
+- {
+- currentHH = new HHEntry(rec);
+- currentPC = fContainer->get(currentUID);
+- Syncer::sync(currentPC,currentHH,fAppInfo,HHtoPC);
+- }
+- }
+- else
+- {
+- // Deleted on HH, unknown on PC -> Ignore it.
+- // Not deleted, unknown -> New record.
+- if (!rec->isDeleted())
+- {
+- currentHH = new HHEntry(rec);
+- currentPC = new PCEntry();
+- Syncer::sync(currentPC,currentHH,fAppInfo,HHtoPC);
+- fContainer->insert(currentPC);
+- }
+- }
+- delete rec;
+- delete currentHH;
+- // delete currentPC; Ownership passed to the container
++ return Done;
++ }
+
+- return NotDone;
++ virtual SyncProgress pcRecToPalm()
++ {
++ return Done;
+ }
+
+ virtual SyncProgress cleanup()
+ {
+- delete fAppInfo;
+- fContainer->save();
+- delete fContainer;
+ return Done;
+ }
+-
+- virtual bool getAppInfo( unsigned char *buffer, int appLen ) { return true; } ;
+-
+-protected:
+- HHAppInfo *fAppInfo;
+- PCContainer *fContainer;
+ } ;
+
+
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/syncAction.cc kdepim-3.5.5.dfsg.1/kpilot/lib/syncAction.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/syncAction.cc 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/syncAction.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -27,7 +27,7 @@
+ ** Bug reports and questions can be sent to kde-pim at kde.org
+ */
+ static const char *syncAction_id =
+- "$Id: syncAction.cc 449688 2005-08-16 12:55:22Z adridg $";
++ "$Id: syncAction.cc 606279 2006-11-19 21:21:12Z vanrijn $";
+
+ #include "options.h"
+
+@@ -57,7 +57,7 @@ static const char *syncAction_id =
+ #include "syncAction.moc"
+ #include "kpilotlibSettings.h"
+
+-SyncAction::SyncAction(KPilotDeviceLink *p,
++SyncAction::SyncAction(KPilotLink *p,
+ const char *name) :
+ QObject(p, name),
+ fHandle(p),
+@@ -67,7 +67,7 @@ SyncAction::SyncAction(KPilotDeviceLink
+ (void) syncAction_id;
+ }
+
+-SyncAction::SyncAction(KPilotDeviceLink *p,
++SyncAction::SyncAction(KPilotLink *p,
+ QWidget * visibleparent,
+ const char *name) :
+ QObject(p, name),
+@@ -95,14 +95,14 @@ SyncAction::~SyncAction()
+ FUNCTIONSETUP;
+
+ #ifdef DEBUG
+- DEBUGCONDUIT << fname
++ DEBUGLIBRARY << fname
+ << ": Running conduit " << name() << endl;
+ #endif
+
+ bool r = this->exec();
+
+ #ifdef DEBUG
+- DEBUGCONDUIT << fname << ": Exec returned " << r << endl;
++ DEBUGLIBRARY << fname << ": Exec returned " << r << endl;
+ #endif
+
+ if (!r)
+@@ -131,20 +131,18 @@ static struct
+ } maps[] =
+ {
+ { SyncAction::SyncMode::eHotSync, "--hotsync" },
+- { SyncAction::SyncMode::eFastSync, "--fast" },
+ { SyncAction::SyncMode::eFullSync, "--full" },
+ { SyncAction::SyncMode::eCopyPCToHH, "--copyPCToHH" },
+ { SyncAction::SyncMode::eCopyHHToPC, "--copyHHToPC" },
+ { SyncAction::SyncMode::eBackup, "--backup" },
+ { SyncAction::SyncMode::eRestore, "--restore" },
+- { SyncAction::SyncMode::eFastSync, "--fastsync" },
+ { SyncAction::SyncMode::eFullSync, "--fullsync" },
+ { SyncAction::SyncMode::eHotSync, (const char *)0 }
+ }
+ ;
+
+ SyncAction::SyncMode::SyncMode(const QStringList &args) :
+- fMode(eFastSync),
++ fMode(eHotSync),
+ fTest(args.contains("--test")),
+ fLocal(args.contains("--local"))
+ {
+@@ -162,7 +160,7 @@ SyncAction::SyncMode::SyncMode(const QSt
+ if (!maps[i].name)
+ {
+ kdError() << k_funcinfo << "No mode set by arguments "
+- << args << ", defaulting to FastSync." << endl;
++ << args << ", defaulting to HotSync." << endl;
+ }
+ }
+
+@@ -171,11 +169,11 @@ SyncAction::SyncMode::SyncMode(Mode m, b
+ fTest(test),
+ fLocal(local)
+ {
+- if ( ((int)m<(int)eFastSync) || ((int)m>(int)eRestore) )
++ if ( ((int)m<(int)eHotSync) || ((int)m>(int)eRestore) )
+ {
+ kdError() << k_funcinfo << "Mode value " << (int)m << " is illegal"
+- ", defaulting to FastSync." << endl;
+- fMode = eFastSync;
++ ", defaulting to HotSync." << endl;
++ fMode = eHotSync;
+ }
+ }
+
+@@ -210,7 +208,6 @@ QStringList SyncAction::SyncMode::list()
+ {
+ switch(e)
+ {
+- case eFastSync : return i18n("FastSync");
+ case eHotSync : return i18n("HotSync");
+ case eFullSync : return i18n("Full Synchronization");
+ case eCopyPCToHH : return i18n("Copy PC to Handheld");
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/syncAction.h kdepim-3.5.5.dfsg.1/kpilot/lib/syncAction.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/syncAction.h 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/syncAction.h 2006-11-19 22:21:12.000000000 +0100
+@@ -49,9 +49,9 @@ class KDE_EXPORT SyncAction : public QOb
+ Q_OBJECT
+
+ public:
+- SyncAction(KPilotDeviceLink *p,
++ SyncAction(KPilotLink *p,
+ const char *name=0L);
+- SyncAction(KPilotDeviceLink *p,
++ SyncAction(KPilotLink *p,
+ QWidget *visibleparent,
+ const char *name=0L);
+ ~SyncAction();
+@@ -113,11 +113,11 @@ public:
+ void addLogProgress( const QString &msg, int prog ) { emit logProgress( msg, prog ); }
+ protected:
+ /** Connection to the device. @todo make private. */
+- KPilotDeviceLink *fHandle;
++ KPilotLink *fHandle;
+ int fActionStatus;
+
+ /** Returns a pointer to the connection to the device. */
+- inline KPilotDeviceLink *deviceLink() const { return fHandle; } ;
++ inline KPilotLink *deviceLink() const { return fHandle; }
+
+ /** Returns the file descriptor for the device link -- that is,
+ * the raw handle to the OS's connection to the device. Use with care.
+@@ -146,13 +146,12 @@ public:
+ public:
+ /** Available modes for the sync. */
+ enum Mode {
+- eFastSync=1,
+- eHotSync=2,
+- eFullSync=3,
+- eCopyPCToHH=4,
+- eCopyHHToPC=5,
+- eBackup=6,
+- eRestore=7
++ eHotSync=1,
++ eFullSync=2,
++ eCopyPCToHH=3,
++ eCopyHHToPC=4,
++ eBackup=5,
++ eRestore=6
+ } ;
+
+ /** Create a mode with the given Mode @p m and
+@@ -177,7 +176,7 @@ public:
+
+ /** Sets a mode from an integer @p mode, if possible.
+ * If the @p mode is illegal, return false and set the
+- * mode to Fast Sync. As a side effect, options test and local
++ * mode to Hot Sync. As a side effect, options test and local
+ * are reset to false.
+ */
+ bool setMode(int);
+@@ -227,8 +226,7 @@ public:
+ bool isSync() const
+ {
+ return ( fMode==eFullSync ) ||
+- ( fMode == eHotSync ) ||
+- ( fMode == eFastSync );
++ ( fMode == eHotSync );
+ } ;
+
+ /** Classify every mode as either a sync (two-way) or copy (one-way) mode. */
+@@ -277,6 +275,17 @@ public:
+ eCROffset=-1
+ };
+
++ /**
++ * This MUST stay in sync with the combobox in
++ * kpilotConfigDialog_backup.ui. If it does not, you need to
++ * either change this enum or the combobox.
++ */
++ enum BackupFrequency
++ {
++ eEveryHotSync=0,
++ eOnRequestOnly
++ };
++
+ protected:
+ /**
+ * Call startTickle() some time before showing a dialog to the
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/testactions.cc kdepim-3.5.5.dfsg.1/kpilot/lib/testactions.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/testactions.cc 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/testactions.cc 1970-01-01 01:00:00.000000000 +0100
+@@ -1,92 +0,0 @@
+-/* testactions KPilot
+-**
+-** Copyright (C) 2005 by Adriaan de Groot <groot at kde.org)
+-**
+-** Test the functions related to sync actions.
+-*/
+-
+-/*
+-** 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.1 of the License, or
+-** (at your option) any later version.
+-**
+-** This program 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 program in a file called COPYING; if not, write to
+-** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+-** MA 02110-1301, USA.
+-*/
+-
+-/*
+-** Bug reports and questions can be sent to kde-pim at kde.org
+-*/
+-
+-#include "options.h"
+-#include "syncAction.h"
+-
+-bool run_modes(bool test, bool local)
+-{
+- bool ok = true;
+-
+- kdDebug() << "***\n*** Sync Modes ("
+- << ( test ? "" : "no")
+- << "test, "
+- << ( local ? "" : "no")
+- << "local)\n***\n";
+-
+-
+- for (int m = (int)SyncAction::SyncMode::eFastSync;
+- m <= (int) SyncAction::SyncMode::eRestore ;
+- m++)
+- {
+- SyncAction::SyncMode mode((SyncAction::SyncMode::Mode)m,test,local);
+- kdDebug() << "* " << mode.name() << endl;
+- SyncAction::SyncMode mode2(mode.list());
+- if (!(mode==mode2)) {
+- kdDebug() << "E " << "Modes mismatch [" << mode.name() << "] ["
+- << mode2.name() << "]" << endl;
+- ok = false;
+- }
+- }
+-
+- return ok;
+-}
+-
+-bool single_mode(int m, bool test, bool local)
+-{
+- SyncAction::SyncMode mode((SyncAction::SyncMode::Mode)m,test,local);
+-
+- kdDebug() << "* " << m << " " << test << " " << local << endl;
+-
+- if ((mode.mode() == m) && (mode.isTest() == test) && (mode.isLocal() == local))
+- {
+- return true;
+- }
+- else
+- {
+- kdDebug() << "E " << "Modes mismatch " << m << " " << test << " " << local
+- << "[" << mode.name() << "]" << endl;
+- return false;
+- }
+-}
+-
+-int main(int argc, char **argv)
+-{
+- if (!run_modes(false,false)) return 1;
+- if (!run_modes(false,true)) return 1;
+- if (!run_modes(true,false)) return 1;
+- if (!run_modes(true,true)) return 1;
+-
+- kdDebug() << "***\n*** Sync Modes - misc\n***\n";
+- if (!single_mode(3,false,false)) return 1;
+- if (!single_mode(1,true,true)) return 1;
+-
+- return 0;
+-}
+-
+-
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/testconstants.cc kdepim-3.5.5.dfsg.1/kpilot/lib/testconstants.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/testconstants.cc 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/testconstants.cc 1970-01-01 01:00:00.000000000 +0100
+@@ -1,54 +0,0 @@
+-/* testconstants KPilot
+-**
+-** Copyright (C) 2005 by Adriaan de Groot <groot at kde.org)
+-**
+-** Checks that various data structures are sized properly.
+-*/
+-
+-/*
+-** 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.1 of the License, or
+-** (at your option) any later version.
+-**
+-** This program 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 program in a file called COPYING; if not, write to
+-** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+-** MA 02110-1301, USA.
+-*/
+-
+-/*
+-** Bug reports and questions can be sent to kde-pim at kde.org
+-*/
+-
+-#include "options.h"
+-
+-#define private public
+-#define protected public
+-
+-#include "pilotDatabase.h"
+-
+-#include <pi-appinfo.h>
+-
+-int main(int argc, char **argv)
+-{
+- PilotAppInfoBase info;
+-
+- kdDebug() << "*** Sizes of structures" << endl;
+- kdDebug() << "AppInfoBase: " << sizeof(PilotAppInfoBase) << endl;
+- kdDebug() << "CategoryInfo: " << sizeof(info.categoryInfo()) << endl;
+- kdDebug() << "CategoryInfo: " << sizeof(*info.categoryInfo()) << endl;
+- kdDebug() << "Category names: " << sizeof(info.categoryInfo()->name) << endl;
+- kdDebug() << "Single category: " << sizeof(info.categoryInfo()->name[0]) << endl;
+-
+- if ( sizeof(info.categoryInfo()->name[0]) != 16 ) return 1;
+- if ( sizeof(info.categoryInfo()->name) / sizeof(info.categoryInfo()->name[0]) != 16 ) return 1;
+- return 0;
+-}
+-
+-
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/testdatabase.cc kdepim-3.5.5.dfsg.1/kpilot/lib/testdatabase.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/testdatabase.cc 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/testdatabase.cc 1970-01-01 01:00:00.000000000 +0100
+@@ -1,315 +0,0 @@
+-/* testdatabase KPilot
+-**
+-** Copyright (C) 2005 by Adriaan de Groot <groot at kde.org)
+-**
+-** Test the functions related to local databases.
+-*/
+-
+-/*
+-** 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.1 of the License, or
+-** (at your option) any later version.
+-**
+-** This program 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 program in a file called COPYING; if not, write to
+-** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+-** MA 02110-1301, USA.
+-*/
+-
+-/*
+-** Bug reports and questions can be sent to kde-pim at kde.org
+-*/
+-
+-#include "options.h"
+-
+-#include <kaboutdata.h>
+-#include <kapplication.h>
+-#include <kdebug.h>
+-#include <klocale.h>
+-#include <kcmdlineargs.h>
+-
+-#include "pilotLocalDatabase.h"
+-#include "pilotRecord.h"
+-#include "pilotMemo.h"
+-
+-
+-/* Return values for the various check* functions. They
+- return OK if all is OK; ERR is for generic errors.
+- ERR_NO_EXIST is returned if something (usually a database
+- or other file) doesn't exist that should. The latter
+- error might be ignored.
+-*/
+-#define OK (0)
+-#define ERR (1)
+-#define ERR_NO_EXIST (2)
+-
+-
+-/* Data about the records in a database. The id field is
+- interpreted specially for the first and last entries.
+-*/
+-typedef struct { int id,size; } recordInfo;
+-
+-/* Use END in the last recordInfo struct describing a database
+- to indicate you expect the database to end there. Use NO_EXIST
+- as the ID in the first struct to indicate that the database
+- is expected _not_ to exist.
+-*/
+-#define NO_EXIST (-2)
+-#define END (-1)
+-
+-/* These tables of data are taken from various databases I have
+- (but which I cannot commit to SVN due to license issues).
+- The aesop listing is from an eBook of Aesop's fables.
+- The way to create these tables is to use a third-party
+- tool such as par to read the database:
+-
+- ./par l /tmp/Aesop.pdb | awk '{print "{",$3,",",$4,"},";}'
+-
+-*/
+-recordInfo nonexistent[] = {
+- { NO_EXIST, 0 }
+-} ;
+-
+-recordInfo aesop[] = {
+-{ 7307264 , 214 },
+-{ 7307265 , 1564 },
+-{ 7307266 , 1575 },
+-{ 7307267 , 2214 },
+-{ 7307268 , 2276 },
+-{ 7307269 , 2148 },
+-{ 7307270 , 2194 },
+-{ 7307271 , 2178 },
+-{ 7307272 , 2220 },
+-{ 7307273 , 2216 },
+-{ 7307274 , 2181 },
+-{ 7307275 , 2183 },
+-{ 7307276 , 2197 },
+-{ 7307277 , 2010 },
+-{ 7307278 , 2198 },
+-{ 7307279 , 2196 },
+-{ 7307280 , 2243 },
+-{ 7307281 , 2211 },
+-{ 7307282 , 2274 },
+-{ 7307283 , 364 },
+-{ 7307284 , 49124 },
+- { END, 0 }
+-} ;
+-
+-int checkDatabase(const char *path, recordInfo *info)
+-{
+- FUNCTIONSETUP;
+-
+- PilotLocalDatabase db(QString::fromLatin1(path));
+- if (!db.isDBOpen())
+- {
+- kdDebug() << "No database " << path << endl;
+- if ( info[0].id == NO_EXIST )
+- {
+- kdDebug() << "This was expected" << endl;
+- return OK;
+- }
+- else
+- {
+- return ERR_NO_EXIST;
+- }
+- }
+-
+- if ( info[0].id == NO_EXIST )
+- {
+- kdDebug() << "Database not expected" << endl;
+- return ERR;
+- }
+-
+- int fail = 0;
+- int index = 0;
+- PilotRecord *r;
+- while( (r = db.readRecordByIndex(index) ) )
+- {
+- kdDebug() << "[" << index << "] id=" << r->id() << " size=" << r->size() << endl;
+- if ( ((recordid_t)info[index].id) != r->id() )
+- {
+- kdDebug() << "* Bad ID (expected" << r->id() << ")" << endl;
+- fail++;
+- }
+- else if ( info[index].size != r->size() )
+- {
+- kdDebug() << "* Bad size (expected " << info[index].size << ")" << endl;
+- fail++;
+- }
+- index++;
+- }
+- if ( info[index].id != END )
+- {
+- kdDebug() << "* End wasn't expected yet." << endl;
+- r++;
+- }
+-
+- if (fail)
+- {
+- kdDebug() << "* " << fail << " failures." << endl;
+- return ERR;
+- }
+- return OK;
+-}
+-
+-const char *categoryNames[4] =
+-{
+- "aardvarks",
+- "toolongToBeaCategoryName",
+- "personal",
+- "impersonal"
+-} ;
+-
+-QStringList listCategories()
+-{
+- QStringList cats;
+- PilotLocalDatabase *l = new PilotLocalDatabase(SOURCE "/data/MemoDB");
+- PilotMemoInfo *m = new PilotMemoInfo(l);
+-
+- if (!l->isDBOpen()) return cats;
+-
+- cats.append(CSL1("Unfiled"));
+- m->dump();
+-
+- for (int i=0; i<20; i++)
+- {
+- PilotRecord *r = l->readRecordByIndex(i);
+- kdDebug() << "Read record " << (void *)r << " with id=" << r->id() << endl;
+- if (!r) break;
+- }
+-
+- for (int i=0; i<4; i++)
+- {
+- QString s = m->category(i);
+- kdDebug() << "Category " << i << ": " << (s.isEmpty() ? CSL1("<empty>") : s) << endl;
+- cats.append(s);
+-/*
+- if (i<((sizeof(categoryNames) / sizeof(categoryNames[0]))))
+- m->setCategoryName(i,QString::fromLatin1(categoryNames[i]));
+-*/
+- }
+-
+- m->write(l);
+-
+- delete m;
+- delete l;
+-
+- return cats;
+-}
+-
+-int checkCategories()
+-{
+- QStringList l = listCategories();
+- QStringList m = listCategories();
+-
+- if (l.isEmpty() || m.isEmpty()) return ERR;
+- if (l!=m) return ERR;
+- return OK;
+-}
+-
+-int checkMemo()
+-{
+- PilotLocalDatabase *l = new PilotLocalDatabase(SOURCE "/data/MemoDB");
+- if (!l->isDBOpen()) return ERR_NO_EXIST;
+-
+- PilotMemoInfo *m = new PilotMemoInfo(l);
+- m->dump();
+-
+- QString c = m->category(1);
+- if (c != CSL1("Business"))
+- {
+- kdDebug() << "* Category 1 is not 'Business' but " << c << endl;
+- return ERR;
+- }
+-
+- m->setCategoryName(2,CSL1("Aardvark"));
+- m->write(l);
+-
+- c = m->category(2);
+- if (c != CSL1("Aardvark"))
+- {
+- kdDebug() << "* Category 2 is not 'Aardvark' but " << c << endl;
+- return ERR;
+- }
+-
+-
+- delete m;
+- delete l;
+- return OK;
+-}
+-
+-static const KCmdLineOptions options[] =
+-{
+- {"verbose", "Verbose output", 0},
+- KCmdLineLastOption
+-};
+-
+-
+-int main(int argc, char **argv)
+-{
+- KAboutData aboutData("testdatabase","Test Databases","0.1");
+- KCmdLineArgs::init(argc,argv,&aboutData);
+- KCmdLineArgs::addCmdLineOptions( options );
+-
+- // KApplication app( false, false );
+- KApplication app;
+-
+- KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+-
+- Q_UNUSED(args)
+-
+- int r = 0;
+- int i = 0;
+-#ifdef DEBUG
+- debug_level=4;
+-#endif
+-
+- Q_UNUSED(argc);
+- Q_UNUSED(argv);
+-
+-#define ALLOW_NO_EXIST (1)
+- static struct { const char *path; recordInfo *info; int flags; }
+- tests[] =
+- {
+- { "/tmp/nonexistant/nonexistent", nonexistent,0 },
+- { "/tmp/Aesop", aesop, ALLOW_NO_EXIST },
+- { 0L, 0L, 0 }
+- } ;
+-
+- while ( tests[i].path )
+- {
+- kdDebug() << "*** Test " << i << endl;
+- int ret = checkDatabase( tests[i].path, tests[i].info );
+- if ( ret )
+- {
+- if ( (ret==ERR_NO_EXIST) &&
+- (tests[i].flags & ALLOW_NO_EXIST) )
+- {
+- kdDebug() << "* Test database doesn't exist, ignored." << endl;
+- }
+- else
+- {
+- r++;
+- }
+- }
+- i++;
+- }
+-
+- kdDebug() << "*** Test " << i << endl;
+- if (checkMemo()) r++;
+- i++;
+-
+- if (r)
+- {
+- kdDebug() << "***\n*** Failed " << r << " tests." << endl;
+- return 1;
+- }
+- return 0;
+-}
+-
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/uiDialog.cc kdepim-3.5.5.dfsg.1/kpilot/lib/uiDialog.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/lib/uiDialog.cc 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/lib/uiDialog.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -63,13 +63,6 @@
+ grid->addColSpacing(4, SPACING);
+
+
+-#ifdef DEBUG
+- DEBUGKPILOT << fname
+- << ": Looking for icon for "
+- << p->appName()
+- << endl;
+-#endif
+-
+ QPixmap applicationIcon =
+ l->loadIcon(QString::fromLatin1(p->appName()),
+ KIcon::Desktop,
+@@ -78,12 +71,6 @@
+
+ if (applicationIcon.isNull())
+ {
+-#ifdef DEBUG
+- DEBUGKPILOT << fname
+- << ": Looking for icon for "
+- << "kpilot"
+- << endl;
+-#endif
+ applicationIcon = l->loadIcon(QString::fromLatin1("kpilot"),
+ KIcon::Desktop);
+ }
+@@ -94,14 +81,7 @@
+ //
+ text->setText(i18n("Send questions and comments to kdepim-users at kde.org"));
+ text->adjustSize();
+-#ifdef DEBUG
+- DEBUGKPILOT << fname
+- << ": Text size "
+- << text->size().width()
+- << ","
+- << text->size().height()
+- << endl;
+-#endif
++
+ int linewidth = text->size().width();
+ int lineheight = text->size().height();
+
+@@ -113,16 +93,16 @@
+
+
+ KActiveLabel *linktext = new KActiveLabel(w);
+- grid->addRowSpacing(1,QMAX(100,6*lineheight));
+- grid->addRowSpacing(2,QMAX(100,6*lineheight));
++ grid->addRowSpacing(1,kMax(100,6*lineheight));
++ grid->addRowSpacing(2,kMax(100,6*lineheight));
+ grid->addColSpacing(2,SPACING+linewidth/2);
+ grid->addColSpacing(3,SPACING+linewidth/2);
+ grid->setRowStretch(1,50);
+ grid->setRowStretch(2,50);
+ grid->setColStretch(2,50);
+ grid->setColStretch(3,50);
+- linktext->setMinimumSize(linewidth,QMAX(260,60+12*lineheight));
+- linktext->setFixedHeight(QMAX(260,60+12*lineheight));
++ linktext->setMinimumSize(linewidth,kMax(260,60+12*lineheight));
++ linktext->setFixedHeight(kMax(260,60+12*lineheight));
+ linktext->setVScrollBarMode(QScrollView::Auto/*AlwaysOn*/);
+ text = new QLabel(w);
+ grid->addMultiCellWidget(text,0,0,2,3);
+@@ -203,24 +183,7 @@
+ linktext->append(s);
+ linktext->ensureVisible(0,0);
+
+-#ifdef DEBUG
+- DEBUGKPILOT << fname
+- << ": Size "
+- << w->size().width()
+- << ","
+- << w->size().height()
+- << endl;
+-#endif
+-
+ w->adjustSize();
+-#ifdef DEBUG
+- DEBUGKPILOT << fname
+- << ": Adjusted size "
+- << w->size().width()
+- << ","
+- << w->size().height()
+- << endl;
+-#endif
+
+ return w;
+ }
+@@ -245,15 +208,6 @@
+ sz.setHeight(tw->size().height());
+ }
+
+-#ifdef DEBUG
+- DEBUGKPILOT << fname
+- << ": Final size "
+- << sz.width()
+- << ","
+- << sz.height()
+- << endl;
+-#endif
+-
+ tw->resize(sz);
+ tw->addTab(w, i18n("About"));
+ tw->adjustSize();
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/Makefile.cmake kdepim-3.5.5.dfsg.1/kpilot/Makefile.cmake
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/Makefile.cmake 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/Makefile.cmake 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,64 @@
++BUILD_DIR ?= build
++# where to install software?
++PREFIX ?=
++
++# CMAKE_OPTIONS can be set and used. this might be needed for overriding
++# PILOT_LINK locations, etc.
++# (-DPILOTLINK_INCLUDE_DIR=$HOME/local/pilot-link-0.12.1/include/
++# -DPILOTLINK_LIBRARY=$HOME/local/pilot-link-0.12.1/lib/libpisock.so.9
++# )
++CMAKE_OPTIONS ?=
++
++CMAKE_FLAGS = -DCMAKE_INSTALL_PREFIX=$(PREFIX) $(CMAKE_OPTIONS)
++
++CMAKE = cmake
++
++all: app conduit
++
++check: lib
++ @echo "Make check is currently disabled"
++
++check-clean:
++ @echo "Make check is currently disabled"
++
++install: app-install conduit-install
++
++uninstall: app-uninstall conduit-uninstall
++
++lib: $(BUILD_DIR)/lib/libkpilot.so
++
++$(BUILD_DIR)/lib/libkpilot.so: build-check
++ cd "$(BUILD_DIR)/lib" && $(MAKE)
++
++app: build-check
++ cd "$(BUILD_DIR)" && $(MAKE)
++
++conduit: build-check
++ cd "$(BUILD_DIR)/conduits" && $(MAKE)
++
++app-install: app
++ cd "$(BUILD_DIR)" && $(MAKE) install
++
++conduit-install: conduit
++ cd "$(BUILD_DIR)/conduits" && $(MAKE) install
++
++app-uninstall:
++ cd "$(BUILD_DIR)" && $(MAKE) uninstall
++
++conduit-uninstall:
++ cd "$(BUILD_DIR)/conduits" && $(MAKE) uninstall
++
++build-check:
++ test -d "$(BUILD_DIR)" || mkdir -p "$(BUILD_DIR)"
++ test -d "$(BUILD_DIR)"
++ SRC_DIR=`pwd` ; cd "$(BUILD_DIR)" && $(CMAKE) $$SRC_DIR $(CMAKE_FLAGS)
++
++clean:
++ @rm -rf $(BUILD_DIR)
++
++help:
++ @echo "Usage: make ( all | install | uninstall | clean )"
++ @echo ""
++
++.PHONY : all install uninstall lib app conduit app-install conduit-install app-uninstall conduit-uninstall clean help
++
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/README kdepim-3.5.5.dfsg.1/kpilot/README
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/README 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/README 2006-11-19 22:21:12.000000000 +0100
+@@ -1,36 +1,20 @@
+-KPILOT 4.5.0 by Dan Pilone / Adriaan de Groot
++KPILOT 4.6.0 by Dan Pilone / Adriaan de Groot
+ =============================================
+ Additional work by Robert Ambrose,
+ Preston Brown, Adriaan de Groot,
+ Heiko Purnhagen, Joerg Habenicht,
+ David Bishop, Aaron Seigo,
+- Reinhold Kainhofer, Joern Ahrens
++ Reinhold Kainhofer, Joern Ahrens,
++ Jason Kasper,
+ and probably many more.
+
+- KPilot is software for syncing PalmOne handhelds, the 3Com Palm Pilot
+-and IBM Workpad (UNTESTED!) with a machine running some flavor of unix. By
+-default KPilot attempts to connnect using /dev/pilot which should be a link
+-to the actual serial port, however this is configurable in the settings dialog.
+-Modern USB-based devices should be accessed by configuring the USB HotPlug
+-manager for your OS to link /dev/pilot to the correct USB device node.
+-
+- Release notes can be found in Documentation/README-4.*. These are
+-official announcements of KPilot 4.x releases. There is also a README for
+-3.2.1 which is probably not interesting any more.
++ KPilot is software for syncing PalmOS based handhelds
++such as the 3Com Palm Pilot with a machine running some flavor of UNIX.
+
+ Developer's notes are listed in the file ChangeLog. This is
+ probably only of interest if you want to see how certain features developed
+ or if certain bugs have been reported before.
+
+- Generic installation instructions can be found in the file
+-INSTALL, but note that KPilot is part of the kdepim package and you
+-have to configure that package, not KPilot. KPilot does compile and
+-install on its own though, once kdepim is configured. Tarballs are
+-available from www.kpilot.org for standalone compilation.
+-
+- You NEED pilot-link to compile or install KPilot; KPilot is
+-currently tested using version 0.11.8 of pilot-link.
+-
+ http://www.kpilot.org/
+
+
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/tests/conduits/vcalconduit/exampletest.cc kdepim-3.5.5.dfsg.1/kpilot/tests/conduits/vcalconduit/exampletest.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/tests/conduits/vcalconduit/exampletest.cc 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/tests/conduits/vcalconduit/exampletest.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,26 @@
++#include "options.h"
++#include "config.h"
++
++#include "exampletest.h"
++
++CPPUNIT_TEST_SUITE_REGISTRATION( VCalConduitTest );
++
++
++void VCalConduitTest::setUp()
++{
++ device = QString("testdevice");
++ link = new KPilotLocalLink(0, "localLink");
++ syncMode = SyncAction::SyncMode::eHotSync;
++}
++
++
++void VCalConduitTest::tearDown()
++{
++ delete link;
++}
++
++
++void VCalConduitTest::testConstructor()
++{
++ CPPUNIT_ASSERT( true == true );
++}
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/tests/conduits/vcalconduit/exampletest.h kdepim-3.5.5.dfsg.1/kpilot/tests/conduits/vcalconduit/exampletest.h
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/tests/conduits/vcalconduit/exampletest.h 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/tests/conduits/vcalconduit/exampletest.h 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,28 @@
++#ifndef EXAMPLETEST_H
++#define EXAMPLETEST_H
++
++#include <cppunit/extensions/HelperMacros.h>
++#include <qstring.h>
++
++#include "kpilotlocallink.h"
++#include "syncAction.h"
++
++class VCalConduitTest : public CppUnit::TestFixture
++{
++ CPPUNIT_TEST_SUITE( VCalConduitTest );
++ CPPUNIT_TEST( testConstructor );
++ CPPUNIT_TEST_SUITE_END();
++
++private:
++ QString device;
++ KPilotLocalLink *link;
++ SyncAction::SyncMode::Mode syncMode;
++
++public:
++ void setUp();
++ void tearDown();
++
++ void testConstructor();
++};
++
++#endif
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/tests/main.cc kdepim-3.5.5.dfsg.1/kpilot/tests/main.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/tests/main.cc 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/tests/main.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,17 @@
++#include <cppunit/extensions/TestFactoryRegistry.h>
++#include <cppunit/ui/text/TestRunner.h>
++
++int main( int argc, char **argv)
++{
++ CppUnit::TestFactoryRegistry ®istry =
++ CppUnit::TestFactoryRegistry::getRegistry();
++
++ CppUnit::TextUi::TestRunner runner;
++ runner.addTest( registry.makeTest() );
++
++ // Run the tests.
++ bool wasSucessful = runner.run();
++
++ // Return error code 1 if the one of test failed.
++ return wasSucessful ? 0 : 1;
++}
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/tests/testactions.cc kdepim-3.5.5.dfsg.1/kpilot/tests/testactions.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/tests/testactions.cc 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/tests/testactions.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,92 @@
++/* testactions KPilot
++**
++** Copyright (C) 2005 by Adriaan de Groot <groot at kde.org)
++**
++** Test the functions related to sync actions.
++*/
++
++/*
++** 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.1 of the License, or
++** (at your option) any later version.
++**
++** This program 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 program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include "options.h"
++#include "syncAction.h"
++
++bool run_modes(bool test, bool local)
++{
++ bool ok = true;
++
++ kdDebug() << "***\n*** Sync Modes ("
++ << ( test ? "" : "no")
++ << "test, "
++ << ( local ? "" : "no")
++ << "local)\n***\n";
++
++
++ for (int m = (int)SyncAction::SyncMode::eHotSync;
++ m <= (int) SyncAction::SyncMode::eRestore ;
++ m++)
++ {
++ SyncAction::SyncMode mode((SyncAction::SyncMode::Mode)m,test,local);
++ kdDebug() << "* " << mode.name() << endl;
++ SyncAction::SyncMode mode2(mode.list());
++ if (!(mode==mode2)) {
++ kdDebug() << "E " << "Modes mismatch [" << mode.name() << "] ["
++ << mode2.name() << "]" << endl;
++ ok = false;
++ }
++ }
++
++ return ok;
++}
++
++bool single_mode(int m, bool test, bool local)
++{
++ SyncAction::SyncMode mode((SyncAction::SyncMode::Mode)m,test,local);
++
++ kdDebug() << "* " << m << " " << test << " " << local << endl;
++
++ if ((mode.mode() == m) && (mode.isTest() == test) && (mode.isLocal() == local))
++ {
++ return true;
++ }
++ else
++ {
++ kdDebug() << "E " << "Modes mismatch " << m << " " << test << " " << local
++ << "[" << mode.name() << "]" << endl;
++ return false;
++ }
++}
++
++int main(int argc, char **argv)
++{
++ if (!run_modes(false,false)) return 1;
++ if (!run_modes(false,true)) return 1;
++ if (!run_modes(true,false)) return 1;
++ if (!run_modes(true,true)) return 1;
++
++ kdDebug() << "***\n*** Sync Modes - misc\n***\n";
++ if (!single_mode(3,false,false)) return 1;
++ if (!single_mode(1,true,true)) return 1;
++
++ return 0;
++}
++
++
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/tests/testcategories.cc kdepim-3.5.5.dfsg.1/kpilot/tests/testcategories.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/tests/testcategories.cc 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/tests/testcategories.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,196 @@
++/* testcategories KPilot
++**
++** Copyright (C) 2005 by Adriaan de Groot <groot at kde.org)
++**
++** Test the functions related to category handling.
++*/
++
++/*
++** 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.1 of the License, or
++** (at your option) any later version.
++**
++** This program 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 program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include "options.h"
++
++#include <kaboutdata.h>
++#include <kapplication.h>
++#include <kdebug.h>
++#include <klocale.h>
++#include <kcmdlineargs.h>
++
++#include "pilotLocalDatabase.h"
++#include "pilotRecord.h"
++
++
++// Name of a bogus broken DB
++#define BOGUS_NAME "./data/bogus"
++
++// Name of an actual DB
++#define MEMO_NAME "./data/MemoDB"
++
++QStringList listCategories( const char *dbname )
++{
++ QStringList cats;
++ PilotLocalDatabase *database = new PilotLocalDatabase( dbname );
++ if (!database->isOpen()) return cats;
++
++ PilotAppInfoBase *appinfo = new PilotAppInfoBase( database );
++ appinfo->dump();
++
++ for (int i=0; i<PILOT_CATEGORY_MAX; i++)
++ {
++ QString s = appinfo->category(i);
++ cats.append(s);
++ }
++
++ delete appinfo;
++ delete database;
++
++ return cats;
++}
++
++void badAppInfoCreation()
++{
++ FUNCTIONSETUP;
++ PilotAppInfoBase *appinfo = new PilotAppInfoBase( 0L );
++ appinfo->dump();
++ KPILOT_DELETE( appinfo ) ;
++
++ PilotLocalDatabase *database = new PilotLocalDatabase( BOGUS_NAME );
++ appinfo = new PilotAppInfoBase( database );
++ appinfo->dump();
++ KPILOT_DELETE( appinfo );
++}
++
++void categoryNames()
++{
++ FUNCTIONSETUP;
++
++ PilotLocalDatabase *database = new PilotLocalDatabase( MEMO_NAME );
++ if (!database->isOpen())
++ {
++ return;
++ }
++
++ PilotAppInfoBase *appinfo = new PilotAppInfoBase( database );
++ appinfo->dump();
++
++ if (!appinfo->categoryInfo())
++ {
++ kdDebug() << "! Could not read required database" << endl;
++ return;
++ }
++
++ const char *funnyname = "AardvarkWhaleMooseExplosion";
++ const int funnyname_length = strlen(funnyname);
++
++ if (funnyname_length < 20)
++ {
++ kdDebug() << "! String of example category names is too short." << endl;
++ return;
++ }
++
++ for (unsigned int i=0; i<PILOT_CATEGORY_MAX+2; i++)
++ {
++ QString name = QString::fromLatin1(funnyname+funnyname_length-i-3);
++ if (!appinfo->setCategoryName(i,name))
++ {
++ kdDebug() << "! Failed to set category " << i << " name to <" << name << ">" << endl;
++ }
++ else
++ {
++ QString categoryname = appinfo->category(i);
++ if (categoryname != name)
++ {
++ kdDebug() << "! Category name " << i
++ << " set to <" << name
++ << "> and returns <"
++ << categoryname << ">" << endl;
++ }
++ }
++ }
++
++ appinfo->dump();
++}
++
++static const KCmdLineOptions options[] =
++{
++ {"verbose", "Verbose output", 0},
++ KCmdLineLastOption
++};
++
++
++int main(int argc, char **argv)
++{
++ KAboutData aboutData("","Test Databases","0.1");
++ KCmdLineArgs::init(argc,argv,&aboutData);
++ KCmdLineArgs::addCmdLineOptions( options );
++
++ // KApplication app( false, false );
++ KApplication app;
++
++ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
++
++ Q_UNUSED(args)
++
++ int r = 0;
++ int i = 0;
++#ifdef DEBUG
++ debug_level= (args->isSet("verbose")) ? 4 : 0;
++#endif
++
++ Q_UNUSED(argc);
++ Q_UNUSED(argv);
++
++ static const char *files[] = {
++ MEMO_NAME,
++ "./data/AddressDB",
++ "./data/MailDB",
++ "./data/ToDoDB",
++ 0L
++ };
++
++ kdDebug() << "# Listing categories from database files.\n#" << endl;
++
++ // Include arbitrary break-off point, in case
++ for (unsigned int i = 0; i<sizeof(files)/sizeof(const char *) ; i++)
++ {
++ if (!files[i])
++ {
++ break;
++ }
++ kdDebug() << "# Categories (" << files[i] << "): "
++ << listCategories( files[i] ) << endl;
++ }
++ // Should bail, not crash
++ kdDebug() << "# Categories (nonexistent): "
++ << listCategories( "nonexistent" ) << endl;
++ kdDebug() << "# Categories (bogus): "
++ << listCategories( BOGUS_NAME ) << endl;
++
++ kdDebug() << "\n# Trying to pass broken pointers to category functions.\n#" << endl;
++ badAppInfoCreation();
++
++ kdDebug() << "\n# Checking category names.\n#" << endl;
++ categoryNames();
++
++ kdDebug() << "\n# OK.\n" << endl;
++ return 0;
++}
++
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/tests/testconstants.cc kdepim-3.5.5.dfsg.1/kpilot/tests/testconstants.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/tests/testconstants.cc 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/tests/testconstants.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,67 @@
++/* testconstants KPilot
++**
++** Copyright (C) 2005 by Adriaan de Groot <groot at kde.org)
++**
++** Checks that various data structures are sized properly.
++*/
++
++/*
++** 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.1 of the License, or
++** (at your option) any later version.
++**
++** This program 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 program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include "options.h"
++
++#include "pilot.h"
++
++#include <pi-appinfo.h>
++
++int main(int argc, char **argv)
++{
++#ifdef DEBUG
++ debug_level = 1;
++#endif
++ PilotDatabaseInfo info( 0L );
++
++
++ kdDebug() << "### testconstants\n#" << endl;
++ kdDebug() << "# Sizes of structures\n#" << endl;
++ kdDebug() << "# AppInfoBase: " << sizeof(PilotDatabaseInfo) << endl;
++ kdDebug() << "# CategoryInfo: " << sizeof(info.categoryInfo()) << endl;
++ kdDebug() << "# CategoryInfo: " << sizeof(*info.categoryInfo()) << endl;
++ kdDebug() << "# Category names: " << sizeof(info.categoryInfo()->name) << endl;
++ kdDebug() << "# Single category: " << sizeof(info.categoryInfo()->name[0]) << endl;
++
++ kdDebug() << "#\n# Sanity checking structure sizes\n#" << endl;
++ if ( sizeof(info.categoryInfo()->name[0]) != Pilot::CATEGORY_SIZE )
++ {
++ kdDebug() << "! Category names are not 16 bytes." << endl;
++ return 1;
++ }
++ if ( sizeof(info.categoryInfo()->name) / sizeof(info.categoryInfo()->name[0]) != Pilot::CATEGORY_COUNT )
++ {
++ kdDebug() << "! There are not " << Pilot::CATEGORY_COUNT << " categories available." << endl;
++ return 1;
++ }
++
++ kdDebug() << "# OK.\n" << endl;
++ return 0;
++}
++
++
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/tests/testdatabase.cc kdepim-3.5.5.dfsg.1/kpilot/tests/testdatabase.cc
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/tests/testdatabase.cc 1970-01-01 01:00:00.000000000 +0100
++++ kdepim-3.5.5.dfsg.1/kpilot/tests/testdatabase.cc 2006-11-19 22:21:12.000000000 +0100
+@@ -0,0 +1,315 @@
++/* testdatabase KPilot
++**
++** Copyright (C) 2005 by Adriaan de Groot <groot at kde.org)
++**
++** Test the functions related to local databases.
++*/
++
++/*
++** 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.1 of the License, or
++** (at your option) any later version.
++**
++** This program 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 program in a file called COPYING; if not, write to
++** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
++** MA 02110-1301, USA.
++*/
++
++/*
++** Bug reports and questions can be sent to kde-pim at kde.org
++*/
++
++#include "options.h"
++
++#include <kaboutdata.h>
++#include <kapplication.h>
++#include <kdebug.h>
++#include <klocale.h>
++#include <kcmdlineargs.h>
++
++#include "pilotLocalDatabase.h"
++#include "pilotRecord.h"
++#include "pilotMemo.h"
++
++
++/* Return values for the various check* functions. They
++ return OK if all is OK; ERR is for generic errors.
++ ERR_NO_EXIST is returned if something (usually a database
++ or other file) doesn't exist that should. The latter
++ error might be ignored.
++*/
++#define OK (0)
++#define ERR (1)
++#define ERR_NO_EXIST (2)
++
++
++/* Data about the records in a database. The id field is
++ interpreted specially for the first and last entries.
++*/
++typedef struct { int id,size; } recordInfo;
++
++/* Use END in the last recordInfo struct describing a database
++ to indicate you expect the database to end there. Use NO_EXIST
++ as the ID in the first struct to indicate that the database
++ is expected _not_ to exist.
++*/
++#define NO_EXIST (-2)
++#define END (-1)
++
++/* These tables of data are taken from various databases I have
++ (but which I cannot commit to SVN due to license issues).
++ The aesop listing is from an eBook of Aesop's fables.
++ The way to create these tables is to use a third-party
++ tool such as par to read the database:
++
++ ./par l /tmp/Aesop.pdb | awk '{print "{",$3,",",$4,"},";}'
++
++*/
++recordInfo nonexistent[] = {
++ { NO_EXIST, 0 }
++} ;
++
++recordInfo aesop[] = {
++{ 7307264 , 214 },
++{ 7307265 , 1564 },
++{ 7307266 , 1575 },
++{ 7307267 , 2214 },
++{ 7307268 , 2276 },
++{ 7307269 , 2148 },
++{ 7307270 , 2194 },
++{ 7307271 , 2178 },
++{ 7307272 , 2220 },
++{ 7307273 , 2216 },
++{ 7307274 , 2181 },
++{ 7307275 , 2183 },
++{ 7307276 , 2197 },
++{ 7307277 , 2010 },
++{ 7307278 , 2198 },
++{ 7307279 , 2196 },
++{ 7307280 , 2243 },
++{ 7307281 , 2211 },
++{ 7307282 , 2274 },
++{ 7307283 , 364 },
++{ 7307284 , 49124 },
++ { END, 0 }
++} ;
++
++int checkDatabase(const char *path, recordInfo *info)
++{
++ FUNCTIONSETUP;
++
++ PilotLocalDatabase db(QString::fromLatin1(path));
++ if (!db.isOpen())
++ {
++ kdDebug() << "No database " << path << endl;
++ if ( info[0].id == NO_EXIST )
++ {
++ kdDebug() << "This was expected" << endl;
++ return OK;
++ }
++ else
++ {
++ return ERR_NO_EXIST;
++ }
++ }
++
++ if ( info[0].id == NO_EXIST )
++ {
++ kdDebug() << "Database not expected" << endl;
++ return ERR;
++ }
++
++ int fail = 0;
++ int index = 0;
++ PilotRecord *r;
++ while( (r = db.readRecordByIndex(index) ) )
++ {
++ kdDebug() << "[" << index << "] id=" << r->id() << " size=" << r->size() << endl;
++ if ( ((recordid_t)info[index].id) != r->id() )
++ {
++ kdDebug() << "* Bad ID (expected" << r->id() << ")" << endl;
++ fail++;
++ }
++ else if ( info[index].size != r->size() )
++ {
++ kdDebug() << "* Bad size (expected " << info[index].size << ")" << endl;
++ fail++;
++ }
++ index++;
++ }
++ if ( info[index].id != END )
++ {
++ kdDebug() << "* End wasn't expected yet." << endl;
++ r++;
++ }
++
++ if (fail)
++ {
++ kdDebug() << "* " << fail << " failures." << endl;
++ return ERR;
++ }
++ return OK;
++}
++
++const char *categoryNames[4] =
++{
++ "aardvarks",
++ "toolongToBeaCategoryName",
++ "personal",
++ "impersonal"
++} ;
++
++QStringList listCategories()
++{
++ QStringList cats;
++ PilotLocalDatabase *l = new PilotLocalDatabase("./data/MemoDB");
++ PilotMemoInfo *m = new PilotMemoInfo(l);
++
++ if (!l->isOpen()) return cats;
++
++ cats.append(CSL1("Unfiled"));
++ m->dump();
++
++ for (int i=0; i<20; i++)
++ {
++ PilotRecord *r = l->readRecordByIndex(i);
++ kdDebug() << "Read record " << (void *)r << " with id=" << r->id() << endl;
++ if (!r) break;
++ }
++
++ for (int i=0; i<4; i++)
++ {
++ QString s = m->category(i);
++ kdDebug() << "Category " << i << ": " << (s.isEmpty() ? CSL1("<empty>") : s) << endl;
++ cats.append(s);
++/*
++ if (i<((sizeof(categoryNames) / sizeof(categoryNames[0]))))
++ m->setCategoryName(i,QString::fromLatin1(categoryNames[i]));
++*/
++ }
++
++ m->write(l);
++
++ delete m;
++ delete l;
++
++ return cats;
++}
++
++int checkCategories()
++{
++ QStringList l = listCategories();
++ QStringList m = listCategories();
++
++ if (l.isEmpty() || m.isEmpty()) return ERR;
++ if (l!=m) return ERR;
++ return OK;
++}
++
++int checkMemo()
++{
++ PilotLocalDatabase *l = new PilotLocalDatabase("./data/MemoDB");
++ if (!l->isOpen()) return ERR_NO_EXIST;
++
++ PilotMemoInfo *m = new PilotMemoInfo(l);
++ m->dump();
++
++ QString c = m->category(1);
++ if (c != CSL1("Business"))
++ {
++ kdDebug() << "* Category 1 is not 'Business' but " << c << endl;
++ return ERR;
++ }
++
++ m->setCategoryName(2,CSL1("Aardvark"));
++ m->dump();
++
++ c = m->category(2);
++ if (c != CSL1("Aardvark"))
++ {
++ kdDebug() << "* Category 2 is not 'Aardvark' but " << c << endl;
++ return ERR;
++ }
++
++
++ delete m;
++ delete l;
++ return OK;
++}
++
++static const KCmdLineOptions options[] =
++{
++ {"verbose", "Verbose output", 0},
++ KCmdLineLastOption
++};
++
++
++int main(int argc, char **argv)
++{
++ KAboutData aboutData("testdatabase","Test Databases","0.1");
++ KCmdLineArgs::init(argc,argv,&aboutData);
++ KCmdLineArgs::addCmdLineOptions( options );
++
++ // KApplication app( false, false );
++ KApplication app;
++
++ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
++
++ Q_UNUSED(args)
++
++ int r = 0;
++ int i = 0;
++#ifdef DEBUG
++ debug_level=4;
++#endif
++
++ Q_UNUSED(argc);
++ Q_UNUSED(argv);
++
++#define ALLOW_NO_EXIST (1)
++ static struct { const char *path; recordInfo *info; int flags; }
++ tests[] =
++ {
++ { "/tmp/nonexistant/nonexistent", nonexistent,0 },
++ { "/tmp/Aesop", aesop, ALLOW_NO_EXIST },
++ { 0L, 0L, 0 }
++ } ;
++
++ while ( tests[i].path )
++ {
++ kdDebug() << "*** Test " << i << endl;
++ int ret = checkDatabase( tests[i].path, tests[i].info );
++ if ( ret )
++ {
++ if ( (ret==ERR_NO_EXIST) &&
++ (tests[i].flags & ALLOW_NO_EXIST) )
++ {
++ kdDebug() << "* Test database doesn't exist, ignored." << endl;
++ }
++ else
++ {
++ r++;
++ }
++ }
++ i++;
++ }
++
++ kdDebug() << "*** Test " << i << endl;
++ if (checkMemo()) r++;
++ i++;
++
++ if (r)
++ {
++ kdDebug() << "***\n*** Failed " << r << " tests." << endl;
++ return 1;
++ }
++ return 0;
++}
++
+diff -Naurp kdepim-3.5.5.dfsg.1.debian-patched/kpilot/TODO kdepim-3.5.5.dfsg.1/kpilot/TODO
+--- kdepim-3.5.5.dfsg.1.debian-patched/kpilot/TODO 2005-09-10 10:24:40.000000000 +0200
++++ kdepim-3.5.5.dfsg.1/kpilot/TODO 2006-11-19 22:21:12.000000000 +0100
+@@ -5,6 +5,12 @@ for details on how an issue is resolved,
+ periodically purged from this list.
+
+
++* Import pilot-link 0.12 CVS again
++* Implement correct full syncing in memofile conduit. honestly, we should
++ really have a generic sync engine that knows how to do all of the
++ different sync types and only calls conduits for comparisons, list
++ fetching, pilotid->whateverId persistence and retrieval, etc. *sigh* is
++ that what opensync gives us?
+
+ Essential
+ =========
More information about the pkg-kde-commits
mailing list