author | zautrix <zautrix> | 2004-10-25 22:23:56 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-25 22:23:56 (UTC) |
commit | dbfa4de9416c28c5424eeee0f36f50de4cfae0ec (patch) (unidiff) | |
tree | 31fa0522ff7821f5b7e98123e16f12455eeb01c9 | |
parent | 03ca6830a9e6742b8873aee04d77b3e094b65d30 (diff) | |
download | kdepimpi-dbfa4de9416c28c5424eeee0f36f50de4cfae0ec.zip kdepimpi-dbfa4de9416c28c5424eeee0f36f50de4cfae0ec.tar.gz kdepimpi-dbfa4de9416c28c5424eeee0f36f50de4cfae0ec.tar.bz2 |
pwmpi windows management fixes
-rw-r--r-- | Makefile | 613 | ||||
-rw-r--r-- | microkde/kdeui/kmainwindow.cpp | 1 | ||||
-rw-r--r-- | microkde/kdeui/kmainwindow.h | 5 | ||||
-rw-r--r-- | pwmanager/pwmanager/getmasterpwwnd_emb.cpp | 2 | ||||
-rw-r--r-- | pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp | 4 | ||||
-rw-r--r-- | pwmanager/pwmanager/libgcryptif.cpp | 5 | ||||
-rw-r--r-- | pwmanager/pwmanager/main.cpp | 1 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwm.cpp | 10 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmdoc.cpp | 1 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmdocui.cpp | 15 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwminit.cpp | 17 |
11 files changed, 296 insertions, 378 deletions
@@ -1,362 +1,253 @@ | |||
1 | export KDEPIMDIR = $(shell pwd) | 1 | ############################################################################# |
2 | 2 | # Makefile for building: kdepim-desktop | |
3 | export KDEPIM_VERSION=$(shell sed -e 's/.*\"\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/' < version) | 3 | # Generated by qmake (1.07a) (Qt 3.3.1) on: Mon Oct 25 11:25:22 2004 |
4 | 4 | # Project: kdepim-desktop.pro | |
5 | ifeq ($(PLATFORM) , zaurus) | 5 | # Template: subdirs |
6 | BUILD_NO_LDAP_PLUGIN=1 | 6 | # Command: $(QMAKE) -o Makefile kdepim-desktop.pro |
7 | endif | 7 | ############################################################################# |
8 | 8 | ||
9 | ifneq ($(PLATFORM) , zaurus) | 9 | MAKEFILE =Makefile |
10 | BUILD_NO_SHARP_PLUGIN=1 | 10 | QMAKE =qmake |
11 | endif | 11 | DEL_FILE = rm -f |
12 | 12 | CHK_DIR_EXISTS= test -d | |
13 | SUBDIRS_MICROKDE = \ | 13 | MKDIR = mkdir -p |
14 | libical/src/libical \ | 14 | SUBTARGETS = \ |
15 | libical/src/libicalss \ | 15 | sub-gammu-emb-common \ |
16 | qtcompat \ | 16 | sub-gammu-emb-gammu \ |
17 | microkde \ | 17 | sub-libical \ |
18 | libkcal \ | 18 | sub-libkcal \ |
19 | libkdepim \ | 19 | sub-microkde \ |
20 | kabc \ | 20 | sub-libkdepim \ |
21 | kabc/formats/binary \ | 21 | sub-kabc \ |
22 | kabc/plugins/file \ | 22 | sub-korganizer \ |
23 | kabc/plugins/dir \ | 23 | sub-kaddressbook \ |
24 | korganizer \ | 24 | sub-kabc-plugins-file \ |
25 | kalarmd \ | 25 | sub-kabc-plugins-dir \ |
26 | kaddressbook | 26 | sub-kabc-plugins-file \ |
27 | 27 | sub-kabc-plugins-qtopia \ | |
28 | SUBDIRS_QTOPIA_PLUGIN = \ | 28 | sub-pwmanager-libcrypt-cipher \ |
29 | kabc/plugins/qtopia | 29 | sub-pwmanager-libcrypt-error \ |
30 | 30 | sub-pwmanager-libcrypt-mpi \ | |
31 | SUBDIRS_OPIE_PLUGIN = \ | 31 | sub-pwmanager-libcrypt-zlib \ |
32 | kabc/plugins/opie | 32 | sub-pwmanager-pwmanager |
33 | 33 | ||
34 | SUBDIRS_SHARP_PLUGIN = \ | 34 | first: all |
35 | kabc/plugins/sharpdtm | 35 | |
36 | 36 | all: Makefile $(SUBTARGETS) | |
37 | SUBDIRS_LDAP_PLUGIN = \ | 37 | |
38 | kabc/plugins/ldap | 38 | gammu/emb/common/$(MAKEFILE): |
39 | 39 | @$(CHK_DIR_EXISTS) "gammu/emb/common" || $(MKDIR) "gammu/emb/common" | |
40 | SUBDIRS_MICROMAIL = \ | 40 | cd gammu/emb/common && $(QMAKE) common.pro -o $(MAKEFILE) |
41 | kmicromail/libetpan \ | 41 | sub-gammu-emb-common: gammu/emb/common/$(MAKEFILE) FORCE |
42 | kmicromail/libmailwrapper \ | 42 | cd gammu/emb/common && $(MAKE) -f $(MAKEFILE) |
43 | kmicromail | 43 | |
44 | 44 | gammu/emb/gammu/$(MAKEFILE): | |
45 | SUBDIRS_GAMMU = \ | 45 | @$(CHK_DIR_EXISTS) "gammu/emb/gammu" || $(MKDIR) "gammu/emb/gammu" |
46 | gammu/emb/common \ | 46 | cd gammu/emb/gammu && $(QMAKE) gammu.pro -o $(MAKEFILE) |
47 | gammu/emb/gammu | 47 | sub-gammu-emb-gammu: gammu/emb/gammu/$(MAKEFILE) FORCE |
48 | 48 | cd gammu/emb/gammu && $(MAKE) -f $(MAKEFILE) | |
49 | SUBDIRS_PWMANAGER = \ | 49 | |
50 | pwmanager/libcrypt/mpi \ | 50 | libical/$(MAKEFILE): |
51 | pwmanager/libcrypt/error \ | 51 | @$(CHK_DIR_EXISTS) "libical" || $(MKDIR) "libical" |
52 | pwmanager/libcrypt/cipher \ | 52 | cd libical && $(QMAKE) libical.pro -o $(MAKEFILE) |
53 | pwmanager/libcrypt/zlib \ | 53 | sub-libical: libical/$(MAKEFILE) FORCE |
54 | pwmanager/pwmanager | 54 | cd libical && $(MAKE) -f $(MAKEFILE) |
55 | 55 | ||
56 | SUBDIRS = \ | 56 | libkcal/$(MAKEFILE): |
57 | $(SUBDIRS_MICROKDE) \ | 57 | @$(CHK_DIR_EXISTS) "libkcal" || $(MKDIR) "libkcal" |
58 | $(SUBDIRS_QTOPIA_PLUGIN) \ | 58 | cd libkcal && $(QMAKE) libkcal.pro -o $(MAKEFILE) |
59 | $(SUBDIRS_OPIE_PLUGIN) \ | 59 | sub-libkcal: libkcal/$(MAKEFILE) FORCE |
60 | $(SUBDIRS_SHARP_PLUGIN) \ | 60 | cd libkcal && $(MAKE) -f $(MAKEFILE) |
61 | $(SUBDIRS_LDAP_PLUGIN) \ | 61 | |
62 | $(SUBDIRS_MICROMAIL) \ | 62 | microkde/$(MAKEFILE): |
63 | $(SUBDIRS_GAMMU) \ | 63 | @$(CHK_DIR_EXISTS) "microkde" || $(MKDIR) "microkde" |
64 | $(SUBDIRS_PWMANAGER) | 64 | cd microkde && $(QMAKE) microkde.pro -o $(MAKEFILE) |
65 | 65 | sub-microkde: microkde/$(MAKEFILE) FORCE | |
66 | 66 | cd microkde && $(MAKE) -f $(MAKEFILE) | |
67 | all: build_microkde \ | 67 | |
68 | build_qtopia_plugin \ | 68 | libkdepim/$(MAKEFILE): |
69 | build_opie_plugin \ | 69 | @$(CHK_DIR_EXISTS) "libkdepim" || $(MKDIR) "libkdepim" |
70 | build_sharp_plugin \ | 70 | cd libkdepim && $(QMAKE) libkdepim.pro -o $(MAKEFILE) |
71 | build_ldap_plugin \ | 71 | sub-libkdepim: libkdepim/$(MAKEFILE) FORCE |
72 | build_micromail \ | 72 | cd libkdepim && $(MAKE) -f $(MAKEFILE) |
73 | build_gammu \ | 73 | |
74 | build_pwmanager | 74 | kabc/$(MAKEFILE): |
75 | 75 | @$(CHK_DIR_EXISTS) "kabc" || $(MKDIR) "kabc" | |
76 | 76 | cd kabc && $(QMAKE) kabc.pro -o $(MAKEFILE) | |
77 | build_microkde: variable_test tmake | 77 | sub-kabc: kabc/$(MAKEFILE) FORCE |
78 | for i in $(SUBDIRS_MICROKDE); do pushd $$i; \ | 78 | cd kabc && $(MAKE) -f $(MAKEFILE) |
79 | make -f Makefile$(PLATFORM) || exit 1; popd; \ | 79 | |
80 | done | 80 | korganizer/$(MAKEFILE): |
81 | 81 | @$(CHK_DIR_EXISTS) "korganizer" || $(MKDIR) "korganizer" | |
82 | build_qtopia_plugin: build_microkde | 82 | cd korganizer && $(QMAKE) korganizer.pro -o $(MAKEFILE) |
83 | ifdef BUILD_NO_QTOPIA_PLUGIN | 83 | sub-korganizer: korganizer/$(MAKEFILE) FORCE |
84 | @echo == qtopia plugin not build. | 84 | cd korganizer && $(MAKE) -f $(MAKEFILE) |
85 | else | 85 | |
86 | for i in $(SUBDIRS_QTOPIA_PLUGIN); do pushd $$i; \ | 86 | kaddressbook/$(MAKEFILE): |
87 | make -f Makefile$(PLATFORM) || exit 1; popd; \ | 87 | @$(CHK_DIR_EXISTS) "kaddressbook" || $(MKDIR) "kaddressbook" |
88 | done | 88 | cd kaddressbook && $(QMAKE) kaddressbook.pro -o $(MAKEFILE) |
89 | endif | 89 | sub-kaddressbook: kaddressbook/$(MAKEFILE) FORCE |
90 | 90 | cd kaddressbook && $(MAKE) -f $(MAKEFILE) | |
91 | build_opie_plugin: build_microkde | 91 | |
92 | ifdef BUILD_NO_OPIE_PLUGIN | 92 | kabc/plugins/file/$(MAKEFILE): |
93 | @echo == opie plugin not build. | 93 | @$(CHK_DIR_EXISTS) "kabc/plugins/file" || $(MKDIR) "kabc/plugins/file" |
94 | else | 94 | cd kabc/plugins/file && $(QMAKE) file.pro -o $(MAKEFILE) |
95 | for i in $(SUBDIRS_OPIE_PLUGIN); do pushd $$i; \ | 95 | sub-kabc-plugins-file: kabc/plugins/file/$(MAKEFILE) FORCE |
96 | make -f Makefile$(PLATFORM) || exit 1; popd; \ | 96 | cd kabc/plugins/file && $(MAKE) -f $(MAKEFILE) |
97 | done | 97 | |
98 | endif | 98 | kabc/plugins/dir/$(MAKEFILE): |
99 | 99 | @$(CHK_DIR_EXISTS) "kabc/plugins/dir" || $(MKDIR) "kabc/plugins/dir" | |
100 | build_sharp_plugin: build_microkde | 100 | cd kabc/plugins/dir && $(QMAKE) dir.pro -o $(MAKEFILE) |
101 | ifdef BUILD_NO_SHARP_PLUGIN | 101 | sub-kabc-plugins-dir: kabc/plugins/dir/$(MAKEFILE) FORCE |
102 | @echo == ldap plugin not build. | 102 | cd kabc/plugins/dir && $(MAKE) -f $(MAKEFILE) |
103 | else | 103 | |
104 | for i in $(SUBDIRS_SHARP_PLUGIN); do pushd $$i; \ | 104 | kabc/plugins/file/$(MAKEFILE): |
105 | make -f Makefile$(PLATFORM) || exit 1; popd; \ | 105 | @$(CHK_DIR_EXISTS) "kabc/plugins/file" || $(MKDIR) "kabc/plugins/file" |
106 | done | 106 | cd kabc/plugins/file && $(QMAKE) file.pro -o $(MAKEFILE) |
107 | endif | 107 | sub-kabc-plugins-file: kabc/plugins/file/$(MAKEFILE) FORCE |
108 | 108 | cd kabc/plugins/file && $(MAKE) -f $(MAKEFILE) | |
109 | build_ldap_plugin: build_microkde | 109 | |
110 | ifdef BUILD_NO_LDAP_PLUGIN | 110 | kabc/plugins/qtopia/$(MAKEFILE): |
111 | @echo == ldap plugin not build. | 111 | @$(CHK_DIR_EXISTS) "kabc/plugins/qtopia" || $(MKDIR) "kabc/plugins/qtopia" |
112 | else | 112 | cd kabc/plugins/qtopia && $(QMAKE) qtopia.pro -o $(MAKEFILE) |
113 | for i in $(SUBDIRS_LDAP_PLUGIN); do pushd $$i; \ | 113 | sub-kabc-plugins-qtopia: kabc/plugins/qtopia/$(MAKEFILE) FORCE |
114 | make -f Makefile$(PLATFORM) || exit 1; popd; \ | 114 | cd kabc/plugins/qtopia && $(MAKE) -f $(MAKEFILE) |
115 | done | 115 | |
116 | endif | 116 | pwmanager/libcrypt/cipher/$(MAKEFILE): |
117 | 117 | @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/cipher" || $(MKDIR) "pwmanager/libcrypt/cipher" | |
118 | 118 | cd pwmanager/libcrypt/cipher && $(QMAKE) cipher.pro -o $(MAKEFILE) | |
119 | build_micromail: build_microkde | 119 | sub-pwmanager-libcrypt-cipher: pwmanager/libcrypt/cipher/$(MAKEFILE) FORCE |
120 | ifdef BUILD_NO_MICROMAIL | 120 | cd pwmanager/libcrypt/cipher && $(MAKE) -f $(MAKEFILE) |
121 | @echo == kmicromail not build. | 121 | |
122 | else | 122 | pwmanager/libcrypt/error/$(MAKEFILE): |
123 | for i in $(SUBDIRS_MICROMAIL); do pushd $$i; \ | 123 | @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/error" || $(MKDIR) "pwmanager/libcrypt/error" |
124 | make -f Makefile$(PLATFORM) || exit 1; popd; \ | 124 | cd pwmanager/libcrypt/error && $(QMAKE) error.pro -o $(MAKEFILE) |
125 | done | 125 | sub-pwmanager-libcrypt-error: pwmanager/libcrypt/error/$(MAKEFILE) FORCE |
126 | endif | 126 | cd pwmanager/libcrypt/error && $(MAKE) -f $(MAKEFILE) |
127 | 127 | ||
128 | build_gammu: variable_test tmake | 128 | pwmanager/libcrypt/mpi/$(MAKEFILE): |
129 | ifdef BUILD_NO_GAMMU | 129 | @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/mpi" || $(MKDIR) "pwmanager/libcrypt/mpi" |
130 | @echo == gammu not build. | 130 | cd pwmanager/libcrypt/mpi && $(QMAKE) mpi.pro -o $(MAKEFILE) |
131 | else | 131 | sub-pwmanager-libcrypt-mpi: pwmanager/libcrypt/mpi/$(MAKEFILE) FORCE |
132 | for i in $(SUBDIRS_GAMMU); do pushd $$i; \ | 132 | cd pwmanager/libcrypt/mpi && $(MAKE) -f $(MAKEFILE) |
133 | make -f Makefile$(PLATFORM) || exit 1; popd; \ | 133 | |
134 | done | 134 | pwmanager/libcrypt/zlib/$(MAKEFILE): |
135 | endif | 135 | @$(CHK_DIR_EXISTS) "pwmanager/libcrypt/zlib" || $(MKDIR) "pwmanager/libcrypt/zlib" |
136 | 136 | cd pwmanager/libcrypt/zlib && $(QMAKE) zlib.pro -o $(MAKEFILE) | |
137 | build_pwmanager: build_microkde | 137 | sub-pwmanager-libcrypt-zlib: pwmanager/libcrypt/zlib/$(MAKEFILE) FORCE |
138 | ifdef BUILD_NO_PWMANAGER | 138 | cd pwmanager/libcrypt/zlib && $(MAKE) -f $(MAKEFILE) |
139 | @echo == pwmanager not build. | 139 | |
140 | else | 140 | pwmanager/pwmanager/$(MAKEFILE): |
141 | for i in $(SUBDIRS_PWMANAGER); do pushd $$i; \ | 141 | @$(CHK_DIR_EXISTS) "pwmanager/pwmanager" || $(MKDIR) "pwmanager/pwmanager" |
142 | make -f Makefile$(PLATFORM) || exit 1; popd; \ | 142 | cd pwmanager/pwmanager && $(QMAKE) pwmanager.pro -o $(MAKEFILE) |
143 | done | 143 | sub-pwmanager-pwmanager: pwmanager/pwmanager/$(MAKEFILE) FORCE |
144 | endif | 144 | cd pwmanager/pwmanager && $(MAKE) -f $(MAKEFILE) |
145 | 145 | ||
146 | 146 | Makefile: kdepim-desktop.pro /usr/lib/qt3/mkspecs/default/qmake.conf | |
147 | variable_info: | 147 | $(QMAKE) -o Makefile kdepim-desktop.pro |
148 | @echo -------------------------------------- | 148 | qmake: qmake_all |
149 | @echo KDEPIM buildsystem, variableinfo... | 149 | @$(QMAKE) -o Makefile kdepim-desktop.pro |
150 | @echo KDEPIMDIR=$(KDEPIMDIR) | 150 | |
151 | @echo QTDIR=$(QTDIR) | 151 | all: $(SUBTARGETS) |
152 | @echo QPEDIR=$(QPEDIR) | 152 | qmake_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) kabc/plugins/file/$(MAKEFILE) kabc/plugins/qtopia/$(MAKEFILE) pwmanager/libcrypt/cipher/$(MAKEFILE) pwmanager/libcrypt/error/$(MAKEFILE) pwmanager/libcrypt/mpi/$(MAKEFILE) pwmanager/libcrypt/zlib/$(MAKEFILE) pwmanager/pwmanager/$(MAKEFILE) |
153 | @echo OPIEDIR=$(OPIEDIR) | 153 | ( [ -d gammu/emb/common ] && cd gammu/emb/common ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true |
154 | @echo PLATFORM=$(PLATFORM) | 154 | ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true |
155 | @echo RELEASE_DEBUG=$(RELEASE_DEBUG) | 155 | ( [ -d libical ] && cd libical ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true |
156 | @echo BUILD_NO_MICROMAIL=$(BUILD_NO_MICROMAIL) | 156 | ( [ -d libkcal ] && cd libkcal ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true |
157 | @echo BUILD_NO_LDAP_PLUGIN=$(BUILD_NO_LDAP_PLUGIN) | 157 | ( [ -d microkde ] && cd microkde ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true |
158 | @echo BUILD_NO_OPIE_PLUGIN=$(BUILD_NO_OPIE_PLUGIN) | 158 | ( [ -d libkdepim ] && cd libkdepim ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true |
159 | @echo BUILD_NO_QTOPIA_PLUGIN=$(BUILD_NO_QTOPIA_PLUGIN) | 159 | ( [ -d kabc ] && cd kabc ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true |
160 | @echo BUILD_NO_SHARP_PLUGIN=$(BUILD_NO_SHARP_PLUGIN) | 160 | ( [ -d korganizer ] && cd korganizer ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true |
161 | ifndef BUILD_NO_SHARP_PLUGIN | 161 | ( [ -d kaddressbook ] && cd kaddressbook ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true |
162 | @echo SHARPDTMSDK=$(SHARPDTMSDK) | 162 | ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true |
163 | endif | 163 | ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true |
164 | @echo BUILD_NO_GAMMU=$(BUILD_NO_GAMMU) | 164 | ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true |
165 | @echo BUILD_NO_PWMANAGER=$(BUILD_NO_PWMANAGER) | 165 | ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true |
166 | @echo -------------------------------------- | 166 | ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true |
167 | 167 | ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true | |
168 | variable_test: variable_info | 168 | ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true |
169 | @echo KDEPIM buildsystem, variablecheck... | 169 | ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true |
170 | ifndef KDEPIMDIR | 170 | ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; grep "^qmake_all:" $(MAKEFILE) && $(MAKE) -f $(MAKEFILE) qmake_all; ) || true |
171 | @echo KDEPIMDIR is not defined. | 171 | clean uicables mocables uiclean mocclean lexclean yaccclean : qmake_all FORCE |
172 | $(error KDEPIMDIR is not defined) | 172 | ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; ) || true |
173 | endif | 173 | ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) $@; ) || true |
174 | ifndef PLATFORM | 174 | ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; ) || true |
175 | @echo PLATFORM is not defined. | 175 | ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; ) || true |
176 | $(error PLATFORM is not defined) | 176 | ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; ) || true |
177 | endif | 177 | ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; ) || true |
178 | ifdef BUILD_NO_LDAP_PLUGIN | 178 | ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; ) || true |
179 | @echo LDAP PLUGIN will not be build, because BUILD_NO_LDAP_PLUGIN is set to $(BUILD_NO_LDAP_PLUGIN) | 179 | ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; ) || true |
180 | endif | 180 | ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; ) || true |
181 | ifdef BUILD_NO_OPIE_PLUGIN | 181 | ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; ) || true |
182 | @echo OPIE PLUGIN will not be build, because BUILD_NO_OPIE_PLUGIN is set to $(BUILD_NO_OPIE_PLUGIN) | 182 | ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; ) || true |
183 | endif | 183 | ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; ) || true |
184 | ifdef BUILD_NO_QTOPIA_PLUGIN | 184 | ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) $@; ) || true |
185 | @echo QTOPIA PLUGIN will not be build, because BUILD_NO__QTOPIA_PLUGIN is set to $(BUILD_NO__QTOPIA_PLUGIN) | 185 | ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) $@; ) || true |
186 | endif | 186 | ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) $@; ) || true |
187 | ifdef BUILD_NO_MICROMAIL | 187 | ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) $@; ) || true |
188 | @echo MICROMAIL will not be build, because BUILD_NO_MICROMAIL is set to $(BUILD_NO_MICROMAIL) | 188 | ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) $@; ) || true |
189 | endif | 189 | ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) $@; ) || true |
190 | ifdef BUILD_NO_SHARP_PLUGIN | 190 | uninstall_subdirs: qmake_all FORCE |
191 | @echo SHARP PLUGIN will not be build, because BUILD_NO_SHARP_PLUGIN is set to $(BUILD_NO_SHARP_PLUGIN) | 191 | ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true |
192 | else | 192 | ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true |
193 | ifndef SHARPDTMSDK | 193 | ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true |
194 | @echo SHARP PLUGIN can not be build, because SHARPDTMSDK is set to $(SHARPDTMSDK) | 194 | ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true |
195 | $(error SHARPDTMSDK is not defined) | 195 | ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true |
196 | endif | 196 | ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true |
197 | endif | 197 | ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true |
198 | ifdef BUILD_NO_GAMMU | 198 | ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true |
199 | @echo GAMMU will not be build, because BUILD_NO_GAMMU is set to $(BUILD_NO_GAMMU) | 199 | ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true |
200 | endif | 200 | ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true |
201 | ifdef BUILD_NO_PWMANAGER | 201 | ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true |
202 | @echo PWMANAGER will not be build, because BUILD_NO_PWMANAGER is set to $(BUILD_NO_PWMANAGER) | 202 | ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true |
203 | endif | 203 | ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true |
204 | @echo -------------------------------------- | 204 | ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true |
205 | 205 | ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true | |
206 | 206 | ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true | |
207 | objects: | 207 | ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true |
208 | for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done | 208 | ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) uninstall; ) || true |
209 | for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done | 209 | install_subdirs: qmake_all FORCE |
210 | mkdir -p libical/lib/$(PLATFORM) | 210 | ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) install; ) || true |
211 | mkdir -p pwmanager/libcrypt/$(PLATFORM) | 211 | ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) install; ) || true |
212 | 212 | ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) install; ) || true | |
213 | clean: | 213 | ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) install; ) || true |
214 | rm -rf libical/lib/$(PLATFORM)/*; | 214 | ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) install; ) || true |
215 | rm -rf pwmanager/libcrypt/$(PLATFORM)/*; | 215 | ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) install; ) || true |
216 | for i in $(SUBDIRS); do pushd $$i; make clean; rm -f *~;\ | 216 | ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) install; ) || true |
217 | rm -f obj/$(PLATFORM)/*; rm -f moc/$(PLATFORM)/*; rm Makefile$(PLATFORM); popd; \ | 217 | ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) install; ) || true |
218 | done | 218 | ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) install; ) || true |
219 | 219 | ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) install; ) || true | |
220 | install: | 220 | ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) install; ) || true |
221 | 221 | ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) install; ) || true | |
222 | cd bin/kdepim; make install | 222 | ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) install; ) || true |
223 | cp -r Pim $(QPEDIR)/apps | 223 | ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) install; ) || true |
224 | cp db2file/db2file $(QPEDIR)/bin/db2file | 224 | ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) install; ) || true |
225 | cp korganizer/korganizer.desktop $(QPEDIR)/apps/Pim/korganizer.desktop | 225 | ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) install; ) || true |
226 | cp kaddressbook/kaddressbook.desktop $(QPEDIR)/apps/Pim/kaddressbook.desktop | 226 | ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) install; ) || true |
227 | cp kmicromail/kmicromail.desktop $(QPEDIR)/apps/Pim/kopiemail.desktop | 227 | ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) install; ) || true |
228 | cp pwmanager/pwmanager/pwmanager.desktop $(QPEDIR)/apps/Pim/pwmanager.desktop | 228 | distclean: qmake_all FORCE |
229 | 229 | ( [ -d gammu/emb/common ] && cd gammu/emb/common ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true | |
230 | dist: | 230 | ( [ -d gammu/emb/gammu ] && cd gammu/emb/gammu ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true |
231 | @echo Dont forget to do "make install" before "make dist" | 231 | ( [ -d libical ] && cd libical ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true |
232 | rm -f *arm.ipk | 232 | ( [ -d libkcal ] && cd libkcal ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true |
233 | rm -f *~ | 233 | ( [ -d microkde ] && cd microkde ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true |
234 | cd ..; tar czf kdepimpi-$(KDEPIM_VERSION).tar.gz --exclude=obj --exclude=moc --exclude=CVS --exclude=Makefilezaurus --exclude=Makefileqtopia kdepim | 234 | ( [ -d libkdepim ] && cd libkdepim ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true |
235 | mkipks kmicrokdelibs.control | 235 | ( [ -d kabc ] && cd kabc ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true |
236 | mkipks korganizer.control | 236 | ( [ -d korganizer ] && cd korganizer ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true |
237 | mkipks kaddressbook.control | 237 | ( [ -d kaddressbook ] && cd kaddressbook ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true |
238 | ifndef BUILD_NO_MICROMAIL | 238 | ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true |
239 | mkipks kopiemail.control | 239 | ( [ -d kabc/plugins/dir ] && cd kabc/plugins/dir ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true |
240 | endif | 240 | ( [ -d kabc/plugins/file ] && cd kabc/plugins/file ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true |
241 | mkipks korganizer-alarm.control | 241 | ( [ -d kabc/plugins/qtopia ] && cd kabc/plugins/qtopia ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true |
242 | ifndef BUILD_NO_GAMMU | 242 | ( [ -d pwmanager/libcrypt/cipher ] && cd pwmanager/libcrypt/cipher ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true |
243 | mkipks phoneaccess.control | 243 | ( [ -d pwmanager/libcrypt/error ] && cd pwmanager/libcrypt/error ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true |
244 | endif | 244 | ( [ -d pwmanager/libcrypt/mpi ] && cd pwmanager/libcrypt/mpi ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true |
245 | ifndef BUILD_NO_PWMANAGER | 245 | ( [ -d pwmanager/libcrypt/zlib ] && cd pwmanager/libcrypt/zlib ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true |
246 | mkipks pwmanager.control | 246 | ( [ -d pwmanager/pwmanager ] && cd pwmanager/pwmanager ; $(MAKE) -f $(MAKEFILE) $@; $(DEL_FILE) $(MAKEFILE); ) || true |
247 | endif | 247 | |
248 | mkipks pim_TAB_icon.control | 248 | install: install_subdirs |
249 | 249 | ||
250 | tmake: objects \ | 250 | uninstall: uninstall_subdirs |
251 | qtcompat/Makefile$(PLATFORM) \ | 251 | |
252 | microkde/Makefile$(PLATFORM) \ | 252 | FORCE: |
253 | libkcal/Makefile$(PLATFORM) \ | ||
254 | libkdepim/Makefile$(PLATFORM) \ | ||
255 | korganizer/Makefile$(PLATFORM) \ | ||
256 | kalarmd/Makefile$(PLATFORM) \ | ||
257 | libical/src/libical/Makefile$(PLATFORM) \ | ||
258 | libical/src/libicalss/Makefile$(PLATFORM) \ | ||
259 | kabc/Makefile$(PLATFORM) \ | ||
260 | kabc/formats/binary/Makefile$(PLATFORM) \ | ||
261 | kabc/plugins/file/Makefile$(PLATFORM) \ | ||
262 | kabc/plugins/dir/Makefile$(PLATFORM) \ | ||
263 | kabc/plugins/ldap/Makefile$(PLATFORM) \ | ||
264 | kabc/plugins/opie/Makefile$(PLATFORM) \ | ||
265 | kabc/plugins/qtopia/Makefile$(PLATFORM) \ | ||
266 | kabc/plugins/sharpdtm/Makefile$(PLATFORM) \ | ||
267 | kaddressbook/Makefile$(PLATFORM) \ | ||
268 | kmicromail/Makefile$(PLATFORM) \ | ||
269 | kmicromail/libetpan/Makefile$(PLATFORM) \ | ||
270 | kmicromail/libmailwrapper/Makefile$(PLATFORM) \ | ||
271 | gammu/emb/common/Makefile$(PLATFORM) \ | ||
272 | gammu/emb/gammu/Makefile$(PLATFORM) \ | ||
273 | pwmanager/pwmanager/Makefile$(PLATFORM) \ | ||
274 | pwmanager/libcrypt/mpi/Makefile$(PLATFORM) \ | ||
275 | pwmanager/libcrypt/error/Makefile$(PLATFORM) \ | ||
276 | pwmanager/libcrypt/cipher/Makefile$(PLATFORM) \ | ||
277 | pwmanager/libcrypt/zlib/Makefile$(PLATFORM) | ||
278 | |||
279 | qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro | ||
280 | cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" qtcompat.pro -o Makefile$(PLATFORM) | ||
281 | |||
282 | microkde/Makefile$(PLATFORM): microkde/microkdeE.pro | ||
283 | cd microkde; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" microkdeE.pro -o Makefile$(PLATFORM) | ||
284 | |||
285 | libkcal/Makefile$(PLATFORM): libkcal/libkcalE.pro | ||
286 | cd libkcal; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libkcalE.pro -o Makefile$(PLATFORM) | ||
287 | |||
288 | |||
289 | libkdepim/Makefile$(PLATFORM): libkdepim/libkdepimE.pro | ||
290 | cd libkdepim; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libkdepimE.pro -o Makefile$(PLATFORM) | ||
291 | |||
292 | kalarmd/Makefile$(PLATFORM): kalarmd/kalarmdE.pro | ||
293 | cd kalarmd; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kalarmdE.pro -o Makefile$(PLATFORM) | ||
294 | |||
295 | korganizer/Makefile$(PLATFORM): korganizer/korganizerE.pro | ||
296 | cd korganizer; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" korganizerE.pro -o Makefile$(PLATFORM) | ||
297 | |||
298 | libical/src/libical/Makefile$(PLATFORM): libical/src/libical/libicalE.pro | ||
299 | cd libical/src/libical; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libicalE.pro -o Makefile$(PLATFORM) | ||
300 | |||
301 | libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro | ||
302 | cd libical/src/libicalss; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libicalssE.pro -o Makefile$(PLATFORM) | ||
303 | |||
304 | kabc/Makefile$(PLATFORM): kabc/kabcE.pro | ||
305 | cd kabc; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kabcE.pro -o Makefile$(PLATFORM) | ||
306 | |||
307 | kabc/formats/binary/Makefile$(PLATFORM): kabc/formats/binary/kabcformat_binaryE.pro | ||
308 | cd kabc/formats/binary; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kabcformat_binaryE.pro -o Makefile$(PLATFORM) | ||
309 | |||
310 | kabc/plugins/file/Makefile$(PLATFORM): kabc/plugins/file/fileE.pro | ||
311 | cd kabc/plugins/file; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" fileE.pro -o Makefile$(PLATFORM) | ||
312 | |||
313 | kabc/plugins/dir/Makefile$(PLATFORM): kabc/plugins/dir/dirE.pro | ||
314 | cd kabc/plugins/dir; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" dirE.pro -o Makefile$(PLATFORM) | ||
315 | |||
316 | kabc/plugins/ldap/Makefile$(PLATFORM): kabc/plugins/ldap/ldapE.pro | ||
317 | cd kabc/plugins/ldap; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" ldapE.pro -o Makefile$(PLATFORM) | ||
318 | |||
319 | kabc/plugins/opie/Makefile$(PLATFORM): kabc/plugins/opie/opieE.pro | ||
320 | cd kabc/plugins/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" opieE.pro -o Makefile$(PLATFORM) | ||
321 | |||
322 | kabc/plugins/qtopia/Makefile$(PLATFORM): kabc/plugins/qtopia/qtopiaE.pro | ||
323 | cd kabc/plugins/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" qtopiaE.pro -o Makefile$(PLATFORM) | ||
324 | |||
325 | kabc/plugins/sharpdtm/Makefile$(PLATFORM): kabc/plugins/sharpdtm/sharpdtmE.pro | ||
326 | cd kabc/plugins/sharpdtm; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" sharpdtmE.pro -o Makefile$(PLATFORM) | ||
327 | |||
328 | kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro | ||
329 | cd kaddressbook; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kaddressbookE.pro -o Makefile$(PLATFORM) | ||
330 | |||
331 | kmicromail/Makefile$(PLATFORM): kmicromail/kmicromailE.pro | ||
332 | cd kmicromail; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" kmicromailE.pro -o Makefile$(PLATFORM) | ||
333 | |||
334 | kmicromail/libetpan/Makefile$(PLATFORM): kmicromail/libetpan/libetpanE.pro | ||
335 | cd kmicromail/libetpan; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libetpanE.pro -o Makefile$(PLATFORM) | ||
336 | |||
337 | kmicromail/libmailwrapper/Makefile$(PLATFORM): kmicromail/libmailwrapper/libmailwrapperE.pro | ||
338 | cd kmicromail/libmailwrapper; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" libmailwrapperE.pro -o Makefile$(PLATFORM) | ||
339 | |||
340 | gammu/emb/common/Makefile$(PLATFORM): gammu/emb/common/commonE.pro | ||
341 | cd gammu/emb/common; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" commonE.pro -o Makefile$(PLATFORM) | ||
342 | |||
343 | gammu/emb/gammu/Makefile$(PLATFORM): gammu/emb/gammu/gammuE.pro | ||
344 | cd gammu/emb/gammu; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" gammuE.pro -o Makefile$(PLATFORM) | ||
345 | |||
346 | pwmanager/pwmanager/Makefile$(PLATFORM): pwmanager/pwmanager/pwmanagerE.pro | ||
347 | cd pwmanager/pwmanager; tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" pwmanagerE.pro -o Makefile$(PLATFORM) | ||
348 | |||
349 | |||
350 | pwmanager/libcrypt/mpi/Makefile$(PLATFORM): pwmanager/libcrypt/mpi/mpi.pro | ||
351 | cd pwmanager/libcrypt/mpi;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" mpi.pro -o Makefile$(PLATFORM) | ||
352 | |||
353 | pwmanager/libcrypt/error/Makefile$(PLATFORM): pwmanager/libcrypt/error/error.pro | ||
354 | cd pwmanager/libcrypt/error;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" error.pro -o Makefile$(PLATFORM) | ||
355 | |||
356 | pwmanager/libcrypt/cipher/Makefile$(PLATFORM): pwmanager/libcrypt/cipher/cipher.pro | ||
357 | cd pwmanager/libcrypt/cipher;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" cipher.pro -o Makefile$(PLATFORM) | ||
358 | |||
359 | pwmanager/libcrypt/zlib/Makefile$(PLATFORM): pwmanager/libcrypt/zlib/zlib.pro | ||
360 | cd pwmanager/libcrypt/zlib;tmake "CONFIG+=$(RELEASE_DEBUG)" "VERSION=$(KDEPIM_VERSION)" zlib.pro -o Makefile$(PLATFORM) | ||
361 | |||
362 | 253 | ||
diff --git a/microkde/kdeui/kmainwindow.cpp b/microkde/kdeui/kmainwindow.cpp index bd5a2cc..3ae4c87 100644 --- a/microkde/kdeui/kmainwindow.cpp +++ b/microkde/kdeui/kmainwindow.cpp | |||
@@ -111,384 +111,385 @@ KMainWindow::~KMainWindow() | |||
111 | //US memberList->remove( this ); | 111 | //US memberList->remove( this ); |
112 | } | 112 | } |
113 | 113 | ||
114 | void KMainWindow::initKMainWindow(const char *name) | 114 | void KMainWindow::initKMainWindow(const char *name) |
115 | { | 115 | { |
116 | setDockMenuEnabled( FALSE ); | 116 | setDockMenuEnabled( FALSE ); |
117 | //US mHelpMenu = 0; | 117 | //US mHelpMenu = 0; |
118 | 118 | ||
119 | //US kapp->setTopWidget( this ); | 119 | //US kapp->setTopWidget( this ); |
120 | actionCollection()->setWidget( this ); | 120 | actionCollection()->setWidget( this ); |
121 | //US connect(kapp, SIGNAL(shutDown()), this, SLOT(shuttingDown())); | 121 | //US connect(kapp, SIGNAL(shutDown()), this, SLOT(shuttingDown())); |
122 | //US if( !memberList ) | 122 | //US if( !memberList ) |
123 | //US memberList = new QPtrList<KMainWindow>; | 123 | //US memberList = new QPtrList<KMainWindow>; |
124 | /*US | 124 | /*US |
125 | 125 | ||
126 | if ( !ksm ) | 126 | if ( !ksm ) |
127 | ksm = ksmd.setObject(new KMWSessionManaged()); | 127 | ksm = ksmd.setObject(new KMWSessionManaged()); |
128 | // set a unique object name. Required by session management. | 128 | // set a unique object name. Required by session management. |
129 | QCString objname; | 129 | QCString objname; |
130 | QCString s; | 130 | QCString s; |
131 | int unusedNumber; | 131 | int unusedNumber; |
132 | if ( !name ) | 132 | if ( !name ) |
133 | { // no name given | 133 | { // no name given |
134 | objname = kapp->instanceName() + "-mainwindow#"; | 134 | objname = kapp->instanceName() + "-mainwindow#"; |
135 | s = objname + '1'; // start adding number immediately | 135 | s = objname + '1'; // start adding number immediately |
136 | unusedNumber = 1; | 136 | unusedNumber = 1; |
137 | } | 137 | } |
138 | else if( name[ strlen( name ) - 1 ] == '#' ) | 138 | else if( name[ strlen( name ) - 1 ] == '#' ) |
139 | { // trailing # - always add a number | 139 | { // trailing # - always add a number |
140 | objname = name; | 140 | objname = name; |
141 | s = objname + '1'; // start adding number immediately | 141 | s = objname + '1'; // start adding number immediately |
142 | unusedNumber = 1; | 142 | unusedNumber = 1; |
143 | } | 143 | } |
144 | else | 144 | else |
145 | { | 145 | { |
146 | objname = name; | 146 | objname = name; |
147 | s = objname; | 147 | s = objname; |
148 | unusedNumber = 0; // add numbers only when needed | 148 | unusedNumber = 0; // add numbers only when needed |
149 | } | 149 | } |
150 | for(;;) { | 150 | for(;;) { |
151 | QWidgetList* list = kapp->topLevelWidgets(); | 151 | QWidgetList* list = kapp->topLevelWidgets(); |
152 | QWidgetListIt it( *list ); | 152 | QWidgetListIt it( *list ); |
153 | bool found = false; | 153 | bool found = false; |
154 | for( QWidget* w = it.current(); | 154 | for( QWidget* w = it.current(); |
155 | w != NULL; | 155 | w != NULL; |
156 | ++it, w = it.current()) | 156 | ++it, w = it.current()) |
157 | if( w != this && w->name() == s ) | 157 | if( w != this && w->name() == s ) |
158 | { | 158 | { |
159 | found = true; | 159 | found = true; |
160 | break; | 160 | break; |
161 | } | 161 | } |
162 | delete list; | 162 | delete list; |
163 | if( !found ) | 163 | if( !found ) |
164 | break; | 164 | break; |
165 | s.setNum( ++unusedNumber ); | 165 | s.setNum( ++unusedNumber ); |
166 | s = objname + s; | 166 | s = objname + s; |
167 | } | 167 | } |
168 | setName( s ); | 168 | setName( s ); |
169 | memberList->append( this ); | 169 | memberList->append( this ); |
170 | */ | 170 | */ |
171 | 171 | ||
172 | d = new KMainWindowPrivate; | 172 | d = new KMainWindowPrivate; |
173 | //US d->showHelpMenu = true; | 173 | //US d->showHelpMenu = true; |
174 | d->settingsDirty = false; | 174 | d->settingsDirty = false; |
175 | d->autoSaveSettings = false; | 175 | d->autoSaveSettings = false; |
176 | d->autoSaveWindowSize = true; // for compatibility | 176 | d->autoSaveWindowSize = true; // for compatibility |
177 | //US d->kaccel = actionCollection()->kaccel(); | 177 | //US d->kaccel = actionCollection()->kaccel(); |
178 | d->toolBarHandler = 0; | 178 | d->toolBarHandler = 0; |
179 | d->settingsTimer = 0; | 179 | d->settingsTimer = 0; |
180 | d->showStatusBarAction = NULL; | 180 | d->showStatusBarAction = NULL; |
181 | /*US | 181 | /*US |
182 | if ((d->care_about_geometry == beeing_first)) { | 182 | if ((d->care_about_geometry == beeing_first)) { |
183 | beeing_first = false; | 183 | beeing_first = false; |
184 | if ( kapp->geometryArgument().isNull() ) // if there is no geometry, it doesn't mater | 184 | if ( kapp->geometryArgument().isNull() ) // if there is no geometry, it doesn't mater |
185 | d->care_about_geometry = false; | 185 | d->care_about_geometry = false; |
186 | else | 186 | else |
187 | parseGeometry(false); | 187 | parseGeometry(false); |
188 | } | 188 | } |
189 | */ | 189 | */ |
190 | d->care_about_geometry = false; | 190 | d->care_about_geometry = false; |
191 | 191 | ||
192 | //US setCaption( kapp->caption() ); | 192 | //US setCaption( kapp->caption() ); |
193 | // attach dcop interface | 193 | // attach dcop interface |
194 | //US d->m_interface = new KMainWindowInterface(this); | 194 | //US d->m_interface = new KMainWindowInterface(this); |
195 | 195 | ||
196 | //US if (!kapp->authorize("movable_toolbars")) | 196 | //US if (!kapp->authorize("movable_toolbars")) |
197 | //US setDockWindowsMovable(false); | 197 | //US setDockWindowsMovable(false); |
198 | } | 198 | } |
199 | 199 | ||
200 | KAction *KMainWindow::toolBarMenuAction() | 200 | KAction *KMainWindow::toolBarMenuAction() |
201 | { | 201 | { |
202 | if ( !d->toolBarHandler ) | 202 | if ( !d->toolBarHandler ) |
203 | return 0; | 203 | return 0; |
204 | 204 | ||
205 | return d->toolBarHandler->toolBarMenuAction(); | 205 | return d->toolBarHandler->toolBarMenuAction(); |
206 | } | 206 | } |
207 | 207 | ||
208 | bool KMainWindow::canBeRestored( int number ) | 208 | bool KMainWindow::canBeRestored( int number ) |
209 | { | 209 | { |
210 | /*US we do not have and want to save sessioninformation. Use info from the default | 210 | /*US we do not have and want to save sessioninformation. Use info from the default |
211 | application config. | 211 | application config. |
212 | */ | 212 | */ |
213 | //US if ( !kapp->isRestored() ) | 213 | //US if ( !kapp->isRestored() ) |
214 | //US return FALSE; | 214 | //US return FALSE; |
215 | //US KConfig *config = kapp->sessionConfig(); | 215 | //US KConfig *config = kapp->sessionConfig(); |
216 | KConfig *config = KGlobal::config(); | 216 | KConfig *config = KGlobal::config(); |
217 | if ( !config ) | 217 | if ( !config ) |
218 | return FALSE; | 218 | return FALSE; |
219 | config->setGroup( QString::fromLatin1("Number") ); | 219 | config->setGroup( QString::fromLatin1("Number") ); |
220 | int n = config->readNumEntry( QString::fromLatin1("NumberOfWindows") , 1 ); | 220 | int n = config->readNumEntry( QString::fromLatin1("NumberOfWindows") , 1 ); |
221 | return number >= 1 && number <= n; | 221 | return number >= 1 && number <= n; |
222 | 222 | ||
223 | } | 223 | } |
224 | 224 | ||
225 | const QString KMainWindow::classNameOfToplevel( int number ) | 225 | const QString KMainWindow::classNameOfToplevel( int number ) |
226 | { | 226 | { |
227 | /*US we do not have and want to save sessioninformation. Use info from the default | 227 | /*US we do not have and want to save sessioninformation. Use info from the default |
228 | application config. | 228 | application config. |
229 | */ | 229 | */ |
230 | //US if ( !kapp->isRestored() ) | 230 | //US if ( !kapp->isRestored() ) |
231 | //US return QString::null; | 231 | //US return QString::null; |
232 | //US KConfig *config = kapp->sessionConfig(); | 232 | //US KConfig *config = kapp->sessionConfig(); |
233 | KConfig *config = KGlobal::config(); | 233 | KConfig *config = KGlobal::config(); |
234 | if ( !config ) | 234 | if ( !config ) |
235 | return QString::null; | 235 | return QString::null; |
236 | QString s; | 236 | QString s; |
237 | s.setNum( number ); | 237 | s.setNum( number ); |
238 | s.prepend( QString::fromLatin1("WindowProperties") ); | 238 | s.prepend( QString::fromLatin1("WindowProperties") ); |
239 | config->setGroup( s ); | 239 | config->setGroup( s ); |
240 | if ( !config->hasKey( QString::fromLatin1("ClassName") ) ) | 240 | if ( !config->hasKey( QString::fromLatin1("ClassName") ) ) |
241 | return QString::null; | 241 | return QString::null; |
242 | else | 242 | else |
243 | return config->readEntry( QString::fromLatin1("ClassName") ); | 243 | return config->readEntry( QString::fromLatin1("ClassName") ); |
244 | } | 244 | } |
245 | 245 | ||
246 | bool KMainWindow::restore( int number, bool show ) | 246 | bool KMainWindow::restore( int number, bool show ) |
247 | { | 247 | { |
248 | /*US we do not have and want to save sessioninformation. Use info from the default | 248 | /*US we do not have and want to save sessioninformation. Use info from the default |
249 | application config. | 249 | application config. |
250 | */ | 250 | */ |
251 | if ( !canBeRestored( number ) ) | 251 | if ( !canBeRestored( number ) ) |
252 | return FALSE; | 252 | return FALSE; |
253 | //US KConfig *config = kapp->sessionConfig(); | 253 | //US KConfig *config = kapp->sessionConfig(); |
254 | KConfig *config = KGlobal::config(); | 254 | KConfig *config = KGlobal::config(); |
255 | 255 | ||
256 | if ( readPropertiesInternal( config, number ) ){ | 256 | if ( readPropertiesInternal( config, number ) ){ |
257 | if ( show ) | 257 | if ( show ) |
258 | KMainWindow::show(); | 258 | KMainWindow::show(); |
259 | return FALSE; | 259 | return FALSE; |
260 | } | 260 | } |
261 | return FALSE; | 261 | return FALSE; |
262 | 262 | ||
263 | } | 263 | } |
264 | 264 | ||
265 | void KMainWindow::setCaption( const QString &caption ) | 265 | void KMainWindow::setCaption( const QString &caption ) |
266 | { | 266 | { |
267 | //US setPlainCaption( kapp->makeStdCaption(caption) ); | 267 | //US setPlainCaption( kapp->makeStdCaption(caption) ); |
268 | setPlainCaption( caption ); | 268 | setPlainCaption( caption ); |
269 | } | 269 | } |
270 | 270 | ||
271 | void KMainWindow::setCaption( const QString &caption, bool modified ) | 271 | void KMainWindow::setCaption( const QString &caption, bool modified ) |
272 | { | 272 | { |
273 | //US setPlainCaption( kapp->makeStdCaption(caption, true, modified) ); | 273 | //US setPlainCaption( kapp->makeStdCaption(caption, true, modified) ); |
274 | setPlainCaption( caption + "modified:" ); | 274 | setPlainCaption( caption + "modified:" ); |
275 | } | 275 | } |
276 | 276 | ||
277 | void KMainWindow::setPlainCaption( const QString &caption ) | 277 | void KMainWindow::setPlainCaption( const QString &caption ) |
278 | { | 278 | { |
279 | QMainWindow::setCaption( caption ); | 279 | QMainWindow::setCaption( caption ); |
280 | #ifndef Q_WS_QWS | 280 | #ifndef Q_WS_QWS |
281 | //US the following is disabled for the embedded version | 281 | //US the following is disabled for the embedded version |
282 | //US NETWinInfo info( qt_xdisplay(), winId(), qt_xrootwin(), 0 ); | 282 | //US NETWinInfo info( qt_xdisplay(), winId(), qt_xrootwin(), 0 ); |
283 | //US info.setName( caption.utf8().data() ); | 283 | //US info.setName( caption.utf8().data() ); |
284 | #endif | 284 | #endif |
285 | } | 285 | } |
286 | 286 | ||
287 | void KMainWindow::slotStateChanged(const QString &newstate) | 287 | void KMainWindow::slotStateChanged(const QString &newstate) |
288 | { | 288 | { |
289 | stateChanged(newstate, KXMLGUIClient::StateNoReverse); | 289 | stateChanged(newstate, KXMLGUIClient::StateNoReverse); |
290 | } | 290 | } |
291 | 291 | ||
292 | /* | 292 | /* |
293 | * Get rid of this for KDE 4.0 | 293 | * Get rid of this for KDE 4.0 |
294 | */ | 294 | */ |
295 | void KMainWindow::slotStateChanged(const QString &newstate, | 295 | void KMainWindow::slotStateChanged(const QString &newstate, |
296 | KXMLGUIClient::ReverseStateChange reverse) | 296 | KXMLGUIClient::ReverseStateChange reverse) |
297 | { | 297 | { |
298 | stateChanged(newstate, reverse); | 298 | stateChanged(newstate, reverse); |
299 | } | 299 | } |
300 | 300 | ||
301 | void KMainWindow::closeEvent ( QCloseEvent *e ) | 301 | void KMainWindow::closeEvent ( QCloseEvent *e ) |
302 | { | 302 | { |
303 | //qDebug("MainWindow::closeEvent "); | ||
303 | // Save settings if auto-save is enabled, and settings have changed | 304 | // Save settings if auto-save is enabled, and settings have changed |
304 | if (d->settingsDirty && d->autoSaveSettings) | 305 | if (d->settingsDirty && d->autoSaveSettings) |
305 | saveAutoSaveSettings(); | 306 | saveAutoSaveSettings(); |
306 | 307 | ||
307 | if (queryClose()) { | 308 | if (queryClose()) { |
308 | e->accept(); | 309 | e->accept(); |
309 | 310 | ||
310 | int not_withdrawn = 0; | 311 | int not_withdrawn = 0; |
311 | /*US | 312 | /*US |
312 | QPtrListIterator<KMainWindow> it(*KMainWindow::memberList); | 313 | QPtrListIterator<KMainWindow> it(*KMainWindow::memberList); |
313 | for (it.toFirst(); it.current(); ++it){ | 314 | for (it.toFirst(); it.current(); ++it){ |
314 | if ( !it.current()->isHidden() && it.current()->isTopLevel() && it.current() != this ) | 315 | if ( !it.current()->isHidden() && it.current()->isTopLevel() && it.current() != this ) |
315 | not_withdrawn++; | 316 | not_withdrawn++; |
316 | } | 317 | } |
317 | */ | 318 | */ |
318 | if ( !no_query_exit && not_withdrawn <= 0 ) { // last window close accepted? | 319 | if ( !no_query_exit && not_withdrawn <= 0 ) { // last window close accepted? |
319 | /*US | 320 | /*US |
320 | if ( queryExit() && !kapp->sessionSaving()) { // Yes, Quit app? | 321 | if ( queryExit() && !kapp->sessionSaving()) { // Yes, Quit app? |
321 | // don't call queryExit() twice | 322 | // don't call queryExit() twice |
322 | disconnect(kapp, SIGNAL(shutDown()), this, SLOT(shuttingDown())); | 323 | disconnect(kapp, SIGNAL(shutDown()), this, SLOT(shuttingDown())); |
323 | kapp->deref(); // ...and quit aplication. | 324 | kapp->deref(); // ...and quit aplication. |
324 | } else { | 325 | } else { |
325 | // cancel closing, it's stupid to end up with no windows at all.... | 326 | // cancel closing, it's stupid to end up with no windows at all.... |
326 | e->ignore(); | 327 | e->ignore(); |
327 | } | 328 | } |
328 | */ | 329 | */ |
329 | //US we have no sessionmanagement. Simply close app. | 330 | //US we have no sessionmanagement. Simply close app. |
330 | if ( queryExit() ) { // Yes, Quit app? | 331 | if ( queryExit() ) { // Yes, Quit app? |
331 | qDebug("KMainWindow::closeEvent: Exit application ???"); | 332 | qDebug("KMainWindow::closeEvent: Exit application ???"); |
332 | // don't call queryExit() twice | 333 | // don't call queryExit() twice |
333 | //US disconnect(kapp, SIGNAL(shutDown()), this, SLOT(shuttingDown())); | 334 | //US disconnect(kapp, SIGNAL(shutDown()), this, SLOT(shuttingDown())); |
334 | } | 335 | } |
335 | 336 | ||
336 | } | 337 | } |
337 | } | 338 | } |
338 | } | 339 | } |
339 | 340 | ||
340 | bool KMainWindow::queryExit() | 341 | bool KMainWindow::queryExit() |
341 | { | 342 | { |
342 | return TRUE; | 343 | return TRUE; |
343 | } | 344 | } |
344 | 345 | ||
345 | bool KMainWindow::queryClose() | 346 | bool KMainWindow::queryClose() |
346 | { | 347 | { |
347 | return TRUE; | 348 | return TRUE; |
348 | } | 349 | } |
349 | 350 | ||
350 | void KMainWindow::saveGlobalProperties( KConfig* ) | 351 | void KMainWindow::saveGlobalProperties( KConfig* ) |
351 | { | 352 | { |
352 | } | 353 | } |
353 | 354 | ||
354 | void KMainWindow::readGlobalProperties( KConfig* ) | 355 | void KMainWindow::readGlobalProperties( KConfig* ) |
355 | { | 356 | { |
356 | } | 357 | } |
357 | 358 | ||
358 | void KMainWindow::savePropertiesInternal( KConfig *config, int number ) | 359 | void KMainWindow::savePropertiesInternal( KConfig *config, int number ) |
359 | { | 360 | { |
360 | bool oldASWS = d->autoSaveWindowSize; | 361 | bool oldASWS = d->autoSaveWindowSize; |
361 | d->autoSaveWindowSize = true; // make saveMainWindowSettings save the window size | 362 | d->autoSaveWindowSize = true; // make saveMainWindowSettings save the window size |
362 | 363 | ||
363 | QString s; | 364 | QString s; |
364 | s.setNum(number); | 365 | s.setNum(number); |
365 | s.prepend(QString::fromLatin1("WindowProperties")); | 366 | s.prepend(QString::fromLatin1("WindowProperties")); |
366 | config->setGroup(s); | 367 | config->setGroup(s); |
367 | 368 | ||
368 | // store objectName, className, Width and Height for later restoring | 369 | // store objectName, className, Width and Height for later restoring |
369 | // (Only useful for session management) | 370 | // (Only useful for session management) |
370 | config->writeEntry(QString::fromLatin1("ObjectName"), name()); | 371 | config->writeEntry(QString::fromLatin1("ObjectName"), name()); |
371 | config->writeEntry(QString::fromLatin1("ClassName"), className()); | 372 | config->writeEntry(QString::fromLatin1("ClassName"), className()); |
372 | 373 | ||
373 | saveMainWindowSettings(config); // Menubar, statusbar and Toolbar settings. | 374 | saveMainWindowSettings(config); // Menubar, statusbar and Toolbar settings. |
374 | 375 | ||
375 | s.setNum(number); | 376 | s.setNum(number); |
376 | config->setGroup(s); | 377 | config->setGroup(s); |
377 | saveProperties(config); | 378 | saveProperties(config); |
378 | 379 | ||
379 | d->autoSaveWindowSize = oldASWS; | 380 | d->autoSaveWindowSize = oldASWS; |
380 | } | 381 | } |
381 | 382 | ||
382 | void KMainWindow::setStandardToolBarMenuEnabled( bool enable ) | 383 | void KMainWindow::setStandardToolBarMenuEnabled( bool enable ) |
383 | { | 384 | { |
384 | if ( enable ) | 385 | if ( enable ) |
385 | { | 386 | { |
386 | if ( d->toolBarHandler ) | 387 | if ( d->toolBarHandler ) |
387 | return; | 388 | return; |
388 | 389 | ||
389 | d->toolBarHandler = new KDEPrivate::ToolBarHandler( this ); | 390 | d->toolBarHandler = new KDEPrivate::ToolBarHandler( this ); |
390 | 391 | ||
391 | /*US if ( factory() ) | 392 | /*US if ( factory() ) |
392 | factory()->addClient( d->toolBarHandler ); | 393 | factory()->addClient( d->toolBarHandler ); |
393 | */ | 394 | */ |
394 | } | 395 | } |
395 | else | 396 | else |
396 | { | 397 | { |
397 | if ( !d->toolBarHandler ) | 398 | if ( !d->toolBarHandler ) |
398 | return; | 399 | return; |
399 | /*US | 400 | /*US |
400 | if ( factory() ) | 401 | if ( factory() ) |
401 | factory()->removeClient( d->toolBarHandler ); | 402 | factory()->removeClient( d->toolBarHandler ); |
402 | */ | 403 | */ |
403 | delete d->toolBarHandler; | 404 | delete d->toolBarHandler; |
404 | d->toolBarHandler = 0; | 405 | d->toolBarHandler = 0; |
405 | } | 406 | } |
406 | 407 | ||
407 | } | 408 | } |
408 | 409 | ||
409 | bool KMainWindow::isStandardToolBarMenuEnabled() const | 410 | bool KMainWindow::isStandardToolBarMenuEnabled() const |
410 | { | 411 | { |
411 | return ( d->toolBarHandler != 0 ); | 412 | return ( d->toolBarHandler != 0 ); |
412 | } | 413 | } |
413 | 414 | ||
414 | void KMainWindow::createStandardStatusBarAction(){ | 415 | void KMainWindow::createStandardStatusBarAction(){ |
415 | if(!d->showStatusBarAction){ | 416 | if(!d->showStatusBarAction){ |
416 | d->showStatusBarAction = KStdAction::showStatusbar(this, SLOT(setSettingsDirty()), actionCollection()); | 417 | d->showStatusBarAction = KStdAction::showStatusbar(this, SLOT(setSettingsDirty()), actionCollection()); |
417 | connect(d->showStatusBarAction, SIGNAL(toggled(bool)), statusBar(), SLOT(setShown(bool))); | 418 | connect(d->showStatusBarAction, SIGNAL(toggled(bool)), statusBar(), SLOT(setShown(bool))); |
418 | if(internalStatusBar()) | 419 | if(internalStatusBar()) |
419 | d->showStatusBarAction->setChecked(!internalStatusBar()->isHidden()); | 420 | d->showStatusBarAction->setChecked(!internalStatusBar()->isHidden()); |
420 | } | 421 | } |
421 | } | 422 | } |
422 | 423 | ||
423 | QToolBar *KMainWindow::tBar( ) | 424 | QToolBar *KMainWindow::tBar( ) |
424 | { | 425 | { |
425 | if ( ! mQToolBar ) | 426 | if ( ! mQToolBar ) |
426 | mQToolBar = new QToolBar( this ); | 427 | mQToolBar = new QToolBar( this ); |
427 | return mQToolBar; | 428 | return mQToolBar; |
428 | } | 429 | } |
429 | 430 | ||
430 | KToolBar *KMainWindow::toolBar( const char * name ) | 431 | KToolBar *KMainWindow::toolBar( const char * name ) |
431 | { | 432 | { |
432 | 433 | ||
433 | if (!name) | 434 | if (!name) |
434 | name = "mainToolBar"; | 435 | name = "mainToolBar"; |
435 | KToolBar *tb = (KToolBar*)child( name, "KToolBar" ); | 436 | KToolBar *tb = (KToolBar*)child( name, "KToolBar" ); |
436 | if ( tb ) | 437 | if ( tb ) |
437 | return tb; | 438 | return tb; |
438 | bool honor_mode = (name == "mainToolBar"); | 439 | bool honor_mode = (name == "mainToolBar"); |
439 | 440 | ||
440 | /*US | 441 | /*US |
441 | if ( builderClient() ) | 442 | if ( builderClient() ) |
442 | return new KToolBar(this, name, honor_mode); // XMLGUI constructor | 443 | return new KToolBar(this, name, honor_mode); // XMLGUI constructor |
443 | else | 444 | else |
444 | */ | 445 | */ |
445 | return new KToolBar(this, Top, false, name, honor_mode ); // non-XMLGUI | 446 | return new KToolBar(this, Top, false, name, honor_mode ); // non-XMLGUI |
446 | } | 447 | } |
447 | 448 | ||
448 | QPtrListIterator<KToolBar> KMainWindow::toolBarIterator() | 449 | QPtrListIterator<KToolBar> KMainWindow::toolBarIterator() |
449 | { | 450 | { |
450 | toolbarList.clear(); | 451 | toolbarList.clear(); |
451 | QPtrList<QToolBar> lst; | 452 | QPtrList<QToolBar> lst; |
452 | for ( int i = (int)QMainWindow::Unmanaged; i <= (int)Minimized; ++i ) { | 453 | for ( int i = (int)QMainWindow::Unmanaged; i <= (int)Minimized; ++i ) { |
453 | lst = toolBars( (ToolBarDock)i ); | 454 | lst = toolBars( (ToolBarDock)i ); |
454 | for ( QToolBar *tb = lst.first(); tb; tb = lst.next() ) { | 455 | for ( QToolBar *tb = lst.first(); tb; tb = lst.next() ) { |
455 | if ( !tb->inherits( "KToolBar" ) ) | 456 | if ( !tb->inherits( "KToolBar" ) ) |
456 | continue; | 457 | continue; |
457 | toolbarList.append( (KToolBar*)tb ); | 458 | toolbarList.append( (KToolBar*)tb ); |
458 | } | 459 | } |
459 | } | 460 | } |
460 | return QPtrListIterator<KToolBar>( toolbarList ); | 461 | return QPtrListIterator<KToolBar>( toolbarList ); |
461 | } | 462 | } |
462 | 463 | ||
463 | void KMainWindow::setAutoSaveSettings( const QString & groupName, bool saveWindowSize ) | 464 | void KMainWindow::setAutoSaveSettings( const QString & groupName, bool saveWindowSize ) |
464 | { | 465 | { |
465 | d->autoSaveSettings = true; | 466 | d->autoSaveSettings = true; |
466 | d->autoSaveGroup = groupName; | 467 | d->autoSaveGroup = groupName; |
467 | d->autoSaveWindowSize = saveWindowSize; | 468 | d->autoSaveWindowSize = saveWindowSize; |
468 | // Get notified when the user moves a toolbar around | 469 | // Get notified when the user moves a toolbar around |
469 | //US connect( this, SIGNAL( dockWindowPositionChanged( QDockWindow * ) ), | 470 | //US connect( this, SIGNAL( dockWindowPositionChanged( QDockWindow * ) ), |
470 | //US this, SLOT( setSettingsDirty() ) ); | 471 | //US this, SLOT( setSettingsDirty() ) ); |
471 | connect( this, SIGNAL( toolBarPositionChanged(QToolBar *) ), | 472 | connect( this, SIGNAL( toolBarPositionChanged(QToolBar *) ), |
472 | this, SLOT( setSettingsDirty() ) ); | 473 | this, SLOT( setSettingsDirty() ) ); |
473 | 474 | ||
474 | 475 | ||
475 | // Get default values | 476 | // Get default values |
476 | //US int scnum = QApplication::desktop()->screenNumber(parentWidget()); | 477 | //US int scnum = QApplication::desktop()->screenNumber(parentWidget()); |
477 | //US QRect desk = QApplication::desktop()->screenGeometry(scnum); | 478 | //US QRect desk = QApplication::desktop()->screenGeometry(scnum); |
478 | QRect desk = KGlobalSettings::desktopGeometry(0); | 479 | QRect desk = KGlobalSettings::desktopGeometry(0); |
479 | 480 | ||
480 | d->defaultWindowSize = QRect(desk.width(), width(), desk.height(), height()); | 481 | d->defaultWindowSize = QRect(desk.width(), width(), desk.height(), height()); |
481 | // Now read the previously saved settings | 482 | // Now read the previously saved settings |
482 | applyMainWindowSettings( KGlobal::config(), groupName ); | 483 | applyMainWindowSettings( KGlobal::config(), groupName ); |
483 | } | 484 | } |
484 | 485 | ||
485 | 486 | ||
486 | void KMainWindow::resetAutoSaveSettings() | 487 | void KMainWindow::resetAutoSaveSettings() |
487 | { | 488 | { |
488 | d->autoSaveSettings = false; | 489 | d->autoSaveSettings = false; |
489 | if ( d->settingsTimer ) | 490 | if ( d->settingsTimer ) |
490 | d->settingsTimer->stop(); | 491 | d->settingsTimer->stop(); |
491 | } | 492 | } |
492 | 493 | ||
493 | bool KMainWindow::autoSaveSettings() const | 494 | bool KMainWindow::autoSaveSettings() const |
494 | { | 495 | { |
diff --git a/microkde/kdeui/kmainwindow.h b/microkde/kdeui/kmainwindow.h index e76e732..2aafb9d 100644 --- a/microkde/kdeui/kmainwindow.h +++ b/microkde/kdeui/kmainwindow.h | |||
@@ -1,288 +1,289 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the KDE libraries | 2 | This file is part of the KDE libraries |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License version 2 as published by the Free Software Foundation. | 6 | License version 2 as published by the Free Software Foundation. |
7 | 7 | ||
8 | This library is distributed in the hope that it will be useful, | 8 | This library is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | Library General Public License for more details. | 11 | Library General Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU Library General Public License | 13 | You should have received a copy of the GNU Library General Public License |
14 | along with this library; see the file COPYING.LIB. If not, write to | 14 | along with this library; see the file COPYING.LIB. If not, write to |
15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | Boston, MA 02111-1307, USA. | 16 | Boston, MA 02111-1307, USA. |
17 | 17 | ||
18 | $Id$ | 18 | $Id$ |
19 | 19 | ||
20 | */ | 20 | */ |
21 | 21 | ||
22 | 22 | ||
23 | 23 | ||
24 | #ifndef KMAINWINDOW_H | 24 | #ifndef KMAINWINDOW_H |
25 | #define KMAINWINDOW_H | 25 | #define KMAINWINDOW_H |
26 | 26 | ||
27 | /*US | 27 | /*US |
28 | #include "kxmlguifactory.h" | 28 | #include "kxmlguifactory.h" |
29 | #include "kxmlguiclient.h" | 29 | #include "kxmlguiclient.h" |
30 | #include "kxmlguibuilder.h" | 30 | #include "kxmlguibuilder.h" |
31 | #include <qmetaobject.h> | 31 | #include <qmetaobject.h> |
32 | 32 | ||
33 | class KPopupMenu; | 33 | class KPopupMenu; |
34 | class KXMLGUIFactory; | 34 | class KXMLGUIFactory; |
35 | class KConfig; | 35 | class KConfig; |
36 | class KHelpMenu; | 36 | class KHelpMenu; |
37 | class KStatusBar; | 37 | class KStatusBar; |
38 | class QStatusBar; | 38 | class QStatusBar; |
39 | class KMenuBar; | 39 | class KMenuBar; |
40 | class KMWSessionManaged; | 40 | class KMWSessionManaged; |
41 | class KAccel; | 41 | class KAccel; |
42 | class KToolBarMenuAction; | 42 | class KToolBarMenuAction; |
43 | */ | 43 | */ |
44 | 44 | ||
45 | class QMenuBar; | 45 | class QMenuBar; |
46 | class QStatusBar; | 46 | class QStatusBar; |
47 | class KMainWindowPrivate; | 47 | class KMainWindowPrivate; |
48 | class KAction; | 48 | class KAction; |
49 | 49 | ||
50 | #include <ktoolbar.h> | 50 | #include <ktoolbar.h> |
51 | #include <ktoolbarhandler.h> | 51 | #include <ktoolbarhandler.h> |
52 | #include <kxmlguiclient.h> | 52 | #include <kxmlguiclient.h> |
53 | #include <qmainwindow.h> | 53 | #include <qmainwindow.h> |
54 | #include <qptrlist.h> | 54 | #include <qptrlist.h> |
55 | 55 | ||
56 | class KActionCollection; | 56 | class KActionCollection; |
57 | 57 | ||
58 | class KMainWindow : public QMainWindow, virtual public KXMLGUIClient | 58 | class KMainWindow : public QMainWindow, virtual public KXMLGUIClient |
59 | { | 59 | { |
60 | Q_OBJECT | 60 | Q_OBJECT |
61 | 61 | ||
62 | private: | 62 | private: |
63 | //US create private defaultconstructor | 63 | //US create private defaultconstructor |
64 | KMainWindow() {;}; | 64 | KMainWindow() {;}; |
65 | 65 | ||
66 | public: | 66 | |
67 | public: | 67 | public: |
68 | /** | 68 | /** |
69 | * Construct a main window. | 69 | * Construct a main window. |
70 | * | 70 | * |
71 | * @param parent The widget parent. This is usually 0 but it may also be the window | 71 | * @param parent The widget parent. This is usually 0 but it may also be the window |
72 | * group leader. In that case, the KMainWindow becomes sort of a | 72 | * group leader. In that case, the KMainWindow becomes sort of a |
73 | * secondary window. | 73 | * secondary window. |
74 | * | 74 | * |
75 | * @param name The object name. For session management and window management to work | 75 | * @param name The object name. For session management and window management to work |
76 | * properly, all main windows in the application should have a | 76 | * properly, all main windows in the application should have a |
77 | * different name. When passing 0 (the default), KMainWindow will create | 77 | * different name. When passing 0 (the default), KMainWindow will create |
78 | * a unique name, but it's recommended to explicitly pass a window name that will | 78 | * a unique name, but it's recommended to explicitly pass a window name that will |
79 | * also describe the type of the window. If there can be several windows of the same | 79 | * also describe the type of the window. If there can be several windows of the same |
80 | * type, append '#' (hash) to the name, and KMainWindow will append numbers to make | 80 | * type, append '#' (hash) to the name, and KMainWindow will append numbers to make |
81 | * the names unique. For example, for a mail client which has one main window showing | 81 | * the names unique. For example, for a mail client which has one main window showing |
82 | * the mails and folders, and which can also have one or more windows for composing | 82 | * the mails and folders, and which can also have one or more windows for composing |
83 | * mails, the name for the folders window should be e.g. "mainwindow" and | 83 | * mails, the name for the folders window should be e.g. "mainwindow" and |
84 | * for the composer windows "composer#". | 84 | * for the composer windows "composer#". |
85 | * | 85 | * |
86 | * @param f Specify the widget flags. The default is | 86 | * @param f Specify the widget flags. The default is |
87 | * WType_TopLevel and WDestructiveClose. TopLevel indicates that a | 87 | * WType_TopLevel and WDestructiveClose. TopLevel indicates that a |
88 | * main window is a toplevel window, regardless of whether it has a | 88 | * main window is a toplevel window, regardless of whether it has a |
89 | * parent or not. DestructiveClose indicates that a main window is | 89 | * parent or not. DestructiveClose indicates that a main window is |
90 | * automatically destroyed when its window is closed. Pass 0 if | 90 | * automatically destroyed when its window is closed. Pass 0 if |
91 | * you do not want this behavior. | 91 | * you do not want this behavior. |
92 | * | 92 | * |
93 | * KMainWindows must be created on the heap with 'new', like: | 93 | * KMainWindows must be created on the heap with 'new', like: |
94 | * <pre> KMainWindow *kmw = new KMainWindow (...</pre> | 94 | * <pre> KMainWindow *kmw = new KMainWindow (...</pre> |
95 | **/ | 95 | **/ |
96 | KMainWindow( QWidget* parent = 0, const char *name = 0, WFlags f = WType_TopLevel | WDestructiveClose ); | 96 | //LR remove WDestructiveClose |
97 | KMainWindow( QWidget* parent = 0, const char *name = 0, WFlags f = WType_TopLevel /*| WDestructiveClose*/ ); | ||
97 | 98 | ||
98 | 99 | ||
99 | /** | 100 | /** |
100 | * Destructor. | 101 | * Destructor. |
101 | * | 102 | * |
102 | * Will also destroy the toolbars, and menubar if | 103 | * Will also destroy the toolbars, and menubar if |
103 | * needed. | 104 | * needed. |
104 | */ | 105 | */ |
105 | virtual ~KMainWindow(); | 106 | virtual ~KMainWindow(); |
106 | 107 | ||
107 | /** | 108 | /** |
108 | * Retrieve the standard help menu. | 109 | * Retrieve the standard help menu. |
109 | * | 110 | * |
110 | * It contains entires for the | 111 | * It contains entires for the |
111 | * help system (activated by F1), an optional "What's This?" entry | 112 | * help system (activated by F1), an optional "What's This?" entry |
112 | * (activated by Shift F1), an application specific dialog box, | 113 | * (activated by Shift F1), an application specific dialog box, |
113 | * and an "About KDE" dialog box. | 114 | * and an "About KDE" dialog box. |
114 | * | 115 | * |
115 | * Example (adding a standard help menu to your application): | 116 | * Example (adding a standard help menu to your application): |
116 | * <pre> | 117 | * <pre> |
117 | * KPopupMenu *help = helpMenu( <myTextString> ); | 118 | * KPopupMenu *help = helpMenu( <myTextString> ); |
118 | * menuBar()->insertItem( i18n("&Help"), help ); | 119 | * menuBar()->insertItem( i18n("&Help"), help ); |
119 | * </pre> | 120 | * </pre> |
120 | * | 121 | * |
121 | * @param aboutAppText The string that is used in the application | 122 | * @param aboutAppText The string that is used in the application |
122 | * specific dialog box. If you leave this string empty the | 123 | * specific dialog box. If you leave this string empty the |
123 | * information in the global @ref KAboutData of the | 124 | * information in the global @ref KAboutData of the |
124 | * application will be used to make a standard dialog box. | 125 | * application will be used to make a standard dialog box. |
125 | * | 126 | * |
126 | * @param showWhatsThis Set this to false if you do not want to include | 127 | * @param showWhatsThis Set this to false if you do not want to include |
127 | * the "What's This" menu entry. | 128 | * the "What's This" menu entry. |
128 | * | 129 | * |
129 | * @return A standard help menu. | 130 | * @return A standard help menu. |
130 | */ | 131 | */ |
131 | //US KPopupMenu* helpMenu( const QString &aboutAppText = QString::null, | 132 | //US KPopupMenu* helpMenu( const QString &aboutAppText = QString::null, |
132 | //US bool showWhatsThis = TRUE ); | 133 | //US bool showWhatsThis = TRUE ); |
133 | 134 | ||
134 | /** | 135 | /** |
135 | * Returns the help menu. Creates a standard help menu if none exists yet. | 136 | * Returns the help menu. Creates a standard help menu if none exists yet. |
136 | * | 137 | * |
137 | * It contains entries for the | 138 | * It contains entries for the |
138 | * help system (activated by F1), an optional "What's This?" entry | 139 | * help system (activated by F1), an optional "What's This?" entry |
139 | * (activated by Shift F1), an application specific dialog box, | 140 | * (activated by Shift F1), an application specific dialog box, |
140 | * and an "About KDE" dialog box. You must create the application | 141 | * and an "About KDE" dialog box. You must create the application |
141 | * specific dialog box yourself. When the "About application" | 142 | * specific dialog box yourself. When the "About application" |
142 | * menu entry is activated, a signal will trigger the | 143 | * menu entry is activated, a signal will trigger the |
143 | * @ref showAboutApplication slot. See @ref showAboutApplication for more | 144 | * @ref showAboutApplication slot. See @ref showAboutApplication for more |
144 | * information. | 145 | * information. |
145 | * | 146 | * |
146 | * Example (adding a help menu to your application): | 147 | * Example (adding a help menu to your application): |
147 | * <pre> | 148 | * <pre> |
148 | * menuBar()->insertItem( i18n("&Help"), customHelpMenu() ); | 149 | * menuBar()->insertItem( i18n("&Help"), customHelpMenu() ); |
149 | * </pre> | 150 | * </pre> |
150 | * | 151 | * |
151 | * @param showWhatsThis Set this to @p false if you do not want to include | 152 | * @param showWhatsThis Set this to @p false if you do not want to include |
152 | * the "What's This" menu entry. | 153 | * the "What's This" menu entry. |
153 | * | 154 | * |
154 | * @return A standard help menu. | 155 | * @return A standard help menu. |
155 | */ | 156 | */ |
156 | //US KPopupMenu* customHelpMenu( bool showWhatsThis = TRUE ); | 157 | //US KPopupMenu* customHelpMenu( bool showWhatsThis = TRUE ); |
157 | 158 | ||
158 | /** | 159 | /** |
159 | * @sect Session Management | 160 | * @sect Session Management |
160 | * | 161 | * |
161 | * Try to restore the toplevel widget as defined by the number (1..X). | 162 | * Try to restore the toplevel widget as defined by the number (1..X). |
162 | * | 163 | * |
163 | * If the session did not contain so high a number, the configuration | 164 | * If the session did not contain so high a number, the configuration |
164 | * is not changed and @p false returned. | 165 | * is not changed and @p false returned. |
165 | * | 166 | * |
166 | * That means clients could simply do the following: | 167 | * That means clients could simply do the following: |
167 | * <pre> | 168 | * <pre> |
168 | * if (kapp->isRestored()){ | 169 | * if (kapp->isRestored()){ |
169 | * int n = 1; | 170 | * int n = 1; |
170 | * while (KMainWindow::canBeRestored(n)){ | 171 | * while (KMainWindow::canBeRestored(n)){ |
171 | * (new childMW)->restore(n); | 172 | * (new childMW)->restore(n); |
172 | * n++; | 173 | * n++; |
173 | * } | 174 | * } |
174 | * } else { | 175 | * } else { |
175 | * // create default application as usual | 176 | * // create default application as usual |
176 | * } | 177 | * } |
177 | * </pre> | 178 | * </pre> |
178 | * Note that @ref QWidget::show() is called implicitly in restore. | 179 | * Note that @ref QWidget::show() is called implicitly in restore. |
179 | * | 180 | * |
180 | * With this you can easily restore all toplevel windows of your | 181 | * With this you can easily restore all toplevel windows of your |
181 | * application. | 182 | * application. |
182 | * | 183 | * |
183 | * If your application uses different kinds of toplevel | 184 | * If your application uses different kinds of toplevel |
184 | * windows, then you can use @ref KMainWindow::classNameOfToplevel(n) | 185 | * windows, then you can use @ref KMainWindow::classNameOfToplevel(n) |
185 | * to determine the exact type before calling the childMW | 186 | * to determine the exact type before calling the childMW |
186 | * constructor in the example from above. | 187 | * constructor in the example from above. |
187 | * | 188 | * |
188 | * If your client has only one kind of toplevel widgets (which | 189 | * If your client has only one kind of toplevel widgets (which |
189 | * should be pretty usual) then you should use the RESTORE-macro | 190 | * should be pretty usual) then you should use the RESTORE-macro |
190 | * for backwards compatibility with 3.1 and 3.0 branches: | 191 | * for backwards compatibility with 3.1 and 3.0 branches: |
191 | * | 192 | * |
192 | * <pre> | 193 | * <pre> |
193 | * if (kapp->isRestored()) | 194 | * if (kapp->isRestored()) |
194 | * RESTORE(childMW) | 195 | * RESTORE(childMW) |
195 | * else { | 196 | * else { |
196 | * // create default application as usual | 197 | * // create default application as usual |
197 | * } | 198 | * } |
198 | * </pre> | 199 | * </pre> |
199 | * | 200 | * |
200 | * The macro expands to the term above but is easier to use and | 201 | * The macro expands to the term above but is easier to use and |
201 | * less code to write. | 202 | * less code to write. |
202 | * | 203 | * |
203 | * For new code or if you have more than one kind of toplevel | 204 | * For new code or if you have more than one kind of toplevel |
204 | * widget (each derived from @ref KMainWindow, of course), you can | 205 | * widget (each derived from @ref KMainWindow, of course), you can |
205 | * use the templated @ref kRestoreMainWindows global functions: | 206 | * use the templated @ref kRestoreMainWindows global functions: |
206 | * | 207 | * |
207 | * <pre> | 208 | * <pre> |
208 | * if (kapp->isRestored()) | 209 | * if (kapp->isRestored()) |
209 | * kRestoreMainWindows< childMW1, childMW2, childMW3 >(); | 210 | * kRestoreMainWindows< childMW1, childMW2, childMW3 >(); |
210 | * else { | 211 | * else { |
211 | * // create default application as usual | 212 | * // create default application as usual |
212 | * } | 213 | * } |
213 | * </pre> | 214 | * </pre> |
214 | * | 215 | * |
215 | * Currently, these functions are provided for up to three | 216 | * Currently, these functions are provided for up to three |
216 | * template arguments. If you need more, tell us. To help you in | 217 | * template arguments. If you need more, tell us. To help you in |
217 | * deciding whether or not you can use @ref kRestoreMainWindows, a | 218 | * deciding whether or not you can use @ref kRestoreMainWindows, a |
218 | * define KDE_RESTORE_MAIN_WINDOWS_NUM_TEMPLATE_ARGS is provided. | 219 | * define KDE_RESTORE_MAIN_WINDOWS_NUM_TEMPLATE_ARGS is provided. |
219 | * | 220 | * |
220 | * @see restore() | 221 | * @see restore() |
221 | * @see classNameOfToplevel() | 222 | * @see classNameOfToplevel() |
222 | * | 223 | * |
223 | **/ | 224 | **/ |
224 | static bool canBeRestored( int number ); | 225 | static bool canBeRestored( int number ); |
225 | 226 | ||
226 | /** | 227 | /** |
227 | * Returns the @ref className() of the @p number of the toplevel window which | 228 | * Returns the @ref className() of the @p number of the toplevel window which |
228 | * should be restored. | 229 | * should be restored. |
229 | * | 230 | * |
230 | * This is only useful if your application uses | 231 | * This is only useful if your application uses |
231 | * different kinds of toplevel windows. | 232 | * different kinds of toplevel windows. |
232 | */ | 233 | */ |
233 | static const QString classNameOfToplevel( int number ); | 234 | static const QString classNameOfToplevel( int number ); |
234 | 235 | ||
235 | /** | 236 | /** |
236 | * Restore the session specified by @p number. | 237 | * Restore the session specified by @p number. |
237 | * | 238 | * |
238 | * Returns @p false if this | 239 | * Returns @p false if this |
239 | * fails, otherwise returns @p true and shows the window. | 240 | * fails, otherwise returns @p true and shows the window. |
240 | * You should call @ref canBeRestored() first. | 241 | * You should call @ref canBeRestored() first. |
241 | * If @p show is true (default), this widget will be shown automatically. | 242 | * If @p show is true (default), this widget will be shown automatically. |
242 | */ | 243 | */ |
243 | bool restore( int number, bool show = TRUE ); | 244 | bool restore( int number, bool show = TRUE ); |
244 | 245 | ||
245 | //US virtual KXMLGUIFactory *guiFactory(); | 246 | //US virtual KXMLGUIFactory *guiFactory(); |
246 | 247 | ||
247 | /** | 248 | /** |
248 | * Create a GUI given a local XML file. | 249 | * Create a GUI given a local XML file. |
249 | * | 250 | * |
250 | * If @p xmlfile is NULL, | 251 | * If @p xmlfile is NULL, |
251 | * then it will try to construct a local XML filename like | 252 | * then it will try to construct a local XML filename like |
252 | * appnameui.rc where 'appname' is your app's name. If that file | 253 | * appnameui.rc where 'appname' is your app's name. If that file |
253 | * does not exist, then the XML UI code will only use the global | 254 | * does not exist, then the XML UI code will only use the global |
254 | * (standard) XML file for the layout purposes. | 255 | * (standard) XML file for the layout purposes. |
255 | * | 256 | * |
256 | * Note that when passing true for the conserveMemory argument subsequent | 257 | * Note that when passing true for the conserveMemory argument subsequent |
257 | * calls to guiFactory()->addClient/removeClient may not work as expected. | 258 | * calls to guiFactory()->addClient/removeClient may not work as expected. |
258 | * Also retrieving references to containers like popup menus or toolbars using | 259 | * Also retrieving references to containers like popup menus or toolbars using |
259 | * the container method will not work. | 260 | * the container method will not work. |
260 | * | 261 | * |
261 | * @param xmlfile The local xmlfile (relative or absolute) | 262 | * @param xmlfile The local xmlfile (relative or absolute) |
262 | * @param _conserveMemory Specify whether createGUI() should call | 263 | * @param _conserveMemory Specify whether createGUI() should call |
263 | * @ref KXMLGuiClient::conserveMemory() to free all memory | 264 | * @ref KXMLGuiClient::conserveMemory() to free all memory |
264 | * allocated by the @ref QDomDocument and by the KXMLGUIFactory. | 265 | * allocated by the @ref QDomDocument and by the KXMLGUIFactory. |
265 | */ | 266 | */ |
266 | void createGUI( const QString &xmlfile = QString::null, bool _conserveMemory = TRUE ); | 267 | void createGUI( const QString &xmlfile = QString::null, bool _conserveMemory = TRUE ); |
267 | 268 | ||
268 | /** | 269 | /** |
269 | * Enables the build of a standard help menu when calling createGUI(). | 270 | * Enables the build of a standard help menu when calling createGUI(). |
270 | * | 271 | * |
271 | * The default behavior is to build one, you must call this function | 272 | * The default behavior is to build one, you must call this function |
272 | * to disable it | 273 | * to disable it |
273 | */ | 274 | */ |
274 | void setHelpMenuEnabled(bool showHelpMenu = true); | 275 | void setHelpMenuEnabled(bool showHelpMenu = true); |
275 | 276 | ||
276 | /** | 277 | /** |
277 | * Return @p true when the help menu is enabled | 278 | * Return @p true when the help menu is enabled |
278 | */ | 279 | */ |
279 | bool isHelpMenuEnabled(); | 280 | bool isHelpMenuEnabled(); |
280 | 281 | ||
281 | 282 | ||
282 | /** | 283 | /** |
283 | * Returns true, if there is a menubar | 284 | * Returns true, if there is a menubar |
284 | * @since 3.1 | 285 | * @since 3.1 |
285 | */ | 286 | */ |
286 | bool hasMenuBar(); | 287 | bool hasMenuBar(); |
287 | 288 | ||
288 | /** | 289 | /** |
diff --git a/pwmanager/pwmanager/getmasterpwwnd_emb.cpp b/pwmanager/pwmanager/getmasterpwwnd_emb.cpp index 8404c3e..678f05f 100644 --- a/pwmanager/pwmanager/getmasterpwwnd_emb.cpp +++ b/pwmanager/pwmanager/getmasterpwwnd_emb.cpp | |||
@@ -1,208 +1,208 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of PwManager/Platform independent. | 2 | This file is part of PwManager/Platform independent. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | 22 | ||
23 | $Id$ | 23 | $Id$ |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "getmasterpwwnd_emb.h" | 26 | #include "getmasterpwwnd_emb.h" |
27 | 27 | ||
28 | #include "klocale.h" | 28 | #include "klocale.h" |
29 | 29 | ||
30 | /* | 30 | /* |
31 | #include <qvariant.h> | 31 | #include <qvariant.h> |
32 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qlineedit.h> | 34 | #include <qlineedit.h> |
35 | #include <qlayout.h> | 35 | #include <qlayout.h> |
36 | #include <qtooltip.h> | 36 | #include <qtooltip.h> |
37 | #include <qwhatsthis.h> | 37 | #include <qwhatsthis.h> |
38 | */ | 38 | */ |
39 | 39 | ||
40 | #include <qwidget.h> | 40 | #include <qwidget.h> |
41 | #include <qlayout.h> | 41 | #include <qlayout.h> |
42 | #include <qlabel.h> | 42 | #include <qlabel.h> |
43 | #include <qlineedit.h> | 43 | #include <qlineedit.h> |
44 | #include <qpushbutton.h> | 44 | #include <qpushbutton.h> |
45 | #include <qapplication.h> | 45 | #include <qapplication.h> |
46 | 46 | ||
47 | /* | 47 | /* |
48 | * Constructs a getMasterPwWnd as a child of 'parent', with the | 48 | * Constructs a getMasterPwWnd as a child of 'parent', with the |
49 | * name 'name' | 49 | * name 'name' |
50 | */ | 50 | */ |
51 | getMasterPwWnd::getMasterPwWnd( QWidget* parent, const char* name) | 51 | getMasterPwWnd::getMasterPwWnd( QWidget* parent, const char* name) |
52 | : KDialogBase( KDialogBase::Plain, i18n( "Master-password" ), | 52 | : KDialogBase( KDialogBase::Plain, i18n( "Master-password" ), |
53 | KDialogBase::Ok | KDialogBase::Cancel, | 53 | KDialogBase::Ok | KDialogBase::Cancel, |
54 | KDialogBase::Ok, parent, name, true ) | 54 | KDialogBase::Ok, parent, name, true ) |
55 | { | 55 | { |
56 | QWidget *page = plainPage(); | 56 | QWidget *page = plainPage(); |
57 | QVBoxLayout *pageLayout = new QVBoxLayout( page ); | 57 | QVBoxLayout *pageLayout = new QVBoxLayout( page ); |
58 | 58 | ||
59 | pwLineEdit = new QLineEdit( page, "pwLineEdit" ); | 59 | pwLineEdit = new QLineEdit( page, "pwLineEdit" ); |
60 | pwLineEdit->setEchoMode( QLineEdit::Password ); | 60 | pwLineEdit->setEchoMode( QLineEdit::Password ); |
61 | 61 | ||
62 | QLabel* textLabel1 = new QLabel( pwLineEdit, i18n("Please enter the master-password:"), page, "textLabel1" ); | 62 | QLabel* textLabel1 = new QLabel( pwLineEdit, i18n("Please enter the master-password:"), page, "textLabel1" ); |
63 | textLabel1->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) ); | 63 | textLabel1->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) ); |
64 | pageLayout->addWidget(textLabel1); | 64 | pageLayout->addWidget(textLabel1); |
65 | pageLayout->addWidget(pwLineEdit); | 65 | pageLayout->addWidget(pwLineEdit); |
66 | 66 | ||
67 | QWidget* numberBox = new QWidget( page ); | 67 | QWidget* numberBox = new QWidget( page ); |
68 | #ifndef DESKTOP_VERSION | 68 | #ifndef DESKTOP_VERSION |
69 | if ( QApplication::desktop()->width() > 320 ) { | 69 | if ( QApplication::desktop()->width() > 320 ) { |
70 | numberBox->setFixedHeight(250); | 70 | numberBox->setFixedHeight(250); |
71 | numberBox->setFixedWidth(200); | 71 | numberBox->setFixedWidth(200); |
72 | } | 72 | } |
73 | else{ | 73 | else{ |
74 | numberBox->setFixedHeight(150); | 74 | numberBox->setFixedHeight(150); |
75 | numberBox->setFixedWidth(150); | 75 | numberBox->setFixedWidth(150); |
76 | } | 76 | } |
77 | #endif | 77 | #endif |
78 | 78 | ||
79 | QGridLayout* numberLayout = new QGridLayout( numberBox, 4, 3 ); | 79 | QGridLayout* numberLayout = new QGridLayout( numberBox, 4, 3 ); |
80 | numberLayout->setMargin( 0 ); | 80 | numberLayout->setMargin( 0 ); |
81 | numberLayout->setSpacing( 0 ); | 81 | numberLayout->setSpacing( 0 ); |
82 | 82 | ||
83 | QPushButton* p1 = new QPushButton( i18n("1"), numberBox ); | 83 | QPushButton* p1 = new QPushButton( i18n("1"), numberBox ); |
84 | numberLayout->addWidget( p1, 0, 0 ); | 84 | numberLayout->addWidget( p1, 0, 0 ); |
85 | QPushButton* p2 = new QPushButton( i18n("2"), numberBox ); | 85 | QPushButton* p2 = new QPushButton( i18n("2"), numberBox ); |
86 | numberLayout->addWidget( p2, 0, 1 ); | 86 | numberLayout->addWidget( p2, 0, 1 ); |
87 | QPushButton* p3 = new QPushButton( i18n("3"), numberBox ); | 87 | QPushButton* p3 = new QPushButton( i18n("3"), numberBox ); |
88 | numberLayout->addWidget( p3, 0, 2 ); | 88 | numberLayout->addWidget( p3, 0, 2 ); |
89 | QPushButton* p4 = new QPushButton( i18n("4"), numberBox ); | 89 | QPushButton* p4 = new QPushButton( i18n("4"), numberBox ); |
90 | numberLayout->addWidget( p4, 1, 0 ); | 90 | numberLayout->addWidget( p4, 1, 0 ); |
91 | QPushButton* p5 = new QPushButton( i18n("5"), numberBox ); | 91 | QPushButton* p5 = new QPushButton( i18n("5"), numberBox ); |
92 | numberLayout->addWidget( p5, 1, 1 ); | 92 | numberLayout->addWidget( p5, 1, 1 ); |
93 | QPushButton* p6 = new QPushButton( i18n("6"), numberBox ); | 93 | QPushButton* p6 = new QPushButton( i18n("6"), numberBox ); |
94 | numberLayout->addWidget( p6, 1, 2 ); | 94 | numberLayout->addWidget( p6, 1, 2 ); |
95 | QPushButton* p7 = new QPushButton( i18n("7"), numberBox ); | 95 | QPushButton* p7 = new QPushButton( i18n("7"), numberBox ); |
96 | numberLayout->addWidget( p7, 2, 0 ); | 96 | numberLayout->addWidget( p7, 2, 0 ); |
97 | QPushButton* p8 = new QPushButton( i18n("8"), numberBox ); | 97 | QPushButton* p8 = new QPushButton( i18n("8"), numberBox ); |
98 | numberLayout->addWidget( p8, 2, 1 ); | 98 | numberLayout->addWidget( p8, 2, 1 ); |
99 | QPushButton* p9 = new QPushButton( i18n("9"), numberBox ); | 99 | QPushButton* p9 = new QPushButton( i18n("9"), numberBox ); |
100 | numberLayout->addWidget( p9, 2, 2 ); | 100 | numberLayout->addWidget( p9, 2, 2 ); |
101 | QPushButton* clear = new QPushButton( i18n("x"), numberBox ); | 101 | QPushButton* clear = new QPushButton( i18n("x"), numberBox ); |
102 | numberLayout->addWidget( clear, 3, 0 ); | 102 | numberLayout->addWidget( clear, 3, 0 ); |
103 | QPushButton* p0 = new QPushButton( i18n("0"), numberBox ); | 103 | QPushButton* p0 = new QPushButton( i18n("0"), numberBox ); |
104 | numberLayout->addWidget( p0, 3, 1 ); | 104 | numberLayout->addWidget( p0, 3, 1 ); |
105 | QPushButton* backspace = new QPushButton( i18n("-"), numberBox ); | 105 | QPushButton* backspace = new QPushButton( i18n("-"), numberBox ); |
106 | numberLayout->addWidget( backspace, 3, 2 ); | 106 | numberLayout->addWidget( backspace, 3, 2 ); |
107 | 107 | ||
108 | 108 | ||
109 | pageLayout->addWidget(numberBox); | 109 | pageLayout->addWidget(numberBox); |
110 | #ifdef DESKTOP_VERSION | 110 | #ifdef DESKTOP_VERSION |
111 | resize( sizeHint() ); | 111 | resize( sizeHint() ); |
112 | #else | 112 | #else |
113 | resize( 200,sizeHint().height() ); | 113 | resize( 200,sizeHint().height() ); |
114 | #endif | 114 | #endif |
115 | 115 | ||
116 | connect( p0, SIGNAL( clicked() ), this, SLOT( add0() ) ); | 116 | connect( p0, SIGNAL( clicked() ), this, SLOT( add0() ) ); |
117 | connect( p1, SIGNAL( clicked() ), this, SLOT( add1() ) ); | 117 | connect( p1, SIGNAL( clicked() ), this, SLOT( add1() ) ); |
118 | connect( p2, SIGNAL( clicked() ), this, SLOT( add2() ) ); | 118 | connect( p2, SIGNAL( clicked() ), this, SLOT( add2() ) ); |
119 | connect( p3, SIGNAL( clicked() ), this, SLOT( add3() ) ); | 119 | connect( p3, SIGNAL( clicked() ), this, SLOT( add3() ) ); |
120 | connect( p4, SIGNAL( clicked() ), this, SLOT( add4() ) ); | 120 | connect( p4, SIGNAL( clicked() ), this, SLOT( add4() ) ); |
121 | connect( p5, SIGNAL( clicked() ), this, SLOT( add5() ) ); | 121 | connect( p5, SIGNAL( clicked() ), this, SLOT( add5() ) ); |
122 | connect( p6, SIGNAL( clicked() ), this, SLOT( add6() ) ); | 122 | connect( p6, SIGNAL( clicked() ), this, SLOT( add6() ) ); |
123 | connect( p7, SIGNAL( clicked() ), this, SLOT( add7() ) ); | 123 | connect( p7, SIGNAL( clicked() ), this, SLOT( add7() ) ); |
124 | connect( p8, SIGNAL( clicked() ), this, SLOT( add8() ) ); | 124 | connect( p8, SIGNAL( clicked() ), this, SLOT( add8() ) ); |
125 | connect( p9, SIGNAL( clicked() ), this, SLOT( add9() ) ); | 125 | connect( p9, SIGNAL( clicked() ), this, SLOT( add9() ) ); |
126 | connect( backspace, SIGNAL( clicked() ), this, SLOT( backspace() ) ); | 126 | connect( backspace, SIGNAL( clicked() ), this, SLOT( backspace() ) ); |
127 | connect( clear, SIGNAL( clicked() ), this, SLOT( clear() ) ); | 127 | connect( clear, SIGNAL( clicked() ), this, SLOT( clear() ) ); |
128 | 128 | ||
129 | 129 | pwLineEdit->setFocus(); | |
130 | 130 | ||
131 | } | 131 | } |
132 | 132 | ||
133 | /* | 133 | /* |
134 | * Destroys the object and frees any allocated resources | 134 | * Destroys the object and frees any allocated resources |
135 | */ | 135 | */ |
136 | getMasterPwWnd::~getMasterPwWnd() | 136 | getMasterPwWnd::~getMasterPwWnd() |
137 | { | 137 | { |
138 | // no need to delete child widgets, Qt does it all for us | 138 | // no need to delete child widgets, Qt does it all for us |
139 | } | 139 | } |
140 | 140 | ||
141 | void getMasterPwWnd::okButton_slot() | 141 | void getMasterPwWnd::okButton_slot() |
142 | { | 142 | { |
143 | qWarning( "getMasterPwWnd::okButton_slot(): Not implemented yet" ); | 143 | qWarning( "getMasterPwWnd::okButton_slot(): Not implemented yet" ); |
144 | } | 144 | } |
145 | 145 | ||
146 | void getMasterPwWnd::cancelButton_slot() | 146 | void getMasterPwWnd::cancelButton_slot() |
147 | { | 147 | { |
148 | qWarning( "getMasterPwWnd::cancelButton_slot(): Not implemented yet" ); | 148 | qWarning( "getMasterPwWnd::cancelButton_slot(): Not implemented yet" ); |
149 | } | 149 | } |
150 | 150 | ||
151 | void getMasterPwWnd::add0() | 151 | void getMasterPwWnd::add0() |
152 | { | 152 | { |
153 | addCharacter("0"); | 153 | addCharacter("0"); |
154 | } | 154 | } |
155 | void getMasterPwWnd::add1() | 155 | void getMasterPwWnd::add1() |
156 | { | 156 | { |
157 | addCharacter("1"); | 157 | addCharacter("1"); |
158 | } | 158 | } |
159 | void getMasterPwWnd::add2() | 159 | void getMasterPwWnd::add2() |
160 | { | 160 | { |
161 | addCharacter("2"); | 161 | addCharacter("2"); |
162 | } | 162 | } |
163 | void getMasterPwWnd::add3() | 163 | void getMasterPwWnd::add3() |
164 | { | 164 | { |
165 | addCharacter("3"); | 165 | addCharacter("3"); |
166 | } | 166 | } |
167 | void getMasterPwWnd::add4() | 167 | void getMasterPwWnd::add4() |
168 | { | 168 | { |
169 | addCharacter("4"); | 169 | addCharacter("4"); |
170 | } | 170 | } |
171 | void getMasterPwWnd::add5() | 171 | void getMasterPwWnd::add5() |
172 | { | 172 | { |
173 | addCharacter("5"); | 173 | addCharacter("5"); |
174 | } | 174 | } |
175 | void getMasterPwWnd::add6() | 175 | void getMasterPwWnd::add6() |
176 | { | 176 | { |
177 | addCharacter("6"); | 177 | addCharacter("6"); |
178 | } | 178 | } |
179 | void getMasterPwWnd::add7() | 179 | void getMasterPwWnd::add7() |
180 | { | 180 | { |
181 | addCharacter("7"); | 181 | addCharacter("7"); |
182 | } | 182 | } |
183 | void getMasterPwWnd::add8() | 183 | void getMasterPwWnd::add8() |
184 | { | 184 | { |
185 | addCharacter("8"); | 185 | addCharacter("8"); |
186 | } | 186 | } |
187 | void getMasterPwWnd::add9() | 187 | void getMasterPwWnd::add9() |
188 | { | 188 | { |
189 | addCharacter("9"); | 189 | addCharacter("9"); |
190 | } | 190 | } |
191 | void getMasterPwWnd::backspace() | 191 | void getMasterPwWnd::backspace() |
192 | { | 192 | { |
193 | QString old = pwLineEdit->text(); | 193 | QString old = pwLineEdit->text(); |
194 | old.truncate(old.length()-1); | 194 | old.truncate(old.length()-1); |
195 | pwLineEdit->setText(old); | 195 | pwLineEdit->setText(old); |
196 | } | 196 | } |
197 | 197 | ||
198 | void getMasterPwWnd::clear() | 198 | void getMasterPwWnd::clear() |
199 | { | 199 | { |
200 | pwLineEdit->setText(""); | 200 | pwLineEdit->setText(""); |
201 | } | 201 | } |
202 | 202 | ||
203 | void getMasterPwWnd::addCharacter(const QString& s) | 203 | void getMasterPwWnd::addCharacter(const QString& s) |
204 | { | 204 | { |
205 | QString old = pwLineEdit->text(); | 205 | QString old = pwLineEdit->text(); |
206 | pwLineEdit->setText(old + s); | 206 | pwLineEdit->setText(old + s); |
207 | } | 207 | } |
208 | 208 | ||
diff --git a/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp b/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp index 26b9708..a8696ea 100644 --- a/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp +++ b/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp | |||
@@ -1,349 +1,349 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <qframe.h> | 25 | #include <qframe.h> |
26 | #include <qgroupbox.h> | 26 | #include <qgroupbox.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qtabwidget.h> | 29 | #include <qtabwidget.h> |
30 | #include <qcombobox.h> | 30 | #include <qcombobox.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qspinbox.h> | 32 | #include <qspinbox.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | #include <qvbox.h> | 35 | #include <qvbox.h> |
36 | 36 | ||
37 | #include <kconfig.h> | 37 | #include <kconfig.h> |
38 | #include <kdebug.h> | 38 | #include <kdebug.h> |
39 | #include <kdialog.h> | 39 | #include <kdialog.h> |
40 | #include <klistview.h> | 40 | #include <klistview.h> |
41 | #include <klocale.h> | 41 | #include <klocale.h> |
42 | #include <kglobal.h> | 42 | #include <kglobal.h> |
43 | #include <kmessagebox.h> | 43 | #include <kmessagebox.h> |
44 | #include <kstandarddirs.h> | 44 | #include <kstandarddirs.h> |
45 | #include <kio/kfile/kurlrequester.h> | 45 | #include <kio/kfile/kurlrequester.h> |
46 | 46 | ||
47 | #include "pwmprefs.h" | 47 | #include "pwmprefs.h" |
48 | 48 | ||
49 | #include "pwmconfigwidget.h" | 49 | #include "pwmconfigwidget.h" |
50 | #include "pwmexception.h" | 50 | #include "pwmexception.h" |
51 | 51 | ||
52 | PWMConfigWidget::PWMConfigWidget(PWMPrefs *prefs, QWidget *parent, const char *name ) | 52 | PWMConfigWidget::PWMConfigWidget(PWMPrefs *prefs, QWidget *parent, const char *name ) |
53 | : KPrefsWidget(prefs, parent, name ) | 53 | : KPrefsWidget(prefs, parent, name ) |
54 | { | 54 | { |
55 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 55 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, |
56 | KDialog::spacingHint() ); | 56 | KDialog::spacingHint() ); |
57 | 57 | ||
58 | QTabWidget *tabWidget = new QTabWidget( this ); | 58 | QTabWidget *tabWidget = new QTabWidget( this ); |
59 | topLayout->addWidget( tabWidget ); | 59 | topLayout->addWidget( tabWidget ); |
60 | 60 | ||
61 | // windowsStyle page | 61 | // windowsStyle page |
62 | ////////////////////////////////////////////////////// | 62 | ////////////////////////////////////////////////////// |
63 | QWidget *windowStylePage = new QWidget( this ); | 63 | QWidget *windowStylePage = new QWidget( this ); |
64 | QGridLayout *windowStyleLayout = new QGridLayout( windowStylePage, 3, 3); | 64 | QGridLayout *windowStyleLayout = new QGridLayout( windowStylePage, 3, 3); |
65 | 65 | ||
66 | int i = 0; | 66 | int i = 0; |
67 | KPrefsWidRadios * windowStyle = addWidRadios(i18n("Window-style:") ,&(prefs->mMainViewStyle), windowStylePage); | 67 | KPrefsWidRadios * windowStyle = addWidRadios(i18n("Window-style:") ,&(prefs->mMainViewStyle), windowStylePage); |
68 | windowStyle->addRadio(i18n("Category on top")); | 68 | windowStyle->addRadio(i18n("Category on top")); |
69 | windowStyle->addRadio(i18n("Category-list left/top")); | 69 | windowStyle->addRadio(i18n("Category-list left/top")); |
70 | windowStyleLayout->addMultiCellWidget( (QWidget*)windowStyle->groupBox(),i,i,0,2); | 70 | windowStyleLayout->addMultiCellWidget( (QWidget*)windowStyle->groupBox(),i,i,0,2); |
71 | ++i; | 71 | ++i; |
72 | 72 | ||
73 | QLabel* lab = new QLabel(i18n("<b>Font for Password entries:</b>"), windowStylePage); | 73 | QLabel* lab = new QLabel(i18n("<b>Font for Password entries:</b>"), windowStylePage); |
74 | windowStyleLayout->addMultiCellWidget( lab,i,i,0,2); | 74 | windowStyleLayout->addMultiCellWidget( lab,i,i,0,2); |
75 | 75 | ||
76 | 76 | ||
77 | ++i; | 77 | ++i; |
78 | 78 | ||
79 | KPrefsWidFont *selEntrFont = | 79 | KPrefsWidFont *selEntrFont = |
80 | addWidFont(i18n("Password"),i18n("Font:"), | 80 | addWidFont(i18n("Password"),i18n("Font:"), |
81 | &(prefs->mEntryFont),windowStylePage); | 81 | &(prefs->mEntryFont),windowStylePage); |
82 | windowStyleLayout->addWidget(selEntrFont->label(),i,0); | 82 | windowStyleLayout->addWidget(selEntrFont->label(),i,0); |
83 | windowStyleLayout->addWidget(selEntrFont->preview(),i,1); | 83 | windowStyleLayout->addWidget(selEntrFont->preview(),i,1); |
84 | windowStyleLayout->addWidget(selEntrFont->button(),i,2); | 84 | windowStyleLayout->addWidget(selEntrFont->button(),i,2); |
85 | ++i; | 85 | ++i; |
86 | lab = new QLabel(i18n(""), windowStylePage); | 86 | lab = new QLabel(i18n(""), windowStylePage); |
87 | windowStyleLayout->addMultiCellWidget( lab,i,i,0,2); | 87 | windowStyleLayout->addMultiCellWidget( lab,i,i,0,2); |
88 | 88 | ||
89 | // File page | 89 | // File page |
90 | ////////////////////////////////////////////////////// | 90 | ////////////////////////////////////////////////////// |
91 | QWidget *filePage = new QWidget( this ); | 91 | QWidget *filePage = new QWidget( this ); |
92 | QGridLayout *fileLayout = new QGridLayout( filePage, 3, 2); | 92 | QGridLayout *fileLayout = new QGridLayout( filePage, 3, 2); |
93 | 93 | ||
94 | i = 0; | 94 | i = 0; |
95 | QLabel* kcfg_compression_label = new QLabel(i18n("Compression:"), filePage); | 95 | QLabel* kcfg_compression_label = new QLabel(i18n("Compression:"), filePage); |
96 | fileLayout->addWidget(kcfg_compression_label,i,0); | 96 | fileLayout->addWidget(kcfg_compression_label,i,0); |
97 | kcfg_compression = new QComboBox(filePage, "kcfg_compression"); | 97 | kcfg_compression = new QComboBox(filePage, "kcfg_compression"); |
98 | kcfg_compression->insertItem(i18n("None")); | 98 | kcfg_compression->insertItem(i18n("None")); |
99 | kcfg_compression->insertItem(i18n("gzip")); | 99 | kcfg_compression->insertItem(i18n("gzip")); |
100 | //US not yet supported: kcfg_compression->insertItem(i18n("bzip2")); | 100 | //US not yet supported: kcfg_compression->insertItem(i18n("bzip2")); |
101 | fileLayout->addWidget( kcfg_compression,i,1); | 101 | fileLayout->addWidget( kcfg_compression,i,1); |
102 | ++i; | 102 | ++i; |
103 | 103 | ||
104 | QLabel* kcfg_crypt_label = new QLabel(i18n("Encryption:"), filePage); | 104 | QLabel* kcfg_crypt_label = new QLabel(i18n("Encryption:"), filePage); |
105 | fileLayout->addWidget(kcfg_crypt_label,i,0); | 105 | fileLayout->addWidget(kcfg_crypt_label,i,0); |
106 | kcfg_cryptAlgo = new QComboBox(filePage, "kcfg_cryptAlgo"); | 106 | kcfg_cryptAlgo = new QComboBox(filePage, "kcfg_cryptAlgo"); |
107 | kcfg_cryptAlgo->insertItem(i18n("Blowfish (128 bit)")); | 107 | kcfg_cryptAlgo->insertItem(i18n("Blowfish (128 bit)")); |
108 | #ifdef CONFIG_PWMANAGER_GCRY | 108 | #ifdef CONFIG_PWMANAGER_GCRY |
109 | kcfg_cryptAlgo->insertItem(i18n("AES-128, Rijndael (128 bit)")); | 109 | kcfg_cryptAlgo->insertItem(i18n("AES-128, Rijndael (128 bit)")); |
110 | kcfg_cryptAlgo->insertItem(i18n("AES-192, Rijndael (192 bit)")); | 110 | kcfg_cryptAlgo->insertItem(i18n("AES-192, Rijndael (192 bit)")); |
111 | kcfg_cryptAlgo->insertItem(i18n("AES-256, Rijndael (256 bit)")); | 111 | kcfg_cryptAlgo->insertItem(i18n("AES-256, Rijndael (256 bit)")); |
112 | kcfg_cryptAlgo->insertItem(i18n("Triple-DES (168 bit)")); | 112 | kcfg_cryptAlgo->insertItem(i18n("Triple-DES (168 bit)")); |
113 | kcfg_cryptAlgo->insertItem(i18n("Twofish (256 bit)")); | 113 | kcfg_cryptAlgo->insertItem(i18n("Twofish (256 bit)")); |
114 | kcfg_cryptAlgo->insertItem(i18n("Twofish-128 (128 bit)")); | 114 | kcfg_cryptAlgo->insertItem(i18n("Twofish-128 (128 bit)")); |
115 | #endif // CONFIG_PWMANAGER_GCRY | 115 | #endif // CONFIG_PWMANAGER_GCRY |
116 | fileLayout->addWidget( kcfg_cryptAlgo,i,1); | 116 | fileLayout->addWidget( kcfg_cryptAlgo,i,1); |
117 | ++i; | 117 | ++i; |
118 | 118 | ||
119 | QLabel* kcfg_hash_label = new QLabel(i18n("Hashing:"), filePage); | 119 | QLabel* kcfg_hash_label = new QLabel(i18n("Hashing:"), filePage); |
120 | fileLayout->addWidget(kcfg_hash_label,i,0); | 120 | fileLayout->addWidget(kcfg_hash_label,i,0); |
121 | kcfg_hashAlgo = new QComboBox(filePage, "kcfg_hashAlgo"); | 121 | kcfg_hashAlgo = new QComboBox(filePage, "kcfg_hashAlgo"); |
122 | kcfg_hashAlgo->insertItem(i18n("SHA-160, SHA1 (160 bit)")); | 122 | kcfg_hashAlgo->insertItem(i18n("SHA-160, SHA1 (160 bit)")); |
123 | #ifdef CONFIG_PWMANAGER_GCRY | 123 | #ifdef CONFIG_PWMANAGER_GCRY |
124 | kcfg_hashAlgo->insertItem(i18n("SHA-256 (256 bit)")); | 124 | kcfg_hashAlgo->insertItem(i18n("SHA-256 (256 bit)")); |
125 | kcfg_hashAlgo->insertItem(i18n("SHA-384 (384 bit)")); | 125 | kcfg_hashAlgo->insertItem(i18n("SHA-384 (384 bit)")); |
126 | kcfg_hashAlgo->insertItem(i18n("SHA-512 (512 bit)")); | 126 | kcfg_hashAlgo->insertItem(i18n("SHA-512 (512 bit)")); |
127 | kcfg_hashAlgo->insertItem(i18n("MD5 (128 bit)")); | 127 | kcfg_hashAlgo->insertItem(i18n("MD5 (128 bit)")); |
128 | kcfg_hashAlgo->insertItem(i18n("RIPE-MD-160 (160 bit)")); | 128 | kcfg_hashAlgo->insertItem(i18n("RIPE-MD-160 (160 bit)")); |
129 | kcfg_hashAlgo->insertItem(i18n("Tiger (192 bit)")); | 129 | kcfg_hashAlgo->insertItem(i18n("Tiger (192 bit)")); |
130 | #endif // CONFIG_PWMANAGER_GCRY | 130 | #endif // CONFIG_PWMANAGER_GCRY |
131 | fileLayout->addWidget( kcfg_hashAlgo,i,1); | 131 | fileLayout->addWidget( kcfg_hashAlgo,i,1); |
132 | ++i; | 132 | ++i; |
133 | 133 | ||
134 | permissionLineEdit = new QLineEdit(filePage); | 134 | permissionLineEdit = new QLineEdit(filePage); |
135 | QLabel* permissionLineLabel = new QLabel(permissionLineEdit, i18n("Permissions:"), filePage); | 135 | QLabel* permissionLineLabel = new QLabel(permissionLineEdit, i18n("Permissions:"), filePage); |
136 | fileLayout->addWidget(permissionLineLabel,i,0); | 136 | fileLayout->addWidget(permissionLineLabel,i,0); |
137 | fileLayout->addWidget(permissionLineEdit,i,1); | 137 | fileLayout->addWidget(permissionLineEdit,i,1); |
138 | ++i; | 138 | ++i; |
139 | 139 | ||
140 | KPrefsWidBool *sb = addWidBool(i18n("Make backup before saving"), | 140 | KPrefsWidBool *sb = addWidBool(i18n("Make backup before saving"), |
141 | &(prefs->mMakeFileBackup),filePage); | 141 | &(prefs->mMakeFileBackup),filePage); |
142 | fileLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 142 | fileLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
143 | ++i; | 143 | ++i; |
144 | 144 | ||
145 | // Timeout page | 145 | // Timeout page |
146 | ////////////////////////////////////////////////////// | 146 | ////////////////////////////////////////////////////// |
147 | QWidget *timeoutPage = new QWidget( this ); | 147 | QWidget *timeoutPage = new QWidget( this ); |
148 | QGridLayout *timeoutLayout = new QGridLayout( timeoutPage, 3, 2); | 148 | QGridLayout *timeoutLayout = new QGridLayout( timeoutPage, 3, 2); |
149 | 149 | ||
150 | i = 0; | 150 | i = 0; |
151 | pwTimeoutSpinBox = new QSpinBox( timeoutPage, "pwTimeoutSpinBox" ); | 151 | pwTimeoutSpinBox = new QSpinBox( 0,600,10,timeoutPage, "pwTimeoutSpinBox" ); |
152 | QLabel* timeoutLabel = new QLabel(pwTimeoutSpinBox, i18n("Password timeout\n(timeout to hold password in\nmemory,so you don't have to\nre-enter it,if you\nalready have entered it)\n[set to 0 to disable]:"), timeoutPage); | 152 | QLabel* timeoutLabel = new QLabel(pwTimeoutSpinBox, i18n("Password timeout\n(timeout to hold password in\nmemory,so you don't have to\nre-enter it,if you\nalready have entered it)\n[set to 0 to disable]:"), timeoutPage); |
153 | timeoutLayout->addMultiCellWidget(timeoutLabel,i, i, 0 ,0); | 153 | timeoutLayout->addMultiCellWidget(timeoutLabel,i, i, 0 ,0); |
154 | timeoutLayout->addWidget(pwTimeoutSpinBox,i,1); | 154 | timeoutLayout->addWidget(pwTimeoutSpinBox,i,1); |
155 | ++i; | 155 | ++i; |
156 | 156 | ||
157 | lockTimeoutSpinBox = new QSpinBox( timeoutPage, "lockTimeoutSpinBox" ); | 157 | lockTimeoutSpinBox = new QSpinBox( 0,600,10,timeoutPage, "lockTimeoutSpinBox" ); |
158 | QLabel* lockTimeoutLabel = new QLabel(lockTimeoutSpinBox, i18n("Auto-lock timeout\n(auto lock document after this\namount of seconds)\n[set to 0 to disable]:"), timeoutPage); | 158 | QLabel* lockTimeoutLabel = new QLabel(lockTimeoutSpinBox, i18n("Auto-lock timeout\n(auto lock document after this\namount of seconds)\n[set to 0 to disable]:"), timeoutPage); |
159 | timeoutLayout->addMultiCellWidget(lockTimeoutLabel,i, i, 0 ,0); | 159 | timeoutLayout->addMultiCellWidget(lockTimeoutLabel,i, i, 0 ,0); |
160 | timeoutLayout->addWidget(lockTimeoutSpinBox,i,1); | 160 | timeoutLayout->addWidget(lockTimeoutSpinBox,i,1); |
161 | ++i; | 161 | ++i; |
162 | 162 | ||
163 | sb = addWidBool(i18n("deep-lock on autolock"), | 163 | sb = addWidBool(i18n("deep-lock on autolock"), |
164 | &(prefs->mAutoDeeplock),timeoutPage); | 164 | &(prefs->mAutoDeeplock),timeoutPage); |
165 | timeoutLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 165 | timeoutLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
166 | ++i; | 166 | ++i; |
167 | 167 | ||
168 | 168 | ||
169 | // Autostart page | 169 | // Autostart page |
170 | ////////////////////////////////////////////////////// | 170 | ////////////////////////////////////////////////////// |
171 | QWidget *autostartPage = new QWidget( this ); | 171 | QWidget *autostartPage = new QWidget( this ); |
172 | QGridLayout *autostartLayout = new QGridLayout( autostartPage, 3, 2); | 172 | QGridLayout *autostartLayout = new QGridLayout( autostartPage, 3, 2); |
173 | 173 | ||
174 | i = 0; | 174 | i = 0; |
175 | 175 | ||
176 | autostartLineEdit = new KURLRequester(autostartPage, "autoStartLineEdit"); | 176 | autostartLineEdit = new KURLRequester(autostartPage, "autoStartLineEdit"); |
177 | QLabel* autostartLineLabel = new QLabel(autostartLineEdit, "Open this file automatically on startup:",autostartPage); | 177 | QLabel* autostartLineLabel = new QLabel(autostartLineEdit, "Open this file automatically on startup:",autostartPage); |
178 | autostartLayout->addMultiCellWidget(autostartLineLabel,i,i,0,1); | 178 | autostartLayout->addMultiCellWidget(autostartLineLabel,i,i,0,1); |
179 | ++i; | 179 | ++i; |
180 | autostartLayout->addMultiCellWidget(autostartLineEdit,i,i,0,1); | 180 | autostartLayout->addMultiCellWidget(autostartLineEdit,i,i,0,1); |
181 | ++i; | 181 | ++i; |
182 | 182 | ||
183 | sb = addWidBool(i18n("open deeplocked"), | 183 | sb = addWidBool(i18n("open deeplocked"), |
184 | &(prefs->mAutostartDeeplocked),autostartPage); | 184 | &(prefs->mAutostartDeeplocked),autostartPage); |
185 | autostartLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 185 | autostartLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
186 | ++i; | 186 | ++i; |
187 | 187 | ||
188 | 188 | ||
189 | // external app page | 189 | // external app page |
190 | ////////////////////////////////////////////////////// | 190 | ////////////////////////////////////////////////////// |
191 | QWidget *externalappPage = new QWidget( this ); | 191 | QWidget *externalappPage = new QWidget( this ); |
192 | QGridLayout *externalappLayout = new QGridLayout( externalappPage, 3, 2); | 192 | QGridLayout *externalappLayout = new QGridLayout( externalappPage, 3, 2); |
193 | 193 | ||
194 | i = 0; | 194 | i = 0; |
195 | 195 | ||
196 | browserLineEdit = new QLineEdit(externalappPage); | 196 | browserLineEdit = new QLineEdit(externalappPage); |
197 | QLabel* browserLineLabel = new QLabel(browserLineEdit, i18n("Favourite browser:"), externalappPage); | 197 | QLabel* browserLineLabel = new QLabel(browserLineEdit, i18n("Favourite browser:"), externalappPage); |
198 | externalappLayout->addWidget(browserLineLabel,i,0); | 198 | externalappLayout->addWidget(browserLineLabel,i,0); |
199 | externalappLayout->addWidget(browserLineEdit,i,1); | 199 | externalappLayout->addWidget(browserLineEdit,i,1); |
200 | ++i; | 200 | ++i; |
201 | 201 | ||
202 | xtermLineEdit = new QLineEdit(externalappPage); | 202 | xtermLineEdit = new QLineEdit(externalappPage); |
203 | QLabel* xtermLineLabel = new QLabel(xtermLineEdit, i18n("Favourite x-terminal:"), externalappPage); | 203 | QLabel* xtermLineLabel = new QLabel(xtermLineEdit, i18n("Favourite x-terminal:"), externalappPage); |
204 | externalappLayout->addWidget(xtermLineLabel,i,0); | 204 | externalappLayout->addWidget(xtermLineLabel,i,0); |
205 | externalappLayout->addWidget(xtermLineEdit,i,1); | 205 | externalappLayout->addWidget(xtermLineEdit,i,1); |
206 | ++i; | 206 | ++i; |
207 | 207 | ||
208 | 208 | ||
209 | // miscelaneous page | 209 | // miscelaneous page |
210 | ////////////////////////////////////////////////////// | 210 | ////////////////////////////////////////////////////// |
211 | QWidget *miscPage = new QWidget( this ); | 211 | QWidget *miscPage = new QWidget( this ); |
212 | QGridLayout *miscLayout = new QGridLayout( miscPage, 3, 2); | 212 | QGridLayout *miscLayout = new QGridLayout( miscPage, 3, 2); |
213 | 213 | ||
214 | i = 0; | 214 | i = 0; |
215 | 215 | ||
216 | /*US ENH: PWM/Pi has no tray and con be minimized | 216 | /*US ENH: PWM/Pi has no tray and con be minimized |
217 | sb = addWidBool(i18n("Show icon in system-tray"),&(prefs->mTray),miscPage); | 217 | sb = addWidBool(i18n("Show icon in system-tray"),&(prefs->mTray),miscPage); |
218 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 218 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
219 | ++i; | 219 | ++i; |
220 | */ | 220 | */ |
221 | 221 | ||
222 | sb = addWidBool(i18n("Open document with passwords unlocked"),&(prefs->mUnlockOnOpen),miscPage); | 222 | sb = addWidBool(i18n("Open document with passwords unlocked"),&(prefs->mUnlockOnOpen),miscPage); |
223 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 223 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
224 | ++i; | 224 | ++i; |
225 | 225 | ||
226 | /*US ENH: PWM/Pi has no tray and con be minimized | 226 | /*US ENH: PWM/Pi has no tray and con be minimized |
227 | sb = addWidBool(i18n("auto-minimize to tray on startup"),&(prefs->mAutoMinimizeOnStart),miscPage); | 227 | sb = addWidBool(i18n("auto-minimize to tray on startup"),&(prefs->mAutoMinimizeOnStart),miscPage); |
228 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 228 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
229 | ++i; | 229 | ++i; |
230 | 230 | ||
231 | KPrefsWidRadios * minimizeRadio = addWidRadios(i18n("auto-lock on minimize:") ,&(prefs->mMinimizeLock), miscPage); | 231 | KPrefsWidRadios * minimizeRadio = addWidRadios(i18n("auto-lock on minimize:") ,&(prefs->mMinimizeLock), miscPage); |
232 | minimizeRadio->addRadio(i18n("don't lock")); | 232 | minimizeRadio->addRadio(i18n("don't lock")); |
233 | minimizeRadio->addRadio(i18n("normal lock")); | 233 | minimizeRadio->addRadio(i18n("normal lock")); |
234 | minimizeRadio->addRadio(i18n("deep-lock")); | 234 | minimizeRadio->addRadio(i18n("deep-lock")); |
235 | miscLayout->addMultiCellWidget( (QWidget*)minimizeRadio->groupBox(),i,i,0,2); | 235 | miscLayout->addMultiCellWidget( (QWidget*)minimizeRadio->groupBox(),i,i,0,2); |
236 | ++i; | 236 | ++i; |
237 | 237 | ||
238 | sb = addWidBool(i18n("KWallet emulation"),&(prefs->mKWalletEmu),miscPage); | 238 | sb = addWidBool(i18n("KWallet emulation"),&(prefs->mKWalletEmu),miscPage); |
239 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 239 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
240 | ++i; | 240 | ++i; |
241 | 241 | ||
242 | sb = addWidBool(i18n("Close instead Minimize into tray"),&(prefs->mClose),miscPage); | 242 | sb = addWidBool(i18n("Close instead Minimize into tray"),&(prefs->mClose),miscPage); |
243 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 243 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
244 | ++i; | 244 | ++i; |
245 | */ | 245 | */ |
246 | 246 | ||
247 | 247 | ||
248 | tabWidget->addTab( windowStylePage, i18n( "Look && feel" ) ); | 248 | tabWidget->addTab( windowStylePage, i18n( "Look && feel" ) ); |
249 | tabWidget->addTab( filePage, i18n( "File" ) ); | 249 | tabWidget->addTab( filePage, i18n( "File" ) ); |
250 | tabWidget->addTab( timeoutPage, i18n( "Timeout" ) ); | 250 | tabWidget->addTab( timeoutPage, i18n( "Timeout" ) ); |
251 | tabWidget->addTab( autostartPage, i18n( "Autostart" ) ); | 251 | tabWidget->addTab( autostartPage, i18n( "Autostart" ) ); |
252 | tabWidget->addTab( externalappPage, i18n( "External apps" ) ); | 252 | tabWidget->addTab( externalappPage, i18n( "External apps" ) ); |
253 | tabWidget->addTab( miscPage, i18n( "Miscellaneous" ) ); | 253 | tabWidget->addTab( miscPage, i18n( "Miscellaneous" ) ); |
254 | 254 | ||
255 | 255 | ||
256 | connect( permissionLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); | 256 | connect( permissionLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); |
257 | connect( pwTimeoutSpinBox, SIGNAL( valueChanged(int) ), this, SLOT( modified() ) ); | 257 | connect( pwTimeoutSpinBox, SIGNAL( valueChanged(int) ), this, SLOT( modified() ) ); |
258 | connect( lockTimeoutSpinBox, SIGNAL( valueChanged(int) ), this, SLOT( modified() ) ); | 258 | connect( lockTimeoutSpinBox, SIGNAL( valueChanged(int) ), this, SLOT( modified() ) ); |
259 | connect( autostartLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); | 259 | connect( autostartLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); |
260 | connect( browserLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); | 260 | connect( browserLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); |
261 | connect( xtermLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); | 261 | connect( xtermLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( modified() ) ); |
262 | 262 | ||
263 | } | 263 | } |
264 | 264 | ||
265 | 265 | ||
266 | void PWMConfigWidget::usrReadConfig() | 266 | void PWMConfigWidget::usrReadConfig() |
267 | { | 267 | { |
268 | PWMPrefs* prefs = PWMPrefs::instance(); | 268 | PWMPrefs* prefs = PWMPrefs::instance(); |
269 | 269 | ||
270 | 270 | ||
271 | setFilePermissions(prefs->mFilePermissions); | 271 | setFilePermissions(prefs->mFilePermissions); |
272 | 272 | ||
273 | pwTimeoutSpinBox->setValue(prefs->mPwTimeout); | 273 | pwTimeoutSpinBox->setValue(prefs->mPwTimeout); |
274 | lockTimeoutSpinBox->setValue(prefs->mLockTimeout); | 274 | lockTimeoutSpinBox->setValue(prefs->mLockTimeout); |
275 | autostartLineEdit->setURL(prefs->mAutoStart); | 275 | autostartLineEdit->setURL(prefs->mAutoStart); |
276 | browserLineEdit->setText(prefs->mBrowserCommand); | 276 | browserLineEdit->setText(prefs->mBrowserCommand); |
277 | xtermLineEdit->setText(prefs->mXTermCommand); | 277 | xtermLineEdit->setText(prefs->mXTermCommand); |
278 | 278 | ||
279 | kcfg_compression->setCurrentItem(prefs->mCompression); | 279 | kcfg_compression->setCurrentItem(prefs->mCompression); |
280 | kcfg_cryptAlgo->setCurrentItem(prefs->mCryptAlgo); | 280 | kcfg_cryptAlgo->setCurrentItem(prefs->mCryptAlgo); |
281 | kcfg_hashAlgo->setCurrentItem(prefs->mHashAlgo); | 281 | kcfg_hashAlgo->setCurrentItem(prefs->mHashAlgo); |
282 | } | 282 | } |
283 | 283 | ||
284 | void PWMConfigWidget::usrWriteConfig() | 284 | void PWMConfigWidget::usrWriteConfig() |
285 | { | 285 | { |
286 | PWMPrefs* prefs = PWMPrefs::instance(); | 286 | PWMPrefs* prefs = PWMPrefs::instance(); |
287 | 287 | ||
288 | prefs->mFilePermissions = getFilePermissions(); | 288 | prefs->mFilePermissions = getFilePermissions(); |
289 | 289 | ||
290 | prefs->mPwTimeout = pwTimeoutSpinBox->value(); | 290 | prefs->mPwTimeout = pwTimeoutSpinBox->value(); |
291 | prefs->mLockTimeout = lockTimeoutSpinBox->value(); | 291 | prefs->mLockTimeout = lockTimeoutSpinBox->value(); |
292 | prefs->mAutoStart = autostartLineEdit->url(); | 292 | prefs->mAutoStart = autostartLineEdit->url(); |
293 | 293 | ||
294 | prefs->mBrowserCommand = browserLineEdit->text(); | 294 | prefs->mBrowserCommand = browserLineEdit->text(); |
295 | prefs->mXTermCommand = xtermLineEdit->text(); | 295 | prefs->mXTermCommand = xtermLineEdit->text(); |
296 | 296 | ||
297 | prefs->mCompression = kcfg_compression->currentItem(); | 297 | prefs->mCompression = kcfg_compression->currentItem(); |
298 | prefs->mCryptAlgo = kcfg_cryptAlgo->currentItem(); | 298 | prefs->mCryptAlgo = kcfg_cryptAlgo->currentItem(); |
299 | prefs->mHashAlgo = kcfg_hashAlgo->currentItem(); | 299 | prefs->mHashAlgo = kcfg_hashAlgo->currentItem(); |
300 | 300 | ||
301 | } | 301 | } |
302 | 302 | ||
303 | int PWMConfigWidget::getFilePermissions() | 303 | int PWMConfigWidget::getFilePermissions() |
304 | { | 304 | { |
305 | char octalDigits[] = "01234567"; | 305 | char octalDigits[] = "01234567"; |
306 | bool isOctal; | 306 | bool isOctal; |
307 | QString permString(permissionLineEdit->text()); | 307 | QString permString(permissionLineEdit->text()); |
308 | int i, j, length = permString.length(); | 308 | int i, j, length = permString.length(); |
309 | if (length != 3) { | 309 | if (length != 3) { |
310 | printWarn("Wrong permission string length! Please enter " | 310 | printWarn("Wrong permission string length! Please enter " |
311 | "the string like the following example: 600"); | 311 | "the string like the following example: 600"); |
312 | return CONF_DEFAULT_FILEPERMISSIONS; | 312 | return CONF_DEFAULT_FILEPERMISSIONS; |
313 | } | 313 | } |
314 | for (i = 0; i < length; ++i) { | 314 | for (i = 0; i < length; ++i) { |
315 | isOctal = false; | 315 | isOctal = false; |
316 | for (j = 0; j < 8; ++j) { | 316 | for (j = 0; j < 8; ++j) { |
317 | if (permString.at(i) == octalDigits[j]) { | 317 | if (permString.at(i) == octalDigits[j]) { |
318 | isOctal = true; | 318 | isOctal = true; |
319 | break; | 319 | break; |
320 | } | 320 | } |
321 | } | 321 | } |
322 | if (!isOctal) { | 322 | if (!isOctal) { |
323 | printWarn("CONFIG: File-permissions: This is " | 323 | printWarn("CONFIG: File-permissions: This is " |
324 | "not an octal number "); | 324 | "not an octal number "); |
325 | return CONF_DEFAULT_FILEPERMISSIONS; | 325 | return CONF_DEFAULT_FILEPERMISSIONS; |
326 | } | 326 | } |
327 | } | 327 | } |
328 | 328 | ||
329 | int ret = strtol(permString.latin1(), 0, 8); | 329 | int ret = strtol(permString.latin1(), 0, 8); |
330 | if (ret == 0) { | 330 | if (ret == 0) { |
331 | /* either an error occured, or the user did really type 000 */ | 331 | /* either an error occured, or the user did really type 000 */ |
332 | printWarn("CONFIG: File-permissions: Hm, either conversion error, " | 332 | printWarn("CONFIG: File-permissions: Hm, either conversion error, " |
333 | "or you really typed 000. 8-)"); | 333 | "or you really typed 000. 8-)"); |
334 | return CONF_DEFAULT_FILEPERMISSIONS; | 334 | return CONF_DEFAULT_FILEPERMISSIONS; |
335 | } | 335 | } |
336 | return ret; | 336 | return ret; |
337 | } | 337 | } |
338 | 338 | ||
339 | void PWMConfigWidget::setFilePermissions(int perm) | 339 | void PWMConfigWidget::setFilePermissions(int perm) |
340 | { | 340 | { |
341 | char tmpBuf[30]; | 341 | char tmpBuf[30]; |
342 | sprintf(tmpBuf, "%o", perm); | 342 | sprintf(tmpBuf, "%o", perm); |
343 | permissionLineEdit->setText(tmpBuf); | 343 | permissionLineEdit->setText(tmpBuf); |
344 | } | 344 | } |
345 | 345 | ||
346 | 346 | ||
347 | 347 | ||
348 | #ifndef PWM_EMBEDDED | 348 | #ifndef PWM_EMBEDDED |
349 | #include "pwmconfigwidget.moc" | 349 | #include "pwmconfigwidget.moc" |
diff --git a/pwmanager/pwmanager/libgcryptif.cpp b/pwmanager/pwmanager/libgcryptif.cpp index eafd318..ff94bf6 100644 --- a/pwmanager/pwmanager/libgcryptif.cpp +++ b/pwmanager/pwmanager/libgcryptif.cpp | |||
@@ -250,200 +250,205 @@ PwMerror LibGCryptIf::hash(unsigned char **outBuf, | |||
250 | hashLen = gcry_md_get_algo_dlen(algo); | 250 | hashLen = gcry_md_get_algo_dlen(algo); |
251 | *outBufLen = hashLen; | 251 | *outBufLen = hashLen; |
252 | *outBuf = new unsigned char[*outBufLen]; | 252 | *outBuf = new unsigned char[*outBufLen]; |
253 | gcry_md_hash_buffer(algo, | 253 | gcry_md_hash_buffer(algo, |
254 | *outBuf, | 254 | *outBuf, |
255 | inBuf, | 255 | inBuf, |
256 | inBufLen); | 256 | inBufLen); |
257 | return ret; | 257 | return ret; |
258 | } | 258 | } |
259 | 259 | ||
260 | unsigned int LibGCryptIf::hashLength(char _algo) | 260 | unsigned int LibGCryptIf::hashLength(char _algo) |
261 | { | 261 | { |
262 | unsigned int ret; | 262 | unsigned int ret; |
263 | int algo = mapHashId(_algo); | 263 | int algo = mapHashId(_algo); |
264 | ret = gcry_md_get_algo_dlen(algo); | 264 | ret = gcry_md_get_algo_dlen(algo); |
265 | return ret; | 265 | return ret; |
266 | } | 266 | } |
267 | 267 | ||
268 | int LibGCryptIf::mapCipherId(char algo) | 268 | int LibGCryptIf::mapCipherId(char algo) |
269 | { | 269 | { |
270 | switch (algo) { | 270 | switch (algo) { |
271 | case PWM_CRYPT_AES128: | 271 | case PWM_CRYPT_AES128: |
272 | return GCRY_CIPHER_AES; | 272 | return GCRY_CIPHER_AES; |
273 | case PWM_CRYPT_AES192: | 273 | case PWM_CRYPT_AES192: |
274 | return GCRY_CIPHER_AES192; | 274 | return GCRY_CIPHER_AES192; |
275 | case PWM_CRYPT_AES256: | 275 | case PWM_CRYPT_AES256: |
276 | return GCRY_CIPHER_AES256; | 276 | return GCRY_CIPHER_AES256; |
277 | case PWM_CRYPT_3DES: | 277 | case PWM_CRYPT_3DES: |
278 | return GCRY_CIPHER_3DES; | 278 | return GCRY_CIPHER_3DES; |
279 | case PWM_CRYPT_TWOFISH: | 279 | case PWM_CRYPT_TWOFISH: |
280 | return GCRY_CIPHER_TWOFISH; | 280 | return GCRY_CIPHER_TWOFISH; |
281 | case PWM_CRYPT_TWOFISH128: | 281 | case PWM_CRYPT_TWOFISH128: |
282 | return GCRY_CIPHER_TWOFISH128; | 282 | return GCRY_CIPHER_TWOFISH128; |
283 | default: | 283 | default: |
284 | BUG(); | 284 | BUG(); |
285 | } | 285 | } |
286 | return GCRY_CIPHER_NONE; | 286 | return GCRY_CIPHER_NONE; |
287 | } | 287 | } |
288 | 288 | ||
289 | int LibGCryptIf::mapHashId(char algo) | 289 | int LibGCryptIf::mapHashId(char algo) |
290 | { | 290 | { |
291 | switch (algo) { | 291 | switch (algo) { |
292 | case PWM_HASH_SHA1: | 292 | case PWM_HASH_SHA1: |
293 | return GCRY_MD_SHA1; | 293 | return GCRY_MD_SHA1; |
294 | case PWM_HASH_SHA256: | 294 | case PWM_HASH_SHA256: |
295 | return GCRY_MD_SHA256; | 295 | return GCRY_MD_SHA256; |
296 | case PWM_HASH_SHA384: | 296 | case PWM_HASH_SHA384: |
297 | return GCRY_MD_SHA384; | 297 | return GCRY_MD_SHA384; |
298 | case PWM_HASH_SHA512: | 298 | case PWM_HASH_SHA512: |
299 | return GCRY_MD_SHA512; | 299 | return GCRY_MD_SHA512; |
300 | case PWM_HASH_MD5: | 300 | case PWM_HASH_MD5: |
301 | return GCRY_MD_MD5; | 301 | return GCRY_MD_MD5; |
302 | case PWM_HASH_RMD160: | 302 | case PWM_HASH_RMD160: |
303 | return GCRY_MD_RMD160; | 303 | return GCRY_MD_RMD160; |
304 | case PWM_HASH_TIGER: | 304 | case PWM_HASH_TIGER: |
305 | return GCRY_MD_TIGER; | 305 | return GCRY_MD_TIGER; |
306 | default: | 306 | default: |
307 | BUG(); | 307 | BUG(); |
308 | } | 308 | } |
309 | return GCRY_MD_NONE; | 309 | return GCRY_MD_NONE; |
310 | } | 310 | } |
311 | 311 | ||
312 | bool LibGCryptIf::hashPassphrase(const unsigned char *pw, | 312 | bool LibGCryptIf::hashPassphrase(const unsigned char *pw, |
313 | size_t pwlen, | 313 | size_t pwlen, |
314 | unsigned char *salt, | 314 | unsigned char *salt, |
315 | unsigned char *key, | 315 | unsigned char *key, |
316 | size_t keylen, | 316 | size_t keylen, |
317 | bool create) | 317 | bool create) |
318 | { | 318 | { |
319 | DEK dek; | 319 | DEK dek; |
320 | STRING2KEY s2k; | 320 | STRING2KEY s2k; |
321 | bool ret; | 321 | bool ret; |
322 | 322 | ||
323 | dek.keylen = keylen; | 323 | dek.keylen = keylen; |
324 | s2k.mode = 1; | 324 | s2k.mode = 1; |
325 | s2k.hash_algo = mapHashId(conf()->confGlobHashAlgo()); | 325 | s2k.hash_algo = mapHashId(conf()->confGlobHashAlgo()); |
326 | s2k.count = 0; | 326 | s2k.count = 0; |
327 | if (!create) | 327 | if (!create) |
328 | memcpy(s2k.salt, salt, STRING2KEY_SALTLEN); | 328 | memcpy(s2k.salt, salt, STRING2KEY_SALTLEN); |
329 | ret = doHashPassphrase(&dek, | 329 | ret = doHashPassphrase(&dek, |
330 | pw, | 330 | pw, |
331 | pwlen, | 331 | pwlen, |
332 | &s2k, | 332 | &s2k, |
333 | create); | 333 | create); |
334 | if (!ret) | 334 | if (!ret) |
335 | goto out; | 335 | goto out; |
336 | memcpy(key, dek.key, dek.keylen); | 336 | memcpy(key, dek.key, dek.keylen); |
337 | if (create) | 337 | if (create) |
338 | memcpy(salt, s2k.salt, STRING2KEY_SALTLEN); | 338 | memcpy(salt, s2k.salt, STRING2KEY_SALTLEN); |
339 | out: | 339 | out: |
340 | return ret; | 340 | return ret; |
341 | } | 341 | } |
342 | 342 | ||
343 | 343 | ||
344 | bool LibGCryptIf::doHashPassphrase(DEK *dek, | 344 | bool LibGCryptIf::doHashPassphrase(DEK *dek, |
345 | const unsigned char *pw, | 345 | const unsigned char *pw, |
346 | size_t pwlen, | 346 | size_t pwlen, |
347 | STRING2KEY *s2k, | 347 | STRING2KEY *s2k, |
348 | bool create) | 348 | bool create) |
349 | { | 349 | { |
350 | // This function is derived from GnuPG-1.2.5-rc2 | 350 | // This function is derived from GnuPG-1.2.5-rc2 |
351 | gcry_md_hd_t md; | 351 | gcry_md_hd_t md; |
352 | gcry_error_t err; | 352 | gcry_error_t err; |
353 | bool ret = true; | 353 | bool ret = true; |
354 | size_t pass, i; | 354 | size_t pass, i; |
355 | size_t used = 0; | 355 | size_t used = 0; |
356 | 356 | ||
357 | PWM_ASSERT(s2k->hash_algo); | 357 | PWM_ASSERT(s2k->hash_algo); |
358 | BUG_ON(!(dek->keylen > 0 && dek->keylen <= array_size(dek->key))); | 358 | BUG_ON(!(dek->keylen > 0 && dek->keylen <= array_size(dek->key))); |
359 | 359 | ||
360 | err = gcry_md_open(&md, s2k->hash_algo, 0); | 360 | err = gcry_md_open(&md, s2k->hash_algo, 0); |
361 | if (err != GPG_ERR_NO_ERROR) { | 361 | if (err != GPG_ERR_NO_ERROR) { |
362 | ret = false; | 362 | ret = false; |
363 | goto out; | 363 | goto out; |
364 | } | 364 | } |
365 | for (pass = 0; used < dek->keylen; pass++) { | 365 | for (pass = 0; used < dek->keylen; pass++) { |
366 | if (pass) { | 366 | if (pass) { |
367 | gcry_md_reset(md); | 367 | gcry_md_reset(md); |
368 | for (i = 0; i < pass; i++) // preset the hash context | 368 | for (i = 0; i < pass; i++) // preset the hash context |
369 | gcry_md_putc(md, 0); | 369 | gcry_md_putc(md, 0); |
370 | } | 370 | } |
371 | if (s2k->mode == 1 || s2k->mode == 3) { | 371 | if (s2k->mode == 1 || s2k->mode == 3) { |
372 | size_t len2 = pwlen + 8; | 372 | size_t len2 = pwlen + 8; |
373 | size_t count = len2; | 373 | size_t count = len2; |
374 | 374 | ||
375 | if (create && !pass) { | 375 | if (create && !pass) { |
376 | Randomizer *rnd = Randomizer::obj(); | 376 | Randomizer *rnd = Randomizer::obj(); |
377 | const unsigned int salt_len = 8; | 377 | const unsigned int salt_len = 8; |
378 | string rndBuf(rnd->genRndBuf(salt_len)); | 378 | string rndBuf(rnd->genRndBuf(salt_len)); |
379 | memcpy(s2k->salt, rndBuf.c_str(), salt_len); | 379 | memcpy(s2k->salt, rndBuf.c_str(), salt_len); |
380 | if (s2k->mode == 3) | 380 | if (s2k->mode == 3) |
381 | s2k->count = 96; // 65536 iterations | 381 | s2k->count = 96; // 65536 iterations |
382 | } | 382 | } |
383 | if (s2k->mode == 3) { | 383 | if (s2k->mode == 3) { |
384 | count = (16ul + (s2k->count & 15)) << ((s2k->count >> 4) + 6); | 384 | count = (16ul + (s2k->count & 15)) << ((s2k->count >> 4) + 6); |
385 | if (count < len2) | 385 | if (count < len2) |
386 | count = len2; | 386 | count = len2; |
387 | } | 387 | } |
388 | // a little bit complicated because we need a ulong for count | 388 | // a little bit complicated because we need a ulong for count |
389 | while (count > len2) { // maybe iterated+salted | 389 | while (count > len2) { // maybe iterated+salted |
390 | gcry_md_write(md, s2k->salt, 8); | 390 | gcry_md_write(md, s2k->salt, 8); |
391 | gcry_md_write(md, pw, pwlen); | 391 | gcry_md_write(md, pw, pwlen); |
392 | count -= len2; | 392 | count -= len2; |
393 | } | 393 | } |
394 | if (count < 8) { | 394 | if (count < 8) { |
395 | gcry_md_write(md, s2k->salt, count); | 395 | gcry_md_write(md, s2k->salt, count); |
396 | } else { | 396 | } else { |
397 | gcry_md_write(md, s2k->salt, 8); | 397 | gcry_md_write(md, s2k->salt, 8); |
398 | count -= 8; | 398 | count -= 8; |
399 | gcry_md_write(md, pw, count); | 399 | gcry_md_write(md, pw, count); |
400 | } | 400 | } |
401 | } else | 401 | } else |
402 | gcry_md_write(md, pw, pwlen); | 402 | gcry_md_write(md, pw, pwlen); |
403 | gcry_md_final(md); | 403 | gcry_md_final(md); |
404 | i = gcry_md_get_algo_dlen(s2k->hash_algo); | 404 | i = gcry_md_get_algo_dlen(s2k->hash_algo); |
405 | if (i > dek->keylen - used) | 405 | if (i > dek->keylen - used) |
406 | i = dek->keylen - used; | 406 | i = dek->keylen - used; |
407 | memcpy(dek->key+used, gcry_md_read(md, s2k->hash_algo), i); | 407 | memcpy(dek->key+used, gcry_md_read(md, s2k->hash_algo), i); |
408 | used += i; | 408 | used += i; |
409 | } | 409 | } |
410 | gcry_md_close(md); | 410 | gcry_md_close(md); |
411 | out: | 411 | out: |
412 | return ret; | 412 | return ret; |
413 | } | 413 | } |
414 | 414 | ||
415 | void LibGCryptIf::padData(unsigned char *buf, | 415 | void LibGCryptIf::padData(unsigned char *buf, |
416 | size_t bufLen, | 416 | size_t bufLen, |
417 | size_t boundary) | 417 | size_t boundary) |
418 | { | 418 | { |
419 | size_t numPadBytes = boundary - ((bufLen + 1) % boundary); | 419 | size_t numPadBytes = boundary - ((bufLen + 1) % boundary); |
420 | buf[bufLen] = static_cast<char>(0x01); | 420 | buf[bufLen] = static_cast<char>(0x01); |
421 | size_t i = 0; | 421 | size_t i = 0; |
422 | Randomizer *rnd = Randomizer::obj(); | 422 | Randomizer *rnd = Randomizer::obj(); |
423 | char c; | 423 | char c; |
424 | unsigned char *b; | 424 | unsigned char *b; |
425 | while (i < numPadBytes) { | 425 | while (i < numPadBytes) { |
426 | c = rnd->genRndChar(); | 426 | c = rnd->genRndChar(); |
427 | if (c == static_cast<char>(0x01)) | 427 | if (c == static_cast<char>(0x01)) |
428 | continue; | 428 | continue; |
429 | b = buf + bufLen + 1 + i; | 429 | b = buf + bufLen + 1 + i; |
430 | *b = c; | 430 | *b = c; |
431 | ++i; | 431 | ++i; |
432 | } | 432 | } |
433 | } | 433 | } |
434 | 434 | ||
435 | void LibGCryptIf::unpadData(const unsigned char *buf, | 435 | void LibGCryptIf::unpadData(const unsigned char *buf, |
436 | size_t *bufLen) | 436 | size_t *bufLen) |
437 | { | 437 | { |
438 | size_t pos; | 438 | size_t pos; |
439 | BUG_ON(*bufLen % 8); | 439 | BUG_ON(*bufLen % 8); |
440 | pos = *bufLen - 1; | 440 | pos = *bufLen - 1; |
441 | while (buf[pos] != static_cast<char>(0x01)) { | 441 | while (buf[pos] != static_cast<char>(0x01)) { |
442 | qDebug("pos %d %d %d", pos, buf[pos], static_cast<char>(0x01) ); | ||
442 | BUG_ON(!pos); | 443 | BUG_ON(!pos); |
444 | //LR BUG we should terminte the loop if p == 0 | ||
445 | if ( pos == 0 ) | ||
446 | break; | ||
443 | --pos; | 447 | --pos; |
444 | } | 448 | } |
445 | *bufLen = pos; | 449 | *bufLen = pos; |
450 | qDebug("ente "); | ||
446 | } | 451 | } |
447 | 452 | ||
448 | #endif // CONFIG_PWMANAGER_GCRY | 453 | #endif // CONFIG_PWMANAGER_GCRY |
449 | 454 | ||
diff --git a/pwmanager/pwmanager/main.cpp b/pwmanager/pwmanager/main.cpp index 1ca7ba8..70df15d 100644 --- a/pwmanager/pwmanager/main.cpp +++ b/pwmanager/pwmanager/main.cpp | |||
@@ -20,200 +20,201 @@ | |||
20 | #ifndef PWM_EMBEDDED | 20 | #ifndef PWM_EMBEDDED |
21 | #include <kcmdlineargs.h> | 21 | #include <kcmdlineargs.h> |
22 | #include <kaboutdata.h> | 22 | #include <kaboutdata.h> |
23 | #else | 23 | #else |
24 | #include <qdir.h> | 24 | #include <qdir.h> |
25 | #include <kpimglobalprefs.h> | 25 | #include <kpimglobalprefs.h> |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #include <klocale.h> | 28 | #include <klocale.h> |
29 | #include <kstandarddirs.h> | 29 | #include <kstandarddirs.h> |
30 | 30 | ||
31 | #include "pwmexception.h" | 31 | #include "pwmexception.h" |
32 | #include "pwminit.h" | 32 | #include "pwminit.h" |
33 | 33 | ||
34 | #define LICENSE_FILE(::locate("data", "pwmanager/pwmanager_license_text")) | 34 | #define LICENSE_FILE(::locate("data", "pwmanager/pwmanager_license_text")) |
35 | 35 | ||
36 | int PwMApplication::newInstance() | 36 | int PwMApplication::newInstance() |
37 | { | 37 | { |
38 | static bool initial = true; | 38 | static bool initial = true; |
39 | if (initial) { | 39 | if (initial) { |
40 | initial = false; | 40 | initial = false; |
41 | init = new PwMInit(this); | 41 | init = new PwMInit(this); |
42 | init->initializeApp(); | 42 | init->initializeApp(); |
43 | } else { | 43 | } else { |
44 | BUG_ON(!init); | 44 | BUG_ON(!init); |
45 | printInfo("passing parameters to old instance."); | 45 | printInfo("passing parameters to old instance."); |
46 | init->handleCmdLineArgs(false); | 46 | init->handleCmdLineArgs(false); |
47 | } | 47 | } |
48 | return EXIT_SUCCESS; | 48 | return EXIT_SUCCESS; |
49 | } | 49 | } |
50 | 50 | ||
51 | 51 | ||
52 | static const char *description = I18N_NOOP("PwManager\n" | 52 | static const char *description = I18N_NOOP("PwManager\n" |
53 | "The convenient way of managing passwords"); | 53 | "The convenient way of managing passwords"); |
54 | 54 | ||
55 | #ifndef PWM_EMBEDDED | 55 | #ifndef PWM_EMBEDDED |
56 | static KCmdLineOptions options[] = | 56 | static KCmdLineOptions options[] = |
57 | { | 57 | { |
58 | { "minimized", I18N_NOOP("Windows minimized"), 0 }, | 58 | { "minimized", I18N_NOOP("Windows minimized"), 0 }, |
59 | { "mintray", I18N_NOOP("Windows minimized to tray"),0 }, | 59 | { "mintray", I18N_NOOP("Windows minimized to tray"),0 }, |
60 | { "open-deeplocked", I18N_NOOP("Open all \"files\" deeplocked"),0 }, | 60 | { "open-deeplocked", I18N_NOOP("Open all \"files\" deeplocked"),0 }, |
61 | { "skip-self-test", I18N_NOOP("Don't run a self-test on startup"),0 }, | 61 | { "skip-self-test", I18N_NOOP("Don't run a self-test on startup"),0 }, |
62 | { "+[files...]", I18N_NOOP("Files to open on startup"), 0 }, | 62 | { "+[files...]", I18N_NOOP("Files to open on startup"), 0 }, |
63 | { 0, 0, 0 } | 63 | { 0, 0, 0 } |
64 | }; | 64 | }; |
65 | #endif | 65 | #endif |
66 | 66 | ||
67 | #ifdef PWM_DEBUG | 67 | #ifdef PWM_DEBUG |
68 | static void printDebugConfigureInfo() | 68 | static void printDebugConfigureInfo() |
69 | { | 69 | { |
70 | cout << "================================" << endl; | 70 | cout << "================================" << endl; |
71 | cout << PROG_NAME " version " PACKAGE_VER << endl; | 71 | cout << PROG_NAME " version " PACKAGE_VER << endl; |
72 | #ifdef CONFIG_KEYCARD | 72 | #ifdef CONFIG_KEYCARD |
73 | cout << "CONFIG_KEYCARD: enabled" << endl; | 73 | cout << "CONFIG_KEYCARD: enabled" << endl; |
74 | #else | 74 | #else |
75 | cout << "CONFIG_KEYCARD: disabled" << endl; | 75 | cout << "CONFIG_KEYCARD: disabled" << endl; |
76 | #endif | 76 | #endif |
77 | #ifdef CONFIG_KWALLETIF | 77 | #ifdef CONFIG_KWALLETIF |
78 | cout << "CONFIG_KWALLETIF: enabled" << endl; | 78 | cout << "CONFIG_KWALLETIF: enabled" << endl; |
79 | #else | 79 | #else |
80 | cout << "CONFIG_KWALLETIF: disabled" << endl; | 80 | cout << "CONFIG_KWALLETIF: disabled" << endl; |
81 | #endif | 81 | #endif |
82 | #ifdef BIG_ENDIAN_HOST | 82 | #ifdef BIG_ENDIAN_HOST |
83 | cout << "Endianess: big-endian" << endl; | 83 | cout << "Endianess: big-endian" << endl; |
84 | #else | 84 | #else |
85 | cout << "Endianess: little-endian" << endl; | 85 | cout << "Endianess: little-endian" << endl; |
86 | #endif | 86 | #endif |
87 | #ifdef WORDS_BIGENDIAN | 87 | #ifdef WORDS_BIGENDIAN |
88 | cout << "Endianess 2: big-endian" << endl; | 88 | cout << "Endianess 2: big-endian" << endl; |
89 | #else | 89 | #else |
90 | cout << "Endianess 2: little-endian" << endl; | 90 | cout << "Endianess 2: little-endian" << endl; |
91 | #endif | 91 | #endif |
92 | 92 | ||
93 | cout << "sizeof(long): " << sizeof(long) << endl; | 93 | cout << "sizeof(long): " << sizeof(long) << endl; |
94 | cout << "================================" << endl; | 94 | cout << "================================" << endl; |
95 | } | 95 | } |
96 | #else // PWM_DEBUG | 96 | #else // PWM_DEBUG |
97 | static inline void printDebugConfigureInfo() { /* nothing */ } | 97 | static inline void printDebugConfigureInfo() { /* nothing */ } |
98 | #endif // PWM_DEBUG | 98 | #endif // PWM_DEBUG |
99 | 99 | ||
100 | #ifndef PWM_EMBEDDED | 100 | #ifndef PWM_EMBEDDED |
101 | static void addAuthors(KAboutData *aboutData) | 101 | static void addAuthors(KAboutData *aboutData) |
102 | { | 102 | { |
103 | aboutData->addAuthor("Michael Buesch", | 103 | aboutData->addAuthor("Michael Buesch", |
104 | I18N_NOOP( | 104 | I18N_NOOP( |
105 | "main programming and current maintainer"), | 105 | "main programming and current maintainer"), |
106 | "mbuesch@freenet.de"); | 106 | "mbuesch@freenet.de"); |
107 | aboutData->addAuthor("Matt Scifo", | 107 | aboutData->addAuthor("Matt Scifo", |
108 | I18N_NOOP( | 108 | I18N_NOOP( |
109 | "original implementaion of \n" | 109 | "original implementaion of \n" |
110 | "\"categories\" and the password-tree \n" | 110 | "\"categories\" and the password-tree \n" |
111 | "in the system-tray. Original implementations of \n" | 111 | "in the system-tray. Original implementations of \n" |
112 | "numerous view-improvements."), | 112 | "numerous view-improvements."), |
113 | "mscifo@o1.com"); | 113 | "mscifo@o1.com"); |
114 | aboutData->addCredit("Elias Probst", | 114 | aboutData->addCredit("Elias Probst", |
115 | I18N_NOOP( | 115 | I18N_NOOP( |
116 | "Gentoo ebuild maintainer."), | 116 | "Gentoo ebuild maintainer."), |
117 | "elias.probst@gmx.de"); | 117 | "elias.probst@gmx.de"); |
118 | aboutData->addCredit("George Staikos", | 118 | aboutData->addCredit("George Staikos", |
119 | I18N_NOOP("KWallet"), | 119 | I18N_NOOP("KWallet"), |
120 | "staikos@kde.org"); | 120 | "staikos@kde.org"); |
121 | aboutData->addCredit("Matthew Palmer", | 121 | aboutData->addCredit("Matthew Palmer", |
122 | I18N_NOOP("rc2 code"), | 122 | I18N_NOOP("rc2 code"), |
123 | "mjp16@uow.edu.au"); | 123 | "mjp16@uow.edu.au"); |
124 | aboutData->addCredit("Olivier Sessink", | 124 | aboutData->addCredit("Olivier Sessink", |
125 | I18N_NOOP("gpasman"), | 125 | I18N_NOOP("gpasman"), |
126 | "gpasman@nl.linux.org"); | 126 | "gpasman@nl.linux.org"); |
127 | aboutData->addCredit("The libgcrypt developers", | 127 | aboutData->addCredit("The libgcrypt developers", |
128 | I18N_NOOP("Blowfish and SHA1 algorithms"), | 128 | I18N_NOOP("Blowfish and SHA1 algorithms"), |
129 | 0, "ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/"); | 129 | 0, "ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/"); |
130 | aboutData->addCredit("Troy Engel", | 130 | aboutData->addCredit("Troy Engel", |
131 | I18N_NOOP("kpasman"), | 131 | I18N_NOOP("kpasman"), |
132 | "tengel@sonic.net"); | 132 | "tengel@sonic.net"); |
133 | aboutData->addCredit("Wickey", | 133 | aboutData->addCredit("Wickey", |
134 | I18N_NOOP("graphics-design in older versions."), | 134 | I18N_NOOP("graphics-design in older versions."), |
135 | "wickey@gmx.at"); | 135 | "wickey@gmx.at"); |
136 | aboutData->addCredit("Ian MacGregor", | 136 | aboutData->addCredit("Ian MacGregor", |
137 | I18N_NOOP( | 137 | I18N_NOOP( |
138 | "original documentation author.")); | 138 | "original documentation author.")); |
139 | } | 139 | } |
140 | #endif | 140 | #endif |
141 | 141 | ||
142 | int main(int argc, char *argv[]) | 142 | int main(int argc, char *argv[]) |
143 | { | 143 | { |
144 | printDebugConfigureInfo(); | 144 | printDebugConfigureInfo(); |
145 | #ifndef PWM_EMBEDDED | 145 | #ifndef PWM_EMBEDDED |
146 | KAboutData aboutData(PACKAGE_NAME, PROG_NAME, | 146 | KAboutData aboutData(PACKAGE_NAME, PROG_NAME, |
147 | PACKAGE_VER, description, KAboutData::License_File, | 147 | PACKAGE_VER, description, KAboutData::License_File, |
148 | "(c) 2003, 2004 Michael Buesch and the PwManager Team", 0, | 148 | "(c) 2003, 2004 Michael Buesch and the PwManager Team", 0, |
149 | "http://passwordmanager.sourceforge.net/", | 149 | "http://passwordmanager.sourceforge.net/", |
150 | "mbuesch@freenet.de"); | 150 | "mbuesch@freenet.de"); |
151 | addAuthors(&aboutData); | 151 | addAuthors(&aboutData); |
152 | 152 | ||
153 | KCmdLineArgs::init(argc, argv, &aboutData); | 153 | KCmdLineArgs::init(argc, argv, &aboutData); |
154 | KCmdLineArgs::addCmdLineOptions(options); | 154 | KCmdLineArgs::addCmdLineOptions(options); |
155 | 155 | ||
156 | KUniqueApplication::addCmdLineOptions(); | 156 | KUniqueApplication::addCmdLineOptions(); |
157 | if (!KUniqueApplication::start()) { | 157 | if (!KUniqueApplication::start()) { |
158 | printInfo("already running."); | 158 | printInfo("already running."); |
159 | return EXIT_SUCCESS; | 159 | return EXIT_SUCCESS; |
160 | } | 160 | } |
161 | PwMApplication a; | 161 | PwMApplication a; |
162 | aboutData.setLicenseTextFile(LICENSE_FILE); | 162 | aboutData.setLicenseTextFile(LICENSE_FILE); |
163 | return a.exec(); | 163 | return a.exec(); |
164 | #else | 164 | #else |
165 | 165 | ||
166 | bool exitHelp = false; | 166 | bool exitHelp = false; |
167 | if ( argc > 1 ) { | 167 | if ( argc > 1 ) { |
168 | QString command = argv[1]; | 168 | QString command = argv[1]; |
169 | if ( command == "-help" ){ | 169 | if ( command == "-help" ){ |
170 | printf("PWM/PI command line commands:\n"); | 170 | printf("PWM/PI command line commands:\n"); |
171 | printf(" no command: Start PWM/PI in usual way\n"); | 171 | printf(" no command: Start PWM/PI in usual way\n"); |
172 | printf(" -help: This output\n"); | 172 | printf(" -help: This output\n"); |
173 | printf(" PWM/PI is exiting now. Bye!\n"); | 173 | printf(" PWM/PI is exiting now. Bye!\n"); |
174 | exitHelp = true; | 174 | exitHelp = true; |
175 | } | 175 | } |
176 | } | 176 | } |
177 | if ( ! exitHelp ) { | 177 | if ( ! exitHelp ) { |
178 | 178 | ||
179 | PwMApplication a(argc, argv); | 179 | PwMApplication a(argc, argv); |
180 | 180 | ||
181 | KGlobal::setAppName( "pwmanager" ); | 181 | KGlobal::setAppName( "pwmanager" ); |
182 | #ifndef DESKTOP_VERSION | 182 | #ifndef DESKTOP_VERSION |
183 | //qDebug("width %d ",QApplication::desktop()->width() ); | 183 | //qDebug("width %d ",QApplication::desktop()->width() ); |
184 | if ( QApplication::desktop()->width() > 320 ) | 184 | if ( QApplication::desktop()->width() > 320 ) |
185 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons22/"); | 185 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons22/"); |
186 | else | 186 | else |
187 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons16/"); | 187 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons16/"); |
188 | #else | 188 | #else |
189 | QString fileName ; | 189 | QString fileName ; |
190 | fileName = qApp->applicationDirPath () + "/kdepim/pwmanager/icons22/"; | 190 | fileName = qApp->applicationDirPath () + "/kdepim/pwmanager/icons22/"; |
191 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 191 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
192 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); | 192 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); |
193 | 193 | ||
194 | #endif | 194 | #endif |
195 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "pwmanager"))); | 195 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "pwmanager"))); |
196 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 196 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
197 | 197 | ||
198 | a.newInstance(); | 198 | a.newInstance(); |
199 | 199 | ||
200 | //US KAddressBookMain m ; | 200 | //US KAddressBookMain m ; |
201 | 201 | ||
202 | //US QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 202 | //US QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
203 | /*US | 203 | /*US |
204 | #ifndef DESKTOP_VERSION | 204 | #ifndef DESKTOP_VERSION |
205 | a.showMainWidget( &m ); | 205 | a.showMainWidget( &m ); |
206 | #else | 206 | #else |
207 | a.setMainWidget( &m ); | 207 | a.setMainWidget( &m ); |
208 | m.resize (640, 480 ); | 208 | m.resize (640, 480 ); |
209 | m.show(); | 209 | m.show(); |
210 | #endif | 210 | #endif |
211 | */ | 211 | */ |
212 | QObject::connect( &a, SIGNAL( lastWindowClosed()), &a, SLOT (quit())); | ||
212 | a.exec(); | 213 | a.exec(); |
213 | KPimGlobalPrefs::instance()->writeConfig(); | 214 | KPimGlobalPrefs::instance()->writeConfig(); |
214 | } | 215 | } |
215 | qDebug("PWMPI: Bye! "); | 216 | qDebug("PWMPI: Bye! "); |
216 | 217 | ||
217 | #endif | 218 | #endif |
218 | 219 | ||
219 | } | 220 | } |
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp index 1ab2b71..2b8f2fa 100644 --- a/pwmanager/pwmanager/pwm.cpp +++ b/pwmanager/pwmanager/pwm.cpp | |||
@@ -4,389 +4,391 @@ | |||
4 | * email: mbuesch@freenet.de * | 4 | * email: mbuesch@freenet.de * |
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 version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include <klocale.h> | 20 | #include <klocale.h> |
21 | #include <klistview.h> | 21 | #include <klistview.h> |
22 | #include <ktoolbar.h> | 22 | #include <ktoolbar.h> |
23 | #include <kfiledialog.h> | 23 | #include <kfiledialog.h> |
24 | #include <kiconloader.h> | 24 | #include <kiconloader.h> |
25 | #include <kmessagebox.h> | 25 | #include <kmessagebox.h> |
26 | 26 | ||
27 | #include <qstatusbar.h> | 27 | #include <qstatusbar.h> |
28 | 28 | ||
29 | #ifndef PWM_EMBEDDED | 29 | #ifndef PWM_EMBEDDED |
30 | #include <kmenubar.h> | 30 | #include <kmenubar.h> |
31 | #include <kstatusbar.h> | 31 | #include <kstatusbar.h> |
32 | #include <dcopclient.h> | 32 | #include <dcopclient.h> |
33 | #include "configwndimpl.h" | 33 | #include "configwndimpl.h" |
34 | #include "configuration.h" | 34 | #include "configuration.h" |
35 | #else | 35 | #else |
36 | #include <qmenubar.h> | 36 | #include <qmenubar.h> |
37 | #include <qmessagebox.h> | 37 | #include <qmessagebox.h> |
38 | #include <pwmprefs.h> | 38 | #include <pwmprefs.h> |
39 | #include <kpimglobalprefs.h> | 39 | #include <kpimglobalprefs.h> |
40 | #include <kcmconfigs/kcmpwmconfig.h> | 40 | #include <kcmconfigs/kcmpwmconfig.h> |
41 | #include <kcmconfigs/kcmkdepimconfig.h> | 41 | #include <kcmconfigs/kcmkdepimconfig.h> |
42 | #include <kcmultidialog.h> | 42 | #include <kcmultidialog.h> |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | 45 | ||
46 | #ifndef DESKTOP_VERSION | 46 | #ifndef DESKTOP_VERSION |
47 | #include <qpe/global.h> | 47 | #include <qpe/global.h> |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | #include <qpixmap.h> | 50 | #include <qpixmap.h> |
51 | #include <qcheckbox.h> | 51 | #include <qcheckbox.h> |
52 | #include <qspinbox.h> | 52 | #include <qspinbox.h> |
53 | #include <qlineedit.h> | 53 | #include <qlineedit.h> |
54 | #include <qfileinfo.h> | 54 | #include <qfileinfo.h> |
55 | #include <qclipboard.h> | 55 | #include <qclipboard.h> |
56 | 56 | ||
57 | 57 | ||
58 | #include <stdio.h> | 58 | #include <stdio.h> |
59 | 59 | ||
60 | #include "pwm.h" | 60 | #include "pwm.h" |
61 | #include "pwminit.h" | 61 | #include "pwminit.h" |
62 | #include "pwmprint.h" | 62 | #include "pwmprint.h" |
63 | #include "addentrywndimpl.h" | 63 | #include "addentrywndimpl.h" |
64 | #include "globalstuff.h" | 64 | #include "globalstuff.h" |
65 | #include "findwndimpl.h" | 65 | #include "findwndimpl.h" |
66 | #include "csv.h" | 66 | #include "csv.h" |
67 | 67 | ||
68 | #ifdef CONFIG_KWALLETIF | 68 | #ifdef CONFIG_KWALLETIF |
69 | # include "kwalletif.h" | 69 | # include "kwalletif.h" |
70 | # include "kwalletemu.h" | 70 | # include "kwalletemu.h" |
71 | #endif | 71 | #endif |
72 | #ifdef CONFIG_KEYCARD | 72 | #ifdef CONFIG_KEYCARD |
73 | # include "pwmkeycard.h" | 73 | # include "pwmkeycard.h" |
74 | #endif | 74 | #endif |
75 | 75 | ||
76 | 76 | ||
77 | #define DEFAULT_SIZE (QSize(700, 400)) | 77 | #define DEFAULT_SIZE (QSize(700, 400)) |
78 | 78 | ||
79 | // Button IDs for "file" popup menu | 79 | // Button IDs for "file" popup menu |
80 | enum { | 80 | enum { |
81 | BUTTON_POPUP_FILE_NEW = 0, | 81 | BUTTON_POPUP_FILE_NEW = 0, |
82 | BUTTON_POPUP_FILE_OPEN, | 82 | BUTTON_POPUP_FILE_OPEN, |
83 | BUTTON_POPUP_FILE_CLOSE, | 83 | BUTTON_POPUP_FILE_CLOSE, |
84 | BUTTON_POPUP_FILE_SAVE, | 84 | BUTTON_POPUP_FILE_SAVE, |
85 | BUTTON_POPUP_FILE_SAVEAS, | 85 | BUTTON_POPUP_FILE_SAVEAS, |
86 | BUTTON_POPUP_FILE_EXPORT, | 86 | BUTTON_POPUP_FILE_EXPORT, |
87 | BUTTON_POPUP_FILE_IMPORT, | 87 | BUTTON_POPUP_FILE_IMPORT, |
88 | BUTTON_POPUP_FILE_PRINT, | 88 | BUTTON_POPUP_FILE_PRINT, |
89 | BUTTON_POPUP_FILE_QUIT | 89 | BUTTON_POPUP_FILE_QUIT |
90 | }; | 90 | }; |
91 | // Button IDs for "manage" popup menu | 91 | // Button IDs for "manage" popup menu |
92 | enum { | 92 | enum { |
93 | BUTTON_POPUP_MANAGE_ADD = 0, | 93 | BUTTON_POPUP_MANAGE_ADD = 0, |
94 | BUTTON_POPUP_MANAGE_EDIT, | 94 | BUTTON_POPUP_MANAGE_EDIT, |
95 | BUTTON_POPUP_MANAGE_DEL, | 95 | BUTTON_POPUP_MANAGE_DEL, |
96 | BUTTON_POPUP_MANAGE_CHANGEMP | 96 | BUTTON_POPUP_MANAGE_CHANGEMP |
97 | }; | 97 | }; |
98 | // Button IDs for chipcard popup menu | 98 | // Button IDs for chipcard popup menu |
99 | enum { | 99 | enum { |
100 | #ifdef CONFIG_KEYCARD | 100 | #ifdef CONFIG_KEYCARD |
101 | BUTTON_POPUP_CHIPCARD_GENNEW = 0, | 101 | BUTTON_POPUP_CHIPCARD_GENNEW = 0, |
102 | BUTTON_POPUP_CHIPCARD_DEL, | 102 | BUTTON_POPUP_CHIPCARD_DEL, |
103 | BUTTON_POPUP_CHIPCARD_READID, | 103 | BUTTON_POPUP_CHIPCARD_READID, |
104 | BUTTON_POPUP_CHIPCARD_SAVEBACKUP, | 104 | BUTTON_POPUP_CHIPCARD_SAVEBACKUP, |
105 | BUTTON_POPUP_CHIPCARD_REPLAYBACKUP | 105 | BUTTON_POPUP_CHIPCARD_REPLAYBACKUP |
106 | #else // CONFIG_KEYCARD | 106 | #else // CONFIG_KEYCARD |
107 | BUTTON_POPUP_CHIPCARD_NO = 0 | 107 | BUTTON_POPUP_CHIPCARD_NO = 0 |
108 | #endif // CONFIG_KEYCARD | 108 | #endif // CONFIG_KEYCARD |
109 | }; | 109 | }; |
110 | // Button IDs for "view" popup menu | 110 | // Button IDs for "view" popup menu |
111 | enum { | 111 | enum { |
112 | BUTTON_POPUP_VIEW_FIND = 0, | 112 | BUTTON_POPUP_VIEW_FIND = 0, |
113 | BUTTON_POPUP_VIEW_LOCK, | 113 | BUTTON_POPUP_VIEW_LOCK, |
114 | BUTTON_POPUP_VIEW_DEEPLOCK, | 114 | BUTTON_POPUP_VIEW_DEEPLOCK, |
115 | BUTTON_POPUP_VIEW_UNLOCK | 115 | BUTTON_POPUP_VIEW_UNLOCK |
116 | }; | 116 | }; |
117 | // Button IDs for "options" popup menu | 117 | // Button IDs for "options" popup menu |
118 | enum { | 118 | enum { |
119 | BUTTON_POPUP_OPTIONS_CONFIG = 0 | 119 | BUTTON_POPUP_OPTIONS_CONFIG = 0 |
120 | }; | 120 | }; |
121 | // Button IDs for "export" popup menu (in "file" popup menu) | 121 | // Button IDs for "export" popup menu (in "file" popup menu) |
122 | enum { | 122 | enum { |
123 | BUTTON_POPUP_EXPORT_TEXT = 0, | 123 | BUTTON_POPUP_EXPORT_TEXT = 0, |
124 | BUTTON_POPUP_EXPORT_GPASMAN, | 124 | BUTTON_POPUP_EXPORT_GPASMAN, |
125 | BUTTON_POPUP_EXPORT_CSV | 125 | BUTTON_POPUP_EXPORT_CSV |
126 | #ifdef CONFIG_KWALLETIF | 126 | #ifdef CONFIG_KWALLETIF |
127 | ,BUTTON_POPUP_EXPORT_KWALLET | 127 | ,BUTTON_POPUP_EXPORT_KWALLET |
128 | #endif | 128 | #endif |
129 | }; | 129 | }; |
130 | // Button IDs for "import" popup menu (in "file" popup menu) | 130 | // Button IDs for "import" popup menu (in "file" popup menu) |
131 | enum { | 131 | enum { |
132 | BUTTON_POPUP_IMPORT_TEXT = 0, | 132 | BUTTON_POPUP_IMPORT_TEXT = 0, |
133 | BUTTON_POPUP_IMPORT_GPASMAN, | 133 | BUTTON_POPUP_IMPORT_GPASMAN, |
134 | BUTTON_POPUP_IMPORT_CSV | 134 | BUTTON_POPUP_IMPORT_CSV |
135 | #ifdef CONFIG_KWALLETIF | 135 | #ifdef CONFIG_KWALLETIF |
136 | ,BUTTON_POPUP_IMPORT_KWALLET | 136 | ,BUTTON_POPUP_IMPORT_KWALLET |
137 | #endif | 137 | #endif |
138 | }; | 138 | }; |
139 | 139 | ||
140 | #ifdef PWM_EMBEDDED | 140 | #ifdef PWM_EMBEDDED |
141 | // Button IDs for "help" popup menu | 141 | // Button IDs for "help" popup menu |
142 | enum { | 142 | enum { |
143 | BUTTON_POPUP_HELP_LICENSE = 0, | 143 | BUTTON_POPUP_HELP_LICENSE = 0, |
144 | BUTTON_POPUP_HELP_FAQ, | 144 | BUTTON_POPUP_HELP_FAQ, |
145 | BUTTON_POPUP_HELP_ABOUT, | 145 | BUTTON_POPUP_HELP_ABOUT, |
146 | BUTTON_POPUP_HELP_SYNC, | 146 | BUTTON_POPUP_HELP_SYNC, |
147 | BUTTON_POPUP_HELP_WHATSNEW | 147 | BUTTON_POPUP_HELP_WHATSNEW |
148 | }; | 148 | }; |
149 | #endif | 149 | #endif |
150 | 150 | ||
151 | // Button IDs for toolbar | 151 | // Button IDs for toolbar |
152 | enum { | 152 | enum { |
153 | BUTTON_TOOL_NEW = 0, | 153 | BUTTON_TOOL_NEW = 0, |
154 | BUTTON_TOOL_OPEN, | 154 | BUTTON_TOOL_OPEN, |
155 | BUTTON_TOOL_SAVE, | 155 | BUTTON_TOOL_SAVE, |
156 | BUTTON_TOOL_SAVEAS, | 156 | BUTTON_TOOL_SAVEAS, |
157 | BUTTON_TOOL_PRINT, | 157 | BUTTON_TOOL_PRINT, |
158 | BUTTON_TOOL_ADD, | 158 | BUTTON_TOOL_ADD, |
159 | BUTTON_TOOL_EDIT, | 159 | BUTTON_TOOL_EDIT, |
160 | BUTTON_TOOL_DEL, | 160 | BUTTON_TOOL_DEL, |
161 | BUTTON_TOOL_FIND, | 161 | BUTTON_TOOL_FIND, |
162 | BUTTON_TOOL_LOCK, | 162 | BUTTON_TOOL_LOCK, |
163 | BUTTON_TOOL_DEEPLOCK, | 163 | BUTTON_TOOL_DEEPLOCK, |
164 | BUTTON_TOOL_UNLOCK | 164 | BUTTON_TOOL_UNLOCK |
165 | }; | 165 | }; |
166 | 166 | ||
167 | 167 | ||
168 | PwM::PwM(PwMInit *_init, PwMDoc *doc, | 168 | PwM::PwM(PwMInit *_init, PwMDoc *doc, |
169 | bool virginity, | 169 | bool virginity, |
170 | QWidget *parent, const char *name) | 170 | QWidget *parent, const char *name) |
171 | : KMainWindow(parent, "HALLO") | 171 | : KMainWindow(parent, "HALLO") |
172 | , forceQuit (false) | 172 | , forceQuit (false) |
173 | , forceMinimizeToTray (false) | 173 | , forceMinimizeToTray (false) |
174 | { | 174 | { |
175 | syncManager = 0; | 175 | syncManager = 0; |
176 | virgin = !virginity; | 176 | virgin = !virginity; |
177 | init = _init; | 177 | init = _init; |
178 | connect(doc, SIGNAL(docClosed(PwMDoc *)), | 178 | connect(doc, SIGNAL(docClosed(PwMDoc *)), |
179 | this, SLOT(docClosed(PwMDoc *))); | 179 | this, SLOT(docClosed(PwMDoc *))); |
180 | initMenubar(); | 180 | initMenubar(); |
181 | initToolbar(); | 181 | initToolbar(); |
182 | initMetrics(); | 182 | initMetrics(); |
183 | setVirgin(virginity); | 183 | setVirgin(virginity); |
184 | setFocusPolicy(QWidget::WheelFocus); | 184 | setFocusPolicy(QWidget::WheelFocus); |
185 | #ifndef PWM_EMBEDDED | 185 | #ifndef PWM_EMBEDDED |
186 | statusBar()->show(); | 186 | statusBar()->show(); |
187 | #endif | 187 | #endif |
188 | view = makeNewListView(doc); | 188 | view = makeNewListView(doc); |
189 | setCentralWidget(view); | 189 | setCentralWidget(view); |
190 | updateCaption(); | 190 | updateCaption(); |
191 | showStatMsg(i18n("Ready.")); | 191 | showStatMsg(i18n("Ready.")); |
192 | } | 192 | } |
193 | 193 | ||
194 | PwM::~PwM() | 194 | PwM::~PwM() |
195 | { | 195 | { |
196 | //qDebug("PwM::~PwM()"); | 196 | qDebug("PwM::~PwM() %x", this); |
197 | disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)), | 197 | disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)), |
198 | this, SLOT(docClosed(PwMDoc *))); | 198 | this, SLOT(docClosed(PwMDoc *))); |
199 | conf()->confWndMainWndSize(size()); | 199 | conf()->confWndMainWndSize(size()); |
200 | emit closed(this); | 200 | //LR closing of windows changed |
201 | //needed for fastload option on PDA | ||
202 | //emit closed(this); | ||
201 | //qDebug("PwM::~PwM() emited closed(this)"); | 203 | //qDebug("PwM::~PwM() emited closed(this)"); |
202 | delete view; | 204 | delete view; |
203 | delete syncManager; | 205 | delete syncManager; |
204 | } | 206 | } |
205 | 207 | ||
206 | void PwM::initMenubar() | 208 | void PwM::initMenubar() |
207 | { | 209 | { |
208 | KIconLoader* picons; | 210 | KIconLoader* picons; |
209 | #ifndef PWM_EMBEDDED | 211 | #ifndef PWM_EMBEDDED |
210 | KIconLoader icons; | 212 | KIconLoader icons; |
211 | picons = &icons; | 213 | picons = &icons; |
212 | #else | 214 | #else |
213 | picons = KGlobal::iconLoader(); | 215 | picons = KGlobal::iconLoader(); |
214 | 216 | ||
215 | 217 | ||
216 | syncPopup = new KPopupMenu(this); | 218 | syncPopup = new KPopupMenu(this); |
217 | 219 | ||
218 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::PWMPI, PWMPrefs::instance(), syncPopup); | 220 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::PWMPI, PWMPrefs::instance(), syncPopup); |
219 | syncManager->setBlockSave(false); | 221 | syncManager->setBlockSave(false); |
220 | 222 | ||
221 | connect ( syncPopup, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 223 | connect ( syncPopup, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
222 | syncManager->fillSyncMenu(); | 224 | syncManager->fillSyncMenu(); |
223 | 225 | ||
224 | #endif | 226 | #endif |
225 | filePopup = new KPopupMenu(this); | 227 | filePopup = new KPopupMenu(this); |
226 | importPopup = new KPopupMenu(filePopup); | 228 | importPopup = new KPopupMenu(filePopup); |
227 | exportPopup = new KPopupMenu(filePopup); | 229 | exportPopup = new KPopupMenu(filePopup); |
228 | managePopup = new KPopupMenu(this); | 230 | managePopup = new KPopupMenu(this); |
229 | #ifdef CONFIG_KEYCARD | 231 | #ifdef CONFIG_KEYCARD |
230 | chipcardPopup = new KPopupMenu(this); | 232 | chipcardPopup = new KPopupMenu(this); |
231 | #endif // CONFIG_KEYCARD | 233 | #endif // CONFIG_KEYCARD |
232 | viewPopup = new KPopupMenu(this); | 234 | viewPopup = new KPopupMenu(this); |
233 | optionsPopup = new KPopupMenu(this); | 235 | optionsPopup = new KPopupMenu(this); |
234 | 236 | ||
235 | // "file" popup menu | 237 | // "file" popup menu |
236 | filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), | 238 | filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), |
237 | i18n("&New"), this, | 239 | i18n("&New"), this, |
238 | SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW); | 240 | SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW); |
239 | filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)), | 241 | filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)), |
240 | i18n("&Open"), this, | 242 | i18n("&Open"), this, |
241 | SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN); | 243 | SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN); |
242 | filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)), | 244 | filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)), |
243 | i18n("&Close"), this, | 245 | i18n("&Close"), this, |
244 | SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE); | 246 | SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE); |
245 | filePopup->insertSeparator(); | 247 | filePopup->insertSeparator(); |
246 | filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)), | 248 | filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)), |
247 | i18n("&Save"), this, | 249 | i18n("&Save"), this, |
248 | SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE); | 250 | SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE); |
249 | filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)), | 251 | filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)), |
250 | i18n("Save &as..."), | 252 | i18n("Save &as..."), |
251 | this, SLOT(saveAs_slot()), 0, | 253 | this, SLOT(saveAs_slot()), 0, |
252 | BUTTON_POPUP_FILE_SAVEAS); | 254 | BUTTON_POPUP_FILE_SAVEAS); |
253 | filePopup->insertSeparator(); | 255 | filePopup->insertSeparator(); |
254 | // "file/export" popup menu | 256 | // "file/export" popup menu |
255 | exportPopup->insertItem(i18n("&Text-file..."), this, | 257 | exportPopup->insertItem(i18n("&Text-file..."), this, |
256 | SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT); | 258 | SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT); |
257 | exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, | 259 | exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, |
258 | SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN); | 260 | SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN); |
259 | exportPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this, | 261 | exportPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this, |
260 | SLOT(exportToCsv()), 0, BUTTON_POPUP_EXPORT_CSV); | 262 | SLOT(exportToCsv()), 0, BUTTON_POPUP_EXPORT_CSV); |
261 | #ifdef CONFIG_KWALLETIF | 263 | #ifdef CONFIG_KWALLETIF |
262 | exportPopup->insertItem(i18n("&KWallet..."), this, | 264 | exportPopup->insertItem(i18n("&KWallet..."), this, |
263 | SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET); | 265 | SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET); |
264 | #endif | 266 | #endif |
265 | filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)), | 267 | filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)), |
266 | i18n("E&xport"), exportPopup, | 268 | i18n("E&xport"), exportPopup, |
267 | BUTTON_POPUP_FILE_EXPORT); | 269 | BUTTON_POPUP_FILE_EXPORT); |
268 | // "file/import" popup menu | 270 | // "file/import" popup menu |
269 | importPopup->insertItem(i18n("&Text-file..."), this, | 271 | importPopup->insertItem(i18n("&Text-file..."), this, |
270 | SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT); | 272 | SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT); |
271 | importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, | 273 | importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, |
272 | SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN); | 274 | SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN); |
273 | importPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this, | 275 | importPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this, |
274 | SLOT(importCsv()), 0, BUTTON_POPUP_IMPORT_CSV); | 276 | SLOT(importCsv()), 0, BUTTON_POPUP_IMPORT_CSV); |
275 | #ifdef CONFIG_KWALLETIF | 277 | #ifdef CONFIG_KWALLETIF |
276 | importPopup->insertItem(i18n("&KWallet..."), this, | 278 | importPopup->insertItem(i18n("&KWallet..."), this, |
277 | SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET); | 279 | SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET); |
278 | #endif | 280 | #endif |
279 | filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)), | 281 | filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)), |
280 | i18n("I&mport"), importPopup, | 282 | i18n("I&mport"), importPopup, |
281 | BUTTON_POPUP_FILE_IMPORT); | 283 | BUTTON_POPUP_FILE_IMPORT); |
282 | filePopup->insertSeparator(); | 284 | filePopup->insertSeparator(); |
283 | filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)), | 285 | filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)), |
284 | i18n("&Print..."), this, | 286 | i18n("&Print..."), this, |
285 | SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT); | 287 | SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT); |
286 | filePopup->insertSeparator(); | 288 | filePopup->insertSeparator(); |
287 | filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)), | 289 | filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)), |
288 | i18n("&Quit"), this, | 290 | i18n("&Quit"), this, |
289 | SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT); | 291 | SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT); |
290 | menuBar()->insertItem(i18n("&File"), filePopup); | 292 | menuBar()->insertItem(i18n("&File"), filePopup); |
291 | // "manage" popup menu | 293 | // "manage" popup menu |
292 | managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)), | 294 | managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)), |
293 | i18n("&Add password"), this, | 295 | i18n("&Add password"), this, |
294 | SLOT(addPwd_slot()), 0, | 296 | SLOT(addPwd_slot()), 0, |
295 | BUTTON_POPUP_MANAGE_ADD); | 297 | BUTTON_POPUP_MANAGE_ADD); |
296 | managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)), | 298 | managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)), |
297 | i18n("&Edit"), this, SLOT(editPwd_slot()), 0, | 299 | i18n("&Edit"), this, SLOT(editPwd_slot()), 0, |
298 | BUTTON_POPUP_MANAGE_EDIT); | 300 | BUTTON_POPUP_MANAGE_EDIT); |
299 | managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), | 301 | managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), |
300 | i18n("&Delete"), this, SLOT(deletePwd_slot()), | 302 | i18n("&Delete"), this, SLOT(deletePwd_slot()), |
301 | 0, BUTTON_POPUP_MANAGE_DEL); | 303 | 0, BUTTON_POPUP_MANAGE_DEL); |
302 | managePopup->insertSeparator(); | 304 | managePopup->insertSeparator(); |
303 | managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)), | 305 | managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)), |
304 | i18n("Change &Master Password"), this, | 306 | i18n("Change &Master Password"), this, |
305 | SLOT(changeMasterPwd_slot()), 0, | 307 | SLOT(changeMasterPwd_slot()), 0, |
306 | BUTTON_POPUP_MANAGE_CHANGEMP); | 308 | BUTTON_POPUP_MANAGE_CHANGEMP); |
307 | menuBar()->insertItem(i18n("&Manage"), managePopup); | 309 | menuBar()->insertItem(i18n("&Manage"), managePopup); |
308 | // "chipcard" popup menu | 310 | // "chipcard" popup menu |
309 | #ifdef CONFIG_KEYCARD | 311 | #ifdef CONFIG_KEYCARD |
310 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), | 312 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), |
311 | i18n("&Generate new key-card"), this, | 313 | i18n("&Generate new key-card"), this, |
312 | SLOT(genNewCard_slot()), 0, | 314 | SLOT(genNewCard_slot()), 0, |
313 | BUTTON_POPUP_CHIPCARD_GENNEW); | 315 | BUTTON_POPUP_CHIPCARD_GENNEW); |
314 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), | 316 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), |
315 | i18n("&Erase key-card"), this, | 317 | i18n("&Erase key-card"), this, |
316 | SLOT(eraseCard_slot()), 0, | 318 | SLOT(eraseCard_slot()), 0, |
317 | BUTTON_POPUP_CHIPCARD_DEL); | 319 | BUTTON_POPUP_CHIPCARD_DEL); |
318 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)), | 320 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)), |
319 | i18n("Read card-&ID"), this, | 321 | i18n("Read card-&ID"), this, |
320 | SLOT(readCardId_slot()), 0, | 322 | SLOT(readCardId_slot()), 0, |
321 | BUTTON_POPUP_CHIPCARD_READID); | 323 | BUTTON_POPUP_CHIPCARD_READID); |
322 | chipcardPopup->insertSeparator(); | 324 | chipcardPopup->insertSeparator(); |
323 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)), | 325 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)), |
324 | i18n("&Make card backup-image"), this, | 326 | i18n("&Make card backup-image"), this, |
325 | SLOT(makeCardBackup_slot()), 0, | 327 | SLOT(makeCardBackup_slot()), 0, |
326 | BUTTON_POPUP_CHIPCARD_SAVEBACKUP); | 328 | BUTTON_POPUP_CHIPCARD_SAVEBACKUP); |
327 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)), | 329 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)), |
328 | i18n("&Replay card backup-image"), this, | 330 | i18n("&Replay card backup-image"), this, |
329 | SLOT(replayCardBackup_slot()), 0, | 331 | SLOT(replayCardBackup_slot()), 0, |
330 | BUTTON_POPUP_CHIPCARD_REPLAYBACKUP); | 332 | BUTTON_POPUP_CHIPCARD_REPLAYBACKUP); |
331 | menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup); | 333 | menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup); |
332 | #endif // CONFIG_KEYCARD | 334 | #endif // CONFIG_KEYCARD |
333 | // "view" popup menu | 335 | // "view" popup menu |
334 | viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)), | 336 | viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)), |
335 | i18n("&Find"), this, | 337 | i18n("&Find"), this, |
336 | SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND); | 338 | SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND); |
337 | viewPopup->insertSeparator(); | 339 | viewPopup->insertSeparator(); |
338 | viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)), | 340 | viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)), |
339 | i18n("&Lock all entries"), this, | 341 | i18n("&Lock all entries"), this, |
340 | SLOT(lockWnd_slot()), 0, | 342 | SLOT(lockWnd_slot()), 0, |
341 | BUTTON_POPUP_VIEW_LOCK); | 343 | BUTTON_POPUP_VIEW_LOCK); |
342 | viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)), | 344 | viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)), |
343 | i18n("&Deep-lock all entries"), this, | 345 | i18n("&Deep-lock all entries"), this, |
344 | SLOT(deepLockWnd_slot()), 0, | 346 | SLOT(deepLockWnd_slot()), 0, |
345 | BUTTON_POPUP_VIEW_DEEPLOCK); | 347 | BUTTON_POPUP_VIEW_DEEPLOCK); |
346 | viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)), | 348 | viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)), |
347 | i18n("&Unlock all entries"), this, | 349 | i18n("&Unlock all entries"), this, |
348 | SLOT(unlockWnd_slot()), 0, | 350 | SLOT(unlockWnd_slot()), 0, |
349 | BUTTON_POPUP_VIEW_UNLOCK); | 351 | BUTTON_POPUP_VIEW_UNLOCK); |
350 | menuBar()->insertItem(i18n("&View"), viewPopup); | 352 | menuBar()->insertItem(i18n("&View"), viewPopup); |
351 | // "options" popup menu | 353 | // "options" popup menu |
352 | optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), | 354 | optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), |
353 | i18n("&Configure..."), this, | 355 | i18n("&Configure..."), this, |
354 | SLOT(config_slot()), | 356 | SLOT(config_slot()), |
355 | BUTTON_POPUP_OPTIONS_CONFIG); | 357 | BUTTON_POPUP_OPTIONS_CONFIG); |
356 | menuBar()->insertItem(i18n("&Options"), optionsPopup); | 358 | menuBar()->insertItem(i18n("&Options"), optionsPopup); |
357 | // "help" popup menu | 359 | // "help" popup menu |
358 | #ifndef PWM_EMBEDDED | 360 | #ifndef PWM_EMBEDDED |
359 | helpPopup = helpMenu(QString::null, false); | 361 | helpPopup = helpMenu(QString::null, false); |
360 | #else | 362 | #else |
361 | menuBar()->insertItem(i18n("&Sync"), syncPopup); | 363 | menuBar()->insertItem(i18n("&Sync"), syncPopup); |
362 | 364 | ||
363 | 365 | ||
364 | 366 | ||
365 | 367 | ||
366 | 368 | ||
367 | helpPopup = new KPopupMenu(this); | 369 | helpPopup = new KPopupMenu(this); |
368 | 370 | ||
369 | 371 | ||
370 | helpPopup->insertItem(i18n("&License"), this, | 372 | helpPopup->insertItem(i18n("&License"), this, |
371 | SLOT(showLicense_slot()), 0, | 373 | SLOT(showLicense_slot()), 0, |
372 | BUTTON_POPUP_HELP_LICENSE); | 374 | BUTTON_POPUP_HELP_LICENSE); |
373 | 375 | ||
374 | helpPopup->insertItem(i18n("&Faq"), this, | 376 | helpPopup->insertItem(i18n("&Faq"), this, |
375 | SLOT(faq_slot()), 0, | 377 | SLOT(faq_slot()), 0, |
376 | BUTTON_POPUP_HELP_FAQ); | 378 | BUTTON_POPUP_HELP_FAQ); |
377 | 379 | ||
378 | helpPopup->insertItem(i18n("&About PwManager"), this, | 380 | helpPopup->insertItem(i18n("&About PwManager"), this, |
379 | SLOT(createAboutData_slot()), 0, | 381 | SLOT(createAboutData_slot()), 0, |
380 | BUTTON_POPUP_HELP_ABOUT); | 382 | BUTTON_POPUP_HELP_ABOUT); |
381 | 383 | ||
382 | helpPopup->insertItem(i18n("&Sync HowTo"), this, | 384 | helpPopup->insertItem(i18n("&Sync HowTo"), this, |
383 | SLOT(syncHowTo_slot()), 0, | 385 | SLOT(syncHowTo_slot()), 0, |
384 | BUTTON_POPUP_HELP_SYNC); | 386 | BUTTON_POPUP_HELP_SYNC); |
385 | 387 | ||
386 | helpPopup->insertItem(i18n("&What's New"), this, | 388 | helpPopup->insertItem(i18n("&What's New"), this, |
387 | SLOT(whatsnew_slot()), 0, | 389 | SLOT(whatsnew_slot()), 0, |
388 | BUTTON_POPUP_HELP_WHATSNEW); | 390 | BUTTON_POPUP_HELP_WHATSNEW); |
389 | 391 | ||
390 | #endif | 392 | #endif |
391 | menuBar()->insertItem(i18n("&Help"), helpPopup); | 393 | menuBar()->insertItem(i18n("&Help"), helpPopup); |
392 | 394 | ||
@@ -698,389 +700,393 @@ void PwM::editPwd_slot3(const QString *category, const int *index, | |||
698 | return; | 700 | return; |
699 | doc->timer()->getLock(DocTimer::id_autoLockTimer); | 701 | doc->timer()->getLock(DocTimer::id_autoLockTimer); |
700 | unsigned int curEntryIndex; | 702 | unsigned int curEntryIndex; |
701 | if (index) { | 703 | if (index) { |
702 | curEntryIndex = *index; | 704 | curEntryIndex = *index; |
703 | } else { | 705 | } else { |
704 | if (!(view->getCurEntryIndex(&curEntryIndex))) { | 706 | if (!(view->getCurEntryIndex(&curEntryIndex))) { |
705 | printDebug("couldn't get index. Maybe we have a binary entry here."); | 707 | printDebug("couldn't get index. Maybe we have a binary entry here."); |
706 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 708 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
707 | return; | 709 | return; |
708 | } | 710 | } |
709 | } | 711 | } |
710 | QString curCategory; | 712 | QString curCategory; |
711 | if (category) { | 713 | if (category) { |
712 | curCategory = *category; | 714 | curCategory = *category; |
713 | } else { | 715 | } else { |
714 | curCategory = view->getCurrentCategory(); | 716 | curCategory = view->getCurrentCategory(); |
715 | } | 717 | } |
716 | PwMDataItem currItem; | 718 | PwMDataItem currItem; |
717 | if (!doc->getEntry(curCategory, curEntryIndex, &currItem, true)) { | 719 | if (!doc->getEntry(curCategory, curEntryIndex, &currItem, true)) { |
718 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 720 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
719 | return; | 721 | return; |
720 | } | 722 | } |
721 | BUG_ON(currItem.binary); | 723 | BUG_ON(currItem.binary); |
722 | 724 | ||
723 | AddEntryWndImpl w; | 725 | AddEntryWndImpl w; |
724 | vector<string> catList; | 726 | vector<string> catList; |
725 | doc->getCategoryList(&catList); | 727 | doc->getCategoryList(&catList); |
726 | unsigned i, size = catList.size(); | 728 | unsigned i, size = catList.size(); |
727 | for (i = 0; i < size; ++i) { | 729 | for (i = 0; i < size; ++i) { |
728 | w.addCategory(catList[i].c_str()); | 730 | w.addCategory(catList[i].c_str()); |
729 | } | 731 | } |
730 | w.setCurrCategory(curCategory); | 732 | w.setCurrCategory(curCategory); |
731 | w.setDescription(currItem.desc.c_str()); | 733 | w.setDescription(currItem.desc.c_str()); |
732 | w.setUsername(currItem.name.c_str()); | 734 | w.setUsername(currItem.name.c_str()); |
733 | w.setPassword(currItem.pw.c_str()); | 735 | w.setPassword(currItem.pw.c_str()); |
734 | w.setUrl(currItem.url.c_str()); | 736 | w.setUrl(currItem.url.c_str()); |
735 | w.setLauncher(currItem.launcher.c_str()); | 737 | w.setLauncher(currItem.launcher.c_str()); |
736 | w.setComment(currItem.comment.c_str()); | 738 | w.setComment(currItem.comment.c_str()); |
737 | if (w.exec() == 1) { | 739 | if (w.exec() == 1) { |
738 | currItem.desc = w.getDescription().latin1(); | 740 | currItem.desc = w.getDescription().latin1(); |
739 | currItem.name = w.getUsername().latin1(); | 741 | currItem.name = w.getUsername().latin1(); |
740 | currItem.pw = w.getPassword().latin1(); | 742 | currItem.pw = w.getPassword().latin1(); |
741 | currItem.comment = w.getComment().latin1(); | 743 | currItem.comment = w.getComment().latin1(); |
742 | currItem.url = w.getUrl().latin1(); | 744 | currItem.url = w.getUrl().latin1(); |
743 | currItem.launcher = w.getLauncher().latin1(); | 745 | currItem.launcher = w.getLauncher().latin1(); |
744 | if (!doc->editEntry(curCategory, w.getCategory(), | 746 | if (!doc->editEntry(curCategory, w.getCategory(), |
745 | curEntryIndex, &currItem)) { | 747 | curEntryIndex, &currItem)) { |
746 | KMessageBox::error(this, | 748 | KMessageBox::error(this, |
747 | i18n("Couldn't edit the entry.\n" | 749 | i18n("Couldn't edit the entry.\n" |
748 | "Maybe you changed the category and\n" | 750 | "Maybe you changed the category and\n" |
749 | "this entry is already present\nin the new " | 751 | "this entry is already present\nin the new " |
750 | "category?"), | 752 | "category?"), |
751 | i18n("couldn't edit entry.")); | 753 | i18n("couldn't edit entry.")); |
752 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 754 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
753 | return; | 755 | return; |
754 | } | 756 | } |
755 | } | 757 | } |
756 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 758 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
757 | } | 759 | } |
758 | 760 | ||
759 | void PwM::deletePwd_slot() | 761 | void PwM::deletePwd_slot() |
760 | { | 762 | { |
761 | PWM_ASSERT(curDoc()); | 763 | PWM_ASSERT(curDoc()); |
762 | if (curDoc()->isDocEmpty()) | 764 | if (curDoc()->isDocEmpty()) |
763 | return; | 765 | return; |
764 | if (curDoc()->isDeepLocked()) | 766 | if (curDoc()->isDeepLocked()) |
765 | return; | 767 | return; |
766 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 768 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
767 | unsigned int curEntryIndex = 0; | 769 | unsigned int curEntryIndex = 0; |
768 | if (!(view->getCurEntryIndex(&curEntryIndex))) { | 770 | if (!(view->getCurEntryIndex(&curEntryIndex))) { |
769 | printDebug("couldn't get index"); | 771 | printDebug("couldn't get index"); |
770 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 772 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
771 | return; | 773 | return; |
772 | } | 774 | } |
773 | 775 | ||
774 | PwMDataItem currItem; | 776 | PwMDataItem currItem; |
775 | QString curCategory = view->getCurrentCategory(); | 777 | QString curCategory = view->getCurrentCategory(); |
776 | if (!curDoc()->getEntry(curCategory, curEntryIndex, &currItem)) { | 778 | if (!curDoc()->getEntry(curCategory, curEntryIndex, &currItem)) { |
777 | printDebug("couldn't get entry"); | 779 | printDebug("couldn't get entry"); |
778 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 780 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
779 | return; | 781 | return; |
780 | } | 782 | } |
781 | if (KMessageBox:: | 783 | if (KMessageBox:: |
782 | questionYesNo(this, | 784 | questionYesNo(this, |
783 | i18n | 785 | i18n |
784 | ("Do you really want to delete\nthe selected entry") + | 786 | ("Do you really want to delete\nthe selected entry") + |
785 | " \n\"" + QString(currItem.desc.c_str()) | 787 | " \n\"" + QString(currItem.desc.c_str()) |
786 | + "\" ?", i18n("delete?")) | 788 | + "\" ?", i18n("delete?")) |
787 | == KMessageBox::Yes) { | 789 | == KMessageBox::Yes) { |
788 | 790 | ||
789 | curDoc()->delEntry(curCategory, curEntryIndex); | 791 | curDoc()->delEntry(curCategory, curEntryIndex); |
790 | } | 792 | } |
791 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 793 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
792 | } | 794 | } |
793 | 795 | ||
794 | void PwM::changeMasterPwd_slot() | 796 | void PwM::changeMasterPwd_slot() |
795 | { | 797 | { |
796 | PWM_ASSERT(curDoc()); | 798 | PWM_ASSERT(curDoc()); |
797 | curDoc()->changeCurrentPw(); | 799 | curDoc()->changeCurrentPw(); |
798 | } | 800 | } |
799 | 801 | ||
800 | void PwM::lockWnd_slot() | 802 | void PwM::lockWnd_slot() |
801 | { | 803 | { |
802 | PWM_ASSERT(curDoc()); | 804 | PWM_ASSERT(curDoc()); |
803 | curDoc()->lockAll(true); | 805 | curDoc()->lockAll(true); |
804 | } | 806 | } |
805 | 807 | ||
806 | void PwM::deepLockWnd_slot() | 808 | void PwM::deepLockWnd_slot() |
807 | { | 809 | { |
808 | PWM_ASSERT(curDoc()); | 810 | PWM_ASSERT(curDoc()); |
809 | curDoc()->deepLock(); | 811 | curDoc()->deepLock(); |
810 | } | 812 | } |
811 | 813 | ||
812 | void PwM::unlockWnd_slot() | 814 | void PwM::unlockWnd_slot() |
813 | { | 815 | { |
814 | PWM_ASSERT(curDoc()); | 816 | PWM_ASSERT(curDoc()); |
815 | curDoc()->lockAll(false); | 817 | curDoc()->lockAll(false); |
816 | } | 818 | } |
817 | 819 | ||
818 | void PwM::config_slot() | 820 | void PwM::config_slot() |
819 | { | 821 | { |
820 | int oldStyle = conf()->confWndMainViewStyle(); | 822 | int oldStyle = conf()->confWndMainViewStyle(); |
821 | #ifdef PWM_EMBEDDED | 823 | #ifdef PWM_EMBEDDED |
822 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"pwmconfigdialog", true ); | 824 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"pwmconfigdialog", true ); |
823 | 825 | ||
824 | KCMPwmConfig* pwmcfg = new KCMPwmConfig( ConfigureDialog->getNewVBoxPage(i18n( "PwManager")) , "KCMPwmConfig" ); | 826 | KCMPwmConfig* pwmcfg = new KCMPwmConfig( ConfigureDialog->getNewVBoxPage(i18n( "PwManager")) , "KCMPwmConfig" ); |
825 | ConfigureDialog->addModule(pwmcfg ); | 827 | ConfigureDialog->addModule(pwmcfg ); |
826 | 828 | ||
827 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); | 829 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); |
828 | ConfigureDialog->addModule(kdelibcfg ); | 830 | ConfigureDialog->addModule(kdelibcfg ); |
829 | 831 | ||
830 | #ifndef DESKTOP_VERSION | 832 | #ifndef DESKTOP_VERSION |
831 | ConfigureDialog->showMaximized(); | 833 | ConfigureDialog->showMaximized(); |
832 | #endif | 834 | #endif |
833 | if ( ConfigureDialog->exec() ) | 835 | if ( ConfigureDialog->exec() ) |
834 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); | 836 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); |
835 | delete ConfigureDialog; | 837 | delete ConfigureDialog; |
836 | 838 | ||
837 | #else //PWM_EMBEDDED | 839 | #else //PWM_EMBEDDED |
838 | // display the configuration window (modal mode) | 840 | // display the configuration window (modal mode) |
839 | if (!conf()->showConfWnd(this)) | 841 | if (!conf()->showConfWnd(this)) |
840 | return; | 842 | return; |
841 | #endif | 843 | #endif |
842 | 844 | ||
843 | int newStyle = conf()->confWndMainViewStyle(); | 845 | int newStyle = conf()->confWndMainViewStyle(); |
844 | // reinitialize tray | 846 | // reinitialize tray |
845 | init->initTray(); | 847 | init->initTray(); |
846 | // reinitialize KWallet emulation | 848 | // reinitialize KWallet emulation |
847 | init->initKWalletEmu(); | 849 | init->initKWalletEmu(); |
848 | 850 | ||
849 | PwMDocList *_dl = PwMDoc::getOpenDocList(); | 851 | PwMDocList *_dl = PwMDoc::getOpenDocList(); |
850 | const vector<PwMDocList::listItem> *dl = _dl->getList(); | 852 | const vector<PwMDocList::listItem> *dl = _dl->getList(); |
851 | vector<PwMDocList::listItem>::const_iterator i = dl->begin(), | 853 | vector<PwMDocList::listItem>::const_iterator i = dl->begin(), |
852 | end = dl->end(); | 854 | end = dl->end(); |
853 | PwMDoc *doc; | 855 | PwMDoc *doc; |
854 | while (i != end) { | 856 | while (i != end) { |
855 | doc = (*i).doc; | 857 | doc = (*i).doc; |
856 | // unlock-without-mpw timeout | 858 | // unlock-without-mpw timeout |
857 | doc->timer()->start(DocTimer::id_mpwTimer); | 859 | doc->timer()->start(DocTimer::id_mpwTimer); |
858 | // auto-lock timeout | 860 | // auto-lock timeout |
859 | doc->timer()->start(DocTimer::id_autoLockTimer); | 861 | doc->timer()->start(DocTimer::id_autoLockTimer); |
860 | ++i; | 862 | ++i; |
861 | } | 863 | } |
862 | 864 | ||
863 | const QValueList<PwM *> *ml = init->mainWndList(); | 865 | const QValueList<PwM *> *ml = init->mainWndList(); |
864 | #ifndef PWM_EMBEDDED | 866 | #ifndef PWM_EMBEDDED |
865 | QValueList<PwM *>::const_iterator i2 = ml->begin(), | 867 | QValueList<PwM *>::const_iterator i2 = ml->begin(), |
866 | end2 = ml->end(); | 868 | end2 = ml->end(); |
867 | #else | 869 | #else |
868 | QValueList<PwM *>::ConstIterator i2 = ml->begin(), | 870 | QValueList<PwM *>::ConstIterator i2 = ml->begin(), |
869 | end2 = ml->end(); | 871 | end2 = ml->end(); |
870 | #endif | 872 | #endif |
871 | PwM *pwm; | 873 | PwM *pwm; |
872 | while (i2 != end2) { | 874 | while (i2 != end2) { |
873 | pwm = *i2; | 875 | pwm = *i2; |
874 | // reinitialize the window style. | 876 | // reinitialize the window style. |
875 | if (oldStyle != newStyle) | 877 | if (oldStyle != newStyle) |
876 | pwm->curView()->initStyle(newStyle); | 878 | pwm->curView()->initStyle(newStyle); |
877 | // set the new font | 879 | // set the new font |
878 | pwm->curView()->setFont(conf()->confGlobEntryFont()); | 880 | pwm->curView()->setFont(conf()->confGlobEntryFont()); |
879 | ++i2; | 881 | ++i2; |
880 | } | 882 | } |
881 | } | 883 | } |
882 | 884 | ||
883 | void PwM::activateMpButton(bool activate) | 885 | void PwM::activateMpButton(bool activate) |
884 | { | 886 | { |
885 | managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, activate); | 887 | managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, activate); |
886 | } | 888 | } |
887 | 889 | ||
888 | void PwM::closeEvent(QCloseEvent *e) | 890 | void PwM::closeEvent(QCloseEvent *e) |
889 | { | 891 | { |
892 | qDebug("PwM::closeEvent "); | ||
893 | emit closed( this ); | ||
894 | return; | ||
890 | e->accept(); | 895 | e->accept(); |
891 | } | 896 | } |
892 | 897 | ||
893 | void PwM::docClosed(PwMDoc *doc) | 898 | void PwM::docClosed(PwMDoc *doc) |
894 | { | 899 | { |
900 | qDebug("PwM::docClosed "); | ||
895 | PARAM_UNUSED(doc); | 901 | PARAM_UNUSED(doc); |
896 | PWM_ASSERT(doc == curDoc()); | 902 | PWM_ASSERT(doc == curDoc()); |
897 | close(); | 903 | close(); |
898 | } | 904 | } |
899 | 905 | ||
900 | void PwM::find_slot() | 906 | void PwM::find_slot() |
901 | { | 907 | { |
902 | PWM_ASSERT(curDoc()); | 908 | PWM_ASSERT(curDoc()); |
903 | if (curDoc()->isDocEmpty()) | 909 | if (curDoc()->isDocEmpty()) |
904 | return; | 910 | return; |
905 | if (curDoc()->isDeepLocked()) | 911 | if (curDoc()->isDeepLocked()) |
906 | return; | 912 | return; |
907 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 913 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
908 | FindWndImpl findWnd(view); | 914 | FindWndImpl findWnd(view); |
909 | findWnd.exec(); | 915 | findWnd.exec(); |
910 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 916 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
911 | } | 917 | } |
912 | 918 | ||
913 | void PwM::exportToText() | 919 | void PwM::exportToText() |
914 | { | 920 | { |
915 | PWM_ASSERT(curDoc()); | 921 | PWM_ASSERT(curDoc()); |
916 | if (curDoc()->isDocEmpty()) { | 922 | if (curDoc()->isDocEmpty()) { |
917 | KMessageBox::information(this, | 923 | KMessageBox::information(this, |
918 | i18n | 924 | i18n |
919 | ("Sorry, there's nothing to export.\n" | 925 | ("Sorry, there's nothing to export.\n" |
920 | "Please first add some passwords."), | 926 | "Please first add some passwords."), |
921 | i18n("nothing to do")); | 927 | i18n("nothing to do")); |
922 | return; | 928 | return; |
923 | } | 929 | } |
924 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 930 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
925 | QString fn(KFileDialog::getSaveFileName(QString::null, | 931 | QString fn(KFileDialog::getSaveFileName(QString::null, |
926 | i18n("*|plain-text file"), | 932 | i18n("*|plain-text file"), |
927 | this)); | 933 | this)); |
928 | if (fn == "") { | 934 | if (fn == "") { |
929 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 935 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
930 | return; | 936 | return; |
931 | } | 937 | } |
932 | 938 | ||
933 | PwMerror ret = curDoc()->exportToText(&fn); | 939 | PwMerror ret = curDoc()->exportToText(&fn); |
934 | if (ret != e_success) { | 940 | if (ret != e_success) { |
935 | KMessageBox::error(this, | 941 | KMessageBox::error(this, |
936 | i18n("Error: Couldn't write to file.\n" | 942 | i18n("Error: Couldn't write to file.\n" |
937 | "Please check if you have permission to write\n" | 943 | "Please check if you have permission to write\n" |
938 | "to the file in that directory."), | 944 | "to the file in that directory."), |
939 | i18n("error while writing")); | 945 | i18n("error while writing")); |
940 | } else | 946 | } else |
941 | showStatMsg(i18n("Successfully exported data.")); | 947 | showStatMsg(i18n("Successfully exported data.")); |
942 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 948 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
943 | } | 949 | } |
944 | 950 | ||
945 | bool PwM::importFromText() | 951 | bool PwM::importFromText() |
946 | { | 952 | { |
947 | if (!isVirgin()) { | 953 | if (!isVirgin()) { |
948 | if (KMessageBox::questionYesNo(this, | 954 | if (KMessageBox::questionYesNo(this, |
949 | i18n("Do you want to import the data\n" | 955 | i18n("Do you want to import the data\n" |
950 | "into the current document? (If you\n" | 956 | "into the current document? (If you\n" |
951 | "select \"no\", a new document will be\n" | 957 | "select \"no\", a new document will be\n" |
952 | "opened.)"), | 958 | "opened.)"), |
953 | i18n("import into this document?")) | 959 | i18n("import into this document?")) |
954 | == KMessageBox::No) { | 960 | == KMessageBox::No) { |
955 | // import the data to a new window. | 961 | // import the data to a new window. |
956 | PwM *newInstance = init->createMainWnd(); | 962 | PwM *newInstance = init->createMainWnd(); |
957 | bool ok = newInstance->importFromText(); | 963 | bool ok = newInstance->importFromText(); |
958 | if (!ok) { | 964 | if (!ok) { |
959 | newInstance->setForceQuit(true); | 965 | newInstance->setForceQuit(true); |
960 | delete_and_null(newInstance); | 966 | delete_and_null(newInstance); |
961 | } | 967 | } |
962 | return ok; | 968 | return ok; |
963 | } | 969 | } |
964 | } | 970 | } |
965 | 971 | ||
966 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 972 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
967 | PwMerror ret; | 973 | PwMerror ret; |
968 | QString path(KFileDialog::getOpenFileName(QString::null, | 974 | QString path(KFileDialog::getOpenFileName(QString::null, |
969 | i18n("*|PWM-exported text file"), | 975 | i18n("*|PWM-exported text file"), |
970 | this)); | 976 | this)); |
971 | if (path == "") | 977 | if (path == "") |
972 | goto cancelImport; | 978 | goto cancelImport; |
973 | 979 | ||
974 | ret = curDoc()->importFromText(&path, 0); | 980 | ret = curDoc()->importFromText(&path, 0); |
975 | if (ret == e_fileFormat) { | 981 | if (ret == e_fileFormat) { |
976 | KMessageBox::error(this, | 982 | KMessageBox::error(this, |
977 | i18n("Could not read file-format.\n" | 983 | i18n("Could not read file-format.\n" |
978 | "This seems to be _not_ a valid file\n" | 984 | "This seems to be _not_ a valid file\n" |
979 | "exported by PwM."), | 985 | "exported by PwM."), |
980 | i18n("invalid file-format")); | 986 | i18n("invalid file-format")); |
981 | goto cancelImport; | 987 | goto cancelImport; |
982 | } else if (ret == e_invalidArg) { | 988 | } else if (ret == e_invalidArg) { |
983 | BUG(); | 989 | BUG(); |
984 | goto cancelImport; | 990 | goto cancelImport; |
985 | } else if (ret != e_success) { | 991 | } else if (ret != e_success) { |
986 | KMessageBox::error(this, | 992 | KMessageBox::error(this, |
987 | i18n("Could not import file!\n" | 993 | i18n("Could not import file!\n" |
988 | "Do you have permission to read this file?\n" | 994 | "Do you have permission to read this file?\n" |
989 | "Do you have enough free memory?"), | 995 | "Do you have enough free memory?"), |
990 | i18n("import failed")); | 996 | i18n("import failed")); |
991 | goto cancelImport; | 997 | goto cancelImport; |
992 | } | 998 | } |
993 | setVirgin(false); | 999 | setVirgin(false); |
994 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1000 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
995 | return true; | 1001 | return true; |
996 | 1002 | ||
997 | cancelImport: | 1003 | cancelImport: |
998 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1004 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
999 | return false; | 1005 | return false; |
1000 | } | 1006 | } |
1001 | 1007 | ||
1002 | void PwM::exportToGpasman() | 1008 | void PwM::exportToGpasman() |
1003 | { | 1009 | { |
1004 | PWM_ASSERT(curDoc()); | 1010 | PWM_ASSERT(curDoc()); |
1005 | if (curDoc()->isDocEmpty()) { | 1011 | if (curDoc()->isDocEmpty()) { |
1006 | KMessageBox::information(this, | 1012 | KMessageBox::information(this, |
1007 | i18n | 1013 | i18n |
1008 | ("Sorry, there's nothing to export.\n" | 1014 | ("Sorry, there's nothing to export.\n" |
1009 | "Please first add some passwords."), | 1015 | "Please first add some passwords."), |
1010 | i18n("nothing to do")); | 1016 | i18n("nothing to do")); |
1011 | return; | 1017 | return; |
1012 | } | 1018 | } |
1013 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 1019 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
1014 | QString fn(KFileDialog::getSaveFileName(QString::null, | 1020 | QString fn(KFileDialog::getSaveFileName(QString::null, |
1015 | i18n("*|Gpasman or Kpasman file"), | 1021 | i18n("*|Gpasman or Kpasman file"), |
1016 | this)); | 1022 | this)); |
1017 | if (fn == "") { | 1023 | if (fn == "") { |
1018 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1024 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1019 | return; | 1025 | return; |
1020 | } | 1026 | } |
1021 | 1027 | ||
1022 | PwMerror ret = curDoc()->exportToGpasman(&fn); | 1028 | PwMerror ret = curDoc()->exportToGpasman(&fn); |
1023 | if (ret != e_success) { | 1029 | if (ret != e_success) { |
1024 | if (ret == e_noPw) { | 1030 | if (ret == e_noPw) { |
1025 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1031 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1026 | return; | 1032 | return; |
1027 | } | 1033 | } |
1028 | KMessageBox::error(this, | 1034 | KMessageBox::error(this, |
1029 | i18n("Error: Couldn't write to file.\n" | 1035 | i18n("Error: Couldn't write to file.\n" |
1030 | "Please check if you have permission to write " | 1036 | "Please check if you have permission to write " |
1031 | "to the file in that directory."), | 1037 | "to the file in that directory."), |
1032 | i18n("error while writing")); | 1038 | i18n("error while writing")); |
1033 | } else | 1039 | } else |
1034 | showStatMsg(i18n("Successfully exported data.")); | 1040 | showStatMsg(i18n("Successfully exported data.")); |
1035 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1041 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1036 | } | 1042 | } |
1037 | 1043 | ||
1038 | 1044 | ||
1039 | 1045 | ||
1040 | void PwM::exportToCsv() | 1046 | void PwM::exportToCsv() |
1041 | { | 1047 | { |
1042 | PWM_ASSERT(curDoc()); | 1048 | PWM_ASSERT(curDoc()); |
1043 | if (curDoc()->isDocEmpty()) { | 1049 | if (curDoc()->isDocEmpty()) { |
1044 | KMessageBox::information(this, | 1050 | KMessageBox::information(this, |
1045 | i18n | 1051 | i18n |
1046 | ("Sorry, there is nothing to export;\n" | 1052 | ("Sorry, there is nothing to export;\n" |
1047 | "please add some passwords first."), | 1053 | "please add some passwords first."), |
1048 | i18n("Nothing to Do")); | 1054 | i18n("Nothing to Do")); |
1049 | return; | 1055 | return; |
1050 | } | 1056 | } |
1051 | 1057 | ||
1052 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 1058 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
1053 | QString fn(KFileDialog::getSaveFileName("*.csv", i18n("*|CSV Text File"), this)); | 1059 | QString fn(KFileDialog::getSaveFileName("*.csv", i18n("*|CSV Text File"), this)); |
1054 | if (fn.isEmpty()) { | 1060 | if (fn.isEmpty()) { |
1055 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1061 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1056 | return; | 1062 | return; |
1057 | } | 1063 | } |
1058 | 1064 | ||
1059 | Csv csv(this); | 1065 | Csv csv(this); |
1060 | if (!csv.exportData(fn, curDoc())) { | 1066 | if (!csv.exportData(fn, curDoc())) { |
1061 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1067 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1062 | showStatMsg(i18n("CSV file export failed.")); | 1068 | showStatMsg(i18n("CSV file export failed.")); |
1063 | return; | 1069 | return; |
1064 | } | 1070 | } |
1065 | showStatMsg(i18n("Successfully exported data.")); | 1071 | showStatMsg(i18n("Successfully exported data.")); |
1066 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1072 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1067 | } | 1073 | } |
1068 | 1074 | ||
1069 | bool PwM::importCsv() | 1075 | bool PwM::importCsv() |
1070 | { | 1076 | { |
1071 | Csv csv(this); | 1077 | Csv csv(this); |
1072 | if (!isVirgin()) { | 1078 | if (!isVirgin()) { |
1073 | if (KMessageBox::questionYesNo(this, | 1079 | if (KMessageBox::questionYesNo(this, |
1074 | i18n("Do you want to import the data\n" | 1080 | i18n("Do you want to import the data\n" |
1075 | "into the current document? (If you\n" | 1081 | "into the current document? (If you\n" |
1076 | "select \"no\", a new document will be\n" | 1082 | "select \"no\", a new document will be\n" |
1077 | "opened.)"), | 1083 | "opened.)"), |
1078 | i18n("Import into This Document?")) | 1084 | i18n("Import into This Document?")) |
1079 | == KMessageBox::No) { | 1085 | == KMessageBox::No) { |
1080 | // import the data to a new window. | 1086 | // import the data to a new window. |
1081 | PwM *newInstance = init->createMainWnd(); | 1087 | PwM *newInstance = init->createMainWnd(); |
1082 | bool ok = newInstance->importCsv(); | 1088 | bool ok = newInstance->importCsv(); |
1083 | if (!ok) { | 1089 | if (!ok) { |
1084 | newInstance->setForceQuit(true); | 1090 | newInstance->setForceQuit(true); |
1085 | delete_and_null(newInstance); | 1091 | delete_and_null(newInstance); |
1086 | } | 1092 | } |
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp index 129bf7b..cf8690f 100644 --- a/pwmanager/pwmanager/pwmdoc.cpp +++ b/pwmanager/pwmanager/pwmdoc.cpp | |||
@@ -2788,384 +2788,385 @@ PwMerror PwMDoc::exportToGpasman(const QString *file) | |||
2788 | entry[3] = new char[commentLen + 1]; | 2788 | entry[3] = new char[commentLen + 1]; |
2789 | strcpy(entry[0], descLen == 0 ? " " : dti.dta[i].d[j].desc.c_str()); | 2789 | strcpy(entry[0], descLen == 0 ? " " : dti.dta[i].d[j].desc.c_str()); |
2790 | strcpy(entry[1], nameLen == 0 ? " " : dti.dta[i].d[j].name.c_str()); | 2790 | strcpy(entry[1], nameLen == 0 ? " " : dti.dta[i].d[j].name.c_str()); |
2791 | strcpy(entry[2], pwLen == 0 ? " " : dti.dta[i].d[j].pw.c_str()); | 2791 | strcpy(entry[2], pwLen == 0 ? " " : dti.dta[i].d[j].pw.c_str()); |
2792 | strcpy(entry[3], commentLen == 0 ? " " : dti.dta[i].d[j].comment.c_str()); | 2792 | strcpy(entry[3], commentLen == 0 ? " " : dti.dta[i].d[j].comment.c_str()); |
2793 | entry[0][descLen == 0 ? descLen + 1 : descLen] = '\0'; | 2793 | entry[0][descLen == 0 ? descLen + 1 : descLen] = '\0'; |
2794 | entry[1][nameLen == 0 ? nameLen + 1 : nameLen] = '\0'; | 2794 | entry[1][nameLen == 0 ? nameLen + 1 : nameLen] = '\0'; |
2795 | entry[2][pwLen == 0 ? pwLen + 1 : pwLen] = '\0'; | 2795 | entry[2][pwLen == 0 ? pwLen + 1 : pwLen] = '\0'; |
2796 | entry[3][commentLen == 0 ? commentLen + 1 : commentLen] = '\0'; | 2796 | entry[3][commentLen == 0 ? commentLen + 1 : commentLen] = '\0'; |
2797 | 2797 | ||
2798 | ret = gp.save_entry(entry); | 2798 | ret = gp.save_entry(entry); |
2799 | if (ret == -1){ | 2799 | if (ret == -1){ |
2800 | delete [] entry[0]; | 2800 | delete [] entry[0]; |
2801 | delete [] entry[1]; | 2801 | delete [] entry[1]; |
2802 | delete [] entry[2]; | 2802 | delete [] entry[2]; |
2803 | delete [] entry[3]; | 2803 | delete [] entry[3]; |
2804 | gp.save_finalize(); | 2804 | gp.save_finalize(); |
2805 | unlockAll_tempoary(true); | 2805 | unlockAll_tempoary(true); |
2806 | return e_writeFile; | 2806 | return e_writeFile; |
2807 | } | 2807 | } |
2808 | 2808 | ||
2809 | delete [] entry[0]; | 2809 | delete [] entry[0]; |
2810 | delete [] entry[1]; | 2810 | delete [] entry[1]; |
2811 | delete [] entry[2]; | 2811 | delete [] entry[2]; |
2812 | delete [] entry[3]; | 2812 | delete [] entry[3]; |
2813 | } | 2813 | } |
2814 | } | 2814 | } |
2815 | unlockAll_tempoary(true); | 2815 | unlockAll_tempoary(true); |
2816 | if (gp.save_finalize() == -1) | 2816 | if (gp.save_finalize() == -1) |
2817 | return e_writeFile; | 2817 | return e_writeFile; |
2818 | 2818 | ||
2819 | return e_success; | 2819 | return e_success; |
2820 | } | 2820 | } |
2821 | 2821 | ||
2822 | PwMerror PwMDoc::importFromGpasman(const QString *file) | 2822 | PwMerror PwMDoc::importFromGpasman(const QString *file) |
2823 | { | 2823 | { |
2824 | PWM_ASSERT(file); | 2824 | PWM_ASSERT(file); |
2825 | QString pw = requestMpw(false); | 2825 | QString pw = requestMpw(false); |
2826 | if (pw == "") | 2826 | if (pw == "") |
2827 | return e_noPw; | 2827 | return e_noPw; |
2828 | GpasmanFile gp; | 2828 | GpasmanFile gp; |
2829 | int ret, i; | 2829 | int ret, i; |
2830 | PwMerror ret2; | 2830 | PwMerror ret2; |
2831 | char *entry[4]; | 2831 | char *entry[4]; |
2832 | PwMDataItem tmpData; | 2832 | PwMDataItem tmpData; |
2833 | ret = gp.load_init(file->latin1(), pw.latin1()); | 2833 | ret = gp.load_init(file->latin1(), pw.latin1()); |
2834 | if (ret != 1) | 2834 | if (ret != 1) |
2835 | return e_accessFile; | 2835 | return e_accessFile; |
2836 | 2836 | ||
2837 | do { | 2837 | do { |
2838 | ret = gp.load_entry(entry); | 2838 | ret = gp.load_entry(entry); |
2839 | if(ret != 1) | 2839 | if(ret != 1) |
2840 | break; | 2840 | break; |
2841 | tmpData.desc = entry[0]; | 2841 | tmpData.desc = entry[0]; |
2842 | tmpData.name = entry[1]; | 2842 | tmpData.name = entry[1]; |
2843 | tmpData.pw = entry[2]; | 2843 | tmpData.pw = entry[2]; |
2844 | tmpData.comment = entry[3]; | 2844 | tmpData.comment = entry[3]; |
2845 | tmpData.lockStat = true; | 2845 | tmpData.lockStat = true; |
2846 | tmpData.listViewPos = -1; | 2846 | tmpData.listViewPos = -1; |
2847 | ret2 = addEntry(DEFAULT_CATEGORY, &tmpData, true); | 2847 | ret2 = addEntry(DEFAULT_CATEGORY, &tmpData, true); |
2848 | for (i = 0; i < 4; ++i) | 2848 | for (i = 0; i < 4; ++i) |
2849 | free(entry[i]); | 2849 | free(entry[i]); |
2850 | if (ret2 == e_maxAllowedEntr) { | 2850 | if (ret2 == e_maxAllowedEntr) { |
2851 | gp.load_finalize(); | 2851 | gp.load_finalize(); |
2852 | return e_maxAllowedEntr; | 2852 | return e_maxAllowedEntr; |
2853 | } | 2853 | } |
2854 | } while (1); | 2854 | } while (1); |
2855 | gp.load_finalize(); | 2855 | gp.load_finalize(); |
2856 | if (isDocEmpty()) | 2856 | if (isDocEmpty()) |
2857 | return e_wrongPw; // we assume this. | 2857 | return e_wrongPw; // we assume this. |
2858 | 2858 | ||
2859 | flagDirty(); | 2859 | flagDirty(); |
2860 | return e_success; | 2860 | return e_success; |
2861 | } | 2861 | } |
2862 | 2862 | ||
2863 | 2863 | ||
2864 | //US: we use the stl sort algorythm to sort all elements in the order | 2864 | //US: we use the stl sort algorythm to sort all elements in the order |
2865 | //of its listViewPos (in the order 1,2,3,5,...,x,-1, -1, -1 | 2865 | //of its listViewPos (in the order 1,2,3,5,...,x,-1, -1, -1 |
2866 | struct PwMDataItemListViewPosSort | 2866 | struct PwMDataItemListViewPosSort |
2867 | { | 2867 | { |
2868 | bool operator()(PwMDataItem* rpStart, PwMDataItem* rpEnd) | 2868 | bool operator()(PwMDataItem* rpStart, PwMDataItem* rpEnd) |
2869 | { | 2869 | { |
2870 | //qDebug("pwMDoc::PwMDataItemListViewPosSort()"); | 2870 | //qDebug("pwMDoc::PwMDataItemListViewPosSort()"); |
2871 | if ((rpEnd)->listViewPos < 0) | 2871 | if ((rpEnd)->listViewPos < 0) |
2872 | return false; | 2872 | return false; |
2873 | else | 2873 | else |
2874 | return (rpStart)->listViewPos < (rpEnd)->listViewPos; | 2874 | return (rpStart)->listViewPos < (rpEnd)->listViewPos; |
2875 | } | 2875 | } |
2876 | }; | 2876 | }; |
2877 | 2877 | ||
2878 | void PwMDoc::ensureLvp() | 2878 | void PwMDoc::ensureLvp() |
2879 | { | 2879 | { |
2880 | if (isDocEmpty()) | 2880 | if (isDocEmpty()) |
2881 | return; | 2881 | return; |
2882 | 2882 | ||
2883 | //US ENH BUG: when using syncronizing, this way of sorting | 2883 | //US ENH BUG: when using syncronizing, this way of sorting |
2884 | //is not sufficient, because there might be empty spaces | 2884 | //is not sufficient, because there might be empty spaces |
2885 | // at the beginning. But the old algorythm only can add elements | 2885 | // at the beginning. But the old algorythm only can add elements |
2886 | //to the end.The result are crashes because of list overflows | 2886 | //to the end.The result are crashes because of list overflows |
2887 | //we need something to fill all gaps. | 2887 | //we need something to fill all gaps. |
2888 | vector<PwMDataItem*> sorted; | 2888 | vector<PwMDataItem*> sorted; |
2889 | vector< PwMDataItem*>::iterator sortedBegin, | 2889 | vector< PwMDataItem*>::iterator sortedBegin, |
2890 | sortedEnd, | 2890 | sortedEnd, |
2891 | sortedI; | 2891 | sortedI; |
2892 | vector<PwMCategoryItem>::iterator catBegin = dti.dta.begin(), | 2892 | vector<PwMCategoryItem>::iterator catBegin = dti.dta.begin(), |
2893 | catEnd = dti.dta.end(), | 2893 | catEnd = dti.dta.end(), |
2894 | catI = catBegin; | 2894 | catI = catBegin; |
2895 | vector<PwMDataItem>::iterator entrBegin, entrEnd, entrI; | 2895 | vector<PwMDataItem>::iterator entrBegin, entrEnd, entrI; |
2896 | int lvpTop, tmpLvp; | 2896 | int lvpTop, tmpLvp; |
2897 | 2897 | ||
2898 | //qDebug("collect:"); | 2898 | //qDebug("collect:"); |
2899 | 2899 | ||
2900 | while (catI != catEnd) { | 2900 | while (catI != catEnd) { |
2901 | lvpTop = -1; | 2901 | lvpTop = -1; |
2902 | sorted.clear(); | 2902 | sorted.clear(); |
2903 | 2903 | ||
2904 | entrBegin = catI->d.begin(); | 2904 | entrBegin = catI->d.begin(); |
2905 | entrEnd = catI->d.end(); | 2905 | entrEnd = catI->d.end(); |
2906 | entrI = entrBegin; | 2906 | entrI = entrBegin; |
2907 | 2907 | ||
2908 | //US: we use the stl sort algorythm to sort all elements in the order | 2908 | //US: we use the stl sort algorythm to sort all elements in the order |
2909 | //of its listViewPos (in the order 1,2,2,3,5,...,x,-1, -1, -1 | 2909 | //of its listViewPos (in the order 1,2,2,3,5,...,x,-1, -1, -1 |
2910 | while (entrI != entrEnd) { | 2910 | while (entrI != entrEnd) { |
2911 | //qDebug("found: %s, pos=%i", (*entrI).desc.c_str(), (*entrI).listViewPos); | 2911 | //qDebug("found: %s, pos=%i", (*entrI).desc.c_str(), (*entrI).listViewPos); |
2912 | sorted.push_back((PwMDataItem*)&(*entrI)); | 2912 | sorted.push_back((PwMDataItem*)&(*entrI)); |
2913 | ++entrI; | 2913 | ++entrI; |
2914 | } | 2914 | } |
2915 | 2915 | ||
2916 | sortedBegin = sorted.begin(); | 2916 | sortedBegin = sorted.begin(); |
2917 | sortedEnd = sorted.end(); | 2917 | sortedEnd = sorted.end(); |
2918 | 2918 | ||
2919 | sort(sortedBegin, sortedEnd, PwMDataItemListViewPosSort()); | 2919 | sort(sortedBegin, sortedEnd, PwMDataItemListViewPosSort()); |
2920 | 2920 | ||
2921 | // qDebug("resort:"); | 2921 | // qDebug("resort:"); |
2922 | //now we have all sorted in a collection | 2922 | //now we have all sorted in a collection |
2923 | //Now start with the sorted and reset listviewpos. | 2923 | //Now start with the sorted and reset listviewpos. |
2924 | sortedBegin = sorted.begin(); | 2924 | sortedBegin = sorted.begin(); |
2925 | sortedEnd = sorted.end(); | 2925 | sortedEnd = sorted.end(); |
2926 | sortedI = sortedBegin; | 2926 | sortedI = sortedBegin; |
2927 | 2927 | ||
2928 | while (sortedI != sortedEnd) { | 2928 | while (sortedI != sortedEnd) { |
2929 | // qDebug("reset defined: %s, from pos=%i to pos=%i", (*sortedI)->desc.c_str(), (*sortedI)->listViewPos, lvpTop+1); | 2929 | // qDebug("reset defined: %s, from pos=%i to pos=%i", (*sortedI)->desc.c_str(), (*sortedI)->listViewPos, lvpTop+1); |
2930 | (*sortedI)->listViewPos = ++lvpTop; | 2930 | (*sortedI)->listViewPos = ++lvpTop; |
2931 | ++sortedI; | 2931 | ++sortedI; |
2932 | } | 2932 | } |
2933 | 2933 | ||
2934 | /*/debug | 2934 | /*/debug |
2935 | entrBegin = catI->d.begin(); | 2935 | entrBegin = catI->d.begin(); |
2936 | entrEnd = catI->d.end(); | 2936 | entrEnd = catI->d.end(); |
2937 | entrI = entrBegin; | 2937 | entrI = entrBegin; |
2938 | 2938 | ||
2939 | while (entrI != entrEnd) { | 2939 | while (entrI != entrEnd) { |
2940 | qDebug("check: %s, pos=%i", (*entrI).desc.c_str(), (*entrI).listViewPos); | 2940 | qDebug("check: %s, pos=%i", (*entrI).desc.c_str(), (*entrI).listViewPos); |
2941 | ++entrI; | 2941 | ++entrI; |
2942 | } | 2942 | } |
2943 | */ | 2943 | */ |
2944 | 2944 | ||
2945 | ++catI; | 2945 | ++catI; |
2946 | } | 2946 | } |
2947 | } | 2947 | } |
2948 | 2948 | ||
2949 | QString PwMDoc::getTitle() | 2949 | QString PwMDoc::getTitle() |
2950 | { | 2950 | { |
2951 | /* NOTE: We have to ensure, that the returned title | 2951 | /* NOTE: We have to ensure, that the returned title |
2952 | * is unique and not reused somewhere else while | 2952 | * is unique and not reused somewhere else while |
2953 | * this document is valid (open). | 2953 | * this document is valid (open). |
2954 | */ | 2954 | */ |
2955 | QString title(getFilename()); | 2955 | QString title(getFilename()); |
2956 | 2956 | ||
2957 | //US ENH: The whole filename on PDAs is too long. So use only the last characters | 2957 | //US ENH: The whole filename on PDAs is too long. So use only the last characters |
2958 | if (QApplication::desktop()->width() < 640) | 2958 | if (QApplication::desktop()->width() < 640) |
2959 | { | 2959 | { |
2960 | if (title.length() > 30) | 2960 | if (title.length() > 30) |
2961 | title = "..." + title.right(30); | 2961 | title = "..." + title.right(30); |
2962 | 2962 | ||
2963 | } | 2963 | } |
2964 | 2964 | ||
2965 | 2965 | ||
2966 | if (title.isEmpty()) { | 2966 | if (title.isEmpty()) { |
2967 | if (unnamedNum == 0) { | 2967 | if (unnamedNum == 0) { |
2968 | unnamedNum = PwMDocList::getNewUnnamedNumber(); | 2968 | unnamedNum = PwMDocList::getNewUnnamedNumber(); |
2969 | PWM_ASSERT(unnamedNum != 0); | 2969 | PWM_ASSERT(unnamedNum != 0); |
2970 | } | 2970 | } |
2971 | title = DEFAULT_TITLE; | 2971 | title = DEFAULT_TITLE; |
2972 | title += " "; | 2972 | title += " "; |
2973 | title += tostr(unnamedNum).c_str(); | 2973 | title += tostr(unnamedNum).c_str(); |
2974 | } | 2974 | } |
2975 | return title; | 2975 | return title; |
2976 | } | 2976 | } |
2977 | 2977 | ||
2978 | bool PwMDoc::tryDelete() | 2978 | bool PwMDoc::tryDelete() |
2979 | { | 2979 | { |
2980 | |||
2980 | if (deleted) | 2981 | if (deleted) |
2981 | return true; | 2982 | return true; |
2982 | int ret; | 2983 | int ret; |
2983 | if (isDirty()) { | 2984 | if (isDirty()) { |
2984 | ret = dirtyAskSave(getTitle()); | 2985 | ret = dirtyAskSave(getTitle()); |
2985 | if (ret == 0) { // save to disk | 2986 | if (ret == 0) { // save to disk |
2986 | if (!saveDocUi(this)) | 2987 | if (!saveDocUi(this)) |
2987 | goto out_ignore; | 2988 | goto out_ignore; |
2988 | } else if (ret == 1) { // don't save and delete | 2989 | } else if (ret == 1) { // don't save and delete |
2989 | goto out_accept; | 2990 | goto out_accept; |
2990 | } else { // cancel operation | 2991 | } else { // cancel operation |
2991 | goto out_ignore; | 2992 | goto out_ignore; |
2992 | } | 2993 | } |
2993 | } | 2994 | } |
2994 | out_accept: | 2995 | out_accept: |
2995 | deleted = true; | 2996 | deleted = true; |
2996 | delete this; | 2997 | delete this; |
2997 | return true; | 2998 | return true; |
2998 | out_ignore: | 2999 | out_ignore: |
2999 | return false; | 3000 | return false; |
3000 | } | 3001 | } |
3001 | 3002 | ||
3002 | 3003 | ||
3003 | 3004 | ||
3004 | #ifdef PWM_EMBEDDED | 3005 | #ifdef PWM_EMBEDDED |
3005 | //US ENH: this is the magic function that syncronizes the this doc with the remote doc | 3006 | //US ENH: this is the magic function that syncronizes the this doc with the remote doc |
3006 | //US it could have been defined as static, but I did not want to. | 3007 | //US it could have been defined as static, but I did not want to. |
3007 | PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* syncRemote, int mode ) | 3008 | PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* syncRemote, int mode ) |
3008 | { | 3009 | { |
3009 | int addedPasswordsLocal = 0; | 3010 | int addedPasswordsLocal = 0; |
3010 | int addedPasswordsRemote = 0; | 3011 | int addedPasswordsRemote = 0; |
3011 | int deletedPasswordsRemote = 0; | 3012 | int deletedPasswordsRemote = 0; |
3012 | int deletedPasswordsLocal = 0; | 3013 | int deletedPasswordsLocal = 0; |
3013 | int changedLocal = 0; | 3014 | int changedLocal = 0; |
3014 | int changedRemote = 0; | 3015 | int changedRemote = 0; |
3015 | 3016 | ||
3016 | PwMSyncItem* syncItemLocal; | 3017 | PwMSyncItem* syncItemLocal; |
3017 | PwMSyncItem* syncItemRemote; | 3018 | PwMSyncItem* syncItemRemote; |
3018 | 3019 | ||
3019 | QString mCurrentSyncName = manager->getCurrentSyncName(); | 3020 | QString mCurrentSyncName = manager->getCurrentSyncName(); |
3020 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 3021 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
3021 | 3022 | ||
3022 | bool fullDateRange = false; | 3023 | bool fullDateRange = false; |
3023 | int take; | 3024 | int take; |
3024 | // local->resetTempSyncStat(); | 3025 | // local->resetTempSyncStat(); |
3025 | QDateTime mLastSync = QDateTime::currentDateTime(); | 3026 | QDateTime mLastSync = QDateTime::currentDateTime(); |
3026 | QDateTime modifiedSync = mLastSync; | 3027 | QDateTime modifiedSync = mLastSync; |
3027 | 3028 | ||
3028 | unsigned int index; | 3029 | unsigned int index; |
3029 | //Step 1. Find syncinfo in Local file and create if not existent. | 3030 | //Step 1. Find syncinfo in Local file and create if not existent. |
3030 | bool found = syncLocal->findSyncData(mCurrentSyncDevice, &index); | 3031 | bool found = syncLocal->findSyncData(mCurrentSyncDevice, &index); |
3031 | if (found == false) | 3032 | if (found == false) |
3032 | { | 3033 | { |
3033 | PwMSyncItem newSyncItemLocal; | 3034 | PwMSyncItem newSyncItemLocal; |
3034 | newSyncItemLocal.syncName = mCurrentSyncDevice.latin1(); | 3035 | newSyncItemLocal.syncName = mCurrentSyncDevice.latin1(); |
3035 | newSyncItemLocal.lastSyncDate = mLastSync; | 3036 | newSyncItemLocal.lastSyncDate = mLastSync; |
3036 | syncLocal->addSyncDataEntry(&newSyncItemLocal, true); | 3037 | syncLocal->addSyncDataEntry(&newSyncItemLocal, true); |
3037 | found = syncLocal->findSyncData(mCurrentSyncDevice, &index); | 3038 | found = syncLocal->findSyncData(mCurrentSyncDevice, &index); |
3038 | if (found == false) { | 3039 | if (found == false) { |
3039 | qDebug("PwMDoc::syncronize : newly created local sync data could not be found"); | 3040 | qDebug("PwMDoc::syncronize : newly created local sync data could not be found"); |
3040 | return e_syncError; | 3041 | return e_syncError; |
3041 | } | 3042 | } |
3042 | } | 3043 | } |
3043 | 3044 | ||
3044 | syncItemLocal = syncLocal->getSyncDataEntry(index); | 3045 | syncItemLocal = syncLocal->getSyncDataEntry(index); |
3045 | qDebug("Last Sync Local %s ", syncItemLocal->lastSyncDate.toString().latin1()); | 3046 | qDebug("Last Sync Local %s ", syncItemLocal->lastSyncDate.toString().latin1()); |
3046 | 3047 | ||
3047 | //Step 2. Find syncinfo in remote file and create if not existent. | 3048 | //Step 2. Find syncinfo in remote file and create if not existent. |
3048 | found = syncRemote->findSyncData(mCurrentSyncName, &index); | 3049 | found = syncRemote->findSyncData(mCurrentSyncName, &index); |
3049 | if (found == false) | 3050 | if (found == false) |
3050 | { | 3051 | { |
3051 | qDebug("FULLDATE 1"); | 3052 | qDebug("FULLDATE 1"); |
3052 | fullDateRange = true; | 3053 | fullDateRange = true; |
3053 | PwMSyncItem newSyncItemRemote; | 3054 | PwMSyncItem newSyncItemRemote; |
3054 | newSyncItemRemote.syncName = mCurrentSyncName.latin1(); | 3055 | newSyncItemRemote.syncName = mCurrentSyncName.latin1(); |
3055 | newSyncItemRemote.lastSyncDate = mLastSync; | 3056 | newSyncItemRemote.lastSyncDate = mLastSync; |
3056 | syncRemote->addSyncDataEntry(&newSyncItemRemote, true); | 3057 | syncRemote->addSyncDataEntry(&newSyncItemRemote, true); |
3057 | found = syncRemote->findSyncData(mCurrentSyncName, &index); | 3058 | found = syncRemote->findSyncData(mCurrentSyncName, &index); |
3058 | if (found == false) { | 3059 | if (found == false) { |
3059 | qDebug("PwMDoc::syncronize : newly created remote sync data could not be found"); | 3060 | qDebug("PwMDoc::syncronize : newly created remote sync data could not be found"); |
3060 | return e_syncError; | 3061 | return e_syncError; |
3061 | } | 3062 | } |
3062 | } | 3063 | } |
3063 | 3064 | ||
3064 | syncItemRemote = syncRemote->getSyncDataEntry(index); | 3065 | syncItemRemote = syncRemote->getSyncDataEntry(index); |
3065 | qDebug("Last Sync Remote %s ", syncItemRemote->lastSyncDate.toString().latin1()); | 3066 | qDebug("Last Sync Remote %s ", syncItemRemote->lastSyncDate.toString().latin1()); |
3066 | //and remove the found entry here. We will reenter it later again. | 3067 | //and remove the found entry here. We will reenter it later again. |
3067 | //US syncRemote->delSyncDataEntry(index, true); | 3068 | //US syncRemote->delSyncDataEntry(index, true); |
3068 | 3069 | ||
3069 | 3070 | ||
3070 | if ( syncItemLocal->lastSyncDate == mLastSync ) { | 3071 | if ( syncItemLocal->lastSyncDate == mLastSync ) { |
3071 | qDebug("FULLDATE 2"); | 3072 | qDebug("FULLDATE 2"); |
3072 | fullDateRange = true; | 3073 | fullDateRange = true; |
3073 | } | 3074 | } |
3074 | 3075 | ||
3075 | if ( ! fullDateRange ) { | 3076 | if ( ! fullDateRange ) { |
3076 | if ( syncItemLocal->lastSyncDate != syncItemRemote->lastSyncDate ) { | 3077 | if ( syncItemLocal->lastSyncDate != syncItemRemote->lastSyncDate ) { |
3077 | 3078 | ||
3078 | fullDateRange = true; | 3079 | fullDateRange = true; |
3079 | qDebug("FULLDATE 3 %s %s", syncItemLocal->lastSyncDate.toString().latin1() , syncItemRemote->lastSyncDate.toString().latin1() ); | 3080 | qDebug("FULLDATE 3 %s %s", syncItemLocal->lastSyncDate.toString().latin1() , syncItemRemote->lastSyncDate.toString().latin1() ); |
3080 | } | 3081 | } |
3081 | } | 3082 | } |
3082 | // fullDateRange = true; // debug only! | 3083 | // fullDateRange = true; // debug only! |
3083 | if ( fullDateRange ) | 3084 | if ( fullDateRange ) |
3084 | mLastSync = QDateTime::currentDateTime().addDays( -100*365); | 3085 | mLastSync = QDateTime::currentDateTime().addDays( -100*365); |
3085 | else | 3086 | else |
3086 | mLastSync = syncItemLocal->lastSyncDate; | 3087 | mLastSync = syncItemLocal->lastSyncDate; |
3087 | 3088 | ||
3088 | 3089 | ||
3089 | qDebug("*************************** "); | 3090 | qDebug("*************************** "); |
3090 | qDebug("mLastSync %s ",mLastSync.toString().latin1() ); | 3091 | qDebug("mLastSync %s ",mLastSync.toString().latin1() ); |
3091 | QStringList er = syncRemote->getIDEntryList(); | 3092 | QStringList er = syncRemote->getIDEntryList(); |
3092 | PwMDataItem* inRemote ;//= er.first(); | 3093 | PwMDataItem* inRemote ;//= er.first(); |
3093 | PwMDataItem* inLocal; | 3094 | PwMDataItem* inLocal; |
3094 | unsigned int catLocal, indexLocal; | 3095 | unsigned int catLocal, indexLocal; |
3095 | unsigned int catRemote, indexRemote; | 3096 | unsigned int catRemote, indexRemote; |
3096 | 3097 | ||
3097 | QString uid; | 3098 | QString uid; |
3098 | manager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); | 3099 | manager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); |
3099 | 3100 | ||
3100 | int modulo = (er.count()/10)+1; | 3101 | int modulo = (er.count()/10)+1; |
3101 | unsigned int incCounter = 0; | 3102 | unsigned int incCounter = 0; |
3102 | while ( incCounter < er.count()) { | 3103 | while ( incCounter < er.count()) { |
3103 | if (manager->isProgressBarCanceled()) | 3104 | if (manager->isProgressBarCanceled()) |
3104 | return e_syncError; | 3105 | return e_syncError; |
3105 | if ( incCounter % modulo == 0 ) | 3106 | if ( incCounter % modulo == 0 ) |
3106 | manager->showProgressBar(incCounter); | 3107 | manager->showProgressBar(incCounter); |
3107 | 3108 | ||
3108 | uid = er[ incCounter ]; | 3109 | uid = er[ incCounter ]; |
3109 | qDebug("sync uid %s from remote file", uid.latin1()); | 3110 | qDebug("sync uid %s from remote file", uid.latin1()); |
3110 | 3111 | ||
3111 | qApp->processEvents(); | 3112 | qApp->processEvents(); |
3112 | 3113 | ||
3113 | inLocal = syncLocal->findEntryByID( uid, &catLocal, &indexLocal ); | 3114 | inLocal = syncLocal->findEntryByID( uid, &catLocal, &indexLocal ); |
3114 | inRemote = syncRemote->findEntryByID( uid, &catRemote, &indexRemote ); | 3115 | inRemote = syncRemote->findEntryByID( uid, &catRemote, &indexRemote ); |
3115 | PWM_ASSERT(inRemote); | 3116 | PWM_ASSERT(inRemote); |
3116 | if ( inLocal != 0 ) { // maybe conflict - same uid in both files | 3117 | if ( inLocal != 0 ) { // maybe conflict - same uid in both files |
3117 | if ( (take = takePwMDataItem( inLocal, inRemote, mLastSync, mode, fullDateRange) ) ) { | 3118 | if ( (take = takePwMDataItem( inLocal, inRemote, mLastSync, mode, fullDateRange) ) ) { |
3118 | qDebug("take %d %s ", take, inLocal->desc.c_str()); | 3119 | qDebug("take %d %s ", take, inLocal->desc.c_str()); |
3119 | if ( take == 3 ) | 3120 | if ( take == 3 ) |
3120 | return e_syncError; | 3121 | return e_syncError; |
3121 | if ( take == 1 ) {// take local | 3122 | if ( take == 1 ) {// take local |
3122 | int oldlistpos = inRemote->listViewPos; | 3123 | int oldlistpos = inRemote->listViewPos; |
3123 | (*inRemote) = (*inLocal); | 3124 | (*inRemote) = (*inLocal); |
3124 | inRemote->listViewPos = oldlistpos; | 3125 | inRemote->listViewPos = oldlistpos; |
3125 | ++changedRemote; | 3126 | ++changedRemote; |
3126 | } else { // take == 2 take remote | 3127 | } else { // take == 2 take remote |
3127 | int oldlistpos = inLocal->listViewPos; | 3128 | int oldlistpos = inLocal->listViewPos; |
3128 | (*inLocal) = (*inRemote); | 3129 | (*inLocal) = (*inRemote); |
3129 | inLocal->listViewPos = oldlistpos; | 3130 | inLocal->listViewPos = oldlistpos; |
3130 | ++changedLocal; | 3131 | ++changedLocal; |
3131 | } | 3132 | } |
3132 | } | 3133 | } |
3133 | } else { // no conflict | 3134 | } else { // no conflict |
3134 | if ( inRemote->meta.update > mLastSync || mode == 5 ) { | 3135 | if ( inRemote->meta.update > mLastSync || mode == 5 ) { |
3135 | inRemote->meta.update = modifiedSync; | 3136 | inRemote->meta.update = modifiedSync; |
3136 | 3137 | ||
3137 | //first check if we have a matching category in the local file | 3138 | //first check if we have a matching category in the local file |
3138 | const string* remotecat = syncRemote->getCategory(catRemote); | 3139 | const string* remotecat = syncRemote->getCategory(catRemote); |
3139 | syncLocal->addEntry(remotecat->c_str(), inRemote, true, false); | 3140 | syncLocal->addEntry(remotecat->c_str(), inRemote, true, false); |
3140 | 3141 | ||
3141 | ++addedPasswordsLocal; | 3142 | ++addedPasswordsLocal; |
3142 | } else { | 3143 | } else { |
3143 | // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); | 3144 | // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); |
3144 | syncRemote->delEntry(catRemote, indexRemote, true); | 3145 | syncRemote->delEntry(catRemote, indexRemote, true); |
3145 | ++deletedPasswordsRemote; | 3146 | ++deletedPasswordsRemote; |
3146 | } | 3147 | } |
3147 | } | 3148 | } |
3148 | 3149 | ||
3149 | ++incCounter; | 3150 | ++incCounter; |
3150 | } | 3151 | } |
3151 | 3152 | ||
3152 | 3153 | ||
3153 | er.clear(); | 3154 | er.clear(); |
3154 | QStringList el = syncLocal->getIDEntryList(); | 3155 | QStringList el = syncLocal->getIDEntryList(); |
3155 | modulo = (el.count()/10)+1; | 3156 | modulo = (el.count()/10)+1; |
3156 | 3157 | ||
3157 | manager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); | 3158 | manager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); |
3158 | incCounter = 0; | 3159 | incCounter = 0; |
3159 | while ( incCounter < el.count()) { | 3160 | while ( incCounter < el.count()) { |
3160 | qApp->processEvents(); | 3161 | qApp->processEvents(); |
3161 | if (manager->isProgressBarCanceled()) | 3162 | if (manager->isProgressBarCanceled()) |
3162 | return e_syncError; | 3163 | return e_syncError; |
3163 | if ( incCounter % modulo == 0 ) | 3164 | if ( incCounter % modulo == 0 ) |
3164 | manager->showProgressBar(incCounter); | 3165 | manager->showProgressBar(incCounter); |
3165 | uid = el[ incCounter ]; | 3166 | uid = el[ incCounter ]; |
3166 | qDebug("sync uid %s from local file", uid.latin1()); | 3167 | qDebug("sync uid %s from local file", uid.latin1()); |
3167 | 3168 | ||
3168 | inLocal = syncLocal->findEntryByID( uid, &catLocal, &indexLocal ); | 3169 | inLocal = syncLocal->findEntryByID( uid, &catLocal, &indexLocal ); |
3169 | inRemote = syncRemote->findEntryByID( uid, &catRemote, &indexRemote ); | 3170 | inRemote = syncRemote->findEntryByID( uid, &catRemote, &indexRemote ); |
3170 | PWM_ASSERT(inLocal); | 3171 | PWM_ASSERT(inLocal); |
3171 | 3172 | ||
diff --git a/pwmanager/pwmanager/pwmdocui.cpp b/pwmanager/pwmanager/pwmdocui.cpp index 71b4a8d..a9916c2 100644 --- a/pwmanager/pwmanager/pwmdocui.cpp +++ b/pwmanager/pwmanager/pwmdocui.cpp | |||
@@ -15,411 +15,414 @@ | |||
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include "pwmdocui.h" | 20 | #include "pwmdocui.h" |
21 | #include "setmasterpwwndimpl.h" | 21 | #include "setmasterpwwndimpl.h" |
22 | #include "getmasterpwwndimpl.h" | 22 | #include "getmasterpwwndimpl.h" |
23 | #include "pwmexception.h" | 23 | #include "pwmexception.h" |
24 | #include "getkeycardwnd.h" | 24 | #include "getkeycardwnd.h" |
25 | #include "pwm.h" | 25 | #include "pwm.h" |
26 | #include "globalstuff.h" | 26 | #include "globalstuff.h" |
27 | #include "spinforsignal.h" | 27 | #include "spinforsignal.h" |
28 | 28 | ||
29 | #include <qlineedit.h> | 29 | #include <qlineedit.h> |
30 | #include <qtabwidget.h> | 30 | #include <qtabwidget.h> |
31 | 31 | ||
32 | #include <kmessagebox.h> | 32 | #include <kmessagebox.h> |
33 | #include <kfiledialog.h> | 33 | #include <kfiledialog.h> |
34 | 34 | ||
35 | #ifndef PWM_EMBEDDED | 35 | #ifndef PWM_EMBEDDED |
36 | #include <kwin.h> | 36 | #include <kwin.h> |
37 | #else | 37 | #else |
38 | #include <qdir.h> | 38 | #include <qdir.h> |
39 | #include "pwmprefs.h" | 39 | #include "pwmprefs.h" |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | 42 | ||
43 | #ifdef CONFIG_KEYCARD | 43 | #ifdef CONFIG_KEYCARD |
44 | # include "pwmkeycard.h" | 44 | # include "pwmkeycard.h" |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | 47 | ||
48 | PwMDocUi::PwMDocUi(QObject *parent, const char *name) | 48 | PwMDocUi::PwMDocUi(QObject *parent, const char *name) |
49 | : QObject(parent, name) | 49 | : QObject(parent, name) |
50 | { | 50 | { |
51 | currentView = 0; | 51 | currentView = 0; |
52 | keyCard = 0; | 52 | keyCard = 0; |
53 | } | 53 | } |
54 | 54 | ||
55 | PwMDocUi::~PwMDocUi() | 55 | PwMDocUi::~PwMDocUi() |
56 | { | 56 | { |
57 | } | 57 | } |
58 | 58 | ||
59 | QString PwMDocUi::requestMpw(bool chipcard) | 59 | QString PwMDocUi::requestMpw(bool chipcard) |
60 | { | 60 | { |
61 | QString pw; | 61 | QString pw; |
62 | 62 | ||
63 | if (chipcard) { | 63 | if (chipcard) { |
64 | #ifdef CONFIG_KEYCARD | 64 | #ifdef CONFIG_KEYCARD |
65 | PWM_ASSERT(keyCard); | 65 | PWM_ASSERT(keyCard); |
66 | uint32_t id; | 66 | uint32_t id; |
67 | string ret; | 67 | string ret; |
68 | SpinForSignal *spinner = keyCard->getSpinner(); | 68 | SpinForSignal *spinner = keyCard->getSpinner(); |
69 | connect(keyCard, SIGNAL(keyAvailable(uint32_t, const string &)), | 69 | connect(keyCard, SIGNAL(keyAvailable(uint32_t, const string &)), |
70 | spinner, SLOT(u32_str_slot(uint32_t, const string &))); | 70 | spinner, SLOT(u32_str_slot(uint32_t, const string &))); |
71 | keyCard->getKey(); | 71 | keyCard->getKey(); |
72 | spinner->spin(&id, &ret); | 72 | spinner->spin(&id, &ret); |
73 | disconnect(keyCard, SIGNAL(keyAvailable(uint32_t, const string &)), | 73 | disconnect(keyCard, SIGNAL(keyAvailable(uint32_t, const string &)), |
74 | spinner, SLOT(u32_str_slot(uint32_t, const string &))); | 74 | spinner, SLOT(u32_str_slot(uint32_t, const string &))); |
75 | if (ret == "") | 75 | if (ret == "") |
76 | return ""; | 76 | return ""; |
77 | pw = ret.c_str(); | 77 | pw = ret.c_str(); |
78 | #else // CONFIG_KEYCARD | 78 | #else // CONFIG_KEYCARD |
79 | no_keycard_support_msg_box(currentView); | 79 | no_keycard_support_msg_box(currentView); |
80 | #endif // CONFIG_KEYCARD | 80 | #endif // CONFIG_KEYCARD |
81 | } else { | 81 | } else { |
82 | #ifndef PWM_EMBEDDED | 82 | #ifndef PWM_EMBEDDED |
83 | GetMasterPwWndImpl pwWnd; | 83 | GetMasterPwWndImpl pwWnd; |
84 | KWin::setState(pwWnd.winId(), NET::StaysOnTop); | 84 | KWin::setState(pwWnd.winId(), NET::StaysOnTop); |
85 | #else | 85 | #else |
86 | GetMasterPwWndImpl pwWnd; | 86 | GetMasterPwWndImpl pwWnd; |
87 | #endif | 87 | #endif |
88 | if (pwWnd.exec() != 1) | 88 | if (pwWnd.exec() != 1) |
89 | return ""; | 89 | return ""; |
90 | pw = pwWnd.pwLineEdit->text(); | 90 | pw = pwWnd.pwLineEdit->text(); |
91 | } | 91 | } |
92 | 92 | ||
93 | return pw; | 93 | return pw; |
94 | } | 94 | } |
95 | 95 | ||
96 | QString PwMDocUi::requestNewMpw(bool *chipcard) | 96 | QString PwMDocUi::requestNewMpw(bool *chipcard) |
97 | { | 97 | { |
98 | QString pw; | 98 | QString pw; |
99 | SetMasterPwWndImpl pwWnd(currentView); | 99 | SetMasterPwWndImpl pwWnd(currentView); |
100 | pwWnd.setPwMKeyCard(keyCard); | 100 | pwWnd.setPwMKeyCard(keyCard); |
101 | if (!chipcard) { | 101 | if (!chipcard) { |
102 | #ifndef PWM_EMBEDDED | 102 | #ifndef PWM_EMBEDDED |
103 | pwWnd.mainTab->removePage(pwWnd.mainTab->page(1)); | 103 | pwWnd.mainTab->removePage(pwWnd.mainTab->page(1)); |
104 | #else | 104 | #else |
105 | pwWnd.mainTab->removePage(pwWnd.tab_2); | 105 | pwWnd.mainTab->removePage(pwWnd.tab_2); |
106 | #endif | 106 | #endif |
107 | } | 107 | } |
108 | 108 | ||
109 | if (pwWnd.exec() != 1) | 109 | if (pwWnd.exec() != 1) |
110 | return ""; | 110 | return ""; |
111 | pw = pwWnd.getPw(chipcard).c_str(); | 111 | pw = pwWnd.getPw(chipcard).c_str(); |
112 | 112 | ||
113 | return pw; | 113 | return pw; |
114 | } | 114 | } |
115 | 115 | ||
116 | QString PwMDocUi::requestMpwChange(const QString *currentPw, bool *chipcard) | 116 | QString PwMDocUi::requestMpwChange(const QString *currentPw, bool *chipcard) |
117 | { | 117 | { |
118 | QString pw(requestMpw(*chipcard)); | 118 | QString pw(requestMpw(*chipcard)); |
119 | if (pw == "") | 119 | if (pw == "") |
120 | return ""; | 120 | return ""; |
121 | if (pw != *currentPw) { | 121 | if (pw != *currentPw) { |
122 | wrongMpwMsgBox(*chipcard); | 122 | wrongMpwMsgBox(*chipcard); |
123 | return ""; | 123 | return ""; |
124 | } | 124 | } |
125 | 125 | ||
126 | pw = requestNewMpw(chipcard); | 126 | pw = requestNewMpw(chipcard); |
127 | if (pw == "") | 127 | if (pw == "") |
128 | return ""; | 128 | return ""; |
129 | return pw; | 129 | return pw; |
130 | } | 130 | } |
131 | 131 | ||
132 | void PwMDocUi::wrongMpwMsgBox(bool chipcard, QString prefix, QString postfix) | 132 | void PwMDocUi::wrongMpwMsgBox(bool chipcard, QString prefix, QString postfix) |
133 | { | 133 | { |
134 | QString msg; | 134 | QString msg; |
135 | if (prefix != "") { | 135 | if (prefix != "") { |
136 | msg += prefix; | 136 | msg += prefix; |
137 | msg += "\n"; | 137 | msg += "\n"; |
138 | } | 138 | } |
139 | 139 | ||
140 | if (chipcard) { | 140 | if (chipcard) { |
141 | msg += i18n("Wrong key-card!\n" | 141 | msg += i18n("Wrong key-card!\n" |
142 | "Please try again with the\n" | 142 | "Please try again with the\n" |
143 | "correct key-card."); | 143 | "correct key-card."); |
144 | } else { | 144 | } else { |
145 | msg += i18n("Wrong master-password!\n" | 145 | msg += i18n("Wrong master-password!\n" |
146 | "Please try again."); | 146 | "Please try again."); |
147 | } | 147 | } |
148 | 148 | ||
149 | if (postfix != "") { | 149 | if (postfix != "") { |
150 | msg += "\n"; | 150 | msg += "\n"; |
151 | msg += postfix; | 151 | msg += postfix; |
152 | } | 152 | } |
153 | KMessageBox::error(currentView, msg, | 153 | KMessageBox::error(currentView, msg, |
154 | (chipcard) ? (i18n("wrong chipcard")) | 154 | (chipcard) ? (i18n("wrong chipcard")) |
155 | : (i18n("password error"))); | 155 | : (i18n("password error"))); |
156 | } | 156 | } |
157 | 157 | ||
158 | void PwMDocUi::noMpwMsgBox(bool chipcard, QString prefix, QString postfix) | 158 | void PwMDocUi::noMpwMsgBox(bool chipcard, QString prefix, QString postfix) |
159 | { | 159 | { |
160 | QString msg; | 160 | QString msg; |
161 | if (prefix != "") { | 161 | if (prefix != "") { |
162 | msg += prefix; | 162 | msg += prefix; |
163 | msg += "\n"; | 163 | msg += "\n"; |
164 | } | 164 | } |
165 | 165 | ||
166 | if (chipcard) { | 166 | if (chipcard) { |
167 | msg += i18n("No key-card found!\n" | 167 | msg += i18n("No key-card found!\n" |
168 | "Please insert the\n" | 168 | "Please insert the\n" |
169 | "correct key-card."); | 169 | "correct key-card."); |
170 | } else { | 170 | } else { |
171 | msg += i18n("No master-password given!"); | 171 | msg += i18n("No master-password given!"); |
172 | } | 172 | } |
173 | 173 | ||
174 | if (postfix != "") { | 174 | if (postfix != "") { |
175 | msg += "\n"; | 175 | msg += "\n"; |
176 | msg += postfix; | 176 | msg += postfix; |
177 | } | 177 | } |
178 | KMessageBox::error(currentView, msg, | 178 | KMessageBox::error(currentView, msg, |
179 | (chipcard) ? (i18n("no chipcard")) | 179 | (chipcard) ? (i18n("no chipcard")) |
180 | : (i18n("password error"))); | 180 | : (i18n("password error"))); |
181 | } | 181 | } |
182 | 182 | ||
183 | void PwMDocUi::rootAlertMsgBox() | 183 | void PwMDocUi::rootAlertMsgBox() |
184 | { | 184 | { |
185 | KMessageBox::error(currentView, | 185 | KMessageBox::error(currentView, |
186 | i18n("This feature is not available,n" | 186 | i18n("This feature is not available,n" |
187 | "if you execute PwM with \"root\" \n" | 187 | "if you execute PwM with \"root\" \n" |
188 | "UID 0 privileges, for security reasons!"), | 188 | "UID 0 privileges, for security reasons!"), |
189 | i18n("not allowed as root!")); | 189 | i18n("not allowed as root!")); |
190 | } | 190 | } |
191 | 191 | ||
192 | void PwMDocUi::cantDeeplock_notSavedMsgBox() | 192 | void PwMDocUi::cantDeeplock_notSavedMsgBox() |
193 | { | 193 | { |
194 | KMessageBox::error(currentView, | 194 | KMessageBox::error(currentView, |
195 | i18n("Can't deep-lock, because the document\n" | 195 | i18n("Can't deep-lock, because the document\n" |
196 | "hasn't been saved, yet. Please save\n" | 196 | "hasn't been saved, yet. Please save\n" |
197 | "to a file and try again."), | 197 | "to a file and try again."), |
198 | i18n("not saved, yet")); | 198 | i18n("not saved, yet")); |
199 | } | 199 | } |
200 | 200 | ||
201 | void PwMDocUi::gpmPwLenErrMsgBox() | 201 | void PwMDocUi::gpmPwLenErrMsgBox() |
202 | { | 202 | { |
203 | KMessageBox::error(currentView, | 203 | KMessageBox::error(currentView, |
204 | i18n("GPasman does not support passwords\n" | 204 | i18n("GPasman does not support passwords\n" |
205 | "shorter than 4 characters! Please try\n" | 205 | "shorter than 4 characters! Please try\n" |
206 | "again with a longer password."), | 206 | "again with a longer password."), |
207 | i18n("password too short")); | 207 | i18n("Password too short")); |
208 | } | 208 | } |
209 | 209 | ||
210 | int PwMDocUi::dirtyAskSave(const QString &docTitle) | 210 | int PwMDocUi::dirtyAskSave(const QString &docTitle) |
211 | { | 211 | { |
212 | int ret; | 212 | int ret; |
213 | #ifndef PWM_EMBEDDED | 213 | #ifndef PWM_EMBEDDED |
214 | ret = KMessageBox::questionYesNoCancel(currentView, | 214 | ret = KMessageBox::questionYesNoCancel(currentView, |
215 | i18n("The list \"") + | 215 | i18n("The list\n\"") + |
216 | docTitle + | 216 | docTitle + |
217 | i18n | 217 | i18n |
218 | ("\" has been modified.\n" | 218 | ("\" has been modified.\n" |
219 | "Do you want to save it?"), | 219 | "Do you want to save it?"), |
220 | i18n("save?")); | 220 | i18n("Save?")); |
221 | if (ret == KMessageBox::Yes) { | 221 | if (ret == KMessageBox::Yes) { |
222 | return 0; | 222 | return 0; |
223 | } else if (ret == KMessageBox::No) { | 223 | } else if (ret == KMessageBox::No) { |
224 | return 1; | 224 | return 1; |
225 | } | 225 | } |
226 | #else | 226 | #else |
227 | QString doc = docTitle; | ||
228 | if ( doc.length() > 33 ) | ||
229 | doc = "..." + doc.right(30); | ||
227 | ret = KMessageBox::warningYesNoCancel(currentView, | 230 | ret = KMessageBox::warningYesNoCancel(currentView, |
228 | i18n("The list \"") + | 231 | i18n("The list\n \"") + |
229 | docTitle + | 232 | doc + |
230 | i18n | 233 | i18n |
231 | ("\"\nhas been modified.\n" | 234 | ("\"\nhas been modified.\n" |
232 | "Do you want to save it?"), | 235 | "Do you want to save it?"), |
233 | i18n("save?")); | 236 | i18n("Save?")); |
234 | if (ret == KMessageBox::Yes) { | 237 | if (ret == KMessageBox::Yes) { |
235 | return 0; | 238 | return 0; |
236 | } else if (ret == KMessageBox::No) { | 239 | } else if (ret == KMessageBox::No) { |
237 | return 1; | 240 | return 1; |
238 | } | 241 | } |
239 | 242 | ||
240 | #endif | 243 | #endif |
241 | 244 | ||
242 | // cancel | 245 | // cancel |
243 | return -1; | 246 | return -1; |
244 | } | 247 | } |
245 | 248 | ||
246 | bool PwMDocUi::saveDocUi(PwMDoc *doc) | 249 | bool PwMDocUi::saveDocUi(PwMDoc *doc) |
247 | { | 250 | { |
248 | PWM_ASSERT(doc); | 251 | PWM_ASSERT(doc); |
249 | doc->timer()->getLock(DocTimer::id_autoLockTimer); | 252 | doc->timer()->getLock(DocTimer::id_autoLockTimer); |
250 | if (doc->isDocEmpty()) { | 253 | if (doc->isDocEmpty()) { |
251 | KMessageBox::information(currentView, | 254 | KMessageBox::information(currentView, |
252 | i18n | 255 | i18n |
253 | ("Sorry, there's nothing to save.\n" | 256 | ("Sorry, there's nothing to save.\n" |
254 | "Please first add some passwords."), | 257 | "Please first add some passwords."), |
255 | i18n("nothing to do")); | 258 | i18n("nothing to do")); |
256 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 259 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
257 | return true; | 260 | return true; |
258 | } | 261 | } |
259 | PwMerror ret = doc->saveDoc(conf()->confGlobCompression()); | 262 | PwMerror ret = doc->saveDoc(conf()->confGlobCompression()); |
260 | if (ret == e_filename) { | 263 | if (ret == e_filename) { |
261 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 264 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
262 | return saveAsDocUi(doc); | 265 | return saveAsDocUi(doc); |
263 | } else if (ret == e_weakPw) { | 266 | } else if (ret == e_weakPw) { |
264 | KMessageBox::error(currentView, | 267 | KMessageBox::error(currentView, |
265 | i18n("Error: This is a weak password.\n" | 268 | i18n("Error: This is a weak password.\n" |
266 | "Please select another password."), | 269 | "Please select another password."), |
267 | i18n("weak password")); | 270 | i18n("weak password")); |
268 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 271 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
269 | return false; | 272 | return false; |
270 | } else if (ret == e_fileBackup) { | 273 | } else if (ret == e_fileBackup) { |
271 | KMessageBox::error(currentView, | 274 | KMessageBox::error(currentView, |
272 | i18n("Error: Couldn't make backup-file!"), | 275 | i18n("Error: Couldn't make backup-file!"), |
273 | i18n("backup failed")); | 276 | i18n("backup failed")); |
274 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 277 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
275 | return false; | 278 | return false; |
276 | } else if (ret == e_noPw || | 279 | } else if (ret == e_noPw || |
277 | ret == e_wrongPw || | 280 | ret == e_wrongPw || |
278 | ret == e_openFile) { | 281 | ret == e_openFile) { |
279 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 282 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
280 | return false; | 283 | return false; |
281 | } else if (ret != e_success) { | 284 | } else if (ret != e_success) { |
282 | KMessageBox::error(currentView, | 285 | KMessageBox::error(currentView, |
283 | i18n("Error: Couldn't write to file.\n" | 286 | i18n("Error: Couldn't write to file.\n" |
284 | "Please check if you have permission to\n" | 287 | "Please check if you have permission to\n" |
285 | "write to the file in that directory."), | 288 | "write to the file in that directory."), |
286 | i18n("error while writing")); | 289 | i18n("error while writing")); |
287 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 290 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
288 | return false; | 291 | return false; |
289 | } | 292 | } |
290 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 293 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
291 | return true; | 294 | return true; |
292 | } | 295 | } |
293 | 296 | ||
294 | bool PwMDocUi::saveAsDocUi(PwMDoc *doc) | 297 | bool PwMDocUi::saveAsDocUi(PwMDoc *doc) |
295 | { | 298 | { |
296 | PWM_ASSERT(doc); | 299 | PWM_ASSERT(doc); |
297 | doc->timer()->getLock(DocTimer::id_autoLockTimer); | 300 | doc->timer()->getLock(DocTimer::id_autoLockTimer); |
298 | if (doc->isDocEmpty()) { | 301 | if (doc->isDocEmpty()) { |
299 | KMessageBox::information(currentView, | 302 | KMessageBox::information(currentView, |
300 | i18n | 303 | i18n |
301 | ("Sorry, there's nothing to save.\n" | 304 | ("Sorry, there's nothing to save.\n" |
302 | "Please first add some passwords."), | 305 | "Please first add some passwords."), |
303 | i18n("nothing to do")); | 306 | i18n("nothing to do")); |
304 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 307 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
305 | return true; | 308 | return true; |
306 | } | 309 | } |
307 | #ifndef PWM_EMBEDDED | 310 | #ifndef PWM_EMBEDDED |
308 | QString fn(KFileDialog::getSaveFileName(QString::null, | 311 | QString fn(KFileDialog::getSaveFileName(QString::null, |
309 | i18n("*.pwm|PwManager Password file"), | 312 | i18n("*.pwm|PwManager Password file"), |
310 | currentView)); | 313 | currentView)); |
311 | #else | 314 | #else |
312 | QString fn = locateLocal( "data", KGlobal::getAppName() + "/*.pwm" ); | 315 | QString fn = locateLocal( "data", KGlobal::getAppName() + "/*.pwm" ); |
313 | fn = KFileDialog::getSaveFileName(fn, | 316 | fn = KFileDialog::getSaveFileName(fn, |
314 | i18n("password filename(*.pwm)"), | 317 | i18n("password filename(*.pwm)"), |
315 | currentView); | 318 | currentView); |
316 | 319 | ||
317 | #endif | 320 | #endif |
318 | if (fn == "") { | 321 | if (fn == "") { |
319 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 322 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
320 | return false; | 323 | return false; |
321 | } | 324 | } |
322 | if (fn.right(4) != ".pwm") | 325 | if (fn.right(4) != ".pwm") |
323 | fn += ".pwm"; | 326 | fn += ".pwm"; |
324 | 327 | ||
325 | PwMerror ret = doc->saveDoc(conf()->confGlobCompression(), &fn); | 328 | PwMerror ret = doc->saveDoc(conf()->confGlobCompression(), &fn); |
326 | if (ret == e_noPw || | 329 | if (ret == e_noPw || |
327 | ret == e_wrongPw || | 330 | ret == e_wrongPw || |
328 | ret == e_openFile) { | 331 | ret == e_openFile) { |
329 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 332 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
330 | return false; | 333 | return false; |
331 | } else if (ret != e_success) { | 334 | } else if (ret != e_success) { |
332 | KMessageBox::error(currentView, | 335 | KMessageBox::error(currentView, |
333 | i18n("Error: Couldn't write to file.\n" | 336 | i18n("Error: Couldn't write to file.\n" |
334 | "Please check if you have permission to\n" | 337 | "Please check if you have permission to\n" |
335 | "write to the file in that directory."), | 338 | "write to the file in that directory."), |
336 | i18n("error while writing")); | 339 | i18n("error while writing")); |
337 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 340 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
338 | return false; | 341 | return false; |
339 | } | 342 | } |
340 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 343 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
341 | return true; | 344 | return true; |
342 | } | 345 | } |
343 | 346 | ||
344 | bool PwMDocUi::openDocUi(PwMDoc *doc, | 347 | bool PwMDocUi::openDocUi(PwMDoc *doc, |
345 | QString filename, | 348 | QString filename, |
346 | bool openDeepLocked) | 349 | bool openDeepLocked) |
347 | { | 350 | { |
348 | if (filename.isEmpty()) | 351 | if (filename.isEmpty()) |
349 | { | 352 | { |
350 | #ifndef PWM_EMBEDDED | 353 | #ifndef PWM_EMBEDDED |
351 | filename = KFileDialog::getOpenFileName(QString::null, | 354 | filename = KFileDialog::getOpenFileName(QString::null, |
352 | i18n("*.pwm|PwManager Password file\n" | 355 | i18n("*.pwm|PwManager Password file\n" |
353 | "*|All files"), getCurrentView()); | 356 | "*|All files"), getCurrentView()); |
354 | #else | 357 | #else |
355 | filename = locateLocal( "data", KGlobal::getAppName() + "/*.pwm"); | 358 | filename = locateLocal( "data", KGlobal::getAppName() + "/*.pwm"); |
356 | filename = KFileDialog::getOpenFileName(filename, | 359 | filename = KFileDialog::getOpenFileName(filename, |
357 | i18n("password filename(*.pwm)"), getCurrentView()); | 360 | i18n("password filename(*.pwm)"), getCurrentView()); |
358 | #endif | 361 | #endif |
359 | } | 362 | } |
360 | if (filename.isEmpty()) | 363 | if (filename.isEmpty()) |
361 | goto cancelOpen; | 364 | goto cancelOpen; |
362 | PwMerror ret; | 365 | PwMerror ret; |
363 | while (true) { | 366 | while (true) { |
364 | int lockStat = -1; | 367 | int lockStat = -1; |
365 | if (openDeepLocked) { | 368 | if (openDeepLocked) { |
366 | lockStat = 2; | 369 | lockStat = 2; |
367 | } else { | 370 | } else { |
368 | if (conf()->confGlobUnlockOnOpen()) { | 371 | if (conf()->confGlobUnlockOnOpen()) { |
369 | lockStat = 0; | 372 | lockStat = 0; |
370 | } else { | 373 | } else { |
371 | lockStat = 1; | 374 | lockStat = 1; |
372 | } | 375 | } |
373 | } | 376 | } |
374 | ret = doc->openDoc(&filename, lockStat); | 377 | ret = doc->openDoc(&filename, lockStat); |
375 | //qDebug("pwmdocui::OpenDocui %i", ret); | 378 | //qDebug("pwmdocui::OpenDocui %i", ret); |
376 | if (ret != e_success) { | 379 | if (ret != e_success) { |
377 | if (ret == e_readFile || ret == e_openFile) { | 380 | if (ret == e_readFile || ret == e_openFile) { |
378 | KMessageBox::error(getCurrentView(), | 381 | KMessageBox::error(getCurrentView(), |
379 | i18n("Could not read file!") | 382 | i18n("Could not read file!") |
380 | + "\n" | 383 | + "\n" |
381 | + filename, | 384 | + filename, |
382 | i18n("File error")); | 385 | i18n("File error")); |
383 | goto cancelOpen; | 386 | goto cancelOpen; |
384 | } | 387 | } |
385 | if (ret == e_alreadyOpen) { | 388 | if (ret == e_alreadyOpen) { |
386 | KMessageBox::error(getCurrentView(), | 389 | KMessageBox::error(getCurrentView(), |
387 | i18n("This file is already open."), | 390 | i18n("This file is already open."), |
388 | i18n("Already open")); | 391 | i18n("Already open")); |
389 | goto cancelOpen; | 392 | goto cancelOpen; |
390 | } | 393 | } |
391 | if (ret == e_fileVer) { | 394 | if (ret == e_fileVer) { |
392 | KMessageBox::error(getCurrentView(), | 395 | KMessageBox::error(getCurrentView(), |
393 | i18n | 396 | i18n |
394 | ("File-version is not supported!\n" | 397 | ("File-version is not supported!\n" |
395 | "Did you create this file with an\nolder or newer version of PwM?"), | 398 | "Did you create this file with an\nolder or newer version of PwM?"), |
396 | i18n | 399 | i18n |
397 | ("Incompatible version")); | 400 | ("Incompatible version")); |
398 | goto cancelOpen; | 401 | goto cancelOpen; |
399 | } | 402 | } |
400 | if (ret == e_wrongPw) { | 403 | if (ret == e_wrongPw) { |
401 | continue; | 404 | continue; |
402 | } | 405 | } |
403 | if (ret == e_noPw) { | 406 | if (ret == e_noPw) { |
404 | goto cancelOpen; | 407 | goto cancelOpen; |
405 | } | 408 | } |
406 | if (ret == e_fileFormat) { | 409 | if (ret == e_fileFormat) { |
407 | KMessageBox::error(getCurrentView(), | 410 | KMessageBox::error(getCurrentView(), |
408 | i18n | 411 | i18n |
409 | ("Sorry, this file has not been recognized\n" | 412 | ("Sorry, this file has not been recognized\n" |
410 | "as a PwM Password file.\n" | 413 | "as a PwM Password file.\n" |
411 | "Probably you have selected the wrong file."), | 414 | "Probably you have selected the wrong file."), |
412 | i18n | 415 | i18n |
413 | ("No PwM password-file")); | 416 | ("No PwM password-file")); |
414 | goto cancelOpen; | 417 | goto cancelOpen; |
415 | } | 418 | } |
416 | if (ret == e_fileCorrupt) { | 419 | if (ret == e_fileCorrupt) { |
417 | KMessageBox::error(getCurrentView(), | 420 | KMessageBox::error(getCurrentView(), |
418 | i18n | 421 | i18n |
419 | ("File corrupt!\n" | 422 | ("File corrupt!\n" |
420 | "Maybe the media, you stored this file on,\n" | 423 | "Maybe the media, you stored this file on,\n" |
421 | "had bad sectors?"), | 424 | "had bad sectors?"), |
422 | i18n | 425 | i18n |
423 | ("Checksum error")); | 426 | ("Checksum error")); |
424 | goto cancelOpen; | 427 | goto cancelOpen; |
425 | } | 428 | } |
diff --git a/pwmanager/pwmanager/pwminit.cpp b/pwmanager/pwmanager/pwminit.cpp index d775aa9..fbd17a7 100644 --- a/pwmanager/pwmanager/pwminit.cpp +++ b/pwmanager/pwmanager/pwminit.cpp | |||
@@ -1,625 +1,634 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2004 by Michael Buesch * | 3 | * copyright (C) 2004 by Michael Buesch * |
4 | * email: mbuesch@freenet.de * | 4 | * email: mbuesch@freenet.de * |
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 version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include "pwminit.h" | 20 | #include "pwminit.h" |
21 | #include "randomizer.h" | 21 | #include "randomizer.h" |
22 | #include <qdir.h> | 22 | #include <qdir.h> |
23 | 23 | ||
24 | #ifndef PWM_EMBEDDED | 24 | #ifndef PWM_EMBEDDED |
25 | #include "selftest.h" | 25 | #include "selftest.h" |
26 | #include "configuration.h" | 26 | #include "configuration.h" |
27 | #else | 27 | #else |
28 | #include "pwmprefs.h" | 28 | #include "pwmprefs.h" |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | #include "pwm.h" | 31 | #include "pwm.h" |
32 | #include "pwmexception.h" | 32 | #include "pwmexception.h" |
33 | #include "pwmtray.h" | 33 | #include "pwmtray.h" |
34 | #include "pwmdoc.h" | 34 | #include "pwmdoc.h" |
35 | 35 | ||
36 | #ifdef CONFIG_KWALLETIF | 36 | #ifdef CONFIG_KWALLETIF |
37 | # include "kwalletemu.h" | 37 | # include "kwalletemu.h" |
38 | #endif // CONFIG_KWALLETIF | 38 | #endif // CONFIG_KWALLETIF |
39 | #ifdef CONFIG_KEYCARD | 39 | #ifdef CONFIG_KEYCARD |
40 | # include "pwmkeycard.h" | 40 | # include "pwmkeycard.h" |
41 | #endif // CONFIG_KEYCARD | 41 | #endif // CONFIG_KEYCARD |
42 | 42 | ||
43 | #include <qmessagebox.h> | 43 | #include <qmessagebox.h> |
44 | 44 | ||
45 | #include <kmessagebox.h> | 45 | #include <kmessagebox.h> |
46 | #ifndef PWM_EMBEDDED | 46 | #ifndef PWM_EMBEDDED |
47 | #include <kcmdlineargs.h> | 47 | #include <kcmdlineargs.h> |
48 | #include <kwin.h> | 48 | #include <kwin.h> |
49 | #include <dcopclient.h> | 49 | #include <dcopclient.h> |
50 | #endif | 50 | #endif |
51 | 51 | ||
52 | #include <kapplication.h> | 52 | #include <kapplication.h> |
53 | #include <kiconloader.h> | 53 | #include <kiconloader.h> |
54 | 54 | ||
55 | #include <signal.h> | 55 | #include <signal.h> |
56 | 56 | ||
57 | static PwMInit *sig_init_pointer; | 57 | static PwMInit *sig_init_pointer; |
58 | #ifdef _WIN32_ | 58 | #ifdef _WIN32_ |
59 | static void sig_handler(int signum) | 59 | static void sig_handler(int signum) |
60 | #else | 60 | #else |
61 | static NOREGPARM void sig_handler(int signum) | 61 | static NOREGPARM void sig_handler(int signum) |
62 | #endif | 62 | #endif |
63 | { | 63 | { |
64 | switch (signum) { | 64 | switch (signum) { |
65 | case SIGINT: | 65 | case SIGINT: |
66 | case SIGTERM: | 66 | case SIGTERM: |
67 | sig_init_pointer->shutdownApp(20 + signum); | 67 | sig_init_pointer->shutdownApp(20 + signum); |
68 | break; | 68 | break; |
69 | default: | 69 | default: |
70 | printDebug(string("unhandled signal ") | 70 | printDebug(string("unhandled signal ") |
71 | + tostr(signum)); | 71 | + tostr(signum)); |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | 75 | ||
76 | 76 | ||
77 | PwMInit::PwMInit(PwMApplication *_app) | 77 | PwMInit::PwMInit(PwMApplication *_app) |
78 | : runStatus (unknown) | 78 | : runStatus (unknown) |
79 | , _curWidget (0) | 79 | , _curWidget (0) |
80 | , _dcopClient (0) | 80 | , _dcopClient (0) |
81 | , _kwalletEmu (0) | 81 | , _kwalletEmu (0) |
82 | , _keycard (0) | 82 | , _keycard (0) |
83 | , _tray (0) | 83 | , _tray (0) |
84 | { | 84 | { |
85 | sig_init_pointer = this; | 85 | sig_init_pointer = this; |
86 | app = _app; | 86 | app = _app; |
87 | } | 87 | } |
88 | 88 | ||
89 | PwMInit::~PwMInit() | 89 | PwMInit::~PwMInit() |
90 | { | 90 | { |
91 | qDebug("PwMInit::~PwMInit() "); | ||
91 | #ifndef PWM_EMBEDDED | 92 | #ifndef PWM_EMBEDDED |
92 | SelfTest::cancel(); | 93 | SelfTest::cancel(); |
93 | // close all open mainwnds | 94 | // close all open mainwnds |
94 | QValueList<PwM *>::iterator i = _mainWndList.begin(), | 95 | QValueList<PwM *>::iterator i = _mainWndList.begin(), |
95 | end = _mainWndList.end(); | 96 | end = _mainWndList.end(); |
96 | 97 | ||
97 | #else | 98 | #else |
98 | // close all open mainwnds | 99 | // close all open mainwnds |
99 | QValueList<PwM *>::Iterator i = _mainWndList.begin(), | 100 | QValueList<PwM *>::Iterator i = _mainWndList.begin(), |
100 | end = _mainWndList.end(); | 101 | end = _mainWndList.end(); |
101 | #endif | 102 | #endif |
102 | while (i != end) { | 103 | while (i != end) { |
103 | disconnect(*i, SIGNAL(closed(PwM *)), | 104 | disconnect(*i, SIGNAL(closed(PwM *)), |
104 | this, SLOT(mainWndClosed(PwM *))); | 105 | this, SLOT(mainWndClosed(PwM *))); |
105 | delete *i; | 106 | delete *i; |
106 | ++i; | 107 | ++i; |
107 | } | 108 | } |
108 | _mainWndList.clear(); | 109 | _mainWndList.clear(); |
109 | // close all remaining open documents | 110 | // close all remaining open documents |
110 | PwMDocList *_dl = PwMDoc::getOpenDocList(); | 111 | PwMDocList *_dl = PwMDoc::getOpenDocList(); |
111 | vector<PwMDocList::listItem> dl = *(_dl->getList()); | 112 | vector<PwMDocList::listItem> dl = *(_dl->getList()); |
112 | vector<PwMDocList::listItem>::iterator i2 = dl.begin(), | 113 | vector<PwMDocList::listItem>::iterator i2 = dl.begin(), |
113 | end2 = dl.end(); | 114 | end2 = dl.end(); |
114 | while (i2 != end2) { | 115 | while (i2 != end2) { |
115 | delete (*i2).doc; | 116 | delete (*i2).doc; |
116 | ++i2; | 117 | ++i2; |
117 | } | 118 | } |
118 | 119 | ||
119 | #ifdef CONFIG_KWALLETIF | 120 | #ifdef CONFIG_KWALLETIF |
120 | delete_ifnot_null(_kwalletEmu); | 121 | delete_ifnot_null(_kwalletEmu); |
121 | #endif // CONFIG_KWALLETIF | 122 | #endif // CONFIG_KWALLETIF |
122 | #ifdef CONFIG_KEYCARD | 123 | #ifdef CONFIG_KEYCARD |
123 | delete_ifnot_null(_keycard); | 124 | delete_ifnot_null(_keycard); |
124 | #endif // CONFIG_KEYCARD | 125 | #endif // CONFIG_KEYCARD |
125 | delete_ifnot_null(_tray); | 126 | delete_ifnot_null(_tray); |
126 | 127 | ||
127 | Randomizer::cleanup(); | 128 | Randomizer::cleanup(); |
128 | #ifndef PWM_EMBEDDED | 129 | #ifndef PWM_EMBEDDED |
129 | Configuration::cleanup(); | 130 | Configuration::cleanup(); |
130 | #endif | 131 | #endif |
131 | } | 132 | } |
132 | 133 | ||
133 | void PwMInit::initializeApp() | 134 | void PwMInit::initializeApp() |
134 | { | 135 | { |
135 | //qDebug("PwMInit::initializeApp() "); | 136 | //qDebug("PwMInit::initializeApp() "); |
136 | PWM_ASSERT(runStatus == unknown); | 137 | PWM_ASSERT(runStatus == unknown); |
137 | runStatus = init; | 138 | runStatus = init; |
138 | initPosixSignalHandler(); | 139 | initPosixSignalHandler(); |
139 | Randomizer::init(); | 140 | Randomizer::init(); |
140 | #ifndef PWM_EMBEDDED | 141 | #ifndef PWM_EMBEDDED |
141 | Configuration::init(); | 142 | Configuration::init(); |
142 | #endif | 143 | #endif |
143 | initDCOP(); | 144 | initDCOP(); |
144 | initKWalletEmu(); | 145 | initKWalletEmu(); |
145 | initKeycard(); | 146 | initKeycard(); |
146 | initTray(); | 147 | initTray(); |
147 | handleCmdLineArgs(); | 148 | handleCmdLineArgs(); |
148 | bool openDeeplocked = false; | 149 | bool openDeeplocked = false; |
149 | if (conf()->confGlobAutostartDeepLocked() || | 150 | if (conf()->confGlobAutostartDeepLocked() || |
150 | savedCmd.open_deeplocked) | 151 | savedCmd.open_deeplocked) |
151 | openDeeplocked = true; | 152 | openDeeplocked = true; |
152 | if ( false ){ | 153 | if ( false ){ |
153 | // LR is not working | 154 | // LR is not working |
154 | //if (conf()->confWndAutoMinimizeOnStart() || | 155 | //if (conf()->confWndAutoMinimizeOnStart() || |
155 | // savedCmd.minToTray) { | 156 | // savedCmd.minToTray) { |
156 | PwMDoc *newDoc = createDoc(); | 157 | PwMDoc *newDoc = createDoc(); |
157 | qDebug(" createDoc()"); | 158 | qDebug(" createDoc()"); |
158 | if (!newDoc->openDocUi(newDoc, | 159 | if (!newDoc->openDocUi(newDoc, |
159 | conf()->confGlobAutoStart(), | 160 | conf()->confGlobAutoStart(), |
160 | openDeeplocked)) { | 161 | openDeeplocked)) { |
161 | delete newDoc; | 162 | delete newDoc; |
162 | } | 163 | } |
163 | 164 | ||
164 | //US ENH for embedded devices: in the case of failure, open a document the default way | 165 | //US ENH for embedded devices: in the case of failure, open a document the default way |
165 | createMainWnd(conf()->confGlobAutoStart(), | 166 | createMainWnd(conf()->confGlobAutoStart(), |
166 | openDeeplocked, | 167 | openDeeplocked, |
167 | true, | 168 | true, |
168 | 0, | 169 | 0, |
169 | savedCmd.minimized); | 170 | savedCmd.minimized); |
170 | 171 | ||
171 | 172 | ||
172 | 173 | ||
173 | 174 | ||
174 | //} | 175 | //} |
175 | } else { | 176 | } else { |
176 | createMainWnd(conf()->confGlobAutoStart(), | 177 | createMainWnd(conf()->confGlobAutoStart(), |
177 | openDeeplocked, | 178 | openDeeplocked, |
178 | true, | 179 | true, |
179 | 0, | 180 | 0, |
180 | savedCmd.minimized); | 181 | savedCmd.minimized); |
181 | } | 182 | } |
182 | |||
183 | runStatus = running; | 183 | runStatus = running; |
184 | } | 184 | } |
185 | 185 | ||
186 | void PwMInit::shutdownApp(int exitStatus) | 186 | void PwMInit::shutdownApp(int exitStatus) |
187 | { | 187 | { |
188 | printDebug(string("PwMInit::shutdownApp(") | 188 | printDebug(string("PwMInit::shutdownApp(") |
189 | + tostr(exitStatus) + ") called."); | 189 | + tostr(exitStatus) + ") called."); |
190 | PWM_ASSERT((runStatus == running) || (runStatus == init)); | 190 | PWM_ASSERT((runStatus == running) || (runStatus == init)); |
191 | runStatus = shutdown; | 191 | runStatus = shutdown; |
192 | QApplication::exit(exitStatus); | 192 | QApplication::exit(exitStatus); |
193 | /* The destructor of PwMInit is called when control | 193 | /* The destructor of PwMInit is called when control |
194 | * leaves main() | 194 | * leaves main() |
195 | */ | 195 | */ |
196 | } | 196 | } |
197 | 197 | ||
198 | void PwMInit::initPosixSignalHandler() | 198 | void PwMInit::initPosixSignalHandler() |
199 | { | 199 | { |
200 | signal(SIGINT, sig_handler); | 200 | signal(SIGINT, sig_handler); |
201 | signal(SIGTERM, sig_handler); | 201 | signal(SIGTERM, sig_handler); |
202 | } | 202 | } |
203 | 203 | ||
204 | void PwMInit::initDCOP() | 204 | void PwMInit::initDCOP() |
205 | { | 205 | { |
206 | #ifndef PWM_EMBEDDED | 206 | #ifndef PWM_EMBEDDED |
207 | _dcopClient = app->dcopClient(); | 207 | _dcopClient = app->dcopClient(); |
208 | _dcopClient->setNotifications(true); | 208 | _dcopClient->setNotifications(true); |
209 | #endif | 209 | #endif |
210 | 210 | ||
211 | } | 211 | } |
212 | 212 | ||
213 | void PwMInit::initKWalletEmu(bool forceDisable, bool forceReload) | 213 | void PwMInit::initKWalletEmu(bool forceDisable, bool forceReload) |
214 | { | 214 | { |
215 | #ifdef CONFIG_KWALLETIF | 215 | #ifdef CONFIG_KWALLETIF |
216 | if (!conf()->confGlobKwalletEmu() || | 216 | if (!conf()->confGlobKwalletEmu() || |
217 | forceDisable) { | 217 | forceDisable) { |
218 | delete_ifnot_null(_kwalletEmu); | 218 | delete_ifnot_null(_kwalletEmu); |
219 | return; | 219 | return; |
220 | } | 220 | } |
221 | try { | 221 | try { |
222 | if (_kwalletEmu && forceReload) | 222 | if (_kwalletEmu && forceReload) |
223 | delete_and_null(_kwalletEmu); | 223 | delete_and_null(_kwalletEmu); |
224 | if (!_kwalletEmu) | 224 | if (!_kwalletEmu) |
225 | _kwalletEmu = new KWalletEmu(this); | 225 | _kwalletEmu = new KWalletEmu(this); |
226 | } catch (PwMException e) { | 226 | } catch (PwMException e) { |
227 | string errMsg("initializing KWallet emulation failed. ID: "); | 227 | string errMsg("initializing KWallet emulation failed. ID: "); |
228 | errMsg += tostr(static_cast<int>(e.getId())); | 228 | errMsg += tostr(static_cast<int>(e.getId())); |
229 | errMsg += " err-message: "; | 229 | errMsg += " err-message: "; |
230 | errMsg += e.getMessage(); | 230 | errMsg += e.getMessage(); |
231 | printWarn(errMsg); | 231 | printWarn(errMsg); |
232 | return; | 232 | return; |
233 | } | 233 | } |
234 | #else // CONFIG_KWALLETIF | 234 | #else // CONFIG_KWALLETIF |
235 | PARAM_UNUSED(forceDisable); | 235 | PARAM_UNUSED(forceDisable); |
236 | PARAM_UNUSED(forceReload); | 236 | PARAM_UNUSED(forceReload); |
237 | #endif // CONFIG_KWALLETIF | 237 | #endif // CONFIG_KWALLETIF |
238 | } | 238 | } |
239 | 239 | ||
240 | void PwMInit::initKeycard() | 240 | void PwMInit::initKeycard() |
241 | { | 241 | { |
242 | #ifdef CONFIG_KEYCARD | 242 | #ifdef CONFIG_KEYCARD |
243 | PWM_ASSERT(!_keycard); | 243 | PWM_ASSERT(!_keycard); |
244 | _keycard = new PwMKeyCard(this); | 244 | _keycard = new PwMKeyCard(this); |
245 | #endif // CONFIG_KEYCARD | 245 | #endif // CONFIG_KEYCARD |
246 | } | 246 | } |
247 | 247 | ||
248 | void PwMInit::initTray() | 248 | void PwMInit::initTray() |
249 | { | 249 | { |
250 | #ifdef PWM_EMBEDDED | 250 | #ifdef PWM_EMBEDDED |
251 | //US ENH : embedded version does not support a tray | 251 | //US ENH : embedded version does not support a tray |
252 | return; | 252 | return; |
253 | #endif | 253 | #endif |
254 | 254 | ||
255 | if (!conf()->confGlobTray()) { | 255 | if (!conf()->confGlobTray()) { |
256 | if (!_tray) | 256 | if (!_tray) |
257 | return; | 257 | return; |
258 | _tray->hide(); | 258 | _tray->hide(); |
259 | delete_and_null(_tray); | 259 | delete_and_null(_tray); |
260 | return; | 260 | return; |
261 | } | 261 | } |
262 | if (_tray) | 262 | if (_tray) |
263 | return; | 263 | return; |
264 | _tray = new PwMTray(this); | 264 | _tray = new PwMTray(this); |
265 | connect(_tray, SIGNAL(quitSelected()), | 265 | connect(_tray, SIGNAL(quitSelected()), |
266 | this, SLOT(removeTrayAndQuit())); | 266 | this, SLOT(removeTrayAndQuit())); |
267 | connect(_tray, SIGNAL(closed(PwMTray *)), | 267 | connect(_tray, SIGNAL(closed(PwMTray *)), |
268 | this, SLOT(trayIconClosed(PwMTray *))); | 268 | this, SLOT(trayIconClosed(PwMTray *))); |
269 | KIconLoader icons; | 269 | KIconLoader icons; |
270 | #ifndef PWM_EMBEDDED | 270 | #ifndef PWM_EMBEDDED |
271 | _tray->setPixmap(icons.loadIcon(PACKAGE_NAME, KIcon::Small)); | 271 | _tray->setPixmap(icons.loadIcon(PACKAGE_NAME, KIcon::Small)); |
272 | #endif | 272 | #endif |
273 | _tray->show(); | 273 | _tray->show(); |
274 | // connect the signals of all open documents. | 274 | // connect the signals of all open documents. |
275 | const vector<PwMDocList::listItem> *dl = PwMDoc::getOpenDocList()->getList(); | 275 | const vector<PwMDocList::listItem> *dl = PwMDoc::getOpenDocList()->getList(); |
276 | vector<PwMDocList::listItem>::const_iterator i = dl->begin(), | 276 | vector<PwMDocList::listItem>::const_iterator i = dl->begin(), |
277 | end = dl->end(); | 277 | end = dl->end(); |
278 | while (i != end) { | 278 | while (i != end) { |
279 | _tray->connectDocToTray((*i).doc); | 279 | _tray->connectDocToTray((*i).doc); |
280 | ++i; | 280 | ++i; |
281 | } | 281 | } |
282 | } | 282 | } |
283 | 283 | ||
284 | void PwMInit::removeTrayAndQuit() | 284 | void PwMInit::removeTrayAndQuit() |
285 | { | 285 | { |
286 | PWM_ASSERT(_tray); | 286 | PWM_ASSERT(_tray); |
287 | // _tray is deleted in ~PwMInit | 287 | // _tray is deleted in ~PwMInit |
288 | shutdownApp(0); | 288 | shutdownApp(0); |
289 | } | 289 | } |
290 | 290 | ||
291 | PwM * PwMInit::createMainWnd(const QString &loadFile, | 291 | PwM * PwMInit::createMainWnd(const QString &loadFile, |
292 | bool loadFileDeepLocked, | 292 | bool loadFileDeepLocked, |
293 | bool virginity, | 293 | bool virginity, |
294 | PwMDoc *doc, | 294 | PwMDoc *doc, |
295 | bool minimized) | 295 | bool minimized) |
296 | { | 296 | { |
297 | PwM *newWnd; | 297 | PwM *newWnd; |
298 | if (!doc) | 298 | if (!doc) |
299 | doc = createDoc(); | 299 | doc = createDoc(); |
300 | newWnd = new PwM(this, doc, virginity); | 300 | newWnd = new PwM(this, doc, virginity); |
301 | #ifndef PWM_EMBEDDED | 301 | #ifndef PWM_EMBEDDED |
302 | _mainWndList.push_back(newWnd); | 302 | _mainWndList.push_back(newWnd); |
303 | #else | 303 | #else |
304 | _mainWndList.append(newWnd); | 304 | _mainWndList.append(newWnd); |
305 | #endif | 305 | #endif |
306 | connect(newWnd, SIGNAL(closed(PwM *)), | 306 | connect(newWnd, SIGNAL(closed(PwM *)), |
307 | this, SLOT(mainWndClosed(PwM *))); | 307 | this, SLOT(mainWndClosed(PwM *))); |
308 | connect(newWnd, SIGNAL(gotFocus(PwM *)), | 308 | connect(newWnd, SIGNAL(gotFocus(PwM *)), |
309 | this, SLOT(setCurWidget(PwM *))); | 309 | this, SLOT(setCurWidget(PwM *))); |
310 | connect(newWnd, SIGNAL(lostFocus(PwM *)), | 310 | connect(newWnd, SIGNAL(lostFocus(PwM *)), |
311 | this, SLOT(resetCurWidget())); | 311 | this, SLOT(resetCurWidget())); |
312 | 312 | ||
313 | //US ENH | 313 | //US ENH |
314 | #ifndef PWM_EMBEDDED | 314 | #ifndef PWM_EMBEDDED |
315 | if (minimized) | 315 | if (minimized) |
316 | newWnd->showMinimized(); | 316 | newWnd->showMinimized(); |
317 | else | 317 | else |
318 | newWnd->show(); | 318 | newWnd->show(); |
319 | 319 | ||
320 | #else //PWM_EMBEDDED | 320 | #else //PWM_EMBEDDED |
321 | 321 | ||
322 | #ifndef DESKTOP_VERSION | 322 | #ifndef DESKTOP_VERSION |
323 | app->showMainWidget( newWnd ); | 323 | app->showMainWidget( newWnd ); |
324 | #else //DESKTOP_VERSION | 324 | #else //DESKTOP_VERSION |
325 | app->setMainWidget( newWnd ); | ||
326 | newWnd->resize (640, 480 ); | 325 | newWnd->resize (640, 480 ); |
327 | newWnd->show(); | 326 | newWnd->show(); |
328 | qDebug("show "); | ||
329 | #endif //DESKTOP_VERSION | 327 | #endif //DESKTOP_VERSION |
330 | 328 | ||
331 | #endif //PWM_EMBEDDED | 329 | #endif //PWM_EMBEDDED |
332 | 330 | ||
333 | if (loadFile != QString::null && | 331 | if (loadFile != QString::null && |
334 | loadFile != "") { | 332 | loadFile != "") { |
335 | newWnd->openDoc(loadFile, loadFileDeepLocked); | 333 | newWnd->openDoc(loadFile, loadFileDeepLocked); |
336 | } | 334 | } |
337 | return newWnd; | 335 | return newWnd; |
338 | } | 336 | } |
339 | 337 | ||
340 | PwMDoc * PwMInit::createDoc() | 338 | PwMDoc * PwMInit::createDoc() |
341 | { | 339 | { |
342 | PwMDoc *doc = new PwMDoc(this); | 340 | PwMDoc *doc = new PwMDoc(this); |
343 | #ifdef CONFIG_KEYCARD | 341 | #ifdef CONFIG_KEYCARD |
344 | doc->setPwMKeyCard(keycard()); | 342 | doc->setPwMKeyCard(keycard()); |
345 | #endif | 343 | #endif |
346 | #ifdef CONFIG_KWALLETIF | 344 | #ifdef CONFIG_KWALLETIF |
347 | if (kwalletEmu()) | 345 | if (kwalletEmu()) |
348 | kwalletEmu()->connectDocSignals(doc); | 346 | kwalletEmu()->connectDocSignals(doc); |
349 | #endif | 347 | #endif |
350 | 348 | ||
351 | if (_tray) | 349 | if (_tray) |
352 | _tray->connectDocToTray(doc); | 350 | _tray->connectDocToTray(doc); |
353 | 351 | ||
354 | return doc; | 352 | return doc; |
355 | 353 | ||
356 | } | 354 | } |
357 | 355 | ||
358 | void PwMInit::mainWndClosed(PwM *wnd) | 356 | void PwMInit::mainWndClosed(PwM *wnd) |
359 | { | 357 | { |
360 | bool doMinimizeToTray = false; | 358 | bool doMinimizeToTray = false; |
361 | bool doDeleteDoc = false; | 359 | bool doDeleteDoc = false; |
362 | #ifndef PWM_EMBEDDED | 360 | #ifndef PWM_EMBEDDED |
363 | dcopClient()->suspend(); | 361 | dcopClient()->suspend(); |
364 | dcopClient()->setAcceptCalls(false); | 362 | dcopClient()->setAcceptCalls(false); |
365 | #endif | 363 | #endif |
366 | again: | 364 | again: |
367 | 365 | ||
368 | if (wnd->isForceMinimizeToTray()) { | 366 | if (wnd->isForceMinimizeToTray()) { |
369 | if (unlikely(!_tray)) { | 367 | if (unlikely(!_tray)) { |
370 | /* This should not happen! If we set forceMinimizeToTray , | 368 | /* This should not happen! If we set forceMinimizeToTray , |
371 | * we must be sure that _tray exists. | 369 | * we must be sure that _tray exists. |
372 | */ | 370 | */ |
373 | BUG(); | 371 | BUG(); |
374 | wnd->setForceMinimizeToTray(false); | 372 | wnd->setForceMinimizeToTray(false); |
375 | goto again; | 373 | goto again; |
376 | } | 374 | } |
377 | doMinimizeToTray = true; | 375 | doMinimizeToTray = true; |
378 | } else { | 376 | } else { |
379 | // Ask to minimize to tray. If not, delete doc. | 377 | // Ask to minimize to tray. If not, delete doc. |
380 | if (_tray && | 378 | if (_tray && |
381 | runStatus != shutdown && | 379 | runStatus != shutdown && |
382 | !wnd->isForceQuit() && | 380 | !wnd->isForceQuit() && |
383 | !wnd->curDoc()->isDeleted()) { | 381 | !wnd->curDoc()->isDeleted()) { |
384 | if (conf()->confWndClose()) | 382 | if (conf()->confWndClose()) |
385 | doDeleteDoc = true; | 383 | doDeleteDoc = true; |
386 | else | 384 | else |
387 | doMinimizeToTray = true; | 385 | doMinimizeToTray = true; |
388 | } else { | 386 | } else { |
389 | doDeleteDoc = true; | 387 | doDeleteDoc = true; |
390 | } | 388 | } |
391 | } | 389 | } |
392 | 390 | ||
393 | if (doMinimizeToTray) { | 391 | if (doMinimizeToTray) { |
394 | 392 | qDebug("doMinimizeToTray "); | |
395 | PWM_ASSERT(_tray); | 393 | PWM_ASSERT(_tray); |
396 | int mmlock = conf()->confGlobMinimizeLock(); | 394 | int mmlock = conf()->confGlobMinimizeLock(); |
397 | switch (mmlock) { | 395 | switch (mmlock) { |
398 | case 0: // don't lock anything | 396 | case 0: // don't lock anything |
399 | break; | 397 | break; |
400 | case 1: // normal lock | 398 | case 1: // normal lock |
401 | wnd->curDoc()->lockAll(true); | 399 | wnd->curDoc()->lockAll(true); |
402 | break; | 400 | break; |
403 | case 2: // deep-lock | 401 | case 2: // deep-lock |
404 | wnd->curDoc()->deepLock(); | 402 | wnd->curDoc()->deepLock(); |
405 | break; | 403 | break; |
406 | default: | 404 | default: |
407 | WARN(); | 405 | WARN(); |
408 | } | 406 | } |
409 | } else if (doDeleteDoc) { | 407 | } else if (doDeleteDoc) { |
408 | qDebug("doDeleteDoc "); | ||
410 | if (!wnd->curDoc()->tryDelete()) { | 409 | if (!wnd->curDoc()->tryDelete()) { |
411 | /* We failed deleting the doc, | 410 | /* We failed deleting the doc, |
412 | * so open a new window with it, again. | 411 | * so open a new window with it, again. |
413 | */ | 412 | */ |
414 | createMainWnd(QString::null, false, | 413 | createMainWnd(QString::null, false, |
415 | false, wnd->curDoc()); | 414 | false, wnd->curDoc()); |
416 | } | 415 | } |
417 | } | 416 | } |
418 | #ifndef PWM_EMBEDDED | 417 | #ifndef PWM_EMBEDDED |
419 | // find the closed window in the "mainWndList" and delete it. | 418 | // find the closed window in the "mainWndList" and delete it. |
420 | QValueList<PwM *>::iterator i = _mainWndList.begin(), | 419 | QValueList<PwM *>::iterator i = _mainWndList.begin(), |
421 | end = _mainWndList.end(); | 420 | end = _mainWndList.end(); |
422 | #else | 421 | #else |
423 | // find the closed window in the "mainWndList" and delete it. | 422 | // find the closed window in the "mainWndList" and delete it. |
424 | QValueList<PwM *>::Iterator i = _mainWndList.begin(), | 423 | QValueList<PwM *>::Iterator i = _mainWndList.begin(), |
425 | end = _mainWndList.end(); | 424 | end = _mainWndList.end(); |
426 | #endif | 425 | #endif |
427 | while (i != end) { | 426 | while (i != end) { |
428 | if (*i == wnd) { | 427 | if (*i == wnd) { |
429 | #ifndef PWM_EMBEDDED | 428 | #ifndef PWM_EMBEDDED |
430 | _mainWndList.erase(i); | 429 | _mainWndList.erase(i); |
431 | #else | 430 | #else |
432 | _mainWndList.remove(i); | 431 | _mainWndList.remove(i); |
433 | #endif | 432 | #endif |
433 | |||
434 | if ( app->mainWidget() == wnd ) { | ||
435 | if ( _mainWndList.count() ) { | ||
436 | #ifndef DESKTOP_VERSION | ||
437 | app->showMainWidget(_mainWndList.first() ); | ||
438 | #endif //DESKTOP_VERSION | ||
439 | |||
440 | } | ||
441 | } | ||
442 | delete wnd; | ||
434 | goto out_success; | 443 | goto out_success; |
435 | } | 444 | } |
436 | ++i; | 445 | ++i; |
437 | } | 446 | } |
438 | BUG(); | 447 | BUG(); |
439 | out_success: | 448 | out_success: |
440 | #ifndef PWM_EMBEDDED | 449 | #ifndef PWM_EMBEDDED |
441 | if (!_mainWndList.size()) | 450 | if (!_mainWndList.size()) |
442 | #else | 451 | #else |
443 | if (!_mainWndList.count()) | 452 | if (!_mainWndList.count()) |
444 | #endif | 453 | #endif |
445 | 454 | ||
446 | { | 455 | { |
447 | /* If there's no main window and no tray icon | 456 | /* If there's no main window and no tray icon |
448 | * left, we have no user interface, so we can | 457 | * left, we have no user interface, so we can |
449 | * shut down the application. | 458 | * shut down the application. |
450 | */ | 459 | */ |
451 | if (!_tray) { | 460 | if (!_tray) { |
452 | #ifndef PWM_EMBEDDED | 461 | #ifndef PWM_EMBEDDED |
453 | dcopClient()->setAcceptCalls(true); | 462 | dcopClient()->setAcceptCalls(true); |
454 | dcopClient()->resume(); | 463 | dcopClient()->resume(); |
455 | #endif | 464 | #endif |
456 | shutdownApp(0); | 465 | shutdownApp(0); |
457 | return; | 466 | return; |
458 | } | 467 | } |
459 | /* There is no widget left, so set | 468 | /* There is no widget left, so set |
460 | * _curWidget to 0 | 469 | * _curWidget to 0 |
461 | */ | 470 | */ |
462 | resetCurWidget(); | 471 | resetCurWidget(); |
463 | } | 472 | } |
464 | #ifndef PWM_EMBEDDED | 473 | #ifndef PWM_EMBEDDED |
465 | dcopClient()->setAcceptCalls(true); | 474 | dcopClient()->setAcceptCalls(true); |
466 | dcopClient()->resume(); | 475 | dcopClient()->resume(); |
467 | #endif | 476 | #endif |
468 | } | 477 | } |
469 | 478 | ||
470 | void PwMInit::trayIconClosed(PwMTray *tray) | 479 | void PwMInit::trayIconClosed(PwMTray *tray) |
471 | { | 480 | { |
472 | if (runStatus != running) | 481 | if (runStatus != running) |
473 | return; | 482 | return; |
474 | PARAM_UNUSED(tray); | 483 | PARAM_UNUSED(tray); |
475 | PWM_ASSERT(tray == _tray); | 484 | PWM_ASSERT(tray == _tray); |
476 | /* If there's no main wnd left we have to | 485 | /* If there's no main wnd left we have to |
477 | * shutdown the app (same as in mainWndClosed()) | 486 | * shutdown the app (same as in mainWndClosed()) |
478 | */ | 487 | */ |
479 | #ifndef PWM_EMBEDDED | 488 | #ifndef PWM_EMBEDDED |
480 | if (!_mainWndList.size()) | 489 | if (!_mainWndList.size()) |
481 | shutdownApp(0); | 490 | shutdownApp(0); |
482 | #else | 491 | #else |
483 | if (!_mainWndList.count()) | 492 | if (!_mainWndList.count()) |
484 | shutdownApp(0); | 493 | shutdownApp(0); |
485 | #endif | 494 | #endif |
486 | } | 495 | } |
487 | 496 | ||
488 | void PwMInit::handleCmdLineArgs(bool initial) | 497 | void PwMInit::handleCmdLineArgs(bool initial) |
489 | { | 498 | { |
490 | #ifndef PWM_EMBEDDED | 499 | #ifndef PWM_EMBEDDED |
491 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); | 500 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); |
492 | PWM_ASSERT(args); | 501 | PWM_ASSERT(args); |
493 | int i, numArgs = args->count(); | 502 | int i, numArgs = args->count(); |
494 | const char *curArg; | 503 | const char *curArg; |
495 | 504 | ||
496 | // read all cmdline options | 505 | // read all cmdline options |
497 | savedCmd.open_deeplocked = args->isSet("open-deeplocked"); | 506 | savedCmd.open_deeplocked = args->isSet("open-deeplocked"); |
498 | savedCmd.minimized = args->isSet("minimized"); | 507 | savedCmd.minimized = args->isSet("minimized"); |
499 | savedCmd.minToTray = args->isSet("mintray"); | 508 | savedCmd.minToTray = args->isSet("mintray"); |
500 | savedCmd.skipSelfTest = args->isSet("skip-self-test"); | 509 | savedCmd.skipSelfTest = args->isSet("skip-self-test"); |
501 | if (savedCmd.minimized && | 510 | if (savedCmd.minimized && |
502 | savedCmd.minToTray) { | 511 | savedCmd.minToTray) { |
503 | printInfo(i18n("Commandline option \"--minimized\" and " | 512 | printInfo(i18n("Commandline option \"--minimized\" and " |
504 | "\"--mintray\" selected. These are incompatible. " | 513 | "\"--mintray\" selected. These are incompatible. " |
505 | "\"--mintray\" will be selected.").latin1()); | 514 | "\"--mintray\" will be selected.").latin1()); |
506 | } | 515 | } |
507 | /* Iterate through all non-option arguments. | 516 | /* Iterate through all non-option arguments. |
508 | * Every non-option arg is a filename to open. | 517 | * Every non-option arg is a filename to open. |
509 | */ | 518 | */ |
510 | for (i = 0; i < numArgs; ++i) { | 519 | for (i = 0; i < numArgs; ++i) { |
511 | curArg = args->arg(i); | 520 | curArg = args->arg(i); |
512 | PWM_ASSERT(curArg); | 521 | PWM_ASSERT(curArg); |
513 | if (savedCmd.minToTray) { | 522 | if (savedCmd.minToTray) { |
514 | PwMDoc *newDoc = createDoc(); | 523 | PwMDoc *newDoc = createDoc(); |
515 | if (!newDoc->openDocUi(newDoc, | 524 | if (!newDoc->openDocUi(newDoc, |
516 | curArg, | 525 | curArg, |
517 | savedCmd.open_deeplocked)) { | 526 | savedCmd.open_deeplocked)) { |
518 | delete newDoc; | 527 | delete newDoc; |
519 | } | 528 | } |
520 | } else { | 529 | } else { |
521 | PwM *newInstance = createMainWnd(QString::null, | 530 | PwM *newInstance = createMainWnd(QString::null, |
522 | false, | 531 | false, |
523 | true, | 532 | true, |
524 | 0, | 533 | 0, |
525 | savedCmd.minimized); | 534 | savedCmd.minimized); |
526 | PwMDoc *newDoc = newInstance->openDoc(curArg, | 535 | PwMDoc *newDoc = newInstance->openDoc(curArg, |
527 | savedCmd.open_deeplocked); | 536 | savedCmd.open_deeplocked); |
528 | if (!newDoc) { | 537 | if (!newDoc) { |
529 | newInstance->setForceQuit(true); | 538 | newInstance->setForceQuit(true); |
530 | delete_and_null(newInstance); | 539 | delete_and_null(newInstance); |
531 | } | 540 | } |
532 | } | 541 | } |
533 | } | 542 | } |
534 | 543 | ||
535 | if (savedCmd.minToTray) { | 544 | if (savedCmd.minToTray) { |
536 | minimizeAllMainWnd(true); | 545 | minimizeAllMainWnd(true); |
537 | } else if (savedCmd.minimized) { | 546 | } else if (savedCmd.minimized) { |
538 | minimizeAllMainWnd(false); | 547 | minimizeAllMainWnd(false); |
539 | } | 548 | } |
540 | if (!savedCmd.skipSelfTest && initial) { | 549 | if (!savedCmd.skipSelfTest && initial) { |
541 | SelfTest::schedule(); | 550 | SelfTest::schedule(); |
542 | } | 551 | } |
543 | args->clear(); | 552 | args->clear(); |
544 | #endif | 553 | #endif |
545 | } | 554 | } |
546 | 555 | ||
547 | void PwMInit::minimizeAllMainWnd(bool toTray) | 556 | void PwMInit::minimizeAllMainWnd(bool toTray) |
548 | { | 557 | { |
549 | #ifndef PWM_EMBEDDED | 558 | #ifndef PWM_EMBEDDED |
550 | if (!_mainWndList.size()) | 559 | if (!_mainWndList.size()) |
551 | return; | 560 | return; |
552 | #else | 561 | #else |
553 | if (!_mainWndList.count()) | 562 | if (!_mainWndList.count()) |
554 | return; | 563 | return; |
555 | #endif | 564 | #endif |
556 | const QValueList<PwM *> *ml = mainWndList(); | 565 | const QValueList<PwM *> *ml = mainWndList(); |
557 | #ifndef PWM_EMBEDDED | 566 | #ifndef PWM_EMBEDDED |
558 | QValueList<PwM *>::const_iterator it = ml->begin(), | 567 | QValueList<PwM *>::const_iterator it = ml->begin(), |
559 | end = ml->end(); | 568 | end = ml->end(); |
560 | #else | 569 | #else |
561 | QValueList<PwM *>::ConstIterator it = ml->begin(), | 570 | QValueList<PwM *>::ConstIterator it = ml->begin(), |
562 | end = ml->end(); | 571 | end = ml->end(); |
563 | #endif | 572 | #endif |
564 | PwM *wnd; | 573 | PwM *wnd; |
565 | if (toTray && _tray) { | 574 | if (toTray && _tray) { |
566 | /* minimize to tray. | 575 | /* minimize to tray. |
567 | * close all mainWnd. | 576 | * close all mainWnd. |
568 | */ | 577 | */ |
569 | while (it != end) { | 578 | while (it != end) { |
570 | wnd = *it; | 579 | wnd = *it; |
571 | wnd->setForceMinimizeToTray(true); | 580 | wnd->setForceMinimizeToTray(true); |
572 | wnd->close_slot(); | 581 | wnd->close_slot(); |
573 | ++it; | 582 | ++it; |
574 | } | 583 | } |
575 | } else { | 584 | } else { |
576 | // normal minimize | 585 | // normal minimize |
577 | while (it != end) { | 586 | while (it != end) { |
578 | wnd = *it; | 587 | wnd = *it; |
579 | wnd->hide(); | 588 | wnd->hide(); |
580 | wnd->showMinimized(); | 589 | wnd->showMinimized(); |
581 | ++it; | 590 | ++it; |
582 | } | 591 | } |
583 | } | 592 | } |
584 | } | 593 | } |
585 | 594 | ||
586 | #ifdef PWM_EMBEDDED | 595 | #ifdef PWM_EMBEDDED |
587 | 596 | ||
588 | #ifndef DESKTOP_VERSION | 597 | #ifndef DESKTOP_VERSION |
589 | 598 | ||
590 | PwMApplication::PwMApplication(int & argc, char ** argv) | 599 | PwMApplication::PwMApplication(int & argc, char ** argv) |
591 | : QPEApplication( argc, argv ) | 600 | : QPEApplication( argc, argv ) |
592 | , init (0) | 601 | , init (0) |
593 | { | 602 | { |
594 | this->setKeepRunning (); | 603 | this->setKeepRunning (); |
595 | } | 604 | } |
596 | 605 | ||
597 | PwMApplication::~PwMApplication() | 606 | PwMApplication::~PwMApplication() |
598 | { | 607 | { |
599 | delete_ifnot_null(init); | 608 | delete_ifnot_null(init); |
600 | } | 609 | } |
601 | #else //DESKTOP_VERSION | 610 | #else //DESKTOP_VERSION |
602 | 611 | ||
603 | PwMApplication::PwMApplication(int & argc, char ** argv) | 612 | PwMApplication::PwMApplication(int & argc, char ** argv) |
604 | : QApplication( argc, argv ) | 613 | : QApplication( argc, argv ) |
605 | , init (0) | 614 | , init (0) |
606 | { | 615 | { |
607 | setStyle( new QPlatinumStyle ()); | 616 | setStyle( new QPlatinumStyle ()); |
608 | QString hdir = QDir::homeDirPath(); | 617 | QString hdir = QDir::homeDirPath(); |
609 | // there is a bug when creating dirs for WIN 98 | 618 | // there is a bug when creating dirs for WIN 98 |
610 | // it is difficult to fix, because we have no WIN 98 runnung | 619 | // it is difficult to fix, because we have no WIN 98 runnung |
611 | // such that we try it to create the dirs at startup here | 620 | // such that we try it to create the dirs at startup here |
612 | if ( hdir == "C:\\" ) | 621 | if ( hdir == "C:\\" ) |
613 | { | 622 | { |
614 | // win 98 or ME | 623 | // win 98 or ME |
615 | QDir app_dir; | 624 | QDir app_dir; |
616 | if ( !app_dir.exists("C:\\kdepim") ) | 625 | if ( !app_dir.exists("C:\\kdepim") ) |
617 | app_dir.mkdir ("C:\\kdepim"); | 626 | app_dir.mkdir ("C:\\kdepim"); |
618 | if ( !app_dir.exists("C:\\kdepim\\apps") ) | 627 | if ( !app_dir.exists("C:\\kdepim\\apps") ) |
619 | app_dir.mkdir ("C:\\kdepim\\apps"); | 628 | app_dir.mkdir ("C:\\kdepim\\apps"); |
620 | if ( !app_dir.exists("C:\\kdepim\\config") ) | 629 | if ( !app_dir.exists("C:\\kdepim\\config") ) |
621 | app_dir.mkdir ("C:\\kdepim\\config"); | 630 | app_dir.mkdir ("C:\\kdepim\\config"); |
622 | if ( !app_dir.exists("C:\\kdepim\\apps\\pwmanager") ) | 631 | if ( !app_dir.exists("C:\\kdepim\\apps\\pwmanager") ) |
623 | app_dir.mkdir ("C:\\kdepim\\apps\\pwmanager"); | 632 | app_dir.mkdir ("C:\\kdepim\\apps\\pwmanager"); |
624 | } | 633 | } |
625 | } | 634 | } |