summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-17 14:32:16 (UTC)
committer zautrix <zautrix>2004-10-17 14:32:16 (UTC)
commit780a12295cbbcf4eff4f9570322c1cac517414ad (patch) (unidiff)
tree4c68b7e6ee854f9d4f0e7e3032f7c70cc45668be
parentf909868a098a22c17906f3d2ab05d5fac0332e85 (diff)
downloadkdepimpi-780a12295cbbcf4eff4f9570322c1cac517414ad.zip
kdepimpi-780a12295cbbcf4eff4f9570322c1cac517414ad.tar.gz
kdepimpi-780a12295cbbcf4eff4f9570322c1cac517414ad.tar.bz2
many kde sync fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile2
-rw-r--r--kde2file/caldump/main.cpp97
-rw-r--r--libkdepim/ksyncmanager.cpp7
3 files changed, 73 insertions, 33 deletions
diff --git a/Makefile b/Makefile
index 93437e6..4d562fe 100644
--- a/Makefile
+++ b/Makefile
@@ -1,171 +1,171 @@
1############################################################################# 1#############################################################################
2# Makefile for building: kdepim-desktop 2# Makefile for building: kdepim-desktop
3# Generated by qmake (1.07a) (Qt 3.3.3) on: Sat Oct 16 22:32:03 2004 3# Generated by qmake (1.07a) (Qt 3.3.3) on: Sun Oct 17 11:53:22 2004
4# Project: kdepim-desktop.pro 4# Project: kdepim-desktop.pro
5# Template: subdirs 5# Template: subdirs
6# Command: $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kdepim-desktop.pro 6# Command: $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kdepim-desktop.pro
7############################################################################# 7#############################################################################
8 8
9 MAKEFILE =Makefile 9 MAKEFILE =Makefile
10 QMAKE =qmake 10 QMAKE =qmake
11DEL_FILE = rm -f 11DEL_FILE = rm -f
12CHK_DIR_EXISTS= test -d 12CHK_DIR_EXISTS= test -d
13MKDIR = mkdir -p 13MKDIR = mkdir -p
14INSTALL_FILE= 14INSTALL_FILE=
15INSTALL_DIR = 15INSTALL_DIR =
16 SUBTARGETS = \ 16 SUBTARGETS = \
17 sub-gammu-emb-common \ 17 sub-gammu-emb-common \
18 sub-gammu-emb-gammu \ 18 sub-gammu-emb-gammu \
19 sub-libical \ 19 sub-libical \
20 sub-libkcal \ 20 sub-libkcal \
21 sub-microkde \ 21 sub-microkde \
22 sub-libkdepim \ 22 sub-libkdepim \
23 sub-kabc \ 23 sub-kabc \
24 sub-korganizer \ 24 sub-korganizer \
25 sub-kaddressbook \ 25 sub-kaddressbook \
26 sub-kabc-plugins-file \ 26 sub-kabc-plugins-file \
27 sub-kabc-plugins-dir 27 sub-kabc-plugins-dir
28 28
29first: all 29first: all
30 30
31all: Makefile $(SUBTARGETS) 31all: Makefile $(SUBTARGETS)
32 32
33gammu/emb/common/$(MAKEFILE): 33gammu/emb/common/$(MAKEFILE):
34 @$(CHK_DIR_EXISTS) "gammu/emb/common" || $(MKDIR) "gammu/emb/common" 34 @$(CHK_DIR_EXISTS) "gammu/emb/common" || $(MKDIR) "gammu/emb/common"
35 cd gammu/emb/common && $(QMAKE) common.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 35 cd gammu/emb/common && $(QMAKE) common.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
36sub-gammu-emb-common: gammu/emb/common/$(MAKEFILE) FORCE 36sub-gammu-emb-common: gammu/emb/common/$(MAKEFILE) FORCE
37 cd gammu/emb/common && $(MAKE) -f $(MAKEFILE) 37 cd gammu/emb/common && $(MAKE) -f $(MAKEFILE)
38 38
39gammu/emb/gammu/$(MAKEFILE): 39gammu/emb/gammu/$(MAKEFILE):
40 @$(CHK_DIR_EXISTS) "gammu/emb/gammu" || $(MKDIR) "gammu/emb/gammu" 40 @$(CHK_DIR_EXISTS) "gammu/emb/gammu" || $(MKDIR) "gammu/emb/gammu"
41 cd gammu/emb/gammu && $(QMAKE) gammu.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 41 cd gammu/emb/gammu && $(QMAKE) gammu.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
42sub-gammu-emb-gammu: gammu/emb/gammu/$(MAKEFILE) FORCE 42sub-gammu-emb-gammu: gammu/emb/gammu/$(MAKEFILE) FORCE
43 cd gammu/emb/gammu && $(MAKE) -f $(MAKEFILE) 43 cd gammu/emb/gammu && $(MAKE) -f $(MAKEFILE)
44 44
45libical/$(MAKEFILE): 45libical/$(MAKEFILE):
46 @$(CHK_DIR_EXISTS) "libical" || $(MKDIR) "libical" 46 @$(CHK_DIR_EXISTS) "libical" || $(MKDIR) "libical"
47 cd libical && $(QMAKE) libical.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 47 cd libical && $(QMAKE) libical.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
48sub-libical: libical/$(MAKEFILE) FORCE 48sub-libical: libical/$(MAKEFILE) FORCE
49 cd libical && $(MAKE) -f $(MAKEFILE) 49 cd libical && $(MAKE) -f $(MAKEFILE)
50 50
51libkcal/$(MAKEFILE): 51libkcal/$(MAKEFILE):
52 @$(CHK_DIR_EXISTS) "libkcal" || $(MKDIR) "libkcal" 52 @$(CHK_DIR_EXISTS) "libkcal" || $(MKDIR) "libkcal"
53 cd libkcal && $(QMAKE) libkcal.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 53 cd libkcal && $(QMAKE) libkcal.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
54sub-libkcal: libkcal/$(MAKEFILE) FORCE 54sub-libkcal: libkcal/$(MAKEFILE) FORCE
55 cd libkcal && $(MAKE) -f $(MAKEFILE) 55 cd libkcal && $(MAKE) -f $(MAKEFILE)
56 56
57microkde/$(MAKEFILE): 57microkde/$(MAKEFILE):
58 @$(CHK_DIR_EXISTS) "microkde" || $(MKDIR) "microkde" 58 @$(CHK_DIR_EXISTS) "microkde" || $(MKDIR) "microkde"
59 cd microkde && $(QMAKE) microkde.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 59 cd microkde && $(QMAKE) microkde.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
60sub-microkde: microkde/$(MAKEFILE) FORCE 60sub-microkde: microkde/$(MAKEFILE) FORCE
61 cd microkde && $(MAKE) -f $(MAKEFILE) 61 cd microkde && $(MAKE) -f $(MAKEFILE)
62 62
63libkdepim/$(MAKEFILE): 63libkdepim/$(MAKEFILE):
64 @$(CHK_DIR_EXISTS) "libkdepim" || $(MKDIR) "libkdepim" 64 @$(CHK_DIR_EXISTS) "libkdepim" || $(MKDIR) "libkdepim"
65 cd libkdepim && $(QMAKE) libkdepim.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 65 cd libkdepim && $(QMAKE) libkdepim.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
66sub-libkdepim: libkdepim/$(MAKEFILE) FORCE 66sub-libkdepim: libkdepim/$(MAKEFILE) FORCE
67 cd libkdepim && $(MAKE) -f $(MAKEFILE) 67 cd libkdepim && $(MAKE) -f $(MAKEFILE)
68 68
69kabc/$(MAKEFILE): 69kabc/$(MAKEFILE):
70 @$(CHK_DIR_EXISTS) "kabc" || $(MKDIR) "kabc" 70 @$(CHK_DIR_EXISTS) "kabc" || $(MKDIR) "kabc"
71 cd kabc && $(QMAKE) kabc.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 71 cd kabc && $(QMAKE) kabc.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
72sub-kabc: kabc/$(MAKEFILE) FORCE 72sub-kabc: kabc/$(MAKEFILE) FORCE
73 cd kabc && $(MAKE) -f $(MAKEFILE) 73 cd kabc && $(MAKE) -f $(MAKEFILE)
74 74
75korganizer/$(MAKEFILE): 75korganizer/$(MAKEFILE):
76 @$(CHK_DIR_EXISTS) "korganizer" || $(MKDIR) "korganizer" 76 @$(CHK_DIR_EXISTS) "korganizer" || $(MKDIR) "korganizer"
77 cd korganizer && $(QMAKE) korganizer.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 77 cd korganizer && $(QMAKE) korganizer.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
78sub-korganizer: korganizer/$(MAKEFILE) FORCE 78sub-korganizer: korganizer/$(MAKEFILE) FORCE
79 cd korganizer && $(MAKE) -f $(MAKEFILE) 79 cd korganizer && $(MAKE) -f $(MAKEFILE)
80 80
81kaddressbook/$(MAKEFILE): 81kaddressbook/$(MAKEFILE):
82 @$(CHK_DIR_EXISTS) "kaddressbook" || $(MKDIR) "kaddressbook" 82 @$(CHK_DIR_EXISTS) "kaddressbook" || $(MKDIR) "kaddressbook"
83 cd kaddressbook && $(QMAKE) kaddressbook.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 83 cd kaddressbook && $(QMAKE) kaddressbook.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
84sub-kaddressbook: kaddressbook/$(MAKEFILE) FORCE 84sub-kaddressbook: kaddressbook/$(MAKEFILE) FORCE
85 cd kaddressbook && $(MAKE) -f $(MAKEFILE) 85 cd kaddressbook && $(MAKE) -f $(MAKEFILE)
86 86
87kabc/plugins/file/$(MAKEFILE): 87kabc/plugins/file/$(MAKEFILE):
88 @$(CHK_DIR_EXISTS) "kabc/plugins/file" || $(MKDIR) "kabc/plugins/file" 88 @$(CHK_DIR_EXISTS) "kabc/plugins/file" || $(MKDIR) "kabc/plugins/file"
89 cd kabc/plugins/file && $(QMAKE) file.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 89 cd kabc/plugins/file && $(QMAKE) file.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
90sub-kabc-plugins-file: kabc/plugins/file/$(MAKEFILE) FORCE 90sub-kabc-plugins-file: kabc/plugins/file/$(MAKEFILE) FORCE
91 cd kabc/plugins/file && $(MAKE) -f $(MAKEFILE) 91 cd kabc/plugins/file && $(MAKE) -f $(MAKEFILE)
92 92
93kabc/plugins/dir/$(MAKEFILE): 93kabc/plugins/dir/$(MAKEFILE):
94 @$(CHK_DIR_EXISTS) "kabc/plugins/dir" || $(MKDIR) "kabc/plugins/dir" 94 @$(CHK_DIR_EXISTS) "kabc/plugins/dir" || $(MKDIR) "kabc/plugins/dir"
95 cd kabc/plugins/dir && $(QMAKE) dir.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE) 95 cd kabc/plugins/dir && $(QMAKE) dir.pro "CONFIG+=thread" "CONFIG+=debug" -o $(MAKEFILE)
96sub-kabc-plugins-dir: kabc/plugins/dir/$(MAKEFILE) FORCE 96sub-kabc-plugins-dir: kabc/plugins/dir/$(MAKEFILE) FORCE
97 cd kabc/plugins/dir && $(MAKE) -f $(MAKEFILE) 97 cd kabc/plugins/dir && $(MAKE) -f $(MAKEFILE)
98 98
99Makefile: kdepim-desktop.pro /usr/local/qtgcc/mkspecs/default/qmake.conf 99Makefile: kdepim-desktop.pro /usr/local/qtgcc/mkspecs/default/qmake.conf
100 $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kdepim-desktop.pro 100 $(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kdepim-desktop.pro
101qmake: qmake_all 101qmake: qmake_all
102 @$(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kdepim-desktop.pro 102 @$(QMAKE) "CONFIG+=thread" "CONFIG+=debug" -o Makefile kdepim-desktop.pro
103 103
104all: $(SUBTARGETS) 104all: $(SUBTARGETS)
105qmake_all: gammu/emb/common/$(MAKEFILE) gammu/emb/gammu/$(MAKEFILE) libical/$(MAKEFILE) libkcal/$(MAKEFILE) microkde/$(MAKEFILE) libkdepim/$(MAKEFILE) kabc/$(MAKEFILE) korganizer/$(MAKEFILE) kaddressbook/$(MAKEFILE) kabc/plugins/file/$(MAKEFILE) kabc/plugins/dir/$(MAKEFILE) 105qmake_all: gammu/emb/common/$(MAKEFILE) gammu/emb/gammu/$(MAKEFILE) libical/$(MAKEFILE) libkcal/$(MAKEFILE) microkde/$(MAKEFILE) libkdepim/$(MAKEFILE) kabc/$(MAKEFILE) korganizer/$(MAKEFILE) kaddressbook/$(MAKEFILE) kabc/plugins/file/$(MAKEFILE) kabc/plugins/dir/$(MAKEFILE)
106 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 106 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
107 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 107 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
108 ( [ -d libical ] && cd libical ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 108 ( [ -d libical ] && cd libical ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
109 ( [ -d libkcal ] && cd libkcal ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 109 ( [ -d libkcal ] && cd libkcal ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
110 ( [ -d microkde ] && cd microkde ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 110 ( [ -d microkde ] && cd microkde ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
111 ( [ -d libkdepim ] && cd libkdepim ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 111 ( [ -d libkdepim ] && cd libkdepim ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
112 ( [ -d kabc ] && cd kabc ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 112 ( [ -d kabc ] && cd kabc ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
113 ( [ -d korganizer ] && cd korganizer ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 113 ( [ -d korganizer ] && cd korganizer ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
114 ( [ -d kaddressbook ] && cd kaddressbook ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 114 ( [ -d kaddressbook ] && cd kaddressbook ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
115 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 115 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
116 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true 116 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true
117clean uicables mocables uiclean mocclean lexclean yaccclean : qmake_all FORCE 117clean uicables mocables uiclean mocclean lexclean yaccclean : qmake_all FORCE
118 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; ) || true 118 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; ) || true
119 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) $@; ) || true 119 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) $@; ) || true
120 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; ) || true 120 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; ) || true
121 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; ) || true 121 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; ) || true
122 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; ) || true 122 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; ) || true
123 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; ) || true 123 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; ) || true
124 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; ) || true 124 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; ) || true
125 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; ) || true 125 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; ) || true
126 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; ) || true 126 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; ) || true
127 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; ) || true 127 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; ) || true
128 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; ) || true 128 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; ) || true
129uninstall_subdirs: qmake_all FORCE 129uninstall_subdirs: qmake_all FORCE
130 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 130 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
131 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 131 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
132 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 132 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
133 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 133 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
134 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 134 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
135 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 135 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
136 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 136 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
137 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 137 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
138 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 138 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
139 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 139 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
140 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true 140 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true
141install_subdirs: qmake_all FORCE 141install_subdirs: qmake_all FORCE
142 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) install; ) || true 142 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) install; ) || true
143 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) install; ) || true 143 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) install; ) || true
144 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) install; ) || true 144 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) install; ) || true
145 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) install; ) || true 145 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) install; ) || true
146 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) install; ) || true 146 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) install; ) || true
147 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) install; ) || true 147 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) install; ) || true
148 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) install; ) || true 148 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) install; ) || true
149 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) install; ) || true 149 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) install; ) || true
150 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) install; ) || true 150 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) install; ) || true
151 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) install; ) || true 151 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) install; ) || true
152 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) install; ) || true 152 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) install; ) || true
153distclean: qmake_all FORCE 153distclean: qmake_all FORCE
154 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 154 ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
155 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 155 ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
156 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 156 ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
157 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 157 ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
158 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 158 ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
159 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 159 ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
160 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 160 ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
161 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 161 ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
162 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 162 ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
163 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 163 ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
164 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true 164 ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true
165 165
166install: install_subdirs 166install: install_subdirs
167 167
168uninstall: uninstall_subdirs 168uninstall: uninstall_subdirs
169 169
170FORCE: 170FORCE:
171 171
diff --git a/kde2file/caldump/main.cpp b/kde2file/caldump/main.cpp
index 76bfad3..8d81307 100644
--- a/kde2file/caldump/main.cpp
+++ b/kde2file/caldump/main.cpp
@@ -1,208 +1,245 @@
1/******************************************************************************* 1/*******************************************************************************
2 * main.cpp * 2 * main.cpp *
3 * * 3 * *
4 * 4 *
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by * 7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or * 8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. * 9 * (at your option) any later version. *
10 * * 10 * *
11 * This program is distributed in the hope that it will be useful, * 11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. * 14 * GNU General Public License for more details. *
15 * * 15 * *
16 * You should have received a copy of the GNU General Public License * 16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software * 17 * along with this program; if not, write to the Free Software *
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 * * 19 * *
20 * As a special exception, permission is given to link this program * 20 * As a special exception, permission is given to link this program *
21 * with any edition of Qt, and distribute the resulting executable, * 21 * with any edition of Qt, and distribute the resulting executable, *
22 * without including the source code for Qt in the source distribution. * 22 * without including the source code for Qt in the source distribution. *
23 * * 23 * *
24 ******************************************************************************/ 24 ******************************************************************************/
25 25
26#ifdef HAVE_CONFIG_H 26#ifdef HAVE_CONFIG_H
27#include "config.h" 27#include "config.h"
28#endif 28#endif
29 29
30#if TIME_WITH_SYS_TIME 30#if TIME_WITH_SYS_TIME
31# include <sys/time.h> 31# include <sys/time.h>
32# include <time.h> 32# include <time.h>
33#else 33#else
34# if HAVE_SYS_TIME_H 34# if HAVE_SYS_TIME_H
35# include <sys/time.h> 35# include <sys/time.h>
36# else 36# else
37# include <time.h> 37# include <time.h>
38# endif 38# endif
39#endif 39#endif
40 40
41#include <kcmdlineargs.h> 41#include <kcmdlineargs.h>
42#include <kaboutdata.h> 42#include <kaboutdata.h>
43#include <klocale.h> 43#include <klocale.h>
44#include <kglobal.h> 44#include <kglobal.h>
45#include <kconfig.h> 45#include <kconfig.h>
46#include <kstandarddirs.h> 46#include <kstandarddirs.h>
47#include <kdebug.h> 47#include <kdebug.h>
48 48
49#include <libkcal/calformat.h> 49#include <libkcal/calformat.h>
50#include <libkcal/calendarresources.h> 50#include <libkcal/calendarresources.h>
51#include <libkcal/resourcelocal.h> 51#include <libkcal/resourcelocal.h>
52#include <libkcal/filestorage.h> 52#include <libkcal/filestorage.h>
53#include <libkcal/icalformat.h> 53#include <libkcal/icalformat.h>
54 54
55#include <qdatetime.h> 55#include <qdatetime.h>
56#include <qfile.h> 56#include <qfile.h>
57#include <qdir.h>
57 58
58#include <stdlib.h> 59#include <stdlib.h>
59#include <iostream> 60#include <iostream>
60 61
61using namespace KCal; 62using namespace KCal;
62using namespace std; 63using namespace std;
63 64
64static const char progName[] = "kdecalendar"; 65static const char progName[] = "kdecalendar";
65static const char progDisplay[] = "KDE_Calendar"; 66static const char progDisplay[] = "KDE_Calendar";
66static const char progVersion[] = "33.1/3"; 67static const char progVersion[] = "33.1/3";
67static const char progDesc[] = "A command line interface to KDE calendars"; 68static const char progDesc[] = "A command line interface to KDE calendars";
68 69
69 70
70static KCmdLineOptions options[] = 71static KCmdLineOptions options[] =
71 { 72 {
72 { "dump", 73 { "dump",
73 I18N_NOOP( "Dumps calendar" ), 0 }, 74 I18N_NOOP( "Dumps calendar" ), 0 },
74 { "read", 75 { "read",
75 I18N_NOOP( "Reads calendar" ), 0 }, 76 I18N_NOOP( "Reads calendar" ), 0 },
76 KCmdLineLastOption 77 KCmdLineLastOption
77 }; 78 };
78 79
79int main( int argc, char *argv[] ) 80int main( int argc, char *argv[] )
80{ 81{
81 KAboutData aboutData( 82 KAboutData aboutData(
82 progName, // internal program name 83 progName, // internal program name
83 I18N_NOOP( progDisplay ), // displayable program name. 84 I18N_NOOP( progDisplay ), // displayable program name.
84 progVersion, // version string 85 progVersion, // version string
85 I18N_NOOP( progDesc ), // short porgram description 86 I18N_NOOP( progDesc ), // short porgram description
86 KAboutData::License_GPL, // license type 87 KAboutData::License_GPL, // license type
87 "(c) 2004, Lutz Rogowski", // copyright statement 88 "(c) 2004, Lutz Rogowski", // copyright statement
88 0, // any free form text 89 0, // any free form text
89 "", // program home page address 90 "", // program home page address
90 "bugs.kde.org" // bug report email address 91 "bugs.kde.org" // bug report email address
91 ); 92 );
92 93
93 94
94 // KCmdLineArgs::init() final 'true' argument indicates no commandline options 95 // KCmdLineArgs::init() final 'true' argument indicates no commandline options
95 // for QApplication/KApplication (no KDE or Qt options) 96 // for QApplication/KApplication (no KDE or Qt options)
96 KCmdLineArgs::init( argc, argv, &aboutData, true ); 97 KCmdLineArgs::init( argc, argv, &aboutData, true );
97 KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. 98 KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
98 99
99 KInstance ins ( progName ); 100 KInstance ins ( progName );
100 101
101 KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); 102 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
102 103
103 bool read = false; 104 bool read = false;
104 if ( args->isSet( "read" ) ) { 105 if ( args->isSet( "read" ) ) {
105 read = true; 106 read = true;
106 qDebug("read "); 107 qDebug("read ");
107 } 108 }
109 QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics";
108 CalendarResources *calendarResource = 0; 110 CalendarResources *calendarResource = 0;
109 CalendarLocal *localCalendar = 0; 111 CalendarLocal *localCalendar = 0;
110 112 KConfig c( locate( "config", "korganizerrc" ) );
111 calendarResource = new CalendarResources( "" ); 113 c.setGroup( "Time & Date" );
114 QString tz = c.readEntry( "TimeZoneId" );
115 calendarResource = new CalendarResources( tz );
112 calendarResource->readConfig(); 116 calendarResource->readConfig();
113 calendarResource->load(); 117 calendarResource->load();
114 qDebug("************************************* "); 118 qDebug("************************************* ");
115 qDebug("************************************* "); 119 qDebug("**************kdecaldump************* ");
116 qDebug("************************************* "); 120 qDebug("************************************* ");
117 qDebug("Using timezone id: %s", calendarResource->timeZoneId().latin1()); 121 qDebug("Using timezone id: %s", calendarResource->timeZoneId().latin1());
118 122
119 if ( !read ) { 123 if ( !read ) {
120 localCalendar = new CalendarLocal(); 124 localCalendar = new CalendarLocal();
121 localCalendar->setTimeZoneId( calendarResource->timeZoneId()); 125 localCalendar->setTimeZoneId( calendarResource->timeZoneId());
122 KCal::Incidence::List allInc = calendarResource->rawIncidences(); 126 KCal::Incidence::List allInc = calendarResource->rawIncidences();
123 Incidence::List::ConstIterator it; 127 Incidence::List::ConstIterator it;
124 int num = 0; 128 int num = 0;
125 for( it = allInc.begin(); it != allInc.end(); ++it ) { 129 for( it = allInc.begin(); it != allInc.end(); ++it ) {
126 ResourceCalendar * re = calendarResource->resource( (*it) ); 130 ResourceCalendar * re = calendarResource->resource( (*it) );
127 if ( re && !re->readOnly() ) { 131 if ( re && !re->readOnly() ) {
128 ++num; 132 ++num;
129 Incidence* cl = (*it)->clone(); 133 Incidence* cl = (*it)->clone();
130 cl->setLastModified( (*it)->lastModified() ); 134 cl->setLastModified( (*it)->lastModified() );
131 if ( cl->type() == "Journal" ) 135 if ( cl->type() == "Journal" )
132 localCalendar->addJournal( (Journal *) cl ); 136 localCalendar->addJournal( (Journal *) cl );
133 else if ( cl->type() == "Todo" ) 137 else if ( cl->type() == "Todo" )
134 localCalendar->addTodo( (Todo *) cl ); 138 localCalendar->addTodo( (Todo *) cl );
135 else if ( cl->type() == "Event" ) 139 else if ( cl->type() == "Event" )
136 localCalendar->addEvent( (Event *) cl ); 140 localCalendar->addEvent( (Event *) cl );
137 } 141 }
138 } 142 }
139 143
140 FileStorage* storage = new FileStorage( calendarResource ); 144 FileStorage* storage = new FileStorage( calendarResource );
141 storage->setFileName( "/tmp/kdedumpall.ics" ); 145 storage->setFileName( fileName );
142 storage->setSaveFormat( new ICalFormat() ); 146 storage->setSaveFormat( new ICalFormat() );
143 storage->save(); 147 storage->save();
144 delete storage; 148 delete storage;
145 qDebug("************************************* "); 149 qDebug("************************************* ");
150 qDebug("************kdecaldump*************** ");
146 qDebug("************************************* "); 151 qDebug("************************************* ");
147 qDebug("************************************* "); 152 qDebug("%d calendar entries dumped to file %s", num, fileName.latin1());
148 qDebug("%d calendar entries dumped to file /tmp/kdedumpall.ics", num);
149 153
150 } else { 154 } else {
151 localCalendar = new CalendarLocal(); 155 localCalendar = new CalendarLocal();
152 localCalendar->setTimeZoneId( calendarResource->timeZoneId()); 156 localCalendar->setTimeZoneId( calendarResource->timeZoneId());
153 FileStorage* storage = new FileStorage( localCalendar ); 157 FileStorage* storage = new FileStorage( localCalendar );
154 storage->setFileName( "/tmp/kdedumpall.ics" ); 158 storage->setFileName( fileName );
155 int num = 0; 159 int num = 0;
156 int del = 0; 160 int del = 0;
161 int add = 0;
157 if ( storage->load() ) { 162 if ( storage->load() ) {
158 KCal::Incidence::List allInc = calendarResource->rawIncidences();
159 KCal::Incidence::List newInc = localCalendar->rawIncidences(); 163 KCal::Incidence::List newInc = localCalendar->rawIncidences();
160 Incidence::List::ConstIterator it; 164 Incidence::List::ConstIterator it;
161 for( it = allInc.begin(); it != allInc.end(); ++it ) { 165 for( it = newInc.begin(); it != newInc.end(); ++it ) {
162 ResourceCalendar * re = calendarResource->resource( (*it) ); 166 Incidence* cl = (*it)->clone();
163 if ( re && !re->readOnly() ) { 167 Incidence *incOld = calendarResource->incidence( cl->uid() );
164 Incidence* cl = localCalendar->incidence( (*it)->uid() ); 168 ResourceCalendar * res = 0;
165 if ( cl ) { 169 if ( incOld )
166 QDateTime lm = cl->lastModified(); 170 res = calendarResource->resource( incOld );
167 cl->setResources( (*it)->resources() ); 171 if ( res ) {
168 cl->setLastModified(lm); 172 ++num;
169 } 173 if ( incOld->type() == "Journal" )
170 ++del; 174 calendarResource->deleteJournal( (Journal *) incOld );
171 cl = (*it); 175 else if ( incOld->type() == "Todo" )
176 calendarResource->deleteTodo( (Todo *) incOld );
177 else if ( incOld->type() == "Event" )
178 calendarResource->deleteEvent( (Event *) incOld );
179
172 if ( cl->type() == "Journal" ) 180 if ( cl->type() == "Journal" )
173 calendarResource->deleteJournal( (Journal *) cl ); 181 calendarResource->addJournal( (Journal *) cl, res );
174 else if ( cl->type() == "Todo" ) 182 else if ( cl->type() == "Todo" )
175 calendarResource->deleteTodo( (Todo *) cl ); 183 calendarResource->addTodo( (Todo *) cl, res );
176 else if ( cl->type() == "Event" ) 184 else if ( cl->type() == "Event" )
177 calendarResource->deleteEvent( (Event *) cl ); 185 calendarResource->addEvent( (Event *) cl, res );
186
187 } else {
188 if ( incOld ) {
189 qDebug("ERROR: no resource found for old incidence ");
190 if ( incOld->type() == "Journal" )
191 calendarResource->deleteJournal( (Journal *) incOld );
192 else if ( incOld->type() == "Todo" )
193 calendarResource->deleteTodo( (Todo *) incOld );
194 else if ( incOld->type() == "Event" )
195 calendarResource->deleteEvent( (Event *) incOld );
196
197 }
198 calendarResource->addIncidence( cl );
199 ++add;
200 }
201 KCal::Incidence::List allInc = calendarResource->rawIncidences();
202
203 for( it = allInc.begin(); it != allInc.end(); ++it ) {
204 ResourceCalendar * re = calendarResource->resource( (*it) );
205 if ( re && !re->readOnly() ) {
206 Incidence* cl = localCalendar->incidence( (*it)->uid() );
207 if ( !cl ) {
208 ++del;
209 cl = (*it);
210 if ( cl->type() == "Journal" )
211 calendarResource->deleteJournal( (Journal *) cl );
212 else if ( cl->type() == "Todo" )
213 calendarResource->deleteTodo( (Todo *) cl );
214 else if ( cl->type() == "Event" )
215 calendarResource->deleteEvent( (Event *) cl );
216 //QDateTime lm = cl->lastModified();
217 //cl->setResources( (*it)->resources() );
218 //cl->setLastModified(lm);
219 }
220 }
178 } 221 }
179 }
180 for( it = newInc.begin(); it != newInc.end(); ++it ) {
181 Incidence* cl = (*it)->clone();
182 ++num;
183 calendarResource->addIncidence( cl );
184 //cl->setLastModified( (*it)->lastModified() );
185 } 222 }
186 calendarResource->save(); 223 calendarResource->save();
187 qDebug("************************************* "); 224 qDebug("************************************* ");
225 qDebug("************kdecaldump*************** ");
188 qDebug("************************************* "); 226 qDebug("************************************* ");
189 qDebug("************************************* "); 227 qDebug("Calendar entries\nchanged %d\ndeleted %d\nadded %d\nfrom file %s", num,del, add, fileName.latin1());
190 qDebug("%d calendar entries deleted/ %d added from file /tmp/kdedumpall.ics", del, num);
191 228
192 } else 229 } else
193 qDebug("error loading file /tmp/kdedumpall.ics"); 230 qDebug("error loading file /tmp/kdedumpall.ics");
194 231
195 } 232 }
196 233
197 if ( localCalendar ) { 234 if ( localCalendar ) {
198 localCalendar->close(); 235 localCalendar->close();
199 delete localCalendar; 236 delete localCalendar;
200 } 237 }
201 if ( calendarResource ) { 238 if ( calendarResource ) {
202 calendarResource->close(); 239 calendarResource->close();
203 delete calendarResource; 240 delete calendarResource;
204 } 241 }
205 242
206 qDebug("ente "); 243 qDebug("ente ");
207 return 0; 244 return 0;
208} 245}
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index c6e06f8..8851097 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -528,515 +528,518 @@ int KSyncManager::ringSync()
528 } 528 }
529 timer.start(); 529 timer.start();
530 while ( timer.elapsed () < 2000 ) { 530 while ( timer.elapsed () < 2000 ) {
531 qApp->processEvents(); 531 qApp->processEvents();
532 } 532 }
533 } else 533 } else
534 syncRemote( temp, false ); 534 syncRemote( temp, false );
535 535
536 } 536 }
537 } 537 }
538 timer.start(); 538 timer.start();
539 mParent->topLevelWidget()->setCaption(i18n("Multiple sync in progress ... please wait!") ); 539 mParent->topLevelWidget()->setCaption(i18n("Multiple sync in progress ... please wait!") );
540 while ( timer.elapsed () < 2000 ) { 540 while ( timer.elapsed () < 2000 ) {
541 qApp->processEvents(); 541 qApp->processEvents();
542#ifndef _WIN32_ 542#ifndef _WIN32_
543 sleep (1); 543 sleep (1);
544#endif 544#endif
545 } 545 }
546 546
547 } 547 }
548 548
549 } 549 }
550 delete temp; 550 delete temp;
551 return syncedProfiles; 551 return syncedProfiles;
552} 552}
553 553
554void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) 554void KSyncManager::syncRemote( KSyncProfile* prof, bool ask)
555{ 555{
556 QString question; 556 QString question;
557 if ( ask ) { 557 if ( ask ) {
558 question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; 558 question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n";
559 if ( QMessageBox::information( mParent, i18n("Sync"), 559 if ( QMessageBox::information( mParent, i18n("Sync"),
560 question, 560 question,
561 i18n("Yes"), i18n("No"), 561 i18n("Yes"), i18n("No"),
562 0, 0 ) != 0 ) 562 0, 0 ) != 0 )
563 return; 563 return;
564 } 564 }
565 565
566 QString preCommand; 566 QString preCommand;
567 QString localTempFile; 567 QString localTempFile;
568 QString postCommand; 568 QString postCommand;
569 569
570 switch(mTargetApp) 570 switch(mTargetApp)
571 { 571 {
572 case (KAPI): 572 case (KAPI):
573 preCommand = prof->getPreSyncCommandAB(); 573 preCommand = prof->getPreSyncCommandAB();
574 postCommand = prof->getPostSyncCommandAB(); 574 postCommand = prof->getPostSyncCommandAB();
575 localTempFile = prof->getLocalTempFileAB(); 575 localTempFile = prof->getLocalTempFileAB();
576 break; 576 break;
577 case (KOPI): 577 case (KOPI):
578 preCommand = prof->getPreSyncCommand(); 578 preCommand = prof->getPreSyncCommand();
579 postCommand = prof->getPostSyncCommand(); 579 postCommand = prof->getPostSyncCommand();
580 localTempFile = prof->getLocalTempFile(); 580 localTempFile = prof->getLocalTempFile();
581 break; 581 break;
582 case (PWMPI): 582 case (PWMPI):
583 preCommand = prof->getPreSyncCommandPWM(); 583 preCommand = prof->getPreSyncCommandPWM();
584 postCommand = prof->getPostSyncCommandPWM(); 584 postCommand = prof->getPostSyncCommandPWM();
585 localTempFile = prof->getLocalTempFilePWM(); 585 localTempFile = prof->getLocalTempFilePWM();
586 break; 586 break;
587 default: 587 default:
588 qDebug("KSyncManager::syncRemote: invalid apptype selected"); 588 qDebug("KSyncManager::syncRemote: invalid apptype selected");
589 break; 589 break;
590 } 590 }
591 591
592 592
593 int fi; 593 int fi;
594 if ( (fi = preCommand.find("$PWD$")) > 0 ) { 594 if ( (fi = preCommand.find("$PWD$")) > 0 ) {
595 QString pwd = getPassword(); 595 QString pwd = getPassword();
596 preCommand = preCommand.left( fi )+ pwd + preCommand.mid( fi+5 ); 596 preCommand = preCommand.left( fi )+ pwd + preCommand.mid( fi+5 );
597 597
598 } 598 }
599 int maxlen = 30; 599 int maxlen = 30;
600 if ( QApplication::desktop()->width() > 320 ) 600 if ( QApplication::desktop()->width() > 320 )
601 maxlen += 25; 601 maxlen += 25;
602 mParent->topLevelWidget()->setCaption ( i18n( "Copy remote file to local machine..." ) ); 602 mParent->topLevelWidget()->setCaption ( i18n( "Copy remote file to local machine..." ) );
603 int fileSize = 0; 603 int fileSize = 0;
604 int result = system ( preCommand ); 604 int result = system ( preCommand );
605 // 0 : okay 605 // 0 : okay
606 // 256: no such file or dir 606 // 256: no such file or dir
607 // 607 //
608 qDebug("Sync: Remote copy result(0 = okay): %d ",result ); 608 qDebug("Sync: Remote copy result(0 = okay): %d ",result );
609 if ( result != 0 ) { 609 if ( result != 0 ) {
610 unsigned int len = maxlen; 610 unsigned int len = maxlen;
611 while ( len < preCommand.length() ) { 611 while ( len < preCommand.length() ) {
612 preCommand.insert( len , "\n" ); 612 preCommand.insert( len , "\n" );
613 len += maxlen +2; 613 len += maxlen +2;
614 } 614 }
615 question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (preCommand) ; 615 question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (preCommand) ;
616 QMessageBox::information( mParent, i18n("Sync - ERROR"), 616 QMessageBox::information( mParent, i18n("Sync - ERROR"),
617 question, 617 question,
618 i18n("Okay!")) ; 618 i18n("Okay!")) ;
619 mParent->topLevelWidget()->setCaption ("KDE-Pim"); 619 mParent->topLevelWidget()->setCaption ("KDE-Pim");
620 return; 620 return;
621 } 621 }
622 mParent->topLevelWidget()->setCaption ( i18n( "Copying succeed." ) ); 622 mParent->topLevelWidget()->setCaption ( i18n( "Copying succeed." ) );
623 //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); 623 //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() );
624 624
625 if ( syncWithFile( localTempFile, true ) ) { 625 if ( syncWithFile( localTempFile, true ) ) {
626 626
627 if ( mWriteBackFile ) { 627 if ( mWriteBackFile ) {
628 int fi; 628 int fi;
629 if ( (fi = postCommand.find("$PWD$")) > 0 ) { 629 if ( (fi = postCommand.find("$PWD$")) > 0 ) {
630 QString pwd = getPassword(); 630 QString pwd = getPassword();
631 postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 ); 631 postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 );
632 632
633 } 633 }
634 mParent->topLevelWidget()->setCaption ( i18n( "Writing back file ..." ) ); 634 mParent->topLevelWidget()->setCaption ( i18n( "Writing back file ..." ) );
635 result = system ( postCommand ); 635 result = system ( postCommand );
636 qDebug("Sync:Writing back file result: %d ", result); 636 qDebug("Sync:Writing back file result: %d ", result);
637 if ( result != 0 ) { 637 if ( result != 0 ) {
638 mParent->topLevelWidget()->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); 638 mParent->topLevelWidget()->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) );
639 return; 639 return;
640 } else { 640 } else {
641 mParent->topLevelWidget()->setCaption ( i18n( "Syncronization sucessfully completed" ) ); 641 mParent->topLevelWidget()->setCaption ( i18n( "Syncronization sucessfully completed" ) );
642 } 642 }
643 } 643 }
644 } 644 }
645 return; 645 return;
646} 646}
647void KSyncManager::edit_pisync_options() 647void KSyncManager::edit_pisync_options()
648{ 648{
649 QDialog dia( mParent, "dia", true ); 649 QDialog dia( mParent, "dia", true );
650 dia.setCaption( i18n("Pi-Sync options for device: " ) +mCurrentSyncDevice ); 650 dia.setCaption( i18n("Pi-Sync options for device: " ) +mCurrentSyncDevice );
651 QVBoxLayout lay ( &dia ); 651 QVBoxLayout lay ( &dia );
652 lay.setSpacing( 5 ); 652 lay.setSpacing( 5 );
653 lay.setMargin( 3 ); 653 lay.setMargin( 3 );
654 QLabel lab1 ( i18n("Password for remote access:"), &dia); 654 QLabel lab1 ( i18n("Password for remote access:"), &dia);
655 lay.addWidget( &lab1 ); 655 lay.addWidget( &lab1 );
656 QLineEdit le1 (&dia ); 656 QLineEdit le1 (&dia );
657 lay.addWidget( &le1 ); 657 lay.addWidget( &le1 );
658 QLabel lab2 ( i18n("Remote IP address:"), &dia); 658 QLabel lab2 ( i18n("Remote IP address:"), &dia);
659 lay.addWidget( &lab2 ); 659 lay.addWidget( &lab2 );
660 QLineEdit le2 (&dia ); 660 QLineEdit le2 (&dia );
661 lay.addWidget( &le2 ); 661 lay.addWidget( &le2 );
662 QLabel lab3 ( i18n("Remote port number:"), &dia); 662 QLabel lab3 ( i18n("Remote port number:"), &dia);
663 lay.addWidget( &lab3 ); 663 lay.addWidget( &lab3 );
664 QLineEdit le3 (&dia ); 664 QLineEdit le3 (&dia );
665 lay.addWidget( &le3 ); 665 lay.addWidget( &le3 );
666 QPushButton pb ( "OK", &dia); 666 QPushButton pb ( "OK", &dia);
667 lay.addWidget( &pb ); 667 lay.addWidget( &pb );
668 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 668 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
669 le1.setText( mPassWordPiSync ); 669 le1.setText( mPassWordPiSync );
670 le2.setText( mActiveSyncIP ); 670 le2.setText( mActiveSyncIP );
671 le3.setText( mActiveSyncPort ); 671 le3.setText( mActiveSyncPort );
672 if ( dia.exec() ) { 672 if ( dia.exec() ) {
673 mPassWordPiSync = le1.text(); 673 mPassWordPiSync = le1.text();
674 mActiveSyncPort = le3.text(); 674 mActiveSyncPort = le3.text();
675 mActiveSyncIP = le2.text(); 675 mActiveSyncIP = le2.text();
676 } 676 }
677 677
678} 678}
679void KSyncManager::edit_sync_options() 679void KSyncManager::edit_sync_options()
680{ 680{
681 681
682 QDialog dia( mParent, "dia", true ); 682 QDialog dia( mParent, "dia", true );
683 dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); 683 dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice );
684 QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia); 684 QButtonGroup gr ( 1, Qt::Horizontal, i18n("Sync preferences"), &dia);
685 QVBoxLayout lay ( &dia ); 685 QVBoxLayout lay ( &dia );
686 lay.setSpacing( 2 ); 686 lay.setSpacing( 2 );
687 lay.setMargin( 3 ); 687 lay.setMargin( 3 );
688 lay.addWidget(&gr); 688 lay.addWidget(&gr);
689 QRadioButton loc ( i18n("Take local entry on conflict"), &gr ); 689 QRadioButton loc ( i18n("Take local entry on conflict"), &gr );
690 QRadioButton rem ( i18n("Take remote entry on conflict"), &gr ); 690 QRadioButton rem ( i18n("Take remote entry on conflict"), &gr );
691 QRadioButton newest( i18n("Take newest entry on conflict"), &gr ); 691 QRadioButton newest( i18n("Take newest entry on conflict"), &gr );
692 QRadioButton ask( i18n("Ask for every entry on conflict"), &gr ); 692 QRadioButton ask( i18n("Ask for every entry on conflict"), &gr );
693 QRadioButton f_loc( i18n("Force: Take local entry always"), &gr ); 693 QRadioButton f_loc( i18n("Force: Take local entry always"), &gr );
694 QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr ); 694 QRadioButton f_rem( i18n("Force: Take remote entry always"), &gr );
695 //QRadioButton both( i18n("Take both on conflict"), &gr ); 695 //QRadioButton both( i18n("Take both on conflict"), &gr );
696 QPushButton pb ( "OK", &dia); 696 QPushButton pb ( "OK", &dia);
697 lay.addWidget( &pb ); 697 lay.addWidget( &pb );
698 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 698 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
699 switch ( mSyncAlgoPrefs ) { 699 switch ( mSyncAlgoPrefs ) {
700 case 0: 700 case 0:
701 loc.setChecked( true); 701 loc.setChecked( true);
702 break; 702 break;
703 case 1: 703 case 1:
704 rem.setChecked( true ); 704 rem.setChecked( true );
705 break; 705 break;
706 case 2: 706 case 2:
707 newest.setChecked( true); 707 newest.setChecked( true);
708 break; 708 break;
709 case 3: 709 case 3:
710 ask.setChecked( true); 710 ask.setChecked( true);
711 break; 711 break;
712 case 4: 712 case 4:
713 f_loc.setChecked( true); 713 f_loc.setChecked( true);
714 break; 714 break;
715 case 5: 715 case 5:
716 f_rem.setChecked( true); 716 f_rem.setChecked( true);
717 break; 717 break;
718 case 6: 718 case 6:
719 // both.setChecked( true); 719 // both.setChecked( true);
720 break; 720 break;
721 default: 721 default:
722 break; 722 break;
723 } 723 }
724 if ( dia.exec() ) { 724 if ( dia.exec() ) {
725 mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; 725 mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ;
726 } 726 }
727 727
728 728
729} 729}
730 730
731QString KSyncManager::getPassword( ) 731QString KSyncManager::getPassword( )
732{ 732{
733 QString retfile = ""; 733 QString retfile = "";
734 QDialog dia ( mParent, "input-dialog", true ); 734 QDialog dia ( mParent, "input-dialog", true );
735 QLineEdit lab ( &dia ); 735 QLineEdit lab ( &dia );
736 lab.setEchoMode( QLineEdit::Password ); 736 lab.setEchoMode( QLineEdit::Password );
737 QVBoxLayout lay( &dia ); 737 QVBoxLayout lay( &dia );
738 lay.setMargin(7); 738 lay.setMargin(7);
739 lay.setSpacing(7); 739 lay.setSpacing(7);
740 lay.addWidget( &lab); 740 lay.addWidget( &lab);
741 dia.setFixedSize( 230,50 ); 741 dia.setFixedSize( 230,50 );
742 dia.setCaption( i18n("Enter password") ); 742 dia.setCaption( i18n("Enter password") );
743 QPushButton pb ( "OK", &dia); 743 QPushButton pb ( "OK", &dia);
744 lay.addWidget( &pb ); 744 lay.addWidget( &pb );
745 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 745 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
746 dia.show(); 746 dia.show();
747 int res = dia.exec(); 747 int res = dia.exec();
748 if ( res ) 748 if ( res )
749 retfile = lab.text(); 749 retfile = lab.text();
750 dia.hide(); 750 dia.hide();
751 qApp->processEvents(); 751 qApp->processEvents();
752 return retfile; 752 return retfile;
753 753
754} 754}
755 755
756 756
757void KSyncManager::confSync() 757void KSyncManager::confSync()
758{ 758{
759 static KSyncPrefsDialog* sp = 0; 759 static KSyncPrefsDialog* sp = 0;
760 if ( ! sp ) { 760 if ( ! sp ) {
761 sp = new KSyncPrefsDialog( mParent, "syncprefs", true ); 761 sp = new KSyncPrefsDialog( mParent, "syncprefs", true );
762 } 762 }
763 sp->usrReadConfig(); 763 sp->usrReadConfig();
764#ifndef DESKTOP_VERSION 764#ifndef DESKTOP_VERSION
765 sp->showMaximized(); 765 sp->showMaximized();
766#else 766#else
767 sp->show(); 767 sp->show();
768#endif 768#endif
769 sp->exec(); 769 sp->exec();
770 mSyncProfileNames = sp->getSyncProfileNames(); 770 mSyncProfileNames = sp->getSyncProfileNames();
771 mLocalMachineName = sp->getLocalMachineName (); 771 mLocalMachineName = sp->getLocalMachineName ();
772 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); 772 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
773} 773}
774void KSyncManager::syncKDE() 774void KSyncManager::syncKDE()
775{ 775{
776 emit save(); 776 emit save();
777 switch(mTargetApp) 777 switch(mTargetApp)
778 { 778 {
779 case (KAPI): 779 case (KAPI):
780 780
781 break; 781 break;
782 case (KOPI): 782 case (KOPI):
783 { 783 {
784 QString command ="./kdecaldump"; 784 QString command = qApp->applicationDirPath () + "/kdecaldump";
785 if ( ! QFile::exists ( command ) )
786 command = "kdecaldump";
787 QString fileName = QDir::homeDirPath ()+"/.kdecalendardump.ics";
785 system ( command.latin1()); 788 system ( command.latin1());
786 if ( syncWithFile( "/tmp/kdedumpall.ics",true ) ) { 789 if ( syncWithFile( fileName,true ) ) {
787 if ( mWriteBackFile ) { 790 if ( mWriteBackFile ) {
788 command += " --read"; 791 command += " --read";
789 system ( command.latin1()); 792 system ( command.latin1());
790 } 793 }
791 } 794 }
792 795
793 } 796 }
794 break; 797 break;
795 case (PWMPI): 798 case (PWMPI):
796 799
797 break; 800 break;
798 default: 801 default:
799 qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); 802 qDebug("KSyncManager::slotSyncMenu: invalid apptype selected");
800 break; 803 break;
801 804
802 } 805 }
803} 806}
804 807
805void KSyncManager::syncSharp() 808void KSyncManager::syncSharp()
806{ 809{
807 810
808 if ( ! syncExternalApplication("sharp") ) 811 if ( ! syncExternalApplication("sharp") )
809 qDebug("ERROR sync sharp "); 812 qDebug("ERROR sync sharp ");
810} 813}
811 814
812bool KSyncManager::syncExternalApplication(QString resource) 815bool KSyncManager::syncExternalApplication(QString resource)
813{ 816{
814 817
815 emit save(); 818 emit save();
816 819
817 if ( mAskForPreferences ) 820 if ( mAskForPreferences )
818 edit_sync_options(); 821 edit_sync_options();
819 822
820 qDebug("Sync extern %s", resource.latin1()); 823 qDebug("Sync extern %s", resource.latin1());
821 824
822 bool syncOK = mImplementation->syncExternal(this, resource); 825 bool syncOK = mImplementation->syncExternal(this, resource);
823 826
824 return syncOK; 827 return syncOK;
825 828
826} 829}
827 830
828void KSyncManager::syncPhone() 831void KSyncManager::syncPhone()
829{ 832{
830 833
831 syncExternalApplication("phone"); 834 syncExternalApplication("phone");
832 835
833} 836}
834 837
835void KSyncManager::showProgressBar(int percentage, QString caption, int total) 838void KSyncManager::showProgressBar(int percentage, QString caption, int total)
836{ 839{
837 if (!bar->isVisible()) 840 if (!bar->isVisible())
838 { 841 {
839 bar->setCaption (caption); 842 bar->setCaption (caption);
840 bar->setTotalSteps ( total ) ; 843 bar->setTotalSteps ( total ) ;
841 844
842 bar->show(); 845 bar->show();
843 } 846 }
844 847
845 bar->setProgress( percentage ); 848 bar->setProgress( percentage );
846} 849}
847 850
848void KSyncManager::hideProgressBar() 851void KSyncManager::hideProgressBar()
849{ 852{
850 bar->hide(); 853 bar->hide();
851} 854}
852 855
853bool KSyncManager::isProgressBarCanceled() 856bool KSyncManager::isProgressBarCanceled()
854{ 857{
855 return !bar->isVisible(); 858 return !bar->isVisible();
856} 859}
857 860
858QString KSyncManager::syncFileName() 861QString KSyncManager::syncFileName()
859{ 862{
860 863
861 QString fn = "tempfile"; 864 QString fn = "tempfile";
862 switch(mTargetApp) 865 switch(mTargetApp)
863 { 866 {
864 case (KAPI): 867 case (KAPI):
865 fn = "tempsyncab.vcf"; 868 fn = "tempsyncab.vcf";
866 break; 869 break;
867 case (KOPI): 870 case (KOPI):
868 fn = "tempsynccal.ics"; 871 fn = "tempsynccal.ics";
869 break; 872 break;
870 case (PWMPI): 873 case (PWMPI):
871 fn = "tempsyncpw.pwm"; 874 fn = "tempsyncpw.pwm";
872 break; 875 break;
873 default: 876 default:
874 break; 877 break;
875 } 878 }
876#ifdef _WIN32_ 879#ifdef _WIN32_
877 return locateLocal( "tmp", fn ); 880 return locateLocal( "tmp", fn );
878#else 881#else
879 return (QString( "/tmp/" )+ fn ); 882 return (QString( "/tmp/" )+ fn );
880#endif 883#endif
881} 884}
882 885
883void KSyncManager::syncPi() 886void KSyncManager::syncPi()
884{ 887{
885 mPisyncFinished = false; 888 mPisyncFinished = false;
886 qApp->processEvents(); 889 qApp->processEvents();
887 if ( mAskForPreferences ) 890 if ( mAskForPreferences )
888 edit_pisync_options(); 891 edit_pisync_options();
889 bool ok; 892 bool ok;
890 Q_UINT16 port = mActiveSyncPort.toUInt(&ok); 893 Q_UINT16 port = mActiveSyncPort.toUInt(&ok);
891 if ( ! ok ) { 894 if ( ! ok ) {
892 mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); 895 mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") );
893 return; 896 return;
894 } 897 }
895 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this ); 898 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this );
896 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); 899 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) );
897 mParent->topLevelWidget()->setCaption( i18n("Sending request for remote file ...") ); 900 mParent->topLevelWidget()->setCaption( i18n("Sending request for remote file ...") );
898 commandSocket->readFile( syncFileName() ); 901 commandSocket->readFile( syncFileName() );
899} 902}
900 903
901void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) 904void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state)
902{ 905{
903 //enum { success, errorW, errorR, quiet }; 906 //enum { success, errorW, errorR, quiet };
904 if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) { 907 if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) {
905 mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); 908 mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") );
906 delete s; 909 delete s;
907 if ( state == KCommandSocket::errorR ) { 910 if ( state == KCommandSocket::errorR ) {
908 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); 911 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this );
909 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); 912 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
910 commandSocket->sendStop(); 913 commandSocket->sendStop();
911 } 914 }
912 mPisyncFinished = true; 915 mPisyncFinished = true;
913 return; 916 return;
914 917
915 } else if ( state == KCommandSocket::errorW ) { 918 } else if ( state == KCommandSocket::errorW ) {
916 mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); 919 mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") );
917 mPisyncFinished = true; 920 mPisyncFinished = true;
918 921
919 } else if ( state == KCommandSocket::successR ) { 922 } else if ( state == KCommandSocket::successR ) {
920 QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); 923 QTimer::singleShot( 1, this , SLOT ( readFileFromSocket()));
921 924
922 } else if ( state == KCommandSocket::successW ) { 925 } else if ( state == KCommandSocket::successW ) {
923 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); 926 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") );
924 mPisyncFinished = true; 927 mPisyncFinished = true;
925 } 928 }
926 929
927 delete s; 930 delete s;
928} 931}
929 932
930void KSyncManager::readFileFromSocket() 933void KSyncManager::readFileFromSocket()
931{ 934{
932 QString fileName = syncFileName(); 935 QString fileName = syncFileName();
933 mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); 936 mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") );
934 if ( ! syncWithFile( fileName , true ) ) { 937 if ( ! syncWithFile( fileName , true ) ) {
935 mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); 938 mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") );
936 mPisyncFinished = true; 939 mPisyncFinished = true;
937 return; 940 return;
938 } 941 }
939 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); 942 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this );
940 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); 943 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
941 if ( mWriteBackFile ) 944 if ( mWriteBackFile )
942 commandSocket->writeFile( fileName ); 945 commandSocket->writeFile( fileName );
943 else { 946 else {
944 commandSocket->sendStop(); 947 commandSocket->sendStop();
945 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); 948 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") );
946 mPisyncFinished = true; 949 mPisyncFinished = true;
947 } 950 }
948} 951}
949 952
950KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) 953KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name )
951{ 954{
952 mPassWord = pw; 955 mPassWord = pw;
953 mSocket = 0; 956 mSocket = 0;
954 mSyncActionDialog = 0; 957 mSyncActionDialog = 0;
955 blockRC = false; 958 blockRC = false;
956}; 959};
957 960
958void KServerSocket::newConnection ( int socket ) 961void KServerSocket::newConnection ( int socket )
959{ 962{
960 // qDebug("KServerSocket:New connection %d ", socket); 963 // qDebug("KServerSocket:New connection %d ", socket);
961 if ( mSocket ) { 964 if ( mSocket ) {
962 qDebug("KServerSocket::newConnection Socket deleted! "); 965 qDebug("KServerSocket::newConnection Socket deleted! ");
963 delete mSocket; 966 delete mSocket;
964 mSocket = 0; 967 mSocket = 0;
965 } 968 }
966 mSocket = new QSocket( this ); 969 mSocket = new QSocket( this );
967 connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); 970 connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) );
968 connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); 971 connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) );
969 mSocket->setSocket( socket ); 972 mSocket->setSocket( socket );
970} 973}
971 974
972void KServerSocket::discardClient() 975void KServerSocket::discardClient()
973{ 976{
974 //qDebug(" KServerSocket::discardClient()"); 977 //qDebug(" KServerSocket::discardClient()");
975 if ( mSocket ) { 978 if ( mSocket ) {
976 delete mSocket; 979 delete mSocket;
977 mSocket = 0; 980 mSocket = 0;
978 } 981 }
979 //emit endConnect(); 982 //emit endConnect();
980} 983}
981void KServerSocket::readClient() 984void KServerSocket::readClient()
982{ 985{
983 if ( blockRC ) 986 if ( blockRC )
984 return; 987 return;
985 if ( mSocket == 0 ) { 988 if ( mSocket == 0 ) {
986 qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 "); 989 qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 ");
987 return; 990 return;
988 } 991 }
989 //qDebug("KServerSocket::readClient()"); 992 //qDebug("KServerSocket::readClient()");
990 if ( mSocket->canReadLine() ) { 993 if ( mSocket->canReadLine() ) {
991 QString line = mSocket->readLine(); 994 QString line = mSocket->readLine();
992 //qDebug("KServerSocket readline: %s ", line.latin1()); 995 //qDebug("KServerSocket readline: %s ", line.latin1());
993 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); 996 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line );
994 if ( tokens[0] == "GET" ) { 997 if ( tokens[0] == "GET" ) {
995 if ( tokens[1] == mPassWord ) 998 if ( tokens[1] == mPassWord )
996 //emit sendFile( mSocket ); 999 //emit sendFile( mSocket );
997 send_file(); 1000 send_file();
998 else { 1001 else {
999 KMessageBox::error( 0, i18n("Got send file request\nwith invalid password")); 1002 KMessageBox::error( 0, i18n("Got send file request\nwith invalid password"));
1000 //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); 1003 //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() );
1001 } 1004 }
1002 } 1005 }
1003 if ( tokens[0] == "PUT" ) { 1006 if ( tokens[0] == "PUT" ) {
1004 if ( tokens[1] == mPassWord ) { 1007 if ( tokens[1] == mPassWord ) {
1005 //emit getFile( mSocket ); 1008 //emit getFile( mSocket );
1006 blockRC = true; 1009 blockRC = true;
1007 get_file(); 1010 get_file();
1008 } 1011 }
1009 else { 1012 else {
1010 KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password")); 1013 KMessageBox::error( 0, i18n("Got receive file request\nwith invalid password"));
1011 //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); 1014 //qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() );
1012 } 1015 }
1013 } 1016 }
1014 if ( tokens[0] == "STOP" ) { 1017 if ( tokens[0] == "STOP" ) {
1015 //emit endConnect(); 1018 //emit endConnect();
1016 end_connect(); 1019 end_connect();
1017 } 1020 }
1018 } 1021 }
1019} 1022}
1020void KServerSocket::end_connect() 1023void KServerSocket::end_connect()
1021{ 1024{
1022 delete mSyncActionDialog; 1025 delete mSyncActionDialog;
1023 mSyncActionDialog = 0; 1026 mSyncActionDialog = 0;
1024} 1027}
1025void KServerSocket::send_file() 1028void KServerSocket::send_file()
1026{ 1029{
1027 //qDebug("MainWindow::sendFile(QSocket* s) "); 1030 //qDebug("MainWindow::sendFile(QSocket* s) ");
1028 if ( mSyncActionDialog ) 1031 if ( mSyncActionDialog )
1029 delete mSyncActionDialog; 1032 delete mSyncActionDialog;
1030 mSyncActionDialog = new QDialog ( 0, "input-dialog", true ); 1033 mSyncActionDialog = new QDialog ( 0, "input-dialog", true );
1031 mSyncActionDialog->setCaption(i18n("Received sync request")); 1034 mSyncActionDialog->setCaption(i18n("Received sync request"));
1032 QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); 1035 QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog );
1033 QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); 1036 QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog );
1034 lay->addWidget( label); 1037 lay->addWidget( label);
1035 lay->setMargin(7); 1038 lay->setMargin(7);
1036 lay->setSpacing(7); 1039 lay->setSpacing(7);
1037 mSyncActionDialog->setFixedSize( 230, 120); 1040 mSyncActionDialog->setFixedSize( 230, 120);
1038 mSyncActionDialog->show(); 1041 mSyncActionDialog->show();
1039 mSyncActionDialog->raise(); 1042 mSyncActionDialog->raise();
1040 emit request_file(); 1043 emit request_file();
1041 qApp->processEvents(); 1044 qApp->processEvents();
1042 QString fileName = mFileName; 1045 QString fileName = mFileName;