author | zautrix <zautrix> | 2005-06-10 10:31:22 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-10 10:31:22 (UTC) |
commit | e5ca8e0d8d6d08b597253f43de401aa1a99a6abe (patch) (unidiff) | |
tree | c319ba89abbe5cd90647bc38deb0ab1ce46f48e5 | |
parent | 89c5159208fd982f527117e49d67ea1f90553dbe (diff) | |
download | kdepimpi-e5ca8e0d8d6d08b597253f43de401aa1a99a6abe.zip kdepimpi-e5ca8e0d8d6d08b597253f43de401aa1a99a6abe.tar.gz kdepimpi-e5ca8e0d8d6d08b597253f43de401aa1a99a6abe.tar.bz2 |
config dialog fixes
-rw-r--r-- | kaddressbook/kabcore.cpp | 40 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 2 | ||||
-rw-r--r-- | kaddressbook/kcmconfigs/kcmkabconfig.h | 2 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 1 | ||||
-rw-r--r-- | korganizer/kodialogmanager.cpp | 23 | ||||
-rw-r--r-- | korganizer/koprefsdialog.cpp | 286 | ||||
-rw-r--r-- | korganizer/koprefsdialog.h | 12 | ||||
-rw-r--r-- | libkdepim/kprefsdialog.cpp | 30 | ||||
-rw-r--r-- | libkdepim/kprefsdialog.h | 26 |
9 files changed, 106 insertions, 316 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index cba5850..cd833cf 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1,3420 +1,3434 @@ | |||
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 | Async a special exception, permission is given to link this program | 19 | Async 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 | /*s | 24 | /*s |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "kabcore.h" | 31 | #include "kabcore.h" |
32 | 32 | ||
33 | #include <stdaddressbook.h> | 33 | #include <stdaddressbook.h> |
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kfiledialog.h> | 35 | #include <kfiledialog.h> |
36 | #include <qtimer.h> | 36 | #include <qtimer.h> |
37 | #include <qlabel.h> | 37 | #include <qlabel.h> |
38 | #include <qregexp.h> | 38 | #include <qregexp.h> |
39 | #include <qlineedit.h> | 39 | #include <qlineedit.h> |
40 | #include <qcheckbox.h> | 40 | #include <qcheckbox.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qprogressbar.h> | 42 | #include <qprogressbar.h> |
43 | #include <libkdepim/phoneaccess.h> | 43 | #include <libkdepim/phoneaccess.h> |
44 | 44 | ||
45 | #ifndef KAB_EMBEDDED | 45 | #ifndef KAB_EMBEDDED |
46 | #include <qclipboard.h> | 46 | #include <qclipboard.h> |
47 | #include <qdir.h> | 47 | #include <qdir.h> |
48 | #include <qfile.h> | 48 | #include <qfile.h> |
49 | #include <qapplicaton.h> | 49 | #include <qapplicaton.h> |
50 | #include <qprogressbar.h> | 50 | #include <qprogressbar.h> |
51 | #include <qlayout.h> | 51 | #include <qlayout.h> |
52 | #include <qregexp.h> | 52 | #include <qregexp.h> |
53 | #include <qvbox.h> | 53 | #include <qvbox.h> |
54 | #include <kabc/addresseelist.h> | 54 | #include <kabc/addresseelist.h> |
55 | #include <kabc/errorhandler.h> | 55 | #include <kabc/errorhandler.h> |
56 | #include <kabc/resource.h> | 56 | #include <kabc/resource.h> |
57 | #include <kabc/vcardconverter.h> | 57 | #include <kabc/vcardconverter.h> |
58 | #include <kapplication.h> | 58 | #include <kapplication.h> |
59 | #include <kactionclasses.h> | 59 | #include <kactionclasses.h> |
60 | #include <kcmultidialog.h> | 60 | #include <kcmultidialog.h> |
61 | #include <kdebug.h> | 61 | #include <kdebug.h> |
62 | #include <kdeversion.h> | 62 | #include <kdeversion.h> |
63 | #include <kkeydialog.h> | 63 | #include <kkeydialog.h> |
64 | #include <kmessagebox.h> | 64 | #include <kmessagebox.h> |
65 | #include <kprinter.h> | 65 | #include <kprinter.h> |
66 | #include <kprotocolinfo.h> | 66 | #include <kprotocolinfo.h> |
67 | #include <kresources/selectdialog.h> | 67 | #include <kresources/selectdialog.h> |
68 | #include <kstandarddirs.h> | 68 | #include <kstandarddirs.h> |
69 | #include <ktempfile.h> | 69 | #include <ktempfile.h> |
70 | #include <kxmlguiclient.h> | 70 | #include <kxmlguiclient.h> |
71 | #include <kaboutdata.h> | 71 | #include <kaboutdata.h> |
72 | #include <libkdepim/categoryselectdialog.h> | 72 | #include <libkdepim/categoryselectdialog.h> |
73 | 73 | ||
74 | #include "addresseeutil.h" | 74 | #include "addresseeutil.h" |
75 | #include "addresseeeditordialog.h" | 75 | #include "addresseeeditordialog.h" |
76 | #include "extensionmanager.h" | 76 | #include "extensionmanager.h" |
77 | #include "kstdaction.h" | 77 | #include "kstdaction.h" |
78 | #include "kaddressbookservice.h" | 78 | #include "kaddressbookservice.h" |
79 | #include "ldapsearchdialog.h" | 79 | #include "ldapsearchdialog.h" |
80 | #include "printing/printingwizard.h" | 80 | #include "printing/printingwizard.h" |
81 | #else // KAB_EMBEDDED | 81 | #else // KAB_EMBEDDED |
82 | 82 | ||
83 | #include <kapplication.h> | 83 | #include <kapplication.h> |
84 | #include "KDGanttMinimizeSplitter.h" | 84 | #include "KDGanttMinimizeSplitter.h" |
85 | #include "kaddressbookmain.h" | 85 | #include "kaddressbookmain.h" |
86 | #include "kactioncollection.h" | 86 | #include "kactioncollection.h" |
87 | #include "addresseedialog.h" | 87 | #include "addresseedialog.h" |
88 | //US | 88 | //US |
89 | #include <addresseeview.h> | 89 | #include <addresseeview.h> |
90 | 90 | ||
91 | #include <qapp.h> | 91 | #include <qapp.h> |
92 | #include <qmenubar.h> | 92 | #include <qmenubar.h> |
93 | //#include <qtoolbar.h> | 93 | //#include <qtoolbar.h> |
94 | #include <qmessagebox.h> | 94 | #include <qmessagebox.h> |
95 | #include <kdebug.h> | 95 | #include <kdebug.h> |
96 | #include <kiconloader.h> // needed for SmallIcon | 96 | #include <kiconloader.h> // needed for SmallIcon |
97 | #include <kresources/kcmkresources.h> | 97 | #include <kresources/kcmkresources.h> |
98 | #include <ktoolbar.h> | 98 | #include <ktoolbar.h> |
99 | #include <kprefsdialog.h> | ||
99 | 100 | ||
100 | 101 | ||
101 | //#include <qlabel.h> | 102 | //#include <qlabel.h> |
102 | 103 | ||
103 | 104 | ||
104 | #ifndef DESKTOP_VERSION | 105 | #ifndef DESKTOP_VERSION |
105 | #include <qpe/ir.h> | 106 | #include <qpe/ir.h> |
106 | #include <qpe/qpemenubar.h> | 107 | #include <qpe/qpemenubar.h> |
107 | #include <qtopia/qcopenvelope_qws.h> | 108 | #include <qtopia/qcopenvelope_qws.h> |
108 | #else | 109 | #else |
109 | 110 | ||
110 | #include <qmenubar.h> | 111 | #include <qmenubar.h> |
111 | #endif | 112 | #endif |
112 | 113 | ||
113 | #endif // KAB_EMBEDDED | 114 | #endif // KAB_EMBEDDED |
114 | #include "kcmconfigs/kcmkabconfig.h" | 115 | #include "kcmconfigs/kcmkabconfig.h" |
115 | #include "kcmconfigs/kcmkdepimconfig.h" | 116 | #include "kcmconfigs/kcmkdepimconfig.h" |
116 | #include "kpimglobalprefs.h" | 117 | #include "kpimglobalprefs.h" |
117 | #include "externalapphandler.h" | 118 | #include "externalapphandler.h" |
118 | #include "xxportselectdialog.h" | 119 | #include "xxportselectdialog.h" |
119 | 120 | ||
120 | 121 | ||
121 | #include <kresources/selectdialog.h> | 122 | #include <kresources/selectdialog.h> |
122 | #include <kmessagebox.h> | 123 | #include <kmessagebox.h> |
123 | 124 | ||
124 | #include <picture.h> | 125 | #include <picture.h> |
125 | #include <resource.h> | 126 | #include <resource.h> |
126 | 127 | ||
127 | //US#include <qsplitter.h> | 128 | //US#include <qsplitter.h> |
128 | #include <qmap.h> | 129 | #include <qmap.h> |
129 | #include <qdir.h> | 130 | #include <qdir.h> |
130 | #include <qfile.h> | 131 | #include <qfile.h> |
131 | #include <qvbox.h> | 132 | #include <qvbox.h> |
132 | #include <qlayout.h> | 133 | #include <qlayout.h> |
133 | #include <qclipboard.h> | 134 | #include <qclipboard.h> |
134 | #include <qtextstream.h> | 135 | #include <qtextstream.h> |
135 | #include <qradiobutton.h> | 136 | #include <qradiobutton.h> |
136 | #include <qbuttongroup.h> | 137 | #include <qbuttongroup.h> |
137 | 138 | ||
138 | #include <libkdepim/categoryselectdialog.h> | 139 | #include <libkdepim/categoryselectdialog.h> |
139 | #include <libkdepim/categoryeditdialog.h> | 140 | #include <libkdepim/categoryeditdialog.h> |
140 | #include <kabc/vcardconverter.h> | 141 | #include <kabc/vcardconverter.h> |
141 | 142 | ||
142 | 143 | ||
143 | #include "addresseeutil.h" | 144 | #include "addresseeutil.h" |
144 | #include "undocmds.h" | 145 | #include "undocmds.h" |
145 | #include "addresseeeditordialog.h" | 146 | #include "addresseeeditordialog.h" |
146 | #include "viewmanager.h" | 147 | #include "viewmanager.h" |
147 | #include "details/detailsviewcontainer.h" | 148 | #include "details/detailsviewcontainer.h" |
148 | #include "kabprefs.h" | 149 | #include "kabprefs.h" |
149 | #include "xxportmanager.h" | 150 | #include "xxportmanager.h" |
150 | #include "incsearchwidget.h" | 151 | #include "incsearchwidget.h" |
151 | #include "jumpbuttonbar.h" | 152 | #include "jumpbuttonbar.h" |
152 | #include "extensionmanager.h" | 153 | #include "extensionmanager.h" |
153 | #include "addresseeconfig.h" | 154 | #include "addresseeconfig.h" |
154 | #include "nameeditdialog.h" | 155 | #include "nameeditdialog.h" |
155 | #include <kcmultidialog.h> | 156 | #include <kcmultidialog.h> |
156 | 157 | ||
157 | #ifdef _WIN32_ | 158 | #ifdef _WIN32_ |
158 | #ifdef _OL_IMPORT_ | 159 | #ifdef _OL_IMPORT_ |
159 | #include "kaimportoldialog.h" | 160 | #include "kaimportoldialog.h" |
160 | #endif | 161 | #endif |
161 | #else | 162 | #else |
162 | #include <unistd.h> | 163 | #include <unistd.h> |
163 | #endif | 164 | #endif |
164 | // sync includes | 165 | // sync includes |
165 | #include <libkdepim/ksyncprofile.h> | 166 | #include <libkdepim/ksyncprofile.h> |
166 | #include <libkdepim/ksyncprefsdialog.h> | 167 | #include <libkdepim/ksyncprefsdialog.h> |
167 | 168 | ||
168 | 169 | ||
169 | class KABCatPrefs : public QDialog | 170 | class KABCatPrefs : public QDialog |
170 | { | 171 | { |
171 | public: | 172 | public: |
172 | KABCatPrefs( QWidget *parent=0, const char *name=0 ) : | 173 | KABCatPrefs( QWidget *parent=0, const char *name=0 ) : |
173 | QDialog( parent, name, true ) | 174 | QDialog( parent, name, true ) |
174 | { | 175 | { |
175 | setCaption( i18n("Manage new Categories") ); | 176 | setCaption( i18n("Manage new Categories") ); |
176 | QVBoxLayout* lay = new QVBoxLayout( this ); | 177 | QVBoxLayout* lay = new QVBoxLayout( this ); |
177 | lay->setSpacing( 3 ); | 178 | lay->setSpacing( 3 ); |
178 | lay->setMargin( 3 ); | 179 | lay->setMargin( 3 ); |
179 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); | 180 | QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\naddressees\nwhich are not in the category list.\nPlease choose what to do:\n "), this ); |
180 | lay->addWidget( lab ); | 181 | lay->addWidget( lab ); |
181 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); | 182 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); |
182 | lay->addWidget( format ); | 183 | lay->addWidget( format ); |
183 | format->setExclusive ( true ) ; | 184 | format->setExclusive ( true ) ; |
184 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 185 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
185 | new QRadioButton(i18n("Remove from addressees"), format ); | 186 | new QRadioButton(i18n("Remove from addressees"), format ); |
186 | addCatBut->setChecked( true ); | 187 | addCatBut->setChecked( true ); |
187 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 188 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
188 | lay->addWidget( ok ); | 189 | lay->addWidget( ok ); |
189 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 190 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
190 | lay->addWidget( cancel ); | 191 | lay->addWidget( cancel ); |
191 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 192 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
192 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 193 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
193 | resize( 200, 200 ); | 194 | resize( 200, 200 ); |
194 | } | 195 | } |
195 | 196 | ||
196 | bool addCat() { return addCatBut->isChecked(); } | 197 | bool addCat() { return addCatBut->isChecked(); } |
197 | private: | 198 | private: |
198 | QRadioButton* addCatBut; | 199 | QRadioButton* addCatBut; |
199 | }; | 200 | }; |
200 | 201 | ||
201 | class KABFormatPrefs : public QDialog | 202 | class KABFormatPrefs : public QDialog |
202 | { | 203 | { |
203 | public: | 204 | public: |
204 | KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : | 205 | KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : |
205 | QDialog( parent, name, true ) | 206 | QDialog( parent, name, true ) |
206 | { | 207 | { |
207 | setCaption( i18n("Set formatted name") ); | 208 | setCaption( i18n("Set formatted name") ); |
208 | QVBoxLayout* lay = new QVBoxLayout( this ); | 209 | QVBoxLayout* lay = new QVBoxLayout( this ); |
209 | lay->setSpacing( 3 ); | 210 | lay->setSpacing( 3 ); |
210 | lay->setMargin( 3 ); | 211 | lay->setMargin( 3 ); |
211 | QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); | 212 | QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); |
212 | lay->addWidget( lab ); | 213 | lay->addWidget( lab ); |
213 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); | 214 | QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); |
214 | lay->addWidget( format ); | 215 | lay->addWidget( format ); |
215 | format->setExclusive ( true ) ; | 216 | format->setExclusive ( true ) ; |
216 | simple = new QRadioButton(i18n("Simple: James Bond"), format ); | 217 | simple = new QRadioButton(i18n("Simple: James Bond"), format ); |
217 | full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); | 218 | full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); |
218 | reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); | 219 | reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); |
219 | company = new QRadioButton(i18n("Organization: MI6"), format ); | 220 | company = new QRadioButton(i18n("Organization: MI6"), format ); |
220 | simple->setChecked( true ); | 221 | simple->setChecked( true ); |
221 | setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); | 222 | setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); |
222 | lay->addWidget( setCompany ); | 223 | lay->addWidget( setCompany ); |
223 | QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); | 224 | QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); |
224 | lay->addWidget( ok ); | 225 | lay->addWidget( ok ); |
225 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 226 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
226 | lay->addWidget( cancel ); | 227 | lay->addWidget( cancel ); |
227 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 228 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
228 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 229 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
229 | //resize( 200, 200 ); | 230 | //resize( 200, 200 ); |
230 | 231 | ||
231 | } | 232 | } |
232 | public: | 233 | public: |
233 | QRadioButton* simple, *full, *reverse, *company; | 234 | QRadioButton* simple, *full, *reverse, *company; |
234 | QCheckBox* setCompany; | 235 | QCheckBox* setCompany; |
235 | }; | 236 | }; |
236 | 237 | ||
237 | 238 | ||
238 | 239 | ||
239 | class KAex2phonePrefs : public QDialog | 240 | class KAex2phonePrefs : public QDialog |
240 | { | 241 | { |
241 | public: | 242 | public: |
242 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 243 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
243 | QDialog( parent, name, true ) | 244 | QDialog( parent, name, true ) |
244 | { | 245 | { |
245 | setCaption( i18n("Export to phone options") ); | 246 | setCaption( i18n("Export to phone options") ); |
246 | QVBoxLayout* lay = new QVBoxLayout( this ); | 247 | QVBoxLayout* lay = new QVBoxLayout( this ); |
247 | lay->setSpacing( 3 ); | 248 | lay->setSpacing( 3 ); |
248 | lay->setMargin( 3 ); | 249 | lay->setMargin( 3 ); |
249 | QLabel *lab; | 250 | QLabel *lab; |
250 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 251 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
251 | lab->setAlignment (AlignHCenter ); | 252 | lab->setAlignment (AlignHCenter ); |
252 | QHBox* temphb; | 253 | QHBox* temphb; |
253 | temphb = new QHBox( this ); | 254 | temphb = new QHBox( this ); |
254 | new QLabel( i18n("I/O device: "), temphb ); | 255 | new QLabel( i18n("I/O device: "), temphb ); |
255 | mPhoneDevice = new QLineEdit( temphb); | 256 | mPhoneDevice = new QLineEdit( temphb); |
256 | lay->addWidget( temphb ); | 257 | lay->addWidget( temphb ); |
257 | temphb = new QHBox( this ); | 258 | temphb = new QHBox( this ); |
258 | new QLabel( i18n("Connection: "), temphb ); | 259 | new QLabel( i18n("Connection: "), temphb ); |
259 | mPhoneConnection = new QLineEdit( temphb); | 260 | mPhoneConnection = new QLineEdit( temphb); |
260 | lay->addWidget( temphb ); | 261 | lay->addWidget( temphb ); |
261 | temphb = new QHBox( this ); | 262 | temphb = new QHBox( this ); |
262 | new QLabel( i18n("Model(opt.): "), temphb ); | 263 | new QLabel( i18n("Model(opt.): "), temphb ); |
263 | mPhoneModel = new QLineEdit( temphb); | 264 | mPhoneModel = new QLineEdit( temphb); |
264 | lay->addWidget( temphb ); | 265 | lay->addWidget( temphb ); |
265 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); | 266 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); |
266 | // lay->addWidget( mWriteToSim ); | 267 | // lay->addWidget( mWriteToSim ); |
267 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); | 268 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); |
268 | lab->setAlignment (AlignHCenter); | 269 | lab->setAlignment (AlignHCenter); |
269 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 270 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
270 | lay->addWidget( ok ); | 271 | lay->addWidget( ok ); |
271 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 272 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
272 | lay->addWidget( cancel ); | 273 | lay->addWidget( cancel ); |
273 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 274 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
274 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 275 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
275 | resize( 220, 240 ); | 276 | resize( 220, 240 ); |
276 | 277 | ||
277 | } | 278 | } |
278 | 279 | ||
279 | public: | 280 | public: |
280 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 281 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
281 | QCheckBox* mWriteToSim; | 282 | QCheckBox* mWriteToSim; |
282 | }; | 283 | }; |
283 | 284 | ||
284 | 285 | ||
285 | bool pasteWithNewUid = true; | 286 | bool pasteWithNewUid = true; |
286 | 287 | ||
287 | #ifdef KAB_EMBEDDED | 288 | #ifdef KAB_EMBEDDED |
288 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 289 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
289 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 290 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
290 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 291 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
291 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 292 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
292 | #else //KAB_EMBEDDED | 293 | #else //KAB_EMBEDDED |
293 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 294 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
294 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 295 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
295 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 296 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
296 | mReadWrite( readWrite ), mModified( false ) | 297 | mReadWrite( readWrite ), mModified( false ) |
297 | #endif //KAB_EMBEDDED | 298 | #endif //KAB_EMBEDDED |
298 | { | 299 | { |
299 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 300 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
300 | // syncManager->setBlockSave(false); | 301 | // syncManager->setBlockSave(false); |
301 | mIncSearchWidget = 0; | 302 | mIncSearchWidget = 0; |
302 | mMiniSplitter = 0; | 303 | mMiniSplitter = 0; |
303 | mExtensionBarSplitter = 0; | 304 | mExtensionBarSplitter = 0; |
304 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 305 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
305 | mAddressBook = KABC::StdAddressBook::self(); | 306 | mAddressBook = KABC::StdAddressBook::self(); |
306 | KABC::StdAddressBook::setAutomaticSave( false ); | 307 | KABC::StdAddressBook::setAutomaticSave( false ); |
307 | 308 | ||
308 | #ifndef KAB_EMBEDDED | 309 | #ifndef KAB_EMBEDDED |
309 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 310 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
310 | #endif //KAB_EMBEDDED | 311 | #endif //KAB_EMBEDDED |
311 | 312 | ||
312 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 313 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
313 | SLOT( addressBookChanged() ) ); | 314 | SLOT( addressBookChanged() ) ); |
314 | 315 | ||
315 | #if 0 | 316 | #if 0 |
316 | // LR moved to addressbook init method | 317 | // LR moved to addressbook init method |
317 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 318 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
318 | "X-Department", "KADDRESSBOOK" ); | 319 | "X-Department", "KADDRESSBOOK" ); |
319 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 320 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
320 | "X-Profession", "KADDRESSBOOK" ); | 321 | "X-Profession", "KADDRESSBOOK" ); |
321 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 322 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
322 | "X-AssistantsName", "KADDRESSBOOK" ); | 323 | "X-AssistantsName", "KADDRESSBOOK" ); |
323 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 324 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
324 | "X-ManagersName", "KADDRESSBOOK" ); | 325 | "X-ManagersName", "KADDRESSBOOK" ); |
325 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 326 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
326 | "X-SpousesName", "KADDRESSBOOK" ); | 327 | "X-SpousesName", "KADDRESSBOOK" ); |
327 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 328 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
328 | "X-Office", "KADDRESSBOOK" ); | 329 | "X-Office", "KADDRESSBOOK" ); |
329 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 330 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
330 | "X-IMAddress", "KADDRESSBOOK" ); | 331 | "X-IMAddress", "KADDRESSBOOK" ); |
331 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 332 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
332 | "X-Anniversary", "KADDRESSBOOK" ); | 333 | "X-Anniversary", "KADDRESSBOOK" ); |
333 | 334 | ||
334 | //US added this field to become compatible with Opie/qtopia addressbook | 335 | //US added this field to become compatible with Opie/qtopia addressbook |
335 | // values can be "female" or "male" or "". An empty field represents undefined. | 336 | // values can be "female" or "male" or "". An empty field represents undefined. |
336 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 337 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
337 | "X-Gender", "KADDRESSBOOK" ); | 338 | "X-Gender", "KADDRESSBOOK" ); |
338 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 339 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
339 | "X-Children", "KADDRESSBOOK" ); | 340 | "X-Children", "KADDRESSBOOK" ); |
340 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 341 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
341 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 342 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
342 | #endif | 343 | #endif |
343 | initGUI(); | 344 | initGUI(); |
344 | 345 | ||
345 | mIncSearchWidget->setFocus(); | 346 | mIncSearchWidget->setFocus(); |
346 | 347 | ||
347 | 348 | ||
348 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 349 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
349 | SLOT( setContactSelected( const QString& ) ) ); | 350 | SLOT( setContactSelected( const QString& ) ) ); |
350 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 351 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
351 | SLOT( executeContact( const QString& ) ) ); | 352 | SLOT( executeContact( const QString& ) ) ); |
352 | 353 | ||
353 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 354 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
354 | SLOT( deleteContacts( ) ) ); | 355 | SLOT( deleteContacts( ) ) ); |
355 | connect( mViewManager, SIGNAL( modified() ), | 356 | connect( mViewManager, SIGNAL( modified() ), |
356 | SLOT( setModified() ) ); | 357 | SLOT( setModified() ) ); |
357 | 358 | ||
358 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 359 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
359 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); | 360 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); |
360 | 361 | ||
361 | connect( mXXPortManager, SIGNAL( modified() ), | 362 | connect( mXXPortManager, SIGNAL( modified() ), |
362 | SLOT( setModified() ) ); | 363 | SLOT( setModified() ) ); |
363 | 364 | ||
364 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 365 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
365 | SLOT( incrementalSearchJump( const QString& ) ) ); | 366 | SLOT( incrementalSearchJump( const QString& ) ) ); |
366 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 367 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
367 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 368 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
368 | 369 | ||
369 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 370 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
370 | SLOT( sendMail( const QString& ) ) ); | 371 | SLOT( sendMail( const QString& ) ) ); |
371 | 372 | ||
372 | 373 | ||
373 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); | 374 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); |
374 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); | 375 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); |
375 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); | 376 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); |
376 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); | 377 | connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); |
377 | connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog())); | 378 | connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog())); |
378 | 379 | ||
379 | 380 | ||
380 | #ifndef KAB_EMBEDDED | 381 | #ifndef KAB_EMBEDDED |
381 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 382 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
382 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 383 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
383 | 384 | ||
384 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 385 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
385 | SLOT( browse( const QString& ) ) ); | 386 | SLOT( browse( const QString& ) ) ); |
386 | 387 | ||
387 | 388 | ||
388 | mAddressBookService = new KAddressBookService( this ); | 389 | mAddressBookService = new KAddressBookService( this ); |
389 | 390 | ||
390 | #endif //KAB_EMBEDDED | 391 | #endif //KAB_EMBEDDED |
391 | 392 | ||
392 | mMessageTimer = new QTimer( this ); | 393 | mMessageTimer = new QTimer( this ); |
393 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); | 394 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); |
394 | mEditorDialog = 0; | 395 | mEditorDialog = 0; |
395 | createAddresseeEditorDialog( this ); | 396 | createAddresseeEditorDialog( this ); |
396 | setModified( false ); | 397 | setModified( false ); |
397 | mBRdisabled = false; | 398 | mBRdisabled = false; |
398 | #ifndef DESKTOP_VERSION | 399 | #ifndef DESKTOP_VERSION |
399 | infrared = 0; | 400 | infrared = 0; |
400 | #endif | 401 | #endif |
401 | //toggleBeamReceive( ); | 402 | //toggleBeamReceive( ); |
402 | mMainWindow->toolBar()->show(); | 403 | mMainWindow->toolBar()->show(); |
403 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi | 404 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi |
404 | QTimer::singleShot( 10, this , SLOT ( updateToolBar())); | 405 | QTimer::singleShot( 10, this , SLOT ( updateToolBar())); |
405 | } | 406 | } |
406 | 407 | ||
407 | void KABCore::updateToolBar() | 408 | void KABCore::updateToolBar() |
408 | { | 409 | { |
409 | static int iii = 0; | 410 | static int iii = 0; |
410 | ++iii; | 411 | ++iii; |
411 | mMainWindow->toolBar()->repaintMe(); | 412 | mMainWindow->toolBar()->repaintMe(); |
412 | if ( iii < 4 ) | 413 | if ( iii < 4 ) |
413 | QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); | 414 | QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); |
414 | } | 415 | } |
415 | KABCore::~KABCore() | 416 | KABCore::~KABCore() |
416 | { | 417 | { |
417 | // save(); | 418 | // save(); |
418 | //saveSettings(); | 419 | //saveSettings(); |
419 | //KABPrefs::instance()->writeConfig(); | 420 | //KABPrefs::instance()->writeConfig(); |
420 | delete AddresseeConfig::instance(); | 421 | delete AddresseeConfig::instance(); |
421 | mAddressBook = 0; | 422 | mAddressBook = 0; |
422 | KABC::StdAddressBook::close(); | 423 | KABC::StdAddressBook::close(); |
423 | 424 | ||
424 | delete syncManager; | 425 | delete syncManager; |
425 | #ifndef DESKTOP_VERSION | 426 | #ifndef DESKTOP_VERSION |
426 | if ( infrared ) | 427 | if ( infrared ) |
427 | delete infrared; | 428 | delete infrared; |
428 | #endif | 429 | #endif |
429 | } | 430 | } |
430 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) | 431 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) |
431 | { | 432 | { |
432 | //qDebug("KA: QCOP message received: %s ", cmsg.data() ); | 433 | //qDebug("KA: QCOP message received: %s ", cmsg.data() ); |
433 | if ( cmsg == "setDocument(QString)" ) { | 434 | if ( cmsg == "setDocument(QString)" ) { |
434 | QDataStream stream( data, IO_ReadOnly ); | 435 | QDataStream stream( data, IO_ReadOnly ); |
435 | QString fileName; | 436 | QString fileName; |
436 | stream >> fileName; | 437 | stream >> fileName; |
437 | recieve( fileName ); | 438 | recieve( fileName ); |
438 | return; | 439 | return; |
439 | } | 440 | } |
440 | } | 441 | } |
441 | void KABCore::toggleBeamReceive( ) | 442 | void KABCore::toggleBeamReceive( ) |
442 | { | 443 | { |
443 | if ( mBRdisabled ) | 444 | if ( mBRdisabled ) |
444 | return; | 445 | return; |
445 | #ifndef DESKTOP_VERSION | 446 | #ifndef DESKTOP_VERSION |
446 | if ( infrared ) { | 447 | if ( infrared ) { |
447 | qDebug("KA: AB disable BeamReceive "); | 448 | qDebug("KA: AB disable BeamReceive "); |
448 | delete infrared; | 449 | delete infrared; |
449 | infrared = 0; | 450 | infrared = 0; |
450 | mActionBR->setChecked(false); | 451 | mActionBR->setChecked(false); |
451 | return; | 452 | return; |
452 | } | 453 | } |
453 | qDebug("KA: AB enable BeamReceive "); | 454 | qDebug("KA: AB enable BeamReceive "); |
454 | mActionBR->setChecked(true); | 455 | mActionBR->setChecked(true); |
455 | 456 | ||
456 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; | 457 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; |
457 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); | 458 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); |
458 | #endif | 459 | #endif |
459 | } | 460 | } |
460 | 461 | ||
461 | 462 | ||
462 | void KABCore::disableBR(bool b) | 463 | void KABCore::disableBR(bool b) |
463 | { | 464 | { |
464 | #ifndef DESKTOP_VERSION | 465 | #ifndef DESKTOP_VERSION |
465 | if ( b ) { | 466 | if ( b ) { |
466 | if ( infrared ) { | 467 | if ( infrared ) { |
467 | toggleBeamReceive( ); | 468 | toggleBeamReceive( ); |
468 | } | 469 | } |
469 | mBRdisabled = true; | 470 | mBRdisabled = true; |
470 | } else { | 471 | } else { |
471 | if ( mBRdisabled ) { | 472 | if ( mBRdisabled ) { |
472 | mBRdisabled = false; | 473 | mBRdisabled = false; |
473 | //toggleBeamReceive( ); | 474 | //toggleBeamReceive( ); |
474 | } | 475 | } |
475 | } | 476 | } |
476 | #endif | 477 | #endif |
477 | 478 | ||
478 | } | 479 | } |
479 | void KABCore::recieve( QString fn ) | 480 | void KABCore::recieve( QString fn ) |
480 | { | 481 | { |
481 | //qDebug("KABCore::recieve "); | 482 | //qDebug("KABCore::recieve "); |
482 | int count = mAddressBook->importFromFile( fn, true ); | 483 | int count = mAddressBook->importFromFile( fn, true ); |
483 | if ( count ) | 484 | if ( count ) |
484 | setModified( true ); | 485 | setModified( true ); |
485 | mViewManager->refreshView(); | 486 | mViewManager->refreshView(); |
486 | message(i18n("%1 contact(s) received!").arg( count )); | 487 | message(i18n("%1 contact(s) received!").arg( count )); |
487 | topLevelWidget()->showMaximized(); | 488 | topLevelWidget()->showMaximized(); |
488 | topLevelWidget()->raise(); | 489 | topLevelWidget()->raise(); |
489 | } | 490 | } |
490 | void KABCore::restoreSettings() | 491 | void KABCore::restoreSettings() |
491 | { | 492 | { |
492 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 493 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
493 | 494 | ||
494 | bool state; | 495 | bool state; |
495 | 496 | ||
496 | if (mMultipleViewsAtOnce) | 497 | if (mMultipleViewsAtOnce) |
497 | state = KABPrefs::instance()->mDetailsPageVisible; | 498 | state = KABPrefs::instance()->mDetailsPageVisible; |
498 | else | 499 | else |
499 | state = false; | 500 | state = false; |
500 | 501 | ||
501 | mActionDetails->setChecked( state ); | 502 | mActionDetails->setChecked( state ); |
502 | setDetailsVisible( state ); | 503 | setDetailsVisible( state ); |
503 | 504 | ||
504 | state = KABPrefs::instance()->mJumpButtonBarVisible; | 505 | state = KABPrefs::instance()->mJumpButtonBarVisible; |
505 | 506 | ||
506 | mActionJumpBar->setChecked( state ); | 507 | mActionJumpBar->setChecked( state ); |
507 | setJumpButtonBarVisible( state ); | 508 | setJumpButtonBarVisible( state ); |
508 | /*US | 509 | /*US |
509 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 510 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
510 | if ( splitterSize.count() == 0 ) { | 511 | if ( splitterSize.count() == 0 ) { |
511 | splitterSize.append( width() / 2 ); | 512 | splitterSize.append( width() / 2 ); |
512 | splitterSize.append( width() / 2 ); | 513 | splitterSize.append( width() / 2 ); |
513 | } | 514 | } |
514 | mMiniSplitter->setSizes( splitterSize ); | 515 | mMiniSplitter->setSizes( splitterSize ); |
515 | if ( mExtensionBarSplitter ) { | 516 | if ( mExtensionBarSplitter ) { |
516 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 517 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
517 | if ( splitterSize.count() == 0 ) { | 518 | if ( splitterSize.count() == 0 ) { |
518 | splitterSize.append( width() / 2 ); | 519 | splitterSize.append( width() / 2 ); |
519 | splitterSize.append( width() / 2 ); | 520 | splitterSize.append( width() / 2 ); |
520 | } | 521 | } |
521 | mExtensionBarSplitter->setSizes( splitterSize ); | 522 | mExtensionBarSplitter->setSizes( splitterSize ); |
522 | 523 | ||
523 | } | 524 | } |
524 | */ | 525 | */ |
525 | mViewManager->restoreSettings(); | 526 | mViewManager->restoreSettings(); |
526 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 527 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
527 | mExtensionManager->restoreSettings(); | 528 | mExtensionManager->restoreSettings(); |
528 | #ifdef DESKTOP_VERSION | 529 | #ifdef DESKTOP_VERSION |
529 | int wid = width(); | 530 | int wid = width(); |
530 | if ( wid < 10 ) | 531 | if ( wid < 10 ) |
531 | wid = 400; | 532 | wid = 400; |
532 | #else | 533 | #else |
533 | int wid = QApplication::desktop()->width(); | 534 | int wid = QApplication::desktop()->width(); |
534 | if ( wid < 640 ) | 535 | if ( wid < 640 ) |
535 | wid = QApplication::desktop()->height(); | 536 | wid = QApplication::desktop()->height(); |
536 | #endif | 537 | #endif |
537 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; | 538 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; |
538 | if ( true /*splitterSize.count() == 0*/ ) { | 539 | if ( true /*splitterSize.count() == 0*/ ) { |
539 | splitterSize.append( wid / 2 ); | 540 | splitterSize.append( wid / 2 ); |
540 | splitterSize.append( wid / 2 ); | 541 | splitterSize.append( wid / 2 ); |
541 | } | 542 | } |
542 | mMiniSplitter->setSizes( splitterSize ); | 543 | mMiniSplitter->setSizes( splitterSize ); |
543 | if ( mExtensionBarSplitter ) { | 544 | if ( mExtensionBarSplitter ) { |
544 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 545 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
545 | if ( true /*splitterSize.count() == 0*/ ) { | 546 | if ( true /*splitterSize.count() == 0*/ ) { |
546 | splitterSize.append( wid / 2 ); | 547 | splitterSize.append( wid / 2 ); |
547 | splitterSize.append( wid / 2 ); | 548 | splitterSize.append( wid / 2 ); |
548 | } | 549 | } |
549 | mExtensionBarSplitter->setSizes( splitterSize ); | 550 | mExtensionBarSplitter->setSizes( splitterSize ); |
550 | 551 | ||
551 | } | 552 | } |
552 | #ifdef DESKTOP_VERSION | 553 | #ifdef DESKTOP_VERSION |
553 | KConfig *config = KABPrefs::instance()->getConfig(); | 554 | KConfig *config = KABPrefs::instance()->getConfig(); |
554 | config->setGroup("WidgetLayout"); | 555 | config->setGroup("WidgetLayout"); |
555 | QStringList list; | 556 | QStringList list; |
556 | list = config->readListEntry("MainLayout"); | 557 | list = config->readListEntry("MainLayout"); |
557 | int x,y,w,h; | 558 | int x,y,w,h; |
558 | if ( ! list.isEmpty() ) { | 559 | if ( ! list.isEmpty() ) { |
559 | x = list[0].toInt(); | 560 | x = list[0].toInt(); |
560 | y = list[1].toInt(); | 561 | y = list[1].toInt(); |
561 | w = list[2].toInt(); | 562 | w = list[2].toInt(); |
562 | h = list[3].toInt(); | 563 | h = list[3].toInt(); |
563 | KApplication::testCoords( &x,&y,&w,&h ); | 564 | KApplication::testCoords( &x,&y,&w,&h ); |
564 | topLevelWidget()->setGeometry(x,y,w,h); | 565 | topLevelWidget()->setGeometry(x,y,w,h); |
565 | 566 | ||
566 | } else { | 567 | } else { |
567 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 568 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
568 | } | 569 | } |
569 | #endif | 570 | #endif |
570 | } | 571 | } |
571 | 572 | ||
572 | void KABCore::saveSettings() | 573 | void KABCore::saveSettings() |
573 | { | 574 | { |
574 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 575 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
575 | if ( mExtensionBarSplitter ) | 576 | if ( mExtensionBarSplitter ) |
576 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 577 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
577 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 578 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
578 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 579 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
579 | #ifndef KAB_EMBEDDED | 580 | #ifndef KAB_EMBEDDED |
580 | 581 | ||
581 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 582 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
582 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 583 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
583 | #endif //KAB_EMBEDDED | 584 | #endif //KAB_EMBEDDED |
584 | mExtensionManager->saveSettings(); | 585 | mExtensionManager->saveSettings(); |
585 | mViewManager->saveSettings(); | 586 | mViewManager->saveSettings(); |
586 | 587 | ||
587 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 588 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
588 | 589 | ||
589 | KABPrefs::instance()->writeConfig(); | 590 | KABPrefs::instance()->writeConfig(); |
590 | qDebug("KA: KABCore::saveSettings() "); | 591 | qDebug("KA: KABCore::saveSettings() "); |
591 | } | 592 | } |
592 | 593 | ||
593 | KABC::AddressBook *KABCore::addressBook() const | 594 | KABC::AddressBook *KABCore::addressBook() const |
594 | { | 595 | { |
595 | return mAddressBook; | 596 | return mAddressBook; |
596 | } | 597 | } |
597 | 598 | ||
598 | KConfig *KABCore::config() | 599 | KConfig *KABCore::config() |
599 | { | 600 | { |
600 | #ifndef KAB_EMBEDDED | 601 | #ifndef KAB_EMBEDDED |
601 | return KABPrefs::instance()->config(); | 602 | return KABPrefs::instance()->config(); |
602 | #else //KAB_EMBEDDED | 603 | #else //KAB_EMBEDDED |
603 | return KABPrefs::instance()->getConfig(); | 604 | return KABPrefs::instance()->getConfig(); |
604 | #endif //KAB_EMBEDDED | 605 | #endif //KAB_EMBEDDED |
605 | } | 606 | } |
606 | 607 | ||
607 | KActionCollection *KABCore::actionCollection() const | 608 | KActionCollection *KABCore::actionCollection() const |
608 | { | 609 | { |
609 | return mGUIClient->actionCollection(); | 610 | return mGUIClient->actionCollection(); |
610 | } | 611 | } |
611 | 612 | ||
612 | KABC::Field *KABCore::currentSearchField() const | 613 | KABC::Field *KABCore::currentSearchField() const |
613 | { | 614 | { |
614 | if (mIncSearchWidget) | 615 | if (mIncSearchWidget) |
615 | return mIncSearchWidget->currentField(); | 616 | return mIncSearchWidget->currentField(); |
616 | else | 617 | else |
617 | return 0; | 618 | return 0; |
618 | } | 619 | } |
619 | 620 | ||
620 | QStringList KABCore::selectedUIDs() const | 621 | QStringList KABCore::selectedUIDs() const |
621 | { | 622 | { |
622 | return mViewManager->selectedUids(); | 623 | return mViewManager->selectedUids(); |
623 | } | 624 | } |
624 | 625 | ||
625 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 626 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
626 | { | 627 | { |
627 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 628 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
628 | 629 | ||
629 | QPtrList<KRES::Resource> kresResources; | 630 | QPtrList<KRES::Resource> kresResources; |
630 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 631 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); |
631 | KABC::Resource *resource; | 632 | KABC::Resource *resource; |
632 | while ( ( resource = resIt.current() ) != 0 ) { | 633 | while ( ( resource = resIt.current() ) != 0 ) { |
633 | ++resIt; | 634 | ++resIt; |
634 | if ( !resource->readOnly() ) { | 635 | if ( !resource->readOnly() ) { |
635 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 636 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
636 | if ( res ) | 637 | if ( res ) |
637 | kresResources.append( res ); | 638 | kresResources.append( res ); |
638 | } | 639 | } |
639 | } | 640 | } |
640 | 641 | ||
641 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); | 642 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); |
642 | return static_cast<KABC::Resource*>( res ); | 643 | return static_cast<KABC::Resource*>( res ); |
643 | } | 644 | } |
644 | 645 | ||
645 | #ifndef KAB_EMBEDDED | 646 | #ifndef KAB_EMBEDDED |
646 | KAboutData *KABCore::createAboutData() | 647 | KAboutData *KABCore::createAboutData() |
647 | #else //KAB_EMBEDDED | 648 | #else //KAB_EMBEDDED |
648 | void KABCore::createAboutData() | 649 | void KABCore::createAboutData() |
649 | #endif //KAB_EMBEDDED | 650 | #endif //KAB_EMBEDDED |
650 | { | 651 | { |
651 | 652 | ||
652 | 653 | ||
653 | QString version; | 654 | QString version; |
654 | #include <../version> | 655 | #include <../version> |
655 | QMessageBox::about( this, "About KAddressbook/Pi", | 656 | QMessageBox::about( this, "About KAddressbook/Pi", |
656 | "KAddressbook/Platform-independent\n" | 657 | "KAddressbook/Platform-independent\n" |
657 | "(KA/Pi) " +version + " - " + | 658 | "(KA/Pi) " +version + " - " + |
658 | #ifdef DESKTOP_VERSION | 659 | #ifdef DESKTOP_VERSION |
659 | "Desktop Edition\n" | 660 | "Desktop Edition\n" |
660 | #else | 661 | #else |
661 | "PDA-Edition\n" | 662 | "PDA-Edition\n" |
662 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 663 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
663 | #endif | 664 | #endif |
664 | 665 | ||
665 | "(c) 2004 Ulf Schenk\n" | 666 | "(c) 2004 Ulf Schenk\n" |
666 | "(c) 2004-2005 Lutz Rogowski\nrogowski@kde.org\n" | 667 | "(c) 2004-2005 Lutz Rogowski\nrogowski@kde.org\n" |
667 | "(c) 1997-2003, The KDE PIM Team\n" | 668 | "(c) 1997-2003, The KDE PIM Team\n" |
668 | "Tobias Koenig Maintainer\n" | 669 | "Tobias Koenig Maintainer\n" |
669 | "Don Sanders Original author\n" | 670 | "Don Sanders Original author\n" |
670 | "Cornelius Schumacher Co-maintainer\n" | 671 | "Cornelius Schumacher Co-maintainer\n" |
671 | "Mike Pilone GUI and framework redesign\n" | 672 | "Mike Pilone GUI and framework redesign\n" |
672 | "Greg Stern DCOP interface\n" | 673 | "Greg Stern DCOP interface\n" |
673 | "Mark Westcot Contact pinning\n" | 674 | "Mark Westcot Contact pinning\n" |
674 | "Michel Boyer de la Giroday LDAP Lookup\n" | 675 | "Michel Boyer de la Giroday LDAP Lookup\n" |
675 | "Steffen Hansen LDAP Lookup" | 676 | "Steffen Hansen LDAP Lookup" |
676 | #ifdef _WIN32_ | 677 | #ifdef _WIN32_ |
677 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" | 678 | "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" |
678 | #endif | 679 | #endif |
679 | ); | 680 | ); |
680 | } | 681 | } |
681 | 682 | ||
682 | void KABCore::setContactSelected( const QString &uid ) | 683 | void KABCore::setContactSelected( const QString &uid ) |
683 | { | 684 | { |
684 | KABC::Addressee addr = mAddressBook->findByUid( uid ); | 685 | KABC::Addressee addr = mAddressBook->findByUid( uid ); |
685 | if ( !mDetails->isHidden() ) | 686 | if ( !mDetails->isHidden() ) |
686 | mDetails->setAddressee( addr ); | 687 | mDetails->setAddressee( addr ); |
687 | 688 | ||
688 | if ( !addr.isEmpty() ) { | 689 | if ( !addr.isEmpty() ) { |
689 | emit contactSelected( addr.formattedName() ); | 690 | emit contactSelected( addr.formattedName() ); |
690 | KABC::Picture pic = addr.photo(); | 691 | KABC::Picture pic = addr.photo(); |
691 | if ( pic.isIntern() ) { | 692 | if ( pic.isIntern() ) { |
692 | //US emit contactSelected( pic.data() ); | 693 | //US emit contactSelected( pic.data() ); |
693 | //US instead use: | 694 | //US instead use: |
694 | QPixmap px; | 695 | QPixmap px; |
695 | if (pic.data().isNull() != true) | 696 | if (pic.data().isNull() != true) |
696 | { | 697 | { |
697 | px.convertFromImage(pic.data()); | 698 | px.convertFromImage(pic.data()); |
698 | } | 699 | } |
699 | 700 | ||
700 | emit contactSelected( px ); | 701 | emit contactSelected( px ); |
701 | } | 702 | } |
702 | } | 703 | } |
703 | 704 | ||
704 | 705 | ||
705 | mExtensionManager->setSelectionChanged(); | 706 | mExtensionManager->setSelectionChanged(); |
706 | 707 | ||
707 | // update the actions | 708 | // update the actions |
708 | bool selected = !uid.isEmpty(); | 709 | bool selected = !uid.isEmpty(); |
709 | 710 | ||
710 | if ( mReadWrite ) { | 711 | if ( mReadWrite ) { |
711 | mActionCut->setEnabled( selected ); | 712 | mActionCut->setEnabled( selected ); |
712 | mActionPaste->setEnabled( selected ); | 713 | mActionPaste->setEnabled( selected ); |
713 | } | 714 | } |
714 | 715 | ||
715 | mActionCopy->setEnabled( selected ); | 716 | mActionCopy->setEnabled( selected ); |
716 | mActionDelete->setEnabled( selected ); | 717 | mActionDelete->setEnabled( selected ); |
717 | mActionEditAddressee->setEnabled( selected ); | 718 | mActionEditAddressee->setEnabled( selected ); |
718 | mActionMail->setEnabled( selected ); | 719 | mActionMail->setEnabled( selected ); |
719 | mActionMailVCard->setEnabled( selected ); | 720 | mActionMailVCard->setEnabled( selected ); |
720 | //if (mActionBeam) | 721 | //if (mActionBeam) |
721 | //mActionBeam->setEnabled( selected ); | 722 | //mActionBeam->setEnabled( selected ); |
722 | mActionWhoAmI->setEnabled( selected ); | 723 | mActionWhoAmI->setEnabled( selected ); |
723 | } | 724 | } |
724 | 725 | ||
725 | void KABCore::sendMail() | 726 | void KABCore::sendMail() |
726 | { | 727 | { |
727 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 728 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
728 | } | 729 | } |
729 | 730 | ||
730 | void KABCore::sendMail( const QString& emaillist ) | 731 | void KABCore::sendMail( const QString& emaillist ) |
731 | { | 732 | { |
732 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " | 733 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " |
733 | if (emaillist.contains(",") > 0) | 734 | if (emaillist.contains(",") > 0) |
734 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); | 735 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); |
735 | else | 736 | else |
736 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); | 737 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); |
737 | } | 738 | } |
738 | 739 | ||
739 | 740 | ||
740 | 741 | ||
741 | void KABCore::mailVCard() | 742 | void KABCore::mailVCard() |
742 | { | 743 | { |
743 | QStringList uids = mViewManager->selectedUids(); | 744 | QStringList uids = mViewManager->selectedUids(); |
744 | if ( !uids.isEmpty() ) | 745 | if ( !uids.isEmpty() ) |
745 | mailVCard( uids ); | 746 | mailVCard( uids ); |
746 | } | 747 | } |
747 | 748 | ||
748 | void KABCore::mailVCard( const QStringList& uids ) | 749 | void KABCore::mailVCard( const QStringList& uids ) |
749 | { | 750 | { |
750 | QStringList urls; | 751 | QStringList urls; |
751 | 752 | ||
752 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 753 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
753 | 754 | ||
754 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); | 755 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); |
755 | 756 | ||
756 | 757 | ||
757 | 758 | ||
758 | QDir().mkdir( dirName, true ); | 759 | QDir().mkdir( dirName, true ); |
759 | 760 | ||
760 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 761 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
761 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 762 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
762 | 763 | ||
763 | if ( a.isEmpty() ) | 764 | if ( a.isEmpty() ) |
764 | continue; | 765 | continue; |
765 | 766 | ||
766 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 767 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
767 | 768 | ||
768 | QString fileName = dirName + "/" + name; | 769 | QString fileName = dirName + "/" + name; |
769 | 770 | ||
770 | QFile outFile(fileName); | 771 | QFile outFile(fileName); |
771 | 772 | ||
772 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 773 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
773 | KABC::VCardConverter converter; | 774 | KABC::VCardConverter converter; |
774 | QString vcard; | 775 | QString vcard; |
775 | 776 | ||
776 | converter.addresseeToVCard( a, vcard ); | 777 | converter.addresseeToVCard( a, vcard ); |
777 | 778 | ||
778 | QTextStream t( &outFile ); // use a text stream | 779 | QTextStream t( &outFile ); // use a text stream |
779 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 780 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
780 | t << vcard; | 781 | t << vcard; |
781 | 782 | ||
782 | outFile.close(); | 783 | outFile.close(); |
783 | 784 | ||
784 | urls.append( fileName ); | 785 | urls.append( fileName ); |
785 | } | 786 | } |
786 | } | 787 | } |
787 | 788 | ||
788 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); | 789 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); |
789 | 790 | ||
790 | 791 | ||
791 | /*US | 792 | /*US |
792 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 793 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
793 | QString::null, // subject | 794 | QString::null, // subject |
794 | QString::null, // body | 795 | QString::null, // body |
795 | QString::null, | 796 | QString::null, |
796 | urls ); // attachments | 797 | urls ); // attachments |
797 | */ | 798 | */ |
798 | 799 | ||
799 | } | 800 | } |
800 | 801 | ||
801 | /** | 802 | /** |
802 | Beams the "WhoAmI contact. | 803 | Beams the "WhoAmI contact. |
803 | */ | 804 | */ |
804 | void KABCore::beamMySelf() | 805 | void KABCore::beamMySelf() |
805 | { | 806 | { |
806 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 807 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
807 | if (!a.isEmpty()) | 808 | if (!a.isEmpty()) |
808 | { | 809 | { |
809 | QStringList uids; | 810 | QStringList uids; |
810 | uids << a.uid(); | 811 | uids << a.uid(); |
811 | 812 | ||
812 | beamVCard(uids); | 813 | beamVCard(uids); |
813 | } else { | 814 | } else { |
814 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); | 815 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); |
815 | 816 | ||
816 | 817 | ||
817 | } | 818 | } |
818 | } | 819 | } |
819 | void KABCore::updateMainWindow() | 820 | void KABCore::updateMainWindow() |
820 | { | 821 | { |
821 | mMainWindow->showMaximized(); | 822 | mMainWindow->showMaximized(); |
822 | mMainWindow->update(); | 823 | mMainWindow->update(); |
823 | } | 824 | } |
824 | void KABCore::resizeEvent(QResizeEvent* e ) | 825 | void KABCore::resizeEvent(QResizeEvent* e ) |
825 | { | 826 | { |
826 | if ( !mMiniSplitter ) | 827 | if ( !mMiniSplitter ) |
827 | return; | 828 | return; |
828 | //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); | 829 | //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); |
829 | if ( QApplication::desktop()->width() >= 480 ) { | 830 | if ( QApplication::desktop()->width() >= 480 ) { |
830 | if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 | 831 | if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 |
831 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { | 832 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { |
832 | mMiniSplitter->setOrientation( Qt::Horizontal); | 833 | mMiniSplitter->setOrientation( Qt::Horizontal); |
833 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 834 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
834 | } | 835 | } |
835 | if ( QApplication::desktop()->width() <= 640 ) { | 836 | if ( QApplication::desktop()->width() <= 640 ) { |
836 | mMainWindow->showMinimized(); | 837 | mMainWindow->showMinimized(); |
837 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | 838 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
838 | mViewManager->getFilterAction()->setComboWidth( 150 ); | 839 | mViewManager->getFilterAction()->setComboWidth( 150 ); |
839 | if ( mIncSearchWidget ) | 840 | if ( mIncSearchWidget ) |
840 | mIncSearchWidget->setSize(); | 841 | mIncSearchWidget->setSize(); |
841 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | 842 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); |
842 | } | 843 | } |
843 | 844 | ||
844 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 | 845 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 |
845 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { | 846 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { |
846 | mMiniSplitter->setOrientation( Qt::Vertical ); | 847 | mMiniSplitter->setOrientation( Qt::Vertical ); |
847 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 848 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
848 | } | 849 | } |
849 | if ( QApplication::desktop()->width() <= 640 ) { | 850 | if ( QApplication::desktop()->width() <= 640 ) { |
850 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | 851 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
851 | mMainWindow->showMinimized(); | 852 | mMainWindow->showMinimized(); |
852 | if ( KABPrefs::instance()->mHideSearchOnSwitch ) { | 853 | if ( KABPrefs::instance()->mHideSearchOnSwitch ) { |
853 | if ( mIncSearchWidget ) { | 854 | if ( mIncSearchWidget ) { |
854 | mIncSearchWidget->setSize(); | 855 | mIncSearchWidget->setSize(); |
855 | } | 856 | } |
856 | } else { | 857 | } else { |
857 | mViewManager->getFilterAction()->setComboWidth( 0 ); | 858 | mViewManager->getFilterAction()->setComboWidth( 0 ); |
858 | } | 859 | } |
859 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | 860 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); |
860 | } | 861 | } |
861 | } | 862 | } |
862 | } | 863 | } |
863 | QWidget::resizeEvent( e ); | 864 | QWidget::resizeEvent( e ); |
864 | 865 | ||
865 | } | 866 | } |
866 | void KABCore::export2phone() | 867 | void KABCore::export2phone() |
867 | { | 868 | { |
868 | 869 | ||
869 | QStringList uids; | 870 | QStringList uids; |
870 | XXPortSelectDialog dlg( this, false, this ); | 871 | XXPortSelectDialog dlg( this, false, this ); |
871 | if ( dlg.exec() ) | 872 | if ( dlg.exec() ) |
872 | uids = dlg.uids(); | 873 | uids = dlg.uids(); |
873 | else | 874 | else |
874 | return; | 875 | return; |
875 | if ( uids.isEmpty() ) | 876 | if ( uids.isEmpty() ) |
876 | return; | 877 | return; |
877 | // qDebug("count %d ", uids.count()); | 878 | // qDebug("count %d ", uids.count()); |
878 | 879 | ||
879 | KAex2phonePrefs ex2phone; | 880 | KAex2phonePrefs ex2phone; |
880 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 881 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
881 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 882 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
882 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 883 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
883 | 884 | ||
884 | if ( !ex2phone.exec() ) { | 885 | if ( !ex2phone.exec() ) { |
885 | return; | 886 | return; |
886 | } | 887 | } |
887 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 888 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
888 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 889 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
889 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 890 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
890 | 891 | ||
891 | 892 | ||
892 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 893 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
893 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 894 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
894 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 895 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
895 | 896 | ||
896 | QString fileName = getPhoneFile(); | 897 | QString fileName = getPhoneFile(); |
897 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) | 898 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) |
898 | return; | 899 | return; |
899 | 900 | ||
900 | message(i18n("Exporting to phone...")); | 901 | message(i18n("Exporting to phone...")); |
901 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); | 902 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); |
902 | 903 | ||
903 | } | 904 | } |
904 | QString KABCore::getPhoneFile() | 905 | QString KABCore::getPhoneFile() |
905 | { | 906 | { |
906 | #ifdef DESKTOP_VERSION | 907 | #ifdef DESKTOP_VERSION |
907 | return locateLocal("tmp", "phonefile.vcf"); | 908 | return locateLocal("tmp", "phonefile.vcf"); |
908 | #else | 909 | #else |
909 | return "/tmp/phonefile.vcf"; | 910 | return "/tmp/phonefile.vcf"; |
910 | #endif | 911 | #endif |
911 | 912 | ||
912 | } | 913 | } |
913 | void KABCore::writeToPhone( ) | 914 | void KABCore::writeToPhone( ) |
914 | { | 915 | { |
915 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) | 916 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) |
916 | message(i18n("Export to phone finished!")); | 917 | message(i18n("Export to phone finished!")); |
917 | else | 918 | else |
918 | qDebug(i18n("KA: Error exporting to phone")); | 919 | qDebug(i18n("KA: Error exporting to phone")); |
919 | } | 920 | } |
920 | void KABCore::beamVCard() | 921 | void KABCore::beamVCard() |
921 | { | 922 | { |
922 | QStringList uids; | 923 | QStringList uids; |
923 | XXPortSelectDialog dlg( this, false, this ); | 924 | XXPortSelectDialog dlg( this, false, this ); |
924 | if ( dlg.exec() ) | 925 | if ( dlg.exec() ) |
925 | uids = dlg.uids(); | 926 | uids = dlg.uids(); |
926 | else | 927 | else |
927 | return; | 928 | return; |
928 | if ( uids.isEmpty() ) | 929 | if ( uids.isEmpty() ) |
929 | return; | 930 | return; |
930 | beamVCard( uids ); | 931 | beamVCard( uids ); |
931 | } | 932 | } |
932 | 933 | ||
933 | 934 | ||
934 | void KABCore::beamVCard(const QStringList& uids) | 935 | void KABCore::beamVCard(const QStringList& uids) |
935 | { | 936 | { |
936 | 937 | ||
937 | // LR: we should use the /tmp dir on the Zaurus, | 938 | // LR: we should use the /tmp dir on the Zaurus, |
938 | // because: /tmp = RAM, (HOME)/kdepim = flash memory | 939 | // because: /tmp = RAM, (HOME)/kdepim = flash memory |
939 | 940 | ||
940 | #ifdef DESKTOP_VERSION | 941 | #ifdef DESKTOP_VERSION |
941 | QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); | 942 | QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); |
942 | #else | 943 | #else |
943 | QString fileName = "/tmp/kapibeamfile.vcf"; | 944 | QString fileName = "/tmp/kapibeamfile.vcf"; |
944 | #endif | 945 | #endif |
945 | 946 | ||
946 | KABC::VCardConverter converter; | 947 | KABC::VCardConverter converter; |
947 | QString description; | 948 | QString description; |
948 | QString datastream; | 949 | QString datastream; |
949 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 950 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
950 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 951 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
951 | 952 | ||
952 | if ( a.isEmpty() ) | 953 | if ( a.isEmpty() ) |
953 | continue; | 954 | continue; |
954 | 955 | ||
955 | if (description.isEmpty()) | 956 | if (description.isEmpty()) |
956 | description = a.formattedName(); | 957 | description = a.formattedName(); |
957 | 958 | ||
958 | QString vcard; | 959 | QString vcard; |
959 | converter.addresseeToVCard( a, vcard ); | 960 | converter.addresseeToVCard( a, vcard ); |
960 | int start = 0; | 961 | int start = 0; |
961 | int next; | 962 | int next; |
962 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { | 963 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { |
963 | int semi = vcard.find(";", next); | 964 | int semi = vcard.find(";", next); |
964 | int dopp = vcard.find(":", next); | 965 | int dopp = vcard.find(":", next); |
965 | int sep; | 966 | int sep; |
966 | if ( semi < dopp && semi >= 0 ) | 967 | if ( semi < dopp && semi >= 0 ) |
967 | sep = semi ; | 968 | sep = semi ; |
968 | else | 969 | else |
969 | sep = dopp; | 970 | sep = dopp; |
970 | datastream +=vcard.mid( start, next - start); | 971 | datastream +=vcard.mid( start, next - start); |
971 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); | 972 | datastream +=vcard.mid( next+5,sep -next -5 ).upper(); |
972 | start = sep; | 973 | start = sep; |
973 | } | 974 | } |
974 | datastream += vcard.mid( start,vcard.length() ); | 975 | datastream += vcard.mid( start,vcard.length() ); |
975 | } | 976 | } |
976 | #ifndef DESKTOP_VERSION | 977 | #ifndef DESKTOP_VERSION |
977 | QFile outFile(fileName); | 978 | QFile outFile(fileName); |
978 | if ( outFile.open(IO_WriteOnly) ) { | 979 | if ( outFile.open(IO_WriteOnly) ) { |
979 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); | 980 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); |
980 | QTextStream t( &outFile ); // use a text stream | 981 | QTextStream t( &outFile ); // use a text stream |
981 | //t.setEncoding( QTextStream::UnicodeUTF8 ); | 982 | //t.setEncoding( QTextStream::UnicodeUTF8 ); |
982 | t.setEncoding( QTextStream::Latin1 ); | 983 | t.setEncoding( QTextStream::Latin1 ); |
983 | t <<datastream.latin1(); | 984 | t <<datastream.latin1(); |
984 | outFile.close(); | 985 | outFile.close(); |
985 | Ir *ir = new Ir( this ); | 986 | Ir *ir = new Ir( this ); |
986 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); | 987 | connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); |
987 | ir->send( fileName, description, "text/x-vCard" ); | 988 | ir->send( fileName, description, "text/x-vCard" ); |
988 | } else { | 989 | } else { |
989 | qDebug("KA: Error open temp beam file "); | 990 | qDebug("KA: Error open temp beam file "); |
990 | return; | 991 | return; |
991 | } | 992 | } |
992 | #endif | 993 | #endif |
993 | 994 | ||
994 | } | 995 | } |
995 | 996 | ||
996 | void KABCore::beamDone( Ir *ir ) | 997 | void KABCore::beamDone( Ir *ir ) |
997 | { | 998 | { |
998 | #ifndef DESKTOP_VERSION | 999 | #ifndef DESKTOP_VERSION |
999 | delete ir; | 1000 | delete ir; |
1000 | #endif | 1001 | #endif |
1001 | topLevelWidget()->raise(); | 1002 | topLevelWidget()->raise(); |
1002 | message( i18n("Beaming finished!") ); | 1003 | message( i18n("Beaming finished!") ); |
1003 | } | 1004 | } |
1004 | 1005 | ||
1005 | 1006 | ||
1006 | void KABCore::browse( const QString& url ) | 1007 | void KABCore::browse( const QString& url ) |
1007 | { | 1008 | { |
1008 | #ifndef KAB_EMBEDDED | 1009 | #ifndef KAB_EMBEDDED |
1009 | kapp->invokeBrowser( url ); | 1010 | kapp->invokeBrowser( url ); |
1010 | #else //KAB_EMBEDDED | 1011 | #else //KAB_EMBEDDED |
1011 | qDebug("KABCore::browse must be fixed"); | 1012 | qDebug("KABCore::browse must be fixed"); |
1012 | #endif //KAB_EMBEDDED | 1013 | #endif //KAB_EMBEDDED |
1013 | } | 1014 | } |
1014 | 1015 | ||
1015 | void KABCore::selectAllContacts() | 1016 | void KABCore::selectAllContacts() |
1016 | { | 1017 | { |
1017 | mViewManager->setSelected( QString::null, true ); | 1018 | mViewManager->setSelected( QString::null, true ); |
1018 | } | 1019 | } |
1019 | 1020 | ||
1020 | void KABCore::deleteContacts() | 1021 | void KABCore::deleteContacts() |
1021 | { | 1022 | { |
1022 | QStringList uidList = mViewManager->selectedUids(); | 1023 | QStringList uidList = mViewManager->selectedUids(); |
1023 | deleteContacts( uidList ); | 1024 | deleteContacts( uidList ); |
1024 | } | 1025 | } |
1025 | 1026 | ||
1026 | void KABCore::deleteContacts( const QStringList &uids ) | 1027 | void KABCore::deleteContacts( const QStringList &uids ) |
1027 | { | 1028 | { |
1028 | if ( uids.count() > 0 ) { | 1029 | if ( uids.count() > 0 ) { |
1029 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); | 1030 | PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); |
1030 | UndoStack::instance()->push( command ); | 1031 | UndoStack::instance()->push( command ); |
1031 | RedoStack::instance()->clear(); | 1032 | RedoStack::instance()->clear(); |
1032 | 1033 | ||
1033 | // now if we deleted anything, refresh | 1034 | // now if we deleted anything, refresh |
1034 | setContactSelected( QString::null ); | 1035 | setContactSelected( QString::null ); |
1035 | setModified( true ); | 1036 | setModified( true ); |
1036 | } | 1037 | } |
1037 | } | 1038 | } |
1038 | 1039 | ||
1039 | void KABCore::copyContacts() | 1040 | void KABCore::copyContacts() |
1040 | { | 1041 | { |
1041 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1042 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1042 | 1043 | ||
1043 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); | 1044 | QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); |
1044 | 1045 | ||
1045 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; | 1046 | kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; |
1046 | 1047 | ||
1047 | QClipboard *cb = QApplication::clipboard(); | 1048 | QClipboard *cb = QApplication::clipboard(); |
1048 | cb->setText( clipText ); | 1049 | cb->setText( clipText ); |
1049 | } | 1050 | } |
1050 | 1051 | ||
1051 | void KABCore::cutContacts() | 1052 | void KABCore::cutContacts() |
1052 | { | 1053 | { |
1053 | QStringList uidList = mViewManager->selectedUids(); | 1054 | QStringList uidList = mViewManager->selectedUids(); |
1054 | 1055 | ||
1055 | //US if ( uidList.size() > 0 ) { | 1056 | //US if ( uidList.size() > 0 ) { |
1056 | if ( uidList.count() > 0 ) { | 1057 | if ( uidList.count() > 0 ) { |
1057 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); | 1058 | PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); |
1058 | UndoStack::instance()->push( command ); | 1059 | UndoStack::instance()->push( command ); |
1059 | RedoStack::instance()->clear(); | 1060 | RedoStack::instance()->clear(); |
1060 | 1061 | ||
1061 | setModified( true ); | 1062 | setModified( true ); |
1062 | } | 1063 | } |
1063 | } | 1064 | } |
1064 | 1065 | ||
1065 | void KABCore::pasteContacts() | 1066 | void KABCore::pasteContacts() |
1066 | { | 1067 | { |
1067 | QClipboard *cb = QApplication::clipboard(); | 1068 | QClipboard *cb = QApplication::clipboard(); |
1068 | 1069 | ||
1069 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); | 1070 | KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); |
1070 | 1071 | ||
1071 | pasteContacts( list ); | 1072 | pasteContacts( list ); |
1072 | } | 1073 | } |
1073 | 1074 | ||
1074 | void KABCore::pasteContacts( KABC::Addressee::List &list ) | 1075 | void KABCore::pasteContacts( KABC::Addressee::List &list ) |
1075 | { | 1076 | { |
1076 | KABC::Resource *resource = requestResource( this ); | 1077 | KABC::Resource *resource = requestResource( this ); |
1077 | KABC::Addressee::List::Iterator it; | 1078 | KABC::Addressee::List::Iterator it; |
1078 | for ( it = list.begin(); it != list.end(); ++it ) | 1079 | for ( it = list.begin(); it != list.end(); ++it ) |
1079 | (*it).setResource( resource ); | 1080 | (*it).setResource( resource ); |
1080 | 1081 | ||
1081 | PwPasteCommand *command = new PwPasteCommand( this, list ); | 1082 | PwPasteCommand *command = new PwPasteCommand( this, list ); |
1082 | UndoStack::instance()->push( command ); | 1083 | UndoStack::instance()->push( command ); |
1083 | RedoStack::instance()->clear(); | 1084 | RedoStack::instance()->clear(); |
1084 | 1085 | ||
1085 | setModified( true ); | 1086 | setModified( true ); |
1086 | } | 1087 | } |
1087 | 1088 | ||
1088 | void KABCore::setWhoAmI() | 1089 | void KABCore::setWhoAmI() |
1089 | { | 1090 | { |
1090 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1091 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1091 | 1092 | ||
1092 | if ( addrList.count() > 1 ) { | 1093 | if ( addrList.count() > 1 ) { |
1093 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); | 1094 | KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); |
1094 | return; | 1095 | return; |
1095 | } | 1096 | } |
1096 | 1097 | ||
1097 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); | 1098 | QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); |
1098 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) | 1099 | if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) |
1099 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); | 1100 | static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); |
1100 | } | 1101 | } |
1101 | void KABCore::editCategories() | 1102 | void KABCore::editCategories() |
1102 | { | 1103 | { |
1103 | KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); | 1104 | KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); |
1104 | dlg.exec(); | 1105 | dlg.exec(); |
1105 | } | 1106 | } |
1106 | void KABCore::setCategories() | 1107 | void KABCore::setCategories() |
1107 | { | 1108 | { |
1108 | 1109 | ||
1109 | QStringList uids; | 1110 | QStringList uids; |
1110 | XXPortSelectDialog dlgx( this, false, this ); | 1111 | XXPortSelectDialog dlgx( this, false, this ); |
1111 | if ( dlgx.exec() ) | 1112 | if ( dlgx.exec() ) |
1112 | uids = dlgx.uids(); | 1113 | uids = dlgx.uids(); |
1113 | else | 1114 | else |
1114 | return; | 1115 | return; |
1115 | if ( uids.isEmpty() ) | 1116 | if ( uids.isEmpty() ) |
1116 | return; | 1117 | return; |
1117 | // qDebug("count %d ", uids.count()); | 1118 | // qDebug("count %d ", uids.count()); |
1118 | 1119 | ||
1119 | 1120 | ||
1120 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); | 1121 | KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); |
1121 | if ( !dlg.exec() ) { | 1122 | if ( !dlg.exec() ) { |
1122 | message( i18n("Setting categories cancelled") ); | 1123 | message( i18n("Setting categories cancelled") ); |
1123 | return; | 1124 | return; |
1124 | } | 1125 | } |
1125 | bool merge = false; | 1126 | bool merge = false; |
1126 | QString msg = i18n( "Merge with existing categories?" ); | 1127 | QString msg = i18n( "Merge with existing categories?" ); |
1127 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) | 1128 | if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) |
1128 | merge = true; | 1129 | merge = true; |
1129 | 1130 | ||
1130 | message( i18n("Setting categories ... please wait!") ); | 1131 | message( i18n("Setting categories ... please wait!") ); |
1131 | QStringList categories = dlg.selectedCategories(); | 1132 | QStringList categories = dlg.selectedCategories(); |
1132 | 1133 | ||
1133 | //QStringList uids = mViewManager->selectedUids(); | 1134 | //QStringList uids = mViewManager->selectedUids(); |
1134 | QStringList::Iterator it; | 1135 | QStringList::Iterator it; |
1135 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 1136 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
1136 | KABC::Addressee addr = mAddressBook->findByUid( *it ); | 1137 | KABC::Addressee addr = mAddressBook->findByUid( *it ); |
1137 | if ( !addr.isEmpty() ) { | 1138 | if ( !addr.isEmpty() ) { |
1138 | if ( !merge ) | 1139 | if ( !merge ) |
1139 | addr.setCategories( categories ); | 1140 | addr.setCategories( categories ); |
1140 | else { | 1141 | else { |
1141 | QStringList addrCategories = addr.categories(); | 1142 | QStringList addrCategories = addr.categories(); |
1142 | QStringList::Iterator catIt; | 1143 | QStringList::Iterator catIt; |
1143 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { | 1144 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { |
1144 | if ( !addrCategories.contains( *catIt ) ) | 1145 | if ( !addrCategories.contains( *catIt ) ) |
1145 | addrCategories.append( *catIt ); | 1146 | addrCategories.append( *catIt ); |
1146 | } | 1147 | } |
1147 | addr.setCategories( addrCategories ); | 1148 | addr.setCategories( addrCategories ); |
1148 | } | 1149 | } |
1149 | mAddressBook->insertAddressee( addr ); | 1150 | mAddressBook->insertAddressee( addr ); |
1150 | } | 1151 | } |
1151 | } | 1152 | } |
1152 | 1153 | ||
1153 | if ( uids.count() > 0 ) | 1154 | if ( uids.count() > 0 ) |
1154 | setModified( true ); | 1155 | setModified( true ); |
1155 | message( i18n("Setting categories completed!") ); | 1156 | message( i18n("Setting categories completed!") ); |
1156 | } | 1157 | } |
1157 | 1158 | ||
1158 | void KABCore::setSearchFields( const KABC::Field::List &fields ) | 1159 | void KABCore::setSearchFields( const KABC::Field::List &fields ) |
1159 | { | 1160 | { |
1160 | mIncSearchWidget->setFields( fields ); | 1161 | mIncSearchWidget->setFields( fields ); |
1161 | } | 1162 | } |
1162 | 1163 | ||
1163 | void KABCore::incrementalSearch( const QString& text ) | 1164 | void KABCore::incrementalSearch( const QString& text ) |
1164 | { | 1165 | { |
1165 | QString stext; | 1166 | QString stext; |
1166 | if ( KABPrefs::instance()->mAutoSearchWithWildcard ) { | 1167 | if ( KABPrefs::instance()->mAutoSearchWithWildcard ) { |
1167 | stext = "*" + text; | 1168 | stext = "*" + text; |
1168 | } else { | 1169 | } else { |
1169 | stext = text; | 1170 | stext = text; |
1170 | } | 1171 | } |
1171 | mViewManager->doSearch( stext, mIncSearchWidget->currentField() ); | 1172 | mViewManager->doSearch( stext, mIncSearchWidget->currentField() ); |
1172 | } | 1173 | } |
1173 | void KABCore::incrementalSearchJump( const QString& text ) | 1174 | void KABCore::incrementalSearchJump( const QString& text ) |
1174 | { | 1175 | { |
1175 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); | 1176 | mViewManager->doSearch( text, mIncSearchWidget->currentField() ); |
1176 | } | 1177 | } |
1177 | 1178 | ||
1178 | void KABCore::setModified() | 1179 | void KABCore::setModified() |
1179 | { | 1180 | { |
1180 | setModified( true ); | 1181 | setModified( true ); |
1181 | } | 1182 | } |
1182 | 1183 | ||
1183 | void KABCore::setModifiedWOrefresh() | 1184 | void KABCore::setModifiedWOrefresh() |
1184 | { | 1185 | { |
1185 | // qDebug("KABCore::setModifiedWOrefresh() "); | 1186 | // qDebug("KABCore::setModifiedWOrefresh() "); |
1186 | mModified = true; | 1187 | mModified = true; |
1187 | mActionSave->setEnabled( mModified ); | 1188 | mActionSave->setEnabled( mModified ); |
1188 | 1189 | ||
1189 | 1190 | ||
1190 | } | 1191 | } |
1191 | void KABCore::setModified( bool modified ) | 1192 | void KABCore::setModified( bool modified ) |
1192 | { | 1193 | { |
1193 | mModified = modified; | 1194 | mModified = modified; |
1194 | mActionSave->setEnabled( mModified ); | 1195 | mActionSave->setEnabled( mModified ); |
1195 | 1196 | ||
1196 | if ( modified ) | 1197 | if ( modified ) |
1197 | mJumpButtonBar->recreateButtons(); | 1198 | mJumpButtonBar->recreateButtons(); |
1198 | 1199 | ||
1199 | mViewManager->refreshView(); | 1200 | mViewManager->refreshView(); |
1200 | 1201 | ||
1201 | } | 1202 | } |
1202 | 1203 | ||
1203 | bool KABCore::modified() const | 1204 | bool KABCore::modified() const |
1204 | { | 1205 | { |
1205 | return mModified; | 1206 | return mModified; |
1206 | } | 1207 | } |
1207 | 1208 | ||
1208 | void KABCore::contactModified( const KABC::Addressee &addr ) | 1209 | void KABCore::contactModified( const KABC::Addressee &addr ) |
1209 | { | 1210 | { |
1210 | addrModified( addr ); | 1211 | addrModified( addr ); |
1211 | #if 0 // debug only | 1212 | #if 0 // debug only |
1212 | KABC::Addressee ad = addr; | 1213 | KABC::Addressee ad = addr; |
1213 | ad.computeCsum( "123"); | 1214 | ad.computeCsum( "123"); |
1214 | #endif | 1215 | #endif |
1215 | } | 1216 | } |
1216 | 1217 | ||
1217 | void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) | 1218 | void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) |
1218 | { | 1219 | { |
1219 | 1220 | ||
1220 | Command *command = 0; | 1221 | Command *command = 0; |
1221 | QString uid; | 1222 | QString uid; |
1222 | 1223 | ||
1223 | // check if it exists already | 1224 | // check if it exists already |
1224 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); | 1225 | KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); |
1225 | if ( origAddr.isEmpty() ) | 1226 | if ( origAddr.isEmpty() ) |
1226 | command = new PwNewCommand( mAddressBook, addr ); | 1227 | command = new PwNewCommand( mAddressBook, addr ); |
1227 | else { | 1228 | else { |
1228 | command = new PwEditCommand( mAddressBook, origAddr, addr ); | 1229 | command = new PwEditCommand( mAddressBook, origAddr, addr ); |
1229 | uid = addr.uid(); | 1230 | uid = addr.uid(); |
1230 | } | 1231 | } |
1231 | 1232 | ||
1232 | UndoStack::instance()->push( command ); | 1233 | UndoStack::instance()->push( command ); |
1233 | RedoStack::instance()->clear(); | 1234 | RedoStack::instance()->clear(); |
1234 | if ( updateDetails ) | 1235 | if ( updateDetails ) |
1235 | mDetails->setAddressee( addr ); | 1236 | mDetails->setAddressee( addr ); |
1236 | setModified( true ); | 1237 | setModified( true ); |
1237 | } | 1238 | } |
1238 | 1239 | ||
1239 | void KABCore::newContact() | 1240 | void KABCore::newContact() |
1240 | { | 1241 | { |
1241 | 1242 | ||
1242 | 1243 | ||
1243 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); | 1244 | QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); |
1244 | 1245 | ||
1245 | QPtrList<KRES::Resource> kresResources; | 1246 | QPtrList<KRES::Resource> kresResources; |
1246 | QPtrListIterator<KABC::Resource> it( kabcResources ); | 1247 | QPtrListIterator<KABC::Resource> it( kabcResources ); |
1247 | KABC::Resource *resource; | 1248 | KABC::Resource *resource; |
1248 | while ( ( resource = it.current() ) != 0 ) { | 1249 | while ( ( resource = it.current() ) != 0 ) { |
1249 | ++it; | 1250 | ++it; |
1250 | if ( !resource->readOnly() ) { | 1251 | if ( !resource->readOnly() ) { |
1251 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 1252 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
1252 | if ( res ) | 1253 | if ( res ) |
1253 | kresResources.append( res ); | 1254 | kresResources.append( res ); |
1254 | } | 1255 | } |
1255 | } | 1256 | } |
1256 | 1257 | ||
1257 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); | 1258 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); |
1258 | resource = static_cast<KABC::Resource*>( res ); | 1259 | resource = static_cast<KABC::Resource*>( res ); |
1259 | 1260 | ||
1260 | if ( resource ) { | 1261 | if ( resource ) { |
1261 | KABC::Addressee addr; | 1262 | KABC::Addressee addr; |
1262 | addr.setResource( resource ); | 1263 | addr.setResource( resource ); |
1263 | mEditorDialog->setAddressee( addr ); | 1264 | mEditorDialog->setAddressee( addr ); |
1264 | mEditorDialog->setCaption( i18n("Edit new contact")); | 1265 | mEditorDialog->setCaption( i18n("Edit new contact")); |
1265 | KApplication::execDialog ( mEditorDialog ); | 1266 | KApplication::execDialog ( mEditorDialog ); |
1266 | 1267 | ||
1267 | } else | 1268 | } else |
1268 | return; | 1269 | return; |
1269 | 1270 | ||
1270 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); | 1271 | // mEditorDict.insert( dialog->addressee().uid(), dialog ); |
1271 | 1272 | ||
1272 | 1273 | ||
1273 | } | 1274 | } |
1274 | 1275 | ||
1275 | void KABCore::addEmail( QString aStr ) | 1276 | void KABCore::addEmail( QString aStr ) |
1276 | { | 1277 | { |
1277 | #ifndef KAB_EMBEDDED | 1278 | #ifndef KAB_EMBEDDED |
1278 | QString fullName, email; | 1279 | QString fullName, email; |
1279 | 1280 | ||
1280 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); | 1281 | KABC::Addressee::parseEmailAddress( aStr, fullName, email ); |
1281 | 1282 | ||
1282 | // Try to lookup the addressee matching the email address | 1283 | // Try to lookup the addressee matching the email address |
1283 | bool found = false; | 1284 | bool found = false; |
1284 | QStringList emailList; | 1285 | QStringList emailList; |
1285 | KABC::AddressBook::Iterator it; | 1286 | KABC::AddressBook::Iterator it; |
1286 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { | 1287 | for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { |
1287 | emailList = (*it).emails(); | 1288 | emailList = (*it).emails(); |
1288 | if ( emailList.contains( email ) > 0 ) { | 1289 | if ( emailList.contains( email ) > 0 ) { |
1289 | found = true; | 1290 | found = true; |
1290 | (*it).setNameFromString( fullName ); | 1291 | (*it).setNameFromString( fullName ); |
1291 | editContact( (*it).uid() ); | 1292 | editContact( (*it).uid() ); |
1292 | } | 1293 | } |
1293 | } | 1294 | } |
1294 | 1295 | ||
1295 | if ( !found ) { | 1296 | if ( !found ) { |
1296 | KABC::Addressee addr; | 1297 | KABC::Addressee addr; |
1297 | addr.setNameFromString( fullName ); | 1298 | addr.setNameFromString( fullName ); |
1298 | addr.insertEmail( email, true ); | 1299 | addr.insertEmail( email, true ); |
1299 | 1300 | ||
1300 | mAddressBook->insertAddressee( addr ); | 1301 | mAddressBook->insertAddressee( addr ); |
1301 | mViewManager->refreshView( addr.uid() ); | 1302 | mViewManager->refreshView( addr.uid() ); |
1302 | editContact( addr.uid() ); | 1303 | editContact( addr.uid() ); |
1303 | } | 1304 | } |
1304 | #else //KAB_EMBEDDED | 1305 | #else //KAB_EMBEDDED |
1305 | qDebug("KABCore::addEmail finsih method"); | 1306 | qDebug("KABCore::addEmail finsih method"); |
1306 | #endif //KAB_EMBEDDED | 1307 | #endif //KAB_EMBEDDED |
1307 | } | 1308 | } |
1308 | 1309 | ||
1309 | void KABCore::importVCard( const KURL &url, bool showPreview ) | 1310 | void KABCore::importVCard( const KURL &url, bool showPreview ) |
1310 | { | 1311 | { |
1311 | mXXPortManager->importVCard( url, showPreview ); | 1312 | mXXPortManager->importVCard( url, showPreview ); |
1312 | } | 1313 | } |
1313 | void KABCore::importFromOL() | 1314 | void KABCore::importFromOL() |
1314 | { | 1315 | { |
1315 | #ifdef _OL_IMPORT_ | 1316 | #ifdef _OL_IMPORT_ |
1316 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); | 1317 | KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); |
1317 | idgl->exec(); | 1318 | idgl->exec(); |
1318 | KABC::Addressee::List list = idgl->getAddressList(); | 1319 | KABC::Addressee::List list = idgl->getAddressList(); |
1319 | if ( list.count() > 0 ) { | 1320 | if ( list.count() > 0 ) { |
1320 | KABC::Addressee::List listNew; | 1321 | KABC::Addressee::List listNew; |
1321 | KABC::Addressee::List listExisting; | 1322 | KABC::Addressee::List listExisting; |
1322 | KABC::Addressee::List::Iterator it; | 1323 | KABC::Addressee::List::Iterator it; |
1323 | KABC::AddressBook::Iterator iter; | 1324 | KABC::AddressBook::Iterator iter; |
1324 | for ( it = list.begin(); it != list.end(); ++it ) { | 1325 | for ( it = list.begin(); it != list.end(); ++it ) { |
1325 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) | 1326 | if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) |
1326 | listNew.append( (*it) ); | 1327 | listNew.append( (*it) ); |
1327 | else | 1328 | else |
1328 | listExisting.append( (*it) ); | 1329 | listExisting.append( (*it) ); |
1329 | } | 1330 | } |
1330 | if ( listExisting.count() > 0 ) | 1331 | if ( listExisting.count() > 0 ) |
1331 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); | 1332 | KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); |
1332 | if ( listNew.count() > 0 ) { | 1333 | if ( listNew.count() > 0 ) { |
1333 | pasteWithNewUid = false; | 1334 | pasteWithNewUid = false; |
1334 | pasteContacts( listNew ); | 1335 | pasteContacts( listNew ); |
1335 | pasteWithNewUid = true; | 1336 | pasteWithNewUid = true; |
1336 | } | 1337 | } |
1337 | } | 1338 | } |
1338 | delete idgl; | 1339 | delete idgl; |
1339 | #endif | 1340 | #endif |
1340 | } | 1341 | } |
1341 | 1342 | ||
1342 | void KABCore::importVCard( const QString &vCard, bool showPreview ) | 1343 | void KABCore::importVCard( const QString &vCard, bool showPreview ) |
1343 | { | 1344 | { |
1344 | mXXPortManager->importVCard( vCard, showPreview ); | 1345 | mXXPortManager->importVCard( vCard, showPreview ); |
1345 | } | 1346 | } |
1346 | 1347 | ||
1347 | //US added a second method without defaultparameter | 1348 | //US added a second method without defaultparameter |
1348 | void KABCore::editContact2() { | 1349 | void KABCore::editContact2() { |
1349 | editContact( QString::null ); | 1350 | editContact( QString::null ); |
1350 | } | 1351 | } |
1351 | 1352 | ||
1352 | void KABCore::editContact( const QString &uid ) | 1353 | void KABCore::editContact( const QString &uid ) |
1353 | { | 1354 | { |
1354 | 1355 | ||
1355 | if ( mExtensionManager->isQuickEditVisible() ) | 1356 | if ( mExtensionManager->isQuickEditVisible() ) |
1356 | return; | 1357 | return; |
1357 | 1358 | ||
1358 | // First, locate the contact entry | 1359 | // First, locate the contact entry |
1359 | QString localUID = uid; | 1360 | QString localUID = uid; |
1360 | if ( localUID.isNull() ) { | 1361 | if ( localUID.isNull() ) { |
1361 | QStringList uidList = mViewManager->selectedUids(); | 1362 | QStringList uidList = mViewManager->selectedUids(); |
1362 | if ( uidList.count() > 0 ) | 1363 | if ( uidList.count() > 0 ) |
1363 | localUID = *( uidList.at( 0 ) ); | 1364 | localUID = *( uidList.at( 0 ) ); |
1364 | } | 1365 | } |
1365 | 1366 | ||
1366 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); | 1367 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); |
1367 | if ( !addr.isEmpty() ) { | 1368 | if ( !addr.isEmpty() ) { |
1368 | mEditorDialog->setAddressee( addr ); | 1369 | mEditorDialog->setAddressee( addr ); |
1369 | KApplication::execDialog ( mEditorDialog ); | 1370 | KApplication::execDialog ( mEditorDialog ); |
1370 | } | 1371 | } |
1371 | } | 1372 | } |
1372 | 1373 | ||
1373 | /** | 1374 | /** |
1374 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 1375 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
1375 | the method will try to find a selected addressee in the view. | 1376 | the method will try to find a selected addressee in the view. |
1376 | */ | 1377 | */ |
1377 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) | 1378 | void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) |
1378 | { | 1379 | { |
1379 | if ( mMultipleViewsAtOnce ) | 1380 | if ( mMultipleViewsAtOnce ) |
1380 | { | 1381 | { |
1381 | editContact( uid ); | 1382 | editContact( uid ); |
1382 | } | 1383 | } |
1383 | else | 1384 | else |
1384 | { | 1385 | { |
1385 | setDetailsVisible( true ); | 1386 | setDetailsVisible( true ); |
1386 | mActionDetails->setChecked(true); | 1387 | mActionDetails->setChecked(true); |
1387 | } | 1388 | } |
1388 | 1389 | ||
1389 | } | 1390 | } |
1390 | 1391 | ||
1391 | void KABCore::save() | 1392 | void KABCore::save() |
1392 | { | 1393 | { |
1393 | if (syncManager->blockSave()) | 1394 | if (syncManager->blockSave()) |
1394 | return; | 1395 | return; |
1395 | if ( !mModified ) | 1396 | if ( !mModified ) |
1396 | return; | 1397 | return; |
1397 | 1398 | ||
1398 | syncManager->setBlockSave(true); | 1399 | syncManager->setBlockSave(true); |
1399 | QString text = i18n( "There was an error while attempting to save\n the " | 1400 | QString text = i18n( "There was an error while attempting to save\n the " |
1400 | "address book. Please check that some \nother application is " | 1401 | "address book. Please check that some \nother application is " |
1401 | "not using it. " ); | 1402 | "not using it. " ); |
1402 | message(i18n("Saving ... please wait! "), false); | 1403 | message(i18n("Saving ... please wait! "), false); |
1403 | //qApp->processEvents(); | 1404 | //qApp->processEvents(); |
1404 | #ifndef KAB_EMBEDDED | 1405 | #ifndef KAB_EMBEDDED |
1405 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); | 1406 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); |
1406 | if ( !b || !b->save() ) { | 1407 | if ( !b || !b->save() ) { |
1407 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); | 1408 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); |
1408 | } | 1409 | } |
1409 | #else //KAB_EMBEDDED | 1410 | #else //KAB_EMBEDDED |
1410 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); | 1411 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); |
1411 | if ( !b || !b->save() ) { | 1412 | if ( !b || !b->save() ) { |
1412 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); | 1413 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); |
1413 | } | 1414 | } |
1414 | #endif //KAB_EMBEDDED | 1415 | #endif //KAB_EMBEDDED |
1415 | 1416 | ||
1416 | message(i18n("Addressbook saved!")); | 1417 | message(i18n("Addressbook saved!")); |
1417 | setModified( false ); | 1418 | setModified( false ); |
1418 | syncManager->setBlockSave(false); | 1419 | syncManager->setBlockSave(false); |
1419 | } | 1420 | } |
1420 | 1421 | ||
1421 | 1422 | ||
1422 | void KABCore::undo() | 1423 | void KABCore::undo() |
1423 | { | 1424 | { |
1424 | UndoStack::instance()->undo(); | 1425 | UndoStack::instance()->undo(); |
1425 | 1426 | ||
1426 | // Refresh the view | 1427 | // Refresh the view |
1427 | mViewManager->refreshView(); | 1428 | mViewManager->refreshView(); |
1428 | } | 1429 | } |
1429 | 1430 | ||
1430 | void KABCore::redo() | 1431 | void KABCore::redo() |
1431 | { | 1432 | { |
1432 | RedoStack::instance()->redo(); | 1433 | RedoStack::instance()->redo(); |
1433 | 1434 | ||
1434 | // Refresh the view | 1435 | // Refresh the view |
1435 | mViewManager->refreshView(); | 1436 | mViewManager->refreshView(); |
1436 | } | 1437 | } |
1437 | void KABCore::setJumpButtonBar( bool visible ) | 1438 | void KABCore::setJumpButtonBar( bool visible ) |
1438 | { | 1439 | { |
1439 | setJumpButtonBarVisible(visible ); | 1440 | setJumpButtonBarVisible(visible ); |
1440 | saveSettings(); | 1441 | saveSettings(); |
1441 | } | 1442 | } |
1442 | void KABCore::setJumpButtonBarVisible( bool visible ) | 1443 | void KABCore::setJumpButtonBarVisible( bool visible ) |
1443 | { | 1444 | { |
1444 | if (mMultipleViewsAtOnce) | 1445 | if (mMultipleViewsAtOnce) |
1445 | { | 1446 | { |
1446 | if ( visible ) | 1447 | if ( visible ) |
1447 | mJumpButtonBar->show(); | 1448 | mJumpButtonBar->show(); |
1448 | else | 1449 | else |
1449 | mJumpButtonBar->hide(); | 1450 | mJumpButtonBar->hide(); |
1450 | } | 1451 | } |
1451 | else | 1452 | else |
1452 | { | 1453 | { |
1453 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" | 1454 | // show the jumpbar only if "the details are hidden" == "viewmanager are shown" |
1454 | if (mViewManager->isVisible()) | 1455 | if (mViewManager->isVisible()) |
1455 | { | 1456 | { |
1456 | if ( visible ) | 1457 | if ( visible ) |
1457 | mJumpButtonBar->show(); | 1458 | mJumpButtonBar->show(); |
1458 | else | 1459 | else |
1459 | mJumpButtonBar->hide(); | 1460 | mJumpButtonBar->hide(); |
1460 | } | 1461 | } |
1461 | else | 1462 | else |
1462 | { | 1463 | { |
1463 | mJumpButtonBar->hide(); | 1464 | mJumpButtonBar->hide(); |
1464 | } | 1465 | } |
1465 | } | 1466 | } |
1466 | if ( visible ) { | 1467 | if ( visible ) { |
1467 | if ( mIncSearchWidget->currentItem() == 0 ) { | 1468 | if ( mIncSearchWidget->currentItem() == 0 ) { |
1468 | message( i18n("Change search field enable jump bar") ); | 1469 | message( i18n("Change search field enable jump bar") ); |
1469 | } | 1470 | } |
1470 | } | 1471 | } |
1471 | } | 1472 | } |
1472 | 1473 | ||
1473 | 1474 | ||
1474 | void KABCore::setDetailsToState() | 1475 | void KABCore::setDetailsToState() |
1475 | { | 1476 | { |
1476 | setDetailsVisible( mActionDetails->isChecked() ); | 1477 | setDetailsVisible( mActionDetails->isChecked() ); |
1477 | } | 1478 | } |
1478 | void KABCore::setDetailsToggle() | 1479 | void KABCore::setDetailsToggle() |
1479 | { | 1480 | { |
1480 | mActionDetails->setChecked( !mActionDetails->isChecked() ); | 1481 | mActionDetails->setChecked( !mActionDetails->isChecked() ); |
1481 | setDetailsToState(); | 1482 | setDetailsToState(); |
1482 | } | 1483 | } |
1483 | 1484 | ||
1484 | 1485 | ||
1485 | 1486 | ||
1486 | void KABCore::setDetailsVisible( bool visible ) | 1487 | void KABCore::setDetailsVisible( bool visible ) |
1487 | { | 1488 | { |
1488 | if (visible && mDetails->isHidden()) | 1489 | if (visible && mDetails->isHidden()) |
1489 | { | 1490 | { |
1490 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); | 1491 | KABC::Addressee::List addrList = mViewManager->selectedAddressees(); |
1491 | if ( addrList.count() > 0 ) | 1492 | if ( addrList.count() > 0 ) |
1492 | mDetails->setAddressee( addrList[ 0 ] ); | 1493 | mDetails->setAddressee( addrList[ 0 ] ); |
1493 | } | 1494 | } |
1494 | 1495 | ||
1495 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between | 1496 | // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between |
1496 | // the listview and the detailview. We do that by changing the splitbar size. | 1497 | // the listview and the detailview. We do that by changing the splitbar size. |
1497 | if (mMultipleViewsAtOnce) | 1498 | if (mMultipleViewsAtOnce) |
1498 | { | 1499 | { |
1499 | if ( visible ) | 1500 | if ( visible ) |
1500 | mDetails->show(); | 1501 | mDetails->show(); |
1501 | else | 1502 | else |
1502 | mDetails->hide(); | 1503 | mDetails->hide(); |
1503 | } | 1504 | } |
1504 | else | 1505 | else |
1505 | { | 1506 | { |
1506 | if ( visible ) { | 1507 | if ( visible ) { |
1507 | mViewManager->hide(); | 1508 | mViewManager->hide(); |
1508 | mDetails->show(); | 1509 | mDetails->show(); |
1509 | mIncSearchWidget->setFocus(); | 1510 | mIncSearchWidget->setFocus(); |
1510 | } | 1511 | } |
1511 | else { | 1512 | else { |
1512 | mViewManager->show(); | 1513 | mViewManager->show(); |
1513 | mDetails->hide(); | 1514 | mDetails->hide(); |
1514 | mViewManager->setFocusAV(); | 1515 | mViewManager->setFocusAV(); |
1515 | } | 1516 | } |
1516 | setJumpButtonBarVisible( !visible ); | 1517 | setJumpButtonBarVisible( !visible ); |
1517 | } | 1518 | } |
1518 | 1519 | ||
1519 | } | 1520 | } |
1520 | 1521 | ||
1521 | void KABCore::extensionChanged( int id ) | 1522 | void KABCore::extensionChanged( int id ) |
1522 | { | 1523 | { |
1523 | //change the details view only for non desktop systems | 1524 | //change the details view only for non desktop systems |
1524 | #ifndef DESKTOP_VERSION | 1525 | #ifndef DESKTOP_VERSION |
1525 | 1526 | ||
1526 | if (id == 0) | 1527 | if (id == 0) |
1527 | { | 1528 | { |
1528 | //the user disabled the extension. | 1529 | //the user disabled the extension. |
1529 | 1530 | ||
1530 | if (mMultipleViewsAtOnce) | 1531 | if (mMultipleViewsAtOnce) |
1531 | { // enable detailsview again | 1532 | { // enable detailsview again |
1532 | setDetailsVisible( true ); | 1533 | setDetailsVisible( true ); |
1533 | mActionDetails->setChecked( true ); | 1534 | mActionDetails->setChecked( true ); |
1534 | } | 1535 | } |
1535 | else | 1536 | else |
1536 | { //go back to the listview | 1537 | { //go back to the listview |
1537 | setDetailsVisible( false ); | 1538 | setDetailsVisible( false ); |
1538 | mActionDetails->setChecked( false ); | 1539 | mActionDetails->setChecked( false ); |
1539 | mActionDetails->setEnabled(true); | 1540 | mActionDetails->setEnabled(true); |
1540 | } | 1541 | } |
1541 | 1542 | ||
1542 | } | 1543 | } |
1543 | else | 1544 | else |
1544 | { | 1545 | { |
1545 | //the user enabled the extension. | 1546 | //the user enabled the extension. |
1546 | setDetailsVisible( false ); | 1547 | setDetailsVisible( false ); |
1547 | mActionDetails->setChecked( false ); | 1548 | mActionDetails->setChecked( false ); |
1548 | 1549 | ||
1549 | if (!mMultipleViewsAtOnce) | 1550 | if (!mMultipleViewsAtOnce) |
1550 | { | 1551 | { |
1551 | mActionDetails->setEnabled(false); | 1552 | mActionDetails->setEnabled(false); |
1552 | } | 1553 | } |
1553 | 1554 | ||
1554 | mExtensionManager->setSelectionChanged(); | 1555 | mExtensionManager->setSelectionChanged(); |
1555 | 1556 | ||
1556 | } | 1557 | } |
1557 | 1558 | ||
1558 | #endif// DESKTOP_VERSION | 1559 | #endif// DESKTOP_VERSION |
1559 | 1560 | ||
1560 | } | 1561 | } |
1561 | 1562 | ||
1562 | 1563 | ||
1563 | void KABCore::extensionModified( const KABC::Addressee::List &list ) | 1564 | void KABCore::extensionModified( const KABC::Addressee::List &list ) |
1564 | { | 1565 | { |
1565 | 1566 | ||
1566 | if ( list.count() != 0 ) { | 1567 | if ( list.count() != 0 ) { |
1567 | KABC::Addressee::List::ConstIterator it; | 1568 | KABC::Addressee::List::ConstIterator it; |
1568 | for ( it = list.begin(); it != list.end(); ++it ) | 1569 | for ( it = list.begin(); it != list.end(); ++it ) |
1569 | mAddressBook->insertAddressee( *it ); | 1570 | mAddressBook->insertAddressee( *it ); |
1570 | if ( list.count() > 1 ) | 1571 | if ( list.count() > 1 ) |
1571 | setModified(); | 1572 | setModified(); |
1572 | else | 1573 | else |
1573 | setModifiedWOrefresh(); | 1574 | setModifiedWOrefresh(); |
1574 | } | 1575 | } |
1575 | if ( list.count() == 0 ) | 1576 | if ( list.count() == 0 ) |
1576 | mViewManager->refreshView(); | 1577 | mViewManager->refreshView(); |
1577 | else | 1578 | else |
1578 | mViewManager->refreshView( list[ 0 ].uid() ); | 1579 | mViewManager->refreshView( list[ 0 ].uid() ); |
1579 | 1580 | ||
1580 | 1581 | ||
1581 | 1582 | ||
1582 | } | 1583 | } |
1583 | 1584 | ||
1584 | QString KABCore::getNameByPhone( const QString &phone ) | 1585 | QString KABCore::getNameByPhone( const QString &phone ) |
1585 | { | 1586 | { |
1586 | #ifndef KAB_EMBEDDED | 1587 | #ifndef KAB_EMBEDDED |
1587 | QRegExp r( "[/*/-/ ]" ); | 1588 | QRegExp r( "[/*/-/ ]" ); |
1588 | QString localPhone( phone ); | 1589 | QString localPhone( phone ); |
1589 | 1590 | ||
1590 | bool found = false; | 1591 | bool found = false; |
1591 | QString ownerName = ""; | 1592 | QString ownerName = ""; |
1592 | KABC::AddressBook::Iterator iter; | 1593 | KABC::AddressBook::Iterator iter; |
1593 | KABC::PhoneNumber::List::Iterator phoneIter; | 1594 | KABC::PhoneNumber::List::Iterator phoneIter; |
1594 | KABC::PhoneNumber::List phoneList; | 1595 | KABC::PhoneNumber::List phoneList; |
1595 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { | 1596 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { |
1596 | phoneList = (*iter).phoneNumbers(); | 1597 | phoneList = (*iter).phoneNumbers(); |
1597 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); | 1598 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); |
1598 | ++phoneIter) { | 1599 | ++phoneIter) { |
1599 | // Get rid of separator chars so just the numbers are compared. | 1600 | // Get rid of separator chars so just the numbers are compared. |
1600 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { | 1601 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { |
1601 | ownerName = (*iter).formattedName(); | 1602 | ownerName = (*iter).formattedName(); |
1602 | found = true; | 1603 | found = true; |
1603 | } | 1604 | } |
1604 | } | 1605 | } |
1605 | } | 1606 | } |
1606 | 1607 | ||
1607 | return ownerName; | 1608 | return ownerName; |
1608 | #else //KAB_EMBEDDED | 1609 | #else //KAB_EMBEDDED |
1609 | qDebug("KABCore::getNameByPhone finsih method"); | 1610 | qDebug("KABCore::getNameByPhone finsih method"); |
1610 | return ""; | 1611 | return ""; |
1611 | #endif //KAB_EMBEDDED | 1612 | #endif //KAB_EMBEDDED |
1612 | 1613 | ||
1613 | } | 1614 | } |
1614 | 1615 | void KABCore::openConfigGlobalDialog() | |
1616 | { | ||
1617 | KPimPrefsGlobalDialog gc ( this ); | ||
1618 | gc.exec(); | ||
1619 | } | ||
1615 | void KABCore::openConfigDialog() | 1620 | void KABCore::openConfigDialog() |
1616 | { | 1621 | { |
1617 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); | 1622 | KDialogBase * ConfigureDialog = new KDialogBase ( KDialogBase::Plain , i18n("Configure KA/Pi"), KDialogBase::Default |KDialogBase::Cancel | KDialogBase::Apply | KDialogBase::Ok, KDialogBase::Ok,0, "name", true, true); |
1618 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); | ||
1619 | ConfigureDialog->addModule(kabcfg ); | ||
1620 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); | ||
1621 | ConfigureDialog->addModule(kdelibcfg ); | ||
1622 | 1623 | ||
1624 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog , "KCMKabConfig" ); | ||
1625 | ConfigureDialog->setMainWidget( kabcfg ); | ||
1623 | connect( ConfigureDialog, SIGNAL( applyClicked() ), | 1626 | connect( ConfigureDialog, SIGNAL( applyClicked() ), |
1624 | this, SLOT( configurationChanged() ) ); | 1627 | this, SLOT( configurationChanged() ) ); |
1628 | connect( ConfigureDialog, SIGNAL( applyClicked() ), | ||
1629 | kabcfg, SLOT( save() ) ); | ||
1625 | connect( ConfigureDialog, SIGNAL( okClicked() ), | 1630 | connect( ConfigureDialog, SIGNAL( okClicked() ), |
1626 | this, SLOT( configurationChanged() ) ); | 1631 | this, SLOT( configurationChanged() ) ); |
1632 | connect( ConfigureDialog, SIGNAL( okClicked() ), | ||
1633 | kabcfg, SLOT( save() ) ); | ||
1634 | connect( ConfigureDialog, SIGNAL( defaultClicked() ), | ||
1635 | kabcfg, SLOT( defaults() ) ); | ||
1627 | saveSettings(); | 1636 | saveSettings(); |
1637 | kabcfg->load(); | ||
1628 | #ifndef DESKTOP_VERSION | 1638 | #ifndef DESKTOP_VERSION |
1639 | if ( QApplication::desktop()->height() <= 480 ) | ||
1640 | ConfigureDialog->hideButtons(); | ||
1629 | ConfigureDialog->showMaximized(); | 1641 | ConfigureDialog->showMaximized(); |
1630 | #endif | 1642 | #endif |
1631 | if ( ConfigureDialog->exec() ) | 1643 | if ( ConfigureDialog->exec() ) |
1632 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); | 1644 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); |
1633 | delete ConfigureDialog; | 1645 | delete ConfigureDialog; |
1634 | } | 1646 | } |
1635 | 1647 | ||
1636 | void KABCore::openLDAPDialog() | 1648 | void KABCore::openLDAPDialog() |
1637 | { | 1649 | { |
1638 | #ifndef KAB_EMBEDDED | 1650 | #ifndef KAB_EMBEDDED |
1639 | if ( !mLdapSearchDialog ) { | 1651 | if ( !mLdapSearchDialog ) { |
1640 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); | 1652 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); |
1641 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, | 1653 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, |
1642 | SLOT( refreshView() ) ); | 1654 | SLOT( refreshView() ) ); |
1643 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, | 1655 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, |
1644 | SLOT( setModified() ) ); | 1656 | SLOT( setModified() ) ); |
1645 | } else | 1657 | } else |
1646 | mLdapSearchDialog->restoreSettings(); | 1658 | mLdapSearchDialog->restoreSettings(); |
1647 | 1659 | ||
1648 | if ( mLdapSearchDialog->isOK() ) | 1660 | if ( mLdapSearchDialog->isOK() ) |
1649 | mLdapSearchDialog->exec(); | 1661 | mLdapSearchDialog->exec(); |
1650 | #else //KAB_EMBEDDED | 1662 | #else //KAB_EMBEDDED |
1651 | qDebug("KABCore::openLDAPDialog() finsih method"); | 1663 | qDebug("KABCore::openLDAPDialog() finsih method"); |
1652 | #endif //KAB_EMBEDDED | 1664 | #endif //KAB_EMBEDDED |
1653 | } | 1665 | } |
1654 | 1666 | ||
1655 | void KABCore::print() | 1667 | void KABCore::print() |
1656 | { | 1668 | { |
1657 | #ifndef KAB_EMBEDDED | 1669 | #ifndef KAB_EMBEDDED |
1658 | KPrinter printer; | 1670 | KPrinter printer; |
1659 | if ( !printer.setup( this ) ) | 1671 | if ( !printer.setup( this ) ) |
1660 | return; | 1672 | return; |
1661 | 1673 | ||
1662 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, | 1674 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, |
1663 | mViewManager->selectedUids(), this ); | 1675 | mViewManager->selectedUids(), this ); |
1664 | 1676 | ||
1665 | wizard.exec(); | 1677 | wizard.exec(); |
1666 | #else //KAB_EMBEDDED | 1678 | #else //KAB_EMBEDDED |
1667 | qDebug("KABCore::print() finsih method"); | 1679 | qDebug("KABCore::print() finsih method"); |
1668 | #endif //KAB_EMBEDDED | 1680 | #endif //KAB_EMBEDDED |
1669 | 1681 | ||
1670 | } | 1682 | } |
1671 | 1683 | ||
1672 | 1684 | ||
1673 | void KABCore::addGUIClient( KXMLGUIClient *client ) | 1685 | void KABCore::addGUIClient( KXMLGUIClient *client ) |
1674 | { | 1686 | { |
1675 | if ( mGUIClient ) | 1687 | if ( mGUIClient ) |
1676 | mGUIClient->insertChildClient( client ); | 1688 | mGUIClient->insertChildClient( client ); |
1677 | else | 1689 | else |
1678 | KMessageBox::error( this, "no KXMLGUICLient"); | 1690 | KMessageBox::error( this, "no KXMLGUICLient"); |
1679 | } | 1691 | } |
1680 | 1692 | ||
1681 | 1693 | ||
1682 | void KABCore::configurationChanged() | 1694 | void KABCore::configurationChanged() |
1683 | { | 1695 | { |
1684 | mExtensionManager->reconfigure(); | 1696 | mExtensionManager->reconfigure(); |
1685 | } | 1697 | } |
1686 | 1698 | ||
1687 | void KABCore::addressBookChanged() | 1699 | void KABCore::addressBookChanged() |
1688 | { | 1700 | { |
1689 | /*US | 1701 | /*US |
1690 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); | 1702 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); |
1691 | while ( it.current() ) { | 1703 | while ( it.current() ) { |
1692 | if ( it.current()->dirty() ) { | 1704 | if ( it.current()->dirty() ) { |
1693 | QString text = i18n( "Data has been changed externally. Unsaved " | 1705 | QString text = i18n( "Data has been changed externally. Unsaved " |
1694 | "changes will be lost." ); | 1706 | "changes will be lost." ); |
1695 | KMessageBox::information( this, text ); | 1707 | KMessageBox::information( this, text ); |
1696 | } | 1708 | } |
1697 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); | 1709 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); |
1698 | ++it; | 1710 | ++it; |
1699 | } | 1711 | } |
1700 | */ | 1712 | */ |
1701 | if (mEditorDialog) | 1713 | if (mEditorDialog) |
1702 | { | 1714 | { |
1703 | if (mEditorDialog->dirty()) | 1715 | if (mEditorDialog->dirty()) |
1704 | { | 1716 | { |
1705 | QString text = i18n( "Data has been changed externally. Unsaved " | 1717 | QString text = i18n( "Data has been changed externally. Unsaved " |
1706 | "changes will be lost." ); | 1718 | "changes will be lost." ); |
1707 | KMessageBox::information( this, text ); | 1719 | KMessageBox::information( this, text ); |
1708 | } | 1720 | } |
1709 | QString currentuid = mEditorDialog->addressee().uid(); | 1721 | QString currentuid = mEditorDialog->addressee().uid(); |
1710 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); | 1722 | mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); |
1711 | } | 1723 | } |
1712 | mViewManager->refreshView(); | 1724 | mViewManager->refreshView(); |
1713 | 1725 | ||
1714 | 1726 | ||
1715 | } | 1727 | } |
1716 | 1728 | ||
1717 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1729 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, |
1718 | const char *name ) | 1730 | const char *name ) |
1719 | { | 1731 | { |
1720 | 1732 | ||
1721 | if ( mEditorDialog == 0 ) { | 1733 | if ( mEditorDialog == 0 ) { |
1722 | mEditorDialog = new AddresseeEditorDialog( this, parent, | 1734 | mEditorDialog = new AddresseeEditorDialog( this, parent, |
1723 | name ? name : "editorDialog" ); | 1735 | name ? name : "editorDialog" ); |
1724 | 1736 | ||
1725 | 1737 | ||
1726 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1738 | connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1727 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1739 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1728 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), | 1740 | //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), |
1729 | // SLOT( slotEditorDestroyed( const QString& ) ) ; | 1741 | // SLOT( slotEditorDestroyed( const QString& ) ) ; |
1730 | } | 1742 | } |
1731 | 1743 | ||
1732 | return mEditorDialog; | 1744 | return mEditorDialog; |
1733 | } | 1745 | } |
1734 | 1746 | ||
1735 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1747 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1736 | { | 1748 | { |
1737 | //mEditorDict.remove( uid ); | 1749 | //mEditorDict.remove( uid ); |
1738 | } | 1750 | } |
1739 | 1751 | ||
1740 | void KABCore::initGUI() | 1752 | void KABCore::initGUI() |
1741 | { | 1753 | { |
1742 | #ifndef KAB_EMBEDDED | 1754 | #ifndef KAB_EMBEDDED |
1743 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1755 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1744 | topLayout->setSpacing( KDialogBase::spacingHint() ); | 1756 | topLayout->setSpacing( KDialogBase::spacingHint() ); |
1745 | 1757 | ||
1746 | mExtensionBarSplitter = new QSplitter( this ); | 1758 | mExtensionBarSplitter = new QSplitter( this ); |
1747 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); | 1759 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); |
1748 | 1760 | ||
1749 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); | 1761 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); |
1750 | 1762 | ||
1751 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1763 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1752 | mIncSearchWidget = new IncSearchWidget( viewSpace ); | 1764 | mIncSearchWidget = new IncSearchWidget( viewSpace ); |
1753 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1765 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1754 | SLOT( incrementalSearch( const QString& ) ) ); | 1766 | SLOT( incrementalSearch( const QString& ) ) ); |
1755 | 1767 | ||
1756 | mViewManager = new ViewManager( this, viewSpace ); | 1768 | mViewManager = new ViewManager( this, viewSpace ); |
1757 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1769 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1758 | 1770 | ||
1759 | mDetails = new ViewContainer( mDetailsSplitter ); | 1771 | mDetails = new ViewContainer( mDetailsSplitter ); |
1760 | 1772 | ||
1761 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1773 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1762 | 1774 | ||
1763 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1775 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1764 | 1776 | ||
1765 | topLayout->addWidget( mExtensionBarSplitter ); | 1777 | topLayout->addWidget( mExtensionBarSplitter ); |
1766 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); | 1778 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); |
1767 | topLayout->addWidget( mJumpButtonBar ); | 1779 | topLayout->addWidget( mJumpButtonBar ); |
1768 | //topLayout->setStretchFactor( mJumpButtonBar, 1 ); | 1780 | //topLayout->setStretchFactor( mJumpButtonBar, 1 ); |
1769 | 1781 | ||
1770 | mXXPortManager = new XXPortManager( this, this ); | 1782 | mXXPortManager = new XXPortManager( this, this ); |
1771 | 1783 | ||
1772 | #else //KAB_EMBEDDED | 1784 | #else //KAB_EMBEDDED |
1773 | //US initialize viewMenu before settingup viewmanager. | 1785 | //US initialize viewMenu before settingup viewmanager. |
1774 | // Viewmanager needs this menu to plugin submenues. | 1786 | // Viewmanager needs this menu to plugin submenues. |
1775 | viewMenu = new QPopupMenu( this ); | 1787 | viewMenu = new QPopupMenu( this ); |
1776 | settingsMenu = new QPopupMenu( this ); | 1788 | settingsMenu = new QPopupMenu( this ); |
1777 | //filterMenu = new QPopupMenu( this ); | 1789 | //filterMenu = new QPopupMenu( this ); |
1778 | ImportMenu = new QPopupMenu( this ); | 1790 | ImportMenu = new QPopupMenu( this ); |
1779 | ExportMenu = new QPopupMenu( this ); | 1791 | ExportMenu = new QPopupMenu( this ); |
1780 | syncMenu = new QPopupMenu( this ); | 1792 | syncMenu = new QPopupMenu( this ); |
1781 | changeMenu= new QPopupMenu( this ); | 1793 | changeMenu= new QPopupMenu( this ); |
1782 | beamMenu= new QPopupMenu( this ); | 1794 | beamMenu= new QPopupMenu( this ); |
1783 | 1795 | ||
1784 | //US since we have no splitter for the embedded system, setup | 1796 | //US since we have no splitter for the embedded system, setup |
1785 | // a layout with two frames. One left and one right. | 1797 | // a layout with two frames. One left and one right. |
1786 | 1798 | ||
1787 | QBoxLayout *topLayout; | 1799 | QBoxLayout *topLayout; |
1788 | 1800 | ||
1789 | // = new QHBoxLayout( this ); | 1801 | // = new QHBoxLayout( this ); |
1790 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); | 1802 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); |
1791 | 1803 | ||
1792 | // QWidget *mainBox = new QWidget( this ); | 1804 | // QWidget *mainBox = new QWidget( this ); |
1793 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); | 1805 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); |
1794 | 1806 | ||
1795 | #ifdef DESKTOP_VERSION | 1807 | #ifdef DESKTOP_VERSION |
1796 | topLayout = new QHBoxLayout( this ); | 1808 | topLayout = new QHBoxLayout( this ); |
1797 | 1809 | ||
1798 | 1810 | ||
1799 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1811 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1800 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1812 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1801 | 1813 | ||
1802 | topLayout->addWidget(mMiniSplitter ); | 1814 | topLayout->addWidget(mMiniSplitter ); |
1803 | 1815 | ||
1804 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); | 1816 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); |
1805 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1817 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1806 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); | 1818 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); |
1807 | mDetails = new ViewContainer( mMiniSplitter ); | 1819 | mDetails = new ViewContainer( mMiniSplitter ); |
1808 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1820 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1809 | #else | 1821 | #else |
1810 | if ( QApplication::desktop()->width() > 480 ) { | 1822 | if ( QApplication::desktop()->width() > 480 ) { |
1811 | topLayout = new QHBoxLayout( this ); | 1823 | topLayout = new QHBoxLayout( this ); |
1812 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1824 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1813 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1825 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1814 | } else { | 1826 | } else { |
1815 | 1827 | ||
1816 | topLayout = new QHBoxLayout( this ); | 1828 | topLayout = new QHBoxLayout( this ); |
1817 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 1829 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
1818 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1830 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1819 | } | 1831 | } |
1820 | 1832 | ||
1821 | topLayout->addWidget(mMiniSplitter ); | 1833 | topLayout->addWidget(mMiniSplitter ); |
1822 | mViewManager = new ViewManager( this, mMiniSplitter ); | 1834 | mViewManager = new ViewManager( this, mMiniSplitter ); |
1823 | mDetails = new ViewContainer( mMiniSplitter ); | 1835 | mDetails = new ViewContainer( mMiniSplitter ); |
1824 | 1836 | ||
1825 | 1837 | ||
1826 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); | 1838 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); |
1827 | #endif | 1839 | #endif |
1828 | //eh->hide(); | 1840 | //eh->hide(); |
1829 | // topLayout->addWidget(mExtensionManager ); | 1841 | // topLayout->addWidget(mExtensionManager ); |
1830 | 1842 | ||
1831 | 1843 | ||
1832 | /*US | 1844 | /*US |
1833 | #ifndef KAB_NOSPLITTER | 1845 | #ifndef KAB_NOSPLITTER |
1834 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1846 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1835 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1847 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1836 | topLayout->setSpacing( 10 ); | 1848 | topLayout->setSpacing( 10 ); |
1837 | 1849 | ||
1838 | mDetailsSplitter = new QSplitter( this ); | 1850 | mDetailsSplitter = new QSplitter( this ); |
1839 | 1851 | ||
1840 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1852 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1841 | 1853 | ||
1842 | mViewManager = new ViewManager( this, viewSpace ); | 1854 | mViewManager = new ViewManager( this, viewSpace ); |
1843 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1855 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1844 | 1856 | ||
1845 | mDetails = new ViewContainer( mDetailsSplitter ); | 1857 | mDetails = new ViewContainer( mDetailsSplitter ); |
1846 | 1858 | ||
1847 | topLayout->addWidget( mDetailsSplitter ); | 1859 | topLayout->addWidget( mDetailsSplitter ); |
1848 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1860 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1849 | #else //KAB_NOSPLITTER | 1861 | #else //KAB_NOSPLITTER |
1850 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1862 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1851 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1863 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1852 | topLayout->setSpacing( 10 ); | 1864 | topLayout->setSpacing( 10 ); |
1853 | 1865 | ||
1854 | // mDetailsSplitter = new QSplitter( this ); | 1866 | // mDetailsSplitter = new QSplitter( this ); |
1855 | 1867 | ||
1856 | QVBox *viewSpace = new QVBox( this ); | 1868 | QVBox *viewSpace = new QVBox( this ); |
1857 | 1869 | ||
1858 | mViewManager = new ViewManager( this, viewSpace ); | 1870 | mViewManager = new ViewManager( this, viewSpace ); |
1859 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1871 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1860 | 1872 | ||
1861 | mDetails = new ViewContainer( this ); | 1873 | mDetails = new ViewContainer( this ); |
1862 | 1874 | ||
1863 | topLayout->addWidget( viewSpace ); | 1875 | topLayout->addWidget( viewSpace ); |
1864 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1876 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1865 | topLayout->addWidget( mDetails ); | 1877 | topLayout->addWidget( mDetails ); |
1866 | #endif //KAB_NOSPLITTER | 1878 | #endif //KAB_NOSPLITTER |
1867 | */ | 1879 | */ |
1868 | 1880 | ||
1869 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 1881 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
1870 | syncManager->setBlockSave(false); | 1882 | syncManager->setBlockSave(false); |
1871 | 1883 | ||
1872 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 1884 | connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
1873 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 1885 | connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
1874 | QString sync_file = sentSyncFile(); | 1886 | QString sync_file = sentSyncFile(); |
1875 | //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); | 1887 | //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); |
1876 | syncManager->setDefaultFileName( sync_file ); | 1888 | syncManager->setDefaultFileName( sync_file ); |
1877 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); | 1889 | //connect(syncManager , SIGNAL( ), this, SLOT( ) ); |
1878 | 1890 | ||
1879 | #endif //KAB_EMBEDDED | 1891 | #endif //KAB_EMBEDDED |
1880 | initActions(); | 1892 | initActions(); |
1881 | 1893 | ||
1882 | #ifdef KAB_EMBEDDED | 1894 | #ifdef KAB_EMBEDDED |
1883 | addActionsManually(); | 1895 | addActionsManually(); |
1884 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1896 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1885 | mXXPortManager = new XXPortManager( this, this ); | 1897 | mXXPortManager = new XXPortManager( this, this ); |
1886 | 1898 | ||
1887 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1899 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1888 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1900 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1889 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1901 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1890 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1902 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1891 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1903 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1892 | // mIncSearchWidget->hide(); | 1904 | // mIncSearchWidget->hide(); |
1893 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1905 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1894 | SLOT( incrementalSearch( const QString& ) ) ); | 1906 | SLOT( incrementalSearch( const QString& ) ) ); |
1895 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); | 1907 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); |
1896 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); | 1908 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); |
1897 | 1909 | ||
1898 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1910 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1899 | 1911 | ||
1900 | topLayout->addWidget( mJumpButtonBar ); | 1912 | topLayout->addWidget( mJumpButtonBar ); |
1901 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1913 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1902 | 1914 | ||
1903 | // mMainWindow->getIconToolBar()->raise(); | 1915 | // mMainWindow->getIconToolBar()->raise(); |
1904 | 1916 | ||
1905 | #endif //KAB_EMBEDDED | 1917 | #endif //KAB_EMBEDDED |
1906 | 1918 | ||
1907 | } | 1919 | } |
1908 | void KABCore::initActions() | 1920 | void KABCore::initActions() |
1909 | { | 1921 | { |
1910 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1922 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1911 | 1923 | ||
1912 | #ifndef KAB_EMBEDDED | 1924 | #ifndef KAB_EMBEDDED |
1913 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1925 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1914 | SLOT( clipboardDataChanged() ) ); | 1926 | SLOT( clipboardDataChanged() ) ); |
1915 | #endif //KAB_EMBEDDED | 1927 | #endif //KAB_EMBEDDED |
1916 | 1928 | ||
1917 | // file menu | 1929 | // file menu |
1918 | 1930 | ||
1919 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1931 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1920 | //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1932 | //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1921 | mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager, | 1933 | mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager, |
1922 | SLOT( printView() ), actionCollection(), "kaddressbook_print" ); | 1934 | SLOT( printView() ), actionCollection(), "kaddressbook_print" ); |
1923 | 1935 | ||
1924 | 1936 | ||
1925 | mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, | 1937 | mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, |
1926 | SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); | 1938 | SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); |
1927 | 1939 | ||
1928 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1940 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1929 | SLOT( save() ), actionCollection(), "file_sync" ); | 1941 | SLOT( save() ), actionCollection(), "file_sync" ); |
1930 | 1942 | ||
1931 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1943 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1932 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1944 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1933 | 1945 | ||
1934 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1946 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1935 | this, SLOT( mailVCard() ), | 1947 | this, SLOT( mailVCard() ), |
1936 | actionCollection(), "file_mail_vcard"); | 1948 | actionCollection(), "file_mail_vcard"); |
1937 | 1949 | ||
1938 | mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, | 1950 | mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, |
1939 | SLOT( export2phone() ), actionCollection(), | 1951 | SLOT( export2phone() ), actionCollection(), |
1940 | "kaddressbook_ex2phone" ); | 1952 | "kaddressbook_ex2phone" ); |
1941 | 1953 | ||
1942 | mActionBeamVCard = 0; | 1954 | mActionBeamVCard = 0; |
1943 | mActionBeam = 0; | 1955 | mActionBeam = 0; |
1944 | 1956 | ||
1945 | #ifndef DESKTOP_VERSION | 1957 | #ifndef DESKTOP_VERSION |
1946 | if ( Ir::supported() ) { | 1958 | if ( Ir::supported() ) { |
1947 | mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, | 1959 | mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, |
1948 | SLOT( beamVCard() ), actionCollection(), | 1960 | SLOT( beamVCard() ), actionCollection(), |
1949 | "kaddressbook_beam_vcard" ); | 1961 | "kaddressbook_beam_vcard" ); |
1950 | 1962 | ||
1951 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, | 1963 | mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, |
1952 | SLOT( beamMySelf() ), actionCollection(), | 1964 | SLOT( beamMySelf() ), actionCollection(), |
1953 | "kaddressbook_beam_myself" ); | 1965 | "kaddressbook_beam_myself" ); |
1954 | } | 1966 | } |
1955 | #endif | 1967 | #endif |
1956 | 1968 | ||
1957 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1969 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1958 | this, SLOT( editContact2() ), | 1970 | this, SLOT( editContact2() ), |
1959 | actionCollection(), "file_properties" ); | 1971 | actionCollection(), "file_properties" ); |
1960 | 1972 | ||
1961 | #ifdef KAB_EMBEDDED | 1973 | #ifdef KAB_EMBEDDED |
1962 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1974 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1963 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1975 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1964 | mMainWindow, SLOT( exit() ), | 1976 | mMainWindow, SLOT( exit() ), |
1965 | actionCollection(), "quit" ); | 1977 | actionCollection(), "quit" ); |
1966 | #endif //KAB_EMBEDDED | 1978 | #endif //KAB_EMBEDDED |
1967 | 1979 | ||
1968 | // edit menu | 1980 | // edit menu |
1969 | if ( mIsPart ) { | 1981 | if ( mIsPart ) { |
1970 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1982 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1971 | SLOT( copyContacts() ), actionCollection(), | 1983 | SLOT( copyContacts() ), actionCollection(), |
1972 | "kaddressbook_copy" ); | 1984 | "kaddressbook_copy" ); |
1973 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1985 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1974 | SLOT( cutContacts() ), actionCollection(), | 1986 | SLOT( cutContacts() ), actionCollection(), |
1975 | "kaddressbook_cut" ); | 1987 | "kaddressbook_cut" ); |
1976 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1988 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1977 | SLOT( pasteContacts() ), actionCollection(), | 1989 | SLOT( pasteContacts() ), actionCollection(), |
1978 | "kaddressbook_paste" ); | 1990 | "kaddressbook_paste" ); |
1979 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1991 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1980 | SLOT( selectAllContacts() ), actionCollection(), | 1992 | SLOT( selectAllContacts() ), actionCollection(), |
1981 | "kaddressbook_select_all" ); | 1993 | "kaddressbook_select_all" ); |
1982 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1994 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1983 | SLOT( undo() ), actionCollection(), | 1995 | SLOT( undo() ), actionCollection(), |
1984 | "kaddressbook_undo" ); | 1996 | "kaddressbook_undo" ); |
1985 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1997 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1986 | this, SLOT( redo() ), actionCollection(), | 1998 | this, SLOT( redo() ), actionCollection(), |
1987 | "kaddressbook_redo" ); | 1999 | "kaddressbook_redo" ); |
1988 | } else { | 2000 | } else { |
1989 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 2001 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1990 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 2002 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1991 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 2003 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1992 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 2004 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1993 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 2005 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1994 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 2006 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1995 | } | 2007 | } |
1996 | 2008 | ||
1997 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 2009 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
1998 | Key_Delete, this, SLOT( deleteContacts() ), | 2010 | Key_Delete, this, SLOT( deleteContacts() ), |
1999 | actionCollection(), "edit_delete" ); | 2011 | actionCollection(), "edit_delete" ); |
2000 | 2012 | ||
2001 | mActionUndo->setEnabled( false ); | 2013 | mActionUndo->setEnabled( false ); |
2002 | mActionRedo->setEnabled( false ); | 2014 | mActionRedo->setEnabled( false ); |
2003 | 2015 | ||
2004 | // settings menu | 2016 | // settings menu |
2005 | #ifdef KAB_EMBEDDED | 2017 | #ifdef KAB_EMBEDDED |
2006 | //US special menuentry to configure the addressbook resources. On KDE | 2018 | //US special menuentry to configure the addressbook resources. On KDE |
2007 | // you do that through the control center !!! | 2019 | // you do that through the control center !!! |
2008 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 2020 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
2009 | SLOT( configureResources() ), actionCollection(), | 2021 | SLOT( configureResources() ), actionCollection(), |
2010 | "kaddressbook_configure_resources" ); | 2022 | "kaddressbook_configure_resources" ); |
2011 | #endif //KAB_EMBEDDED | 2023 | #endif //KAB_EMBEDDED |
2012 | 2024 | ||
2013 | if ( mIsPart ) { | 2025 | if ( mIsPart ) { |
2014 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 2026 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
2015 | SLOT( openConfigDialog() ), actionCollection(), | 2027 | SLOT( openConfigDialog() ), actionCollection(), |
2016 | "kaddressbook_configure" ); | 2028 | "kaddressbook_configure" ); |
2017 | 2029 | ||
2018 | //US not implemented yet | 2030 | //US not implemented yet |
2019 | //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 2031 | //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
2020 | // this, SLOT( configureKeyBindings() ), actionCollection(), | 2032 | // this, SLOT( configureKeyBindings() ), actionCollection(), |
2021 | // "kaddressbook_configure_shortcuts" ); | 2033 | // "kaddressbook_configure_shortcuts" ); |
2022 | #ifdef KAB_EMBEDDED | 2034 | #ifdef KAB_EMBEDDED |
2023 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 2035 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
2024 | mActionConfigureToolbars->setEnabled( false ); | 2036 | mActionConfigureToolbars->setEnabled( false ); |
2025 | #endif //KAB_EMBEDDED | 2037 | #endif //KAB_EMBEDDED |
2026 | 2038 | ||
2027 | } else { | 2039 | } else { |
2028 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 2040 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KA/Pi..." ), "configure", 0, this, |
2029 | 2041 | SLOT( openConfigDialog() ), actionCollection(), | |
2030 | //US not implemented yet | 2042 | "kaddressbook_configure" ); |
2031 | //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 2043 | mActionConfigGlobal = new KAction( i18n( "Global Settings..." ), "configure", 0, this, |
2044 | SLOT( openConfigGlobalDialog() ), actionCollection(), | ||
2045 | "kaddressbook_configure" ); | ||
2032 | } | 2046 | } |
2033 | |||
2034 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 2047 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
2035 | actionCollection(), "options_show_jump_bar" ); | 2048 | actionCollection(), "options_show_jump_bar" ); |
2036 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) ); | 2049 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBar( bool ) ) ); |
2037 | 2050 | ||
2038 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, | 2051 | mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, |
2039 | actionCollection(), "options_show_details" ); | 2052 | actionCollection(), "options_show_details" ); |
2040 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 2053 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
2041 | 2054 | ||
2042 | 2055 | ||
2043 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, | 2056 | mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, |
2044 | SLOT( toggleBeamReceive() ), actionCollection(), | 2057 | SLOT( toggleBeamReceive() ), actionCollection(), |
2045 | "kaddressbook_beam_rec" ); | 2058 | "kaddressbook_beam_rec" ); |
2046 | 2059 | ||
2047 | 2060 | ||
2048 | // misc | 2061 | // misc |
2049 | // only enable LDAP lookup if we can handle the protocol | 2062 | // only enable LDAP lookup if we can handle the protocol |
2050 | #ifndef KAB_EMBEDDED | 2063 | #ifndef KAB_EMBEDDED |
2051 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 2064 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
2052 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 2065 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
2053 | this, SLOT( openLDAPDialog() ), actionCollection(), | 2066 | this, SLOT( openLDAPDialog() ), actionCollection(), |
2054 | "ldap_lookup" ); | 2067 | "ldap_lookup" ); |
2055 | } | 2068 | } |
2056 | #else //KAB_EMBEDDED | 2069 | #else //KAB_EMBEDDED |
2057 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 2070 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
2058 | #endif //KAB_EMBEDDED | 2071 | #endif //KAB_EMBEDDED |
2059 | 2072 | ||
2060 | 2073 | ||
2061 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 2074 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
2062 | SLOT( setWhoAmI() ), actionCollection(), | 2075 | SLOT( setWhoAmI() ), actionCollection(), |
2063 | "set_personal" ); | 2076 | "set_personal" ); |
2064 | 2077 | ||
2065 | 2078 | ||
2066 | mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this, | 2079 | mActionCategories = new KAction( i18n( "Set Categories for Contacts..." ), 0, this, |
2067 | SLOT( setCategories() ), actionCollection(), | 2080 | SLOT( setCategories() ), actionCollection(), |
2068 | "edit_set_categories" ); | 2081 | "edit_set_categories" ); |
2069 | mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this, | 2082 | mActionEditCategories = new KAction( i18n( "Edit Category List..." ), 0, this, |
2070 | SLOT( editCategories() ), actionCollection(), | 2083 | SLOT( editCategories() ), actionCollection(), |
2071 | "edit__categories" ); | 2084 | "edit__categories" ); |
2072 | 2085 | ||
2073 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, | 2086 | mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, |
2074 | SLOT( removeVoice() ), actionCollection(), | 2087 | SLOT( removeVoice() ), actionCollection(), |
2075 | "remove_voice" ); | 2088 | "remove_voice" ); |
2076 | mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this, | 2089 | mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this, |
2077 | SLOT( setFormattedName() ), actionCollection(), | 2090 | SLOT( setFormattedName() ), actionCollection(), |
2078 | "set_formatted" ); | 2091 | "set_formatted" ); |
2079 | 2092 | ||
2080 | mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, | 2093 | mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, |
2081 | SLOT( manageCategories() ), actionCollection(), | 2094 | SLOT( manageCategories() ), actionCollection(), |
2082 | "remove_voice" ); | 2095 | "remove_voice" ); |
2083 | 2096 | ||
2084 | 2097 | ||
2085 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, | 2098 | mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, |
2086 | SLOT( importFromOL() ), actionCollection(), | 2099 | SLOT( importFromOL() ), actionCollection(), |
2087 | "import_OL" ); | 2100 | "import_OL" ); |
2088 | #ifdef KAB_EMBEDDED | 2101 | #ifdef KAB_EMBEDDED |
2089 | mActionLicence = new KAction( i18n( "Licence" ), 0, | 2102 | mActionLicence = new KAction( i18n( "Licence" ), 0, |
2090 | this, SLOT( showLicence() ), actionCollection(), | 2103 | this, SLOT( showLicence() ), actionCollection(), |
2091 | "licence_about_data" ); | 2104 | "licence_about_data" ); |
2092 | mActionFaq = new KAction( i18n( "Faq" ), 0, | 2105 | mActionFaq = new KAction( i18n( "Faq" ), 0, |
2093 | this, SLOT( faq() ), actionCollection(), | 2106 | this, SLOT( faq() ), actionCollection(), |
2094 | "faq_about_data" ); | 2107 | "faq_about_data" ); |
2095 | mActionWN = new KAction( i18n( "What's New?" ), 0, | 2108 | mActionWN = new KAction( i18n( "What's New?" ), 0, |
2096 | this, SLOT( whatsnew() ), actionCollection(), | 2109 | this, SLOT( whatsnew() ), actionCollection(), |
2097 | "wn" ); | 2110 | "wn" ); |
2098 | 2111 | ||
2099 | 2112 | ||
2100 | 2113 | ||
2101 | mActionStorageHowto = new KAction( i18n( "Storage HowTo" ), 0, | 2114 | mActionStorageHowto = new KAction( i18n( "Storage HowTo" ), 0, |
2102 | this, SLOT( storagehowto() ), actionCollection(), | 2115 | this, SLOT( storagehowto() ), actionCollection(), |
2103 | "storage" ); | 2116 | "storage" ); |
2104 | 2117 | ||
2105 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, | 2118 | mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, |
2106 | this, SLOT( synchowto() ), actionCollection(), | 2119 | this, SLOT( synchowto() ), actionCollection(), |
2107 | "sync" ); | 2120 | "sync" ); |
2108 | mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, | 2121 | mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, |
2109 | this, SLOT( kdesynchowto() ), actionCollection(), | 2122 | this, SLOT( kdesynchowto() ), actionCollection(), |
2110 | "kdesync" ); | 2123 | "kdesync" ); |
2111 | mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, | 2124 | mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, |
2112 | this, SLOT( multisynchowto() ), actionCollection(), | 2125 | this, SLOT( multisynchowto() ), actionCollection(), |
2113 | "multisync" ); | 2126 | "multisync" ); |
2114 | 2127 | ||
2115 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 2128 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
2116 | this, SLOT( createAboutData() ), actionCollection(), | 2129 | this, SLOT( createAboutData() ), actionCollection(), |
2117 | "kaddressbook_about_data" ); | 2130 | "kaddressbook_about_data" ); |
2118 | #endif //KAB_EMBEDDED | 2131 | #endif //KAB_EMBEDDED |
2119 | 2132 | ||
2120 | clipboardDataChanged(); | 2133 | clipboardDataChanged(); |
2121 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 2134 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
2122 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 2135 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
2123 | } | 2136 | } |
2124 | 2137 | ||
2125 | //US we need this function, to plug all actions into the correct menues. | 2138 | //US we need this function, to plug all actions into the correct menues. |
2126 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 2139 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
2127 | void KABCore::addActionsManually() | 2140 | void KABCore::addActionsManually() |
2128 | { | 2141 | { |
2129 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 2142 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
2130 | 2143 | ||
2131 | #ifdef KAB_EMBEDDED | 2144 | #ifdef KAB_EMBEDDED |
2132 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 2145 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
2133 | QPopupMenu *editMenu = new QPopupMenu( this ); | 2146 | QPopupMenu *editMenu = new QPopupMenu( this ); |
2134 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 2147 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
2135 | 2148 | ||
2136 | KToolBar* tb = mMainWindow->toolBar(); | 2149 | KToolBar* tb = mMainWindow->toolBar(); |
2137 | mMainWindow->setToolBarsMovable (false ); | 2150 | mMainWindow->setToolBarsMovable (false ); |
2138 | #ifndef DESKTOP_VERSION | 2151 | #ifndef DESKTOP_VERSION |
2139 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { | 2152 | if ( KABPrefs::instance()->mFullMenuBarVisible ) { |
2140 | #endif | 2153 | #endif |
2141 | QMenuBar* mb = mMainWindow->menuBar(); | 2154 | QMenuBar* mb = mMainWindow->menuBar(); |
2142 | 2155 | ||
2143 | //US setup menubar. | 2156 | //US setup menubar. |
2144 | //Disable the following block if you do not want to have a menubar. | 2157 | //Disable the following block if you do not want to have a menubar. |
2145 | mb->insertItem( i18n("&File"), fileMenu ); | 2158 | mb->insertItem( i18n("&File"), fileMenu ); |
2146 | mb->insertItem( i18n("&Edit"), editMenu ); | 2159 | mb->insertItem( i18n("&Edit"), editMenu ); |
2147 | mb->insertItem( i18n("&View"), viewMenu ); | 2160 | mb->insertItem( i18n("&View"), viewMenu ); |
2148 | mb->insertItem( i18n("&Settings"), settingsMenu ); | 2161 | mb->insertItem( i18n("&Settings"), settingsMenu ); |
2149 | #ifdef DESKTOP_VERSION | 2162 | #ifdef DESKTOP_VERSION |
2150 | mb->insertItem( i18n("Synchronize"), syncMenu ); | 2163 | mb->insertItem( i18n("Synchronize"), syncMenu ); |
2151 | #else | 2164 | #else |
2152 | mb->insertItem( i18n("Sync"), syncMenu ); | 2165 | mb->insertItem( i18n("Sync"), syncMenu ); |
2153 | #endif | 2166 | #endif |
2154 | //mb->insertItem( i18n("&Change"), changeMenu ); | 2167 | //mb->insertItem( i18n("&Change"), changeMenu ); |
2155 | mb->insertItem( i18n("&Help"), helpMenu ); | 2168 | mb->insertItem( i18n("&Help"), helpMenu ); |
2156 | mIncSearchWidget = new IncSearchWidget( tb ); | 2169 | mIncSearchWidget = new IncSearchWidget( tb ); |
2157 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 2170 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
2158 | #ifndef DESKTOP_VERSION | 2171 | #ifndef DESKTOP_VERSION |
2159 | } else { | 2172 | } else { |
2160 | //US setup toolbar | 2173 | //US setup toolbar |
2161 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); | 2174 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); |
2162 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 2175 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
2163 | menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB); | 2176 | menuBarTB->insertItem( SmallIcon( "z_menu" ) , popupBarTB); |
2164 | tb->insertWidget(-1, 0, menuBarTB); | 2177 | tb->insertWidget(-1, 0, menuBarTB); |
2165 | mIncSearchWidget = new IncSearchWidget( tb ); | 2178 | mIncSearchWidget = new IncSearchWidget( tb ); |
2166 | tb->enableMoving(false); | 2179 | tb->enableMoving(false); |
2167 | popupBarTB->insertItem( i18n("&File"), fileMenu ); | 2180 | popupBarTB->insertItem( i18n("&File"), fileMenu ); |
2168 | popupBarTB->insertItem( i18n("&Edit"), editMenu ); | 2181 | popupBarTB->insertItem( i18n("&Edit"), editMenu ); |
2169 | popupBarTB->insertItem( i18n("&View"), viewMenu ); | 2182 | popupBarTB->insertItem( i18n("&View"), viewMenu ); |
2170 | popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); | 2183 | popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); |
2171 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); | 2184 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); |
2172 | mViewManager->getFilterAction()->plug ( popupBarTB); | 2185 | mViewManager->getFilterAction()->plug ( popupBarTB); |
2173 | //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); | 2186 | //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); |
2174 | popupBarTB->insertItem( i18n("&Help"), helpMenu ); | 2187 | popupBarTB->insertItem( i18n("&Help"), helpMenu ); |
2175 | if (QApplication::desktop()->width() > 320 ) { | 2188 | if (QApplication::desktop()->width() > 320 ) { |
2176 | // mViewManager->getFilterAction()->plug ( tb); | 2189 | // mViewManager->getFilterAction()->plug ( tb); |
2177 | } | 2190 | } |
2178 | } | 2191 | } |
2179 | #endif | 2192 | #endif |
2180 | mIncSearchWidget->setSize(); | 2193 | mIncSearchWidget->setSize(); |
2181 | // mActionQuit->plug ( mMainWindow->toolBar()); | 2194 | // mActionQuit->plug ( mMainWindow->toolBar()); |
2182 | 2195 | ||
2183 | 2196 | ||
2184 | 2197 | ||
2185 | //US Now connect the actions with the menue entries. | 2198 | //US Now connect the actions with the menue entries. |
2186 | #ifdef DESKTOP_VERSION | 2199 | #ifdef DESKTOP_VERSION |
2187 | mActionPrint->plug( fileMenu ); | 2200 | mActionPrint->plug( fileMenu ); |
2188 | mActionPrintDetails->plug( fileMenu ); | 2201 | mActionPrintDetails->plug( fileMenu ); |
2189 | fileMenu->insertSeparator(); | 2202 | fileMenu->insertSeparator(); |
2190 | #endif | 2203 | #endif |
2191 | mActionMail->plug( fileMenu ); | 2204 | mActionMail->plug( fileMenu ); |
2192 | fileMenu->insertSeparator(); | 2205 | fileMenu->insertSeparator(); |
2193 | 2206 | ||
2194 | mActionNewContact->plug( editMenu ); | 2207 | mActionNewContact->plug( editMenu ); |
2195 | mActionNewContact->plug( tb ); | 2208 | mActionNewContact->plug( tb ); |
2196 | 2209 | ||
2197 | mActionEditAddressee->plug( editMenu ); | 2210 | mActionEditAddressee->plug( editMenu ); |
2198 | editMenu->insertSeparator(); | 2211 | editMenu->insertSeparator(); |
2199 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || | 2212 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || |
2200 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) | 2213 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) |
2201 | mActionEditAddressee->plug( tb ); | 2214 | mActionEditAddressee->plug( tb ); |
2202 | 2215 | ||
2203 | // fileMenu->insertSeparator(); | 2216 | // fileMenu->insertSeparator(); |
2204 | mActionSave->plug( fileMenu ); | 2217 | mActionSave->plug( fileMenu ); |
2205 | fileMenu->insertItem( "&Import", ImportMenu ); | 2218 | fileMenu->insertItem( "&Import", ImportMenu ); |
2206 | fileMenu->insertItem( "&Export", ExportMenu ); | 2219 | fileMenu->insertItem( "&Export", ExportMenu ); |
2207 | editMenu->insertItem( i18n("&Change"), changeMenu ); | 2220 | editMenu->insertItem( i18n("&Change"), changeMenu ); |
2208 | editMenu->insertSeparator(); | 2221 | editMenu->insertSeparator(); |
2209 | #ifndef DESKTOP_VERSION | 2222 | #ifndef DESKTOP_VERSION |
2210 | if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); | 2223 | if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); |
2211 | #endif | 2224 | #endif |
2212 | #if 0 | 2225 | #if 0 |
2213 | // PENDING fix MailVCard | 2226 | // PENDING fix MailVCard |
2214 | fileMenu->insertSeparator(); | 2227 | fileMenu->insertSeparator(); |
2215 | mActionMailVCard->plug( fileMenu ); | 2228 | mActionMailVCard->plug( fileMenu ); |
2216 | #endif | 2229 | #endif |
2217 | #ifndef DESKTOP_VERSION | 2230 | #ifndef DESKTOP_VERSION |
2218 | if ( Ir::supported() ) mActionBR->plug( beamMenu ); | 2231 | if ( Ir::supported() ) mActionBR->plug( beamMenu ); |
2219 | if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); | 2232 | if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); |
2220 | if ( Ir::supported() ) mActionBeam->plug( beamMenu ); | 2233 | if ( Ir::supported() ) mActionBeam->plug( beamMenu ); |
2221 | #endif | 2234 | #endif |
2222 | fileMenu->insertSeparator(); | 2235 | fileMenu->insertSeparator(); |
2223 | mActionQuit->plug( fileMenu ); | 2236 | mActionQuit->plug( fileMenu ); |
2224 | #ifdef _OL_IMPORT_ | 2237 | #ifdef _OL_IMPORT_ |
2225 | mActionImportOL->plug( ImportMenu ); | 2238 | mActionImportOL->plug( ImportMenu ); |
2226 | #endif | 2239 | #endif |
2227 | // edit menu | 2240 | // edit menu |
2228 | mActionUndo->plug( editMenu ); | 2241 | mActionUndo->plug( editMenu ); |
2229 | mActionRedo->plug( editMenu ); | 2242 | mActionRedo->plug( editMenu ); |
2230 | editMenu->insertSeparator(); | 2243 | editMenu->insertSeparator(); |
2231 | mActionCut->plug( editMenu ); | 2244 | mActionCut->plug( editMenu ); |
2232 | mActionCopy->plug( editMenu ); | 2245 | mActionCopy->plug( editMenu ); |
2233 | mActionPaste->plug( editMenu ); | 2246 | mActionPaste->plug( editMenu ); |
2234 | mActionDelete->plug( editMenu ); | 2247 | mActionDelete->plug( editMenu ); |
2235 | editMenu->insertSeparator(); | 2248 | editMenu->insertSeparator(); |
2236 | mActionSelectAll->plug( editMenu ); | 2249 | mActionSelectAll->plug( editMenu ); |
2237 | 2250 | ||
2238 | mActionSetFormattedName->plug( changeMenu ); | 2251 | mActionSetFormattedName->plug( changeMenu ); |
2239 | mActionRemoveVoice->plug( changeMenu ); | 2252 | mActionRemoveVoice->plug( changeMenu ); |
2240 | // settingsmings menu | 2253 | // settingsmings menu |
2241 | //US special menuentry to configure the addressbook resources. On KDE | 2254 | //US special menuentry to configure the addressbook resources. On KDE |
2242 | // you do that through the control center !!! | 2255 | // you do that through the control center !!! |
2243 | // settingsMenu->insertSeparator(); | 2256 | // settingsMenu->insertSeparator(); |
2244 | 2257 | ||
2245 | mActionConfigKAddressbook->plug( settingsMenu, 0 ); | 2258 | mActionConfigKAddressbook->plug( settingsMenu, 0 ); |
2246 | mActionConfigResources->plug( settingsMenu,1 ); | 2259 | mActionConfigGlobal->plug( settingsMenu, 1 ); |
2247 | settingsMenu->insertSeparator(2); | 2260 | mActionConfigResources->plug( settingsMenu,2 ); |
2261 | settingsMenu->insertSeparator(3); | ||
2248 | 2262 | ||
2249 | if ( mIsPart ) { | 2263 | if ( mIsPart ) { |
2250 | //US not implemented yet | 2264 | //US not implemented yet |
2251 | //mActionConfigShortcuts->plug( settingsMenu ); | 2265 | //mActionConfigShortcuts->plug( settingsMenu ); |
2252 | //mActionConfigureToolbars->plug( settingsMenu ); | 2266 | //mActionConfigureToolbars->plug( settingsMenu ); |
2253 | 2267 | ||
2254 | } else { | 2268 | } else { |
2255 | //US not implemented yet | 2269 | //US not implemented yet |
2256 | //mActionKeyBindings->plug( settingsMenu ); | 2270 | //mActionKeyBindings->plug( settingsMenu ); |
2257 | } | 2271 | } |
2258 | 2272 | ||
2259 | mActionEditCategories->plug( settingsMenu ); | 2273 | mActionEditCategories->plug( settingsMenu ); |
2260 | mActionManageCategories->plug( settingsMenu ); | 2274 | mActionManageCategories->plug( settingsMenu ); |
2261 | mActionJumpBar->plug( viewMenu,0 ); | 2275 | mActionJumpBar->plug( viewMenu,0 ); |
2262 | mActionDetails->plug( viewMenu,0 ); | 2276 | mActionDetails->plug( viewMenu,0 ); |
2263 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 2277 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
2264 | mActionDetails->plug( tb ); | 2278 | mActionDetails->plug( tb ); |
2265 | settingsMenu->insertSeparator(); | 2279 | settingsMenu->insertSeparator(); |
2266 | #ifndef DESKTOP_VERSION | 2280 | #ifndef DESKTOP_VERSION |
2267 | if ( Ir::supported() ) mActionBR->plug(settingsMenu ); | 2281 | if ( Ir::supported() ) mActionBR->plug(settingsMenu ); |
2268 | settingsMenu->insertSeparator(); | 2282 | settingsMenu->insertSeparator(); |
2269 | #endif | 2283 | #endif |
2270 | 2284 | ||
2271 | mActionWhoAmI->plug( settingsMenu ); | 2285 | mActionWhoAmI->plug( settingsMenu ); |
2272 | //mActionEditCategories->plug( changeMenu ); | 2286 | //mActionEditCategories->plug( changeMenu ); |
2273 | mActionCategories->plug( changeMenu ); | 2287 | mActionCategories->plug( changeMenu ); |
2274 | //mActionManageCategories->plug( changeMenu ); | 2288 | //mActionManageCategories->plug( changeMenu ); |
2275 | 2289 | ||
2276 | //mActionCategories->plug( settingsMenu ); | 2290 | //mActionCategories->plug( settingsMenu ); |
2277 | 2291 | ||
2278 | 2292 | ||
2279 | mActionWN->plug( helpMenu ); | 2293 | mActionWN->plug( helpMenu ); |
2280 | mActionStorageHowto->plug( helpMenu ); | 2294 | mActionStorageHowto->plug( helpMenu ); |
2281 | mActionSyncHowto->plug( helpMenu ); | 2295 | mActionSyncHowto->plug( helpMenu ); |
2282 | mActionKdeSyncHowto->plug( helpMenu ); | 2296 | mActionKdeSyncHowto->plug( helpMenu ); |
2283 | mActionMultiSyncHowto->plug( helpMenu ); | 2297 | mActionMultiSyncHowto->plug( helpMenu ); |
2284 | mActionFaq->plug( helpMenu ); | 2298 | mActionFaq->plug( helpMenu ); |
2285 | mActionLicence->plug( helpMenu ); | 2299 | mActionLicence->plug( helpMenu ); |
2286 | mActionAboutKAddressbook->plug( helpMenu ); | 2300 | mActionAboutKAddressbook->plug( helpMenu ); |
2287 | 2301 | ||
2288 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 2302 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
2289 | 2303 | ||
2290 | mActionSave->plug( tb ); | 2304 | mActionSave->plug( tb ); |
2291 | mViewManager->getFilterAction()->plug ( tb); | 2305 | mViewManager->getFilterAction()->plug ( tb); |
2292 | //LR hide filteraction on started in 480x640 | 2306 | //LR hide filteraction on started in 480x640 |
2293 | if (QApplication::desktop()->width() == 480 ) { | 2307 | if (QApplication::desktop()->width() == 480 ) { |
2294 | mViewManager->getFilterAction()->setComboWidth( 0 ); | 2308 | mViewManager->getFilterAction()->setComboWidth( 0 ); |
2295 | } | 2309 | } |
2296 | mActionUndo->plug( tb ); | 2310 | mActionUndo->plug( tb ); |
2297 | mActionDelete->plug( tb ); | 2311 | mActionDelete->plug( tb ); |
2298 | mActionRedo->plug( tb ); | 2312 | mActionRedo->plug( tb ); |
2299 | } else { | 2313 | } else { |
2300 | mActionSave->plug( tb ); | 2314 | mActionSave->plug( tb ); |
2301 | tb->enableMoving(false); | 2315 | tb->enableMoving(false); |
2302 | } | 2316 | } |
2303 | //mActionQuit->plug ( tb ); | 2317 | //mActionQuit->plug ( tb ); |
2304 | //tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 2318 | //tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
2305 | 2319 | ||
2306 | //US link the searchwidget first to this. | 2320 | //US link the searchwidget first to this. |
2307 | // The real linkage to the toolbar happens later. | 2321 | // The real linkage to the toolbar happens later. |
2308 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 2322 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
2309 | //US tb->insertItem( mIncSearchWidget ); | 2323 | //US tb->insertItem( mIncSearchWidget ); |
2310 | /*US | 2324 | /*US |
2311 | mIncSearchWidget = new IncSearchWidget( tb ); | 2325 | mIncSearchWidget = new IncSearchWidget( tb ); |
2312 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 2326 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
2313 | SLOT( incrementalSearch( const QString& ) ) ); | 2327 | SLOT( incrementalSearch( const QString& ) ) ); |
2314 | 2328 | ||
2315 | mJumpButtonBar = new JumpButtonBar( this, this ); | 2329 | mJumpButtonBar = new JumpButtonBar( this, this ); |
2316 | 2330 | ||
2317 | //US topLayout->addWidget( mJumpButtonBar ); | 2331 | //US topLayout->addWidget( mJumpButtonBar ); |
2318 | this->layout()->add( mJumpButtonBar ); | 2332 | this->layout()->add( mJumpButtonBar ); |
2319 | */ | 2333 | */ |
2320 | 2334 | ||
2321 | #endif //KAB_EMBEDDED | 2335 | #endif //KAB_EMBEDDED |
2322 | 2336 | ||
2323 | mActionExport2phone->plug( ExportMenu ); | 2337 | mActionExport2phone->plug( ExportMenu ); |
2324 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 2338 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
2325 | syncManager->fillSyncMenu(); | 2339 | syncManager->fillSyncMenu(); |
2326 | 2340 | ||
2327 | } | 2341 | } |
2328 | void KABCore::showLicence() | 2342 | void KABCore::showLicence() |
2329 | { | 2343 | { |
2330 | KApplication::showLicence(); | 2344 | KApplication::showLicence(); |
2331 | } | 2345 | } |
2332 | 2346 | ||
2333 | void KABCore::manageCategories( ) | 2347 | void KABCore::manageCategories( ) |
2334 | { | 2348 | { |
2335 | KABCatPrefs* cp = new KABCatPrefs(); | 2349 | KABCatPrefs* cp = new KABCatPrefs(); |
2336 | cp->show(); | 2350 | cp->show(); |
2337 | int w =cp->sizeHint().width() ; | 2351 | int w =cp->sizeHint().width() ; |
2338 | int h = cp->sizeHint().height() ; | 2352 | int h = cp->sizeHint().height() ; |
2339 | int dw = QApplication::desktop()->width(); | 2353 | int dw = QApplication::desktop()->width(); |
2340 | int dh = QApplication::desktop()->height(); | 2354 | int dh = QApplication::desktop()->height(); |
2341 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2355 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2342 | if ( !cp->exec() ) { | 2356 | if ( !cp->exec() ) { |
2343 | delete cp; | 2357 | delete cp; |
2344 | return; | 2358 | return; |
2345 | } | 2359 | } |
2346 | int count = 0; | 2360 | int count = 0; |
2347 | int cc = 0; | 2361 | int cc = 0; |
2348 | message( i18n("Please wait, processing categories...")); | 2362 | message( i18n("Please wait, processing categories...")); |
2349 | if ( cp->addCat() ) { | 2363 | if ( cp->addCat() ) { |
2350 | KABC::AddressBook::Iterator it; | 2364 | KABC::AddressBook::Iterator it; |
2351 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2365 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2352 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2366 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2353 | ++cc; | 2367 | ++cc; |
2354 | if ( cc %10 == 0) | 2368 | if ( cc %10 == 0) |
2355 | message(i18n("Processing contact #%1").arg(cc)); | 2369 | message(i18n("Processing contact #%1").arg(cc)); |
2356 | QStringList catIncList = (*it).categories(); | 2370 | QStringList catIncList = (*it).categories(); |
2357 | int i; | 2371 | int i; |
2358 | for( i = 0; i< catIncList.count(); ++i ) { | 2372 | for( i = 0; i< catIncList.count(); ++i ) { |
2359 | if ( !catList.contains (catIncList[i])) { | 2373 | if ( !catList.contains (catIncList[i])) { |
2360 | catList.append( catIncList[i] ); | 2374 | catList.append( catIncList[i] ); |
2361 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2375 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2362 | ++count; | 2376 | ++count; |
2363 | } | 2377 | } |
2364 | } | 2378 | } |
2365 | } | 2379 | } |
2366 | catList.sort(); | 2380 | catList.sort(); |
2367 | KABPrefs::instance()->mCustomCategories = catList; | 2381 | KABPrefs::instance()->mCustomCategories = catList; |
2368 | KABPrefs::instance()->writeConfig(); | 2382 | KABPrefs::instance()->writeConfig(); |
2369 | message(QString::number( count )+ i18n(" categories added to list! ")); | 2383 | message(QString::number( count )+ i18n(" categories added to list! ")); |
2370 | } else { | 2384 | } else { |
2371 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2385 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2372 | QStringList catIncList; | 2386 | QStringList catIncList; |
2373 | QStringList newCatList; | 2387 | QStringList newCatList; |
2374 | KABC::AddressBook::Iterator it; | 2388 | KABC::AddressBook::Iterator it; |
2375 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2389 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2376 | ++cc; | 2390 | ++cc; |
2377 | if ( cc %10 == 0) | 2391 | if ( cc %10 == 0) |
2378 | message(i18n("Processing contact #%1").arg(cc)); | 2392 | message(i18n("Processing contact #%1").arg(cc)); |
2379 | QStringList catIncList = (*it).categories(); | 2393 | QStringList catIncList = (*it).categories(); |
2380 | int i; | 2394 | int i; |
2381 | if ( catIncList.count() ) { | 2395 | if ( catIncList.count() ) { |
2382 | newCatList.clear(); | 2396 | newCatList.clear(); |
2383 | for( i = 0; i< catIncList.count(); ++i ) { | 2397 | for( i = 0; i< catIncList.count(); ++i ) { |
2384 | if ( catList.contains (catIncList[i])) { | 2398 | if ( catList.contains (catIncList[i])) { |
2385 | newCatList.append( catIncList[i] ); | 2399 | newCatList.append( catIncList[i] ); |
2386 | } | 2400 | } |
2387 | } | 2401 | } |
2388 | newCatList.sort(); | 2402 | newCatList.sort(); |
2389 | (*it).setCategories( newCatList ); | 2403 | (*it).setCategories( newCatList ); |
2390 | mAddressBook->insertAddressee( (*it) ); | 2404 | mAddressBook->insertAddressee( (*it) ); |
2391 | } | 2405 | } |
2392 | } | 2406 | } |
2393 | setModified( true ); | 2407 | setModified( true ); |
2394 | mViewManager->refreshView(); | 2408 | mViewManager->refreshView(); |
2395 | message( i18n("Removing categories done!")); | 2409 | message( i18n("Removing categories done!")); |
2396 | } | 2410 | } |
2397 | delete cp; | 2411 | delete cp; |
2398 | } | 2412 | } |
2399 | void KABCore::removeVoice() | 2413 | void KABCore::removeVoice() |
2400 | { | 2414 | { |
2401 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) | 2415 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) |
2402 | return; | 2416 | return; |
2403 | XXPortSelectDialog dlg( this, false, this ); | 2417 | XXPortSelectDialog dlg( this, false, this ); |
2404 | if ( !dlg.exec() ) | 2418 | if ( !dlg.exec() ) |
2405 | return; | 2419 | return; |
2406 | mAddressBook->setUntagged(); | 2420 | mAddressBook->setUntagged(); |
2407 | dlg.tagSelected(); | 2421 | dlg.tagSelected(); |
2408 | message(i18n("Removing voice..."), false ); | 2422 | message(i18n("Removing voice..."), false ); |
2409 | KABC::AddressBook::Iterator it; | 2423 | KABC::AddressBook::Iterator it; |
2410 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2424 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2411 | if ( (*it).tagged() ) { | 2425 | if ( (*it).tagged() ) { |
2412 | (*it).removeVoice(); | 2426 | (*it).removeVoice(); |
2413 | } | 2427 | } |
2414 | } | 2428 | } |
2415 | message(i18n("Refreshing view...") ); | 2429 | message(i18n("Refreshing view...") ); |
2416 | qApp->processEvents(); | 2430 | qApp->processEvents(); |
2417 | mViewManager->refreshView( "" ); | 2431 | mViewManager->refreshView( "" ); |
2418 | Addressee add; | 2432 | Addressee add; |
2419 | mDetails->setAddressee( add ); | 2433 | mDetails->setAddressee( add ); |
2420 | message(i18n("Remove voice completed!") ); | 2434 | message(i18n("Remove voice completed!") ); |
2421 | 2435 | ||
2422 | 2436 | ||
2423 | 2437 | ||
2424 | } | 2438 | } |
2425 | 2439 | ||
2426 | void KABCore::setFormattedName() | 2440 | void KABCore::setFormattedName() |
2427 | { | 2441 | { |
2428 | KABFormatPrefs setpref; | 2442 | KABFormatPrefs setpref; |
2429 | if ( !setpref.exec() ) { | 2443 | if ( !setpref.exec() ) { |
2430 | return; | 2444 | return; |
2431 | } | 2445 | } |
2432 | XXPortSelectDialog dlg( this, false, this ); | 2446 | XXPortSelectDialog dlg( this, false, this ); |
2433 | if ( !dlg.exec() ) | 2447 | if ( !dlg.exec() ) |
2434 | return; | 2448 | return; |
2435 | mAddressBook->setUntagged(); | 2449 | mAddressBook->setUntagged(); |
2436 | dlg.tagSelected(); | 2450 | dlg.tagSelected(); |
2437 | int count = 0; | 2451 | int count = 0; |
2438 | KABC::AddressBook::Iterator it; | 2452 | KABC::AddressBook::Iterator it; |
2439 | bool modified = false; | 2453 | bool modified = false; |
2440 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2454 | for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2441 | if ( (*it).tagged() ) { | 2455 | if ( (*it).tagged() ) { |
2442 | if ( (*it).uid().left( 2 ) == "la" ) | 2456 | if ( (*it).uid().left( 2 ) == "la" ) |
2443 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) | 2457 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) |
2444 | continue; | 2458 | continue; |
2445 | ++count; | 2459 | ++count; |
2446 | if ( count %10 == 0 ) | 2460 | if ( count %10 == 0 ) |
2447 | message(i18n("Changing contact #%1").arg( count ) ); | 2461 | message(i18n("Changing contact #%1").arg( count ) ); |
2448 | qApp->processEvents(); | 2462 | qApp->processEvents(); |
2449 | QString fName; | 2463 | QString fName; |
2450 | if ( setpref.simple->isChecked() ) | 2464 | if ( setpref.simple->isChecked() ) |
2451 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); | 2465 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); |
2452 | else if ( setpref.full->isChecked() ) | 2466 | else if ( setpref.full->isChecked() ) |
2453 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); | 2467 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); |
2454 | else if ( setpref.reverse->isChecked() ) | 2468 | else if ( setpref.reverse->isChecked() ) |
2455 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); | 2469 | fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); |
2456 | else | 2470 | else |
2457 | fName = (*it).organization(); | 2471 | fName = (*it).organization(); |
2458 | if ( setpref.setCompany->isChecked() ) | 2472 | if ( setpref.setCompany->isChecked() ) |
2459 | if ( fName.isEmpty() || fName =="," ) | 2473 | if ( fName.isEmpty() || fName =="," ) |
2460 | fName = (*it).organization(); | 2474 | fName = (*it).organization(); |
2461 | (*it).setFormattedName( fName ); | 2475 | (*it).setFormattedName( fName ); |
2462 | (*it).setChanged( true ); | 2476 | (*it).setChanged( true ); |
2463 | modified = true; | 2477 | modified = true; |
2464 | (*it).setRevision( QDateTime::currentDateTime() ); | 2478 | (*it).setRevision( QDateTime::currentDateTime() ); |
2465 | } | 2479 | } |
2466 | } | 2480 | } |
2467 | message(i18n("Refreshing view...") ); | 2481 | message(i18n("Refreshing view...") ); |
2468 | qApp->processEvents(); | 2482 | qApp->processEvents(); |
2469 | if ( modified ) | 2483 | if ( modified ) |
2470 | setModified( true ); | 2484 | setModified( true ); |
2471 | Addressee add; | 2485 | Addressee add; |
2472 | mDetails->setAddressee( add ); | 2486 | mDetails->setAddressee( add ); |
2473 | if ( count == 0 ) | 2487 | if ( count == 0 ) |
2474 | message(i18n("No contact changed!") ); | 2488 | message(i18n("No contact changed!") ); |
2475 | else | 2489 | else |
2476 | message(i18n("%1 contacts changed!").arg( count ) ); | 2490 | message(i18n("%1 contacts changed!").arg( count ) ); |
2477 | } | 2491 | } |
2478 | 2492 | ||
2479 | void KABCore::clipboardDataChanged() | 2493 | void KABCore::clipboardDataChanged() |
2480 | { | 2494 | { |
2481 | 2495 | ||
2482 | if ( mReadWrite ) | 2496 | if ( mReadWrite ) |
2483 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 2497 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
2484 | 2498 | ||
2485 | } | 2499 | } |
2486 | 2500 | ||
2487 | void KABCore::updateActionMenu() | 2501 | void KABCore::updateActionMenu() |
2488 | { | 2502 | { |
2489 | UndoStack *undo = UndoStack::instance(); | 2503 | UndoStack *undo = UndoStack::instance(); |
2490 | RedoStack *redo = RedoStack::instance(); | 2504 | RedoStack *redo = RedoStack::instance(); |
2491 | 2505 | ||
2492 | if ( undo->isEmpty() ) | 2506 | if ( undo->isEmpty() ) |
2493 | mActionUndo->setText( i18n( "Undo" ) ); | 2507 | mActionUndo->setText( i18n( "Undo" ) ); |
2494 | else | 2508 | else |
2495 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 2509 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
2496 | 2510 | ||
2497 | mActionUndo->setEnabled( !undo->isEmpty() ); | 2511 | mActionUndo->setEnabled( !undo->isEmpty() ); |
2498 | 2512 | ||
2499 | if ( !redo->top() ) | 2513 | if ( !redo->top() ) |
2500 | mActionRedo->setText( i18n( "Redo" ) ); | 2514 | mActionRedo->setText( i18n( "Redo" ) ); |
2501 | else | 2515 | else |
2502 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 2516 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
2503 | 2517 | ||
2504 | mActionRedo->setEnabled( !redo->isEmpty() ); | 2518 | mActionRedo->setEnabled( !redo->isEmpty() ); |
2505 | } | 2519 | } |
2506 | 2520 | ||
2507 | void KABCore::configureKeyBindings() | 2521 | void KABCore::configureKeyBindings() |
2508 | { | 2522 | { |
2509 | #ifndef KAB_EMBEDDED | 2523 | #ifndef KAB_EMBEDDED |
2510 | KKeyDialog::configure( actionCollection(), true ); | 2524 | KKeyDialog::configure( actionCollection(), true ); |
2511 | #else //KAB_EMBEDDED | 2525 | #else //KAB_EMBEDDED |
2512 | qDebug("KABCore::configureKeyBindings() not implemented"); | 2526 | qDebug("KABCore::configureKeyBindings() not implemented"); |
2513 | #endif //KAB_EMBEDDED | 2527 | #endif //KAB_EMBEDDED |
2514 | } | 2528 | } |
2515 | 2529 | ||
2516 | #ifdef KAB_EMBEDDED | 2530 | #ifdef KAB_EMBEDDED |
2517 | void KABCore::configureResources() | 2531 | void KABCore::configureResources() |
2518 | { | 2532 | { |
2519 | KRES::KCMKResources dlg( this, "" , 0 ); | 2533 | KRES::KCMKResources dlg( this, "" , 0 ); |
2520 | 2534 | ||
2521 | if ( !dlg.exec() ) | 2535 | if ( !dlg.exec() ) |
2522 | return; | 2536 | return; |
2523 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | 2537 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); |
2524 | } | 2538 | } |
2525 | #endif //KAB_EMBEDDED | 2539 | #endif //KAB_EMBEDDED |
2526 | 2540 | ||
2527 | 2541 | ||
2528 | /* this method will be called through the QCop interface from Ko/Pi to select addresses | 2542 | /* this method will be called through the QCop interface from Ko/Pi to select addresses |
2529 | * for the attendees list of an event. | 2543 | * for the attendees list of an event. |
2530 | */ | 2544 | */ |
2531 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) | 2545 | void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) |
2532 | { | 2546 | { |
2533 | 2547 | ||
2534 | bool ok = false; | 2548 | bool ok = false; |
2535 | mEmailSourceChannel = sourceChannel; | 2549 | mEmailSourceChannel = sourceChannel; |
2536 | mEmailSourceUID = uid; | 2550 | mEmailSourceUID = uid; |
2537 | callContactdialog(); | 2551 | callContactdialog(); |
2538 | #if 0 | 2552 | #if 0 |
2539 | int wid = uid.toInt( &ok ); | 2553 | int wid = uid.toInt( &ok ); |
2540 | qDebug("UID %s ", uid.latin1()); | 2554 | qDebug("UID %s ", uid.latin1()); |
2541 | if ( ok ) { | 2555 | if ( ok ) { |
2542 | if ( wid != QApplication::desktop()->width() ) { | 2556 | if ( wid != QApplication::desktop()->width() ) { |
2543 | qDebug("KA/Pi: Request from different desktop geometry. Resizing ..."); | 2557 | qDebug("KA/Pi: Request from different desktop geometry. Resizing ..."); |
2544 | message( i18n("Resizing, please wait...") ); | 2558 | message( i18n("Resizing, please wait...") ); |
2545 | mMainWindow->showMinimized(); | 2559 | mMainWindow->showMinimized(); |
2546 | /* | 2560 | /* |
2547 | { | 2561 | { |
2548 | QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); | 2562 | QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); |
2549 | } | 2563 | } |
2550 | */ | 2564 | */ |
2551 | QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) ); | 2565 | QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) ); |
2552 | return; | 2566 | return; |
2553 | } | 2567 | } |
2554 | 2568 | ||
2555 | } else { | 2569 | } else { |
2556 | qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid "); | 2570 | qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid "); |
2557 | } | 2571 | } |
2558 | callContactdialog(); | 2572 | callContactdialog(); |
2559 | //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); | 2573 | //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); |
2560 | #endif | 2574 | #endif |
2561 | } | 2575 | } |
2562 | void KABCore::resizeAndCallContactdialog() | 2576 | void KABCore::resizeAndCallContactdialog() |
2563 | { | 2577 | { |
2564 | updateMainWindow(); | 2578 | updateMainWindow(); |
2565 | QTimer::singleShot( 100,this, SLOT ( callContactdialog() ) ); | 2579 | QTimer::singleShot( 100,this, SLOT ( callContactdialog() ) ); |
2566 | } | 2580 | } |
2567 | 2581 | ||
2568 | void KABCore::callContactdialog() | 2582 | void KABCore::callContactdialog() |
2569 | { | 2583 | { |
2570 | QStringList nameList; | 2584 | QStringList nameList; |
2571 | QStringList emailList; | 2585 | QStringList emailList; |
2572 | QStringList uidList; | 2586 | QStringList uidList; |
2573 | qDebug(" KABCore::callContactdialog:DESKTOP WIDTH %d ", QApplication::desktop()->width() ); | 2587 | qDebug(" KABCore::callContactdialog:DESKTOP WIDTH %d ", QApplication::desktop()->width() ); |
2574 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 2588 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
2575 | uint i=0; | 2589 | uint i=0; |
2576 | for (i=0; i < list.count(); i++) | 2590 | for (i=0; i < list.count(); i++) |
2577 | { | 2591 | { |
2578 | nameList.append(list[i].realName()); | 2592 | nameList.append(list[i].realName()); |
2579 | emailList.append(list[i].preferredEmail()); | 2593 | emailList.append(list[i].preferredEmail()); |
2580 | uidList.append(list[i].uid()); | 2594 | uidList.append(list[i].uid()); |
2581 | } | 2595 | } |
2582 | QString uid = mEmailSourceUID; | 2596 | QString uid = mEmailSourceUID; |
2583 | //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); | 2597 | //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); |
2584 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList); | 2598 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList); |
2585 | 2599 | ||
2586 | } | 2600 | } |
2587 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays | 2601 | /* this method will be called through the QCop interface from Ko/Pi to select birthdays |
2588 | * to put them into the calendar. | 2602 | * to put them into the calendar. |
2589 | */ | 2603 | */ |
2590 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) | 2604 | void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) |
2591 | { | 2605 | { |
2592 | // qDebug("KABCore::requestForBirthdayList"); | 2606 | // qDebug("KABCore::requestForBirthdayList"); |
2593 | QStringList birthdayList; | 2607 | QStringList birthdayList; |
2594 | QStringList anniversaryList; | 2608 | QStringList anniversaryList; |
2595 | QStringList realNameList; | 2609 | QStringList realNameList; |
2596 | QStringList preferredEmailList; | 2610 | QStringList preferredEmailList; |
2597 | QStringList assembledNameList; | 2611 | QStringList assembledNameList; |
2598 | QStringList uidList; | 2612 | QStringList uidList; |
2599 | 2613 | ||
2600 | KABC::AddressBook::Iterator it; | 2614 | KABC::AddressBook::Iterator it; |
2601 | 2615 | ||
2602 | int count = 0; | 2616 | int count = 0; |
2603 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2617 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2604 | ++count; | 2618 | ++count; |
2605 | } | 2619 | } |
2606 | QProgressBar bar(count,0 ); | 2620 | QProgressBar bar(count,0 ); |
2607 | int w = 300; | 2621 | int w = 300; |
2608 | if ( QApplication::desktop()->width() < 320 ) | 2622 | if ( QApplication::desktop()->width() < 320 ) |
2609 | w = 220; | 2623 | w = 220; |
2610 | int h = bar.sizeHint().height() ; | 2624 | int h = bar.sizeHint().height() ; |
2611 | int dw = QApplication::desktop()->width(); | 2625 | int dw = QApplication::desktop()->width(); |
2612 | int dh = QApplication::desktop()->height(); | 2626 | int dh = QApplication::desktop()->height(); |
2613 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2627 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2614 | bar.show(); | 2628 | bar.show(); |
2615 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); | 2629 | bar.setCaption (i18n("Collecting birthdays - close to abort!") ); |
2616 | qApp->processEvents(); | 2630 | qApp->processEvents(); |
2617 | 2631 | ||
2618 | QDate bday; | 2632 | QDate bday; |
2619 | QString anni; | 2633 | QString anni; |
2620 | QString formattedbday; | 2634 | QString formattedbday; |
2621 | 2635 | ||
2622 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) | 2636 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) |
2623 | { | 2637 | { |
2624 | if ( ! bar.isVisible() ) | 2638 | if ( ! bar.isVisible() ) |
2625 | return; | 2639 | return; |
2626 | bar.setProgress( count++ ); | 2640 | bar.setProgress( count++ ); |
2627 | qApp->processEvents(); | 2641 | qApp->processEvents(); |
2628 | bday = (*it).birthday().date(); | 2642 | bday = (*it).birthday().date(); |
2629 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); | 2643 | anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); |
2630 | 2644 | ||
2631 | if ( bday.isValid() || !anni.isEmpty()) | 2645 | if ( bday.isValid() || !anni.isEmpty()) |
2632 | { | 2646 | { |
2633 | if (bday.isValid()) | 2647 | if (bday.isValid()) |
2634 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); | 2648 | formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); |
2635 | else | 2649 | else |
2636 | formattedbday = "NOTVALID"; | 2650 | formattedbday = "NOTVALID"; |
2637 | if (anni.isEmpty()) | 2651 | if (anni.isEmpty()) |
2638 | anni = "INVALID"; | 2652 | anni = "INVALID"; |
2639 | 2653 | ||
2640 | birthdayList.append(formattedbday); | 2654 | birthdayList.append(formattedbday); |
2641 | anniversaryList.append(anni); //should be ISODate | 2655 | anniversaryList.append(anni); //should be ISODate |
2642 | realNameList.append((*it).realName()); | 2656 | realNameList.append((*it).realName()); |
2643 | preferredEmailList.append((*it).preferredEmail()); | 2657 | preferredEmailList.append((*it).preferredEmail()); |
2644 | assembledNameList.append((*it).assembledName()); | 2658 | assembledNameList.append((*it).assembledName()); |
2645 | uidList.append((*it).uid()); | 2659 | uidList.append((*it).uid()); |
2646 | 2660 | ||
2647 | //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); | 2661 | //qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() ); |
2648 | } | 2662 | } |
2649 | } | 2663 | } |
2650 | 2664 | ||
2651 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); | 2665 | bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); |
2652 | 2666 | ||
2653 | } | 2667 | } |
2654 | 2668 | ||
2655 | /* this method will be called through the QCop interface from other apps to show details of a contact. | 2669 | /* this method will be called through the QCop interface from other apps to show details of a contact. |
2656 | */ | 2670 | */ |
2657 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 2671 | void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) |
2658 | { | 2672 | { |
2659 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); | 2673 | //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); |
2660 | 2674 | ||
2661 | QString foundUid = QString::null; | 2675 | QString foundUid = QString::null; |
2662 | if ( ! uid.isEmpty() ) { | 2676 | if ( ! uid.isEmpty() ) { |
2663 | Addressee adrr = mAddressBook->findByUid( uid ); | 2677 | Addressee adrr = mAddressBook->findByUid( uid ); |
2664 | if ( !adrr.isEmpty() ) { | 2678 | if ( !adrr.isEmpty() ) { |
2665 | foundUid = uid; | 2679 | foundUid = uid; |
2666 | } | 2680 | } |
2667 | if ( email == "sendbacklist" ) { | 2681 | if ( email == "sendbacklist" ) { |
2668 | //qDebug("ssssssssssssssssssssssend "); | 2682 | //qDebug("ssssssssssssssssssssssend "); |
2669 | QStringList nameList; | 2683 | QStringList nameList; |
2670 | QStringList emailList; | 2684 | QStringList emailList; |
2671 | QStringList uidList; | 2685 | QStringList uidList; |
2672 | nameList.append(adrr.realName()); | 2686 | nameList.append(adrr.realName()); |
2673 | emailList = adrr.emails(); | 2687 | emailList = adrr.emails(); |
2674 | uidList.append( adrr.preferredEmail()); | 2688 | uidList.append( adrr.preferredEmail()); |
2675 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 2689 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
2676 | return; | 2690 | return; |
2677 | } | 2691 | } |
2678 | 2692 | ||
2679 | } | 2693 | } |
2680 | 2694 | ||
2681 | if ( email == "sendbacklist" ) | 2695 | if ( email == "sendbacklist" ) |
2682 | return; | 2696 | return; |
2683 | if (foundUid.isEmpty()) | 2697 | if (foundUid.isEmpty()) |
2684 | { | 2698 | { |
2685 | //find the uid of the person first | 2699 | //find the uid of the person first |
2686 | Addressee::List namelist; | 2700 | Addressee::List namelist; |
2687 | Addressee::List emaillist; | 2701 | Addressee::List emaillist; |
2688 | 2702 | ||
2689 | if (!name.isEmpty()) | 2703 | if (!name.isEmpty()) |
2690 | namelist = mAddressBook->findByName( name ); | 2704 | namelist = mAddressBook->findByName( name ); |
2691 | 2705 | ||
2692 | if (!email.isEmpty()) | 2706 | if (!email.isEmpty()) |
2693 | emaillist = mAddressBook->findByEmail( email ); | 2707 | emaillist = mAddressBook->findByEmail( email ); |
2694 | //qDebug("count %d %d ", namelist.count(),emaillist.count() ); | 2708 | //qDebug("count %d %d ", namelist.count(),emaillist.count() ); |
2695 | //check if we have a match in Namelist and Emaillist | 2709 | //check if we have a match in Namelist and Emaillist |
2696 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { | 2710 | if ((namelist.count() == 0) && (emaillist.count() > 0)) { |
2697 | foundUid = emaillist[0].uid(); | 2711 | foundUid = emaillist[0].uid(); |
2698 | } | 2712 | } |
2699 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) | 2713 | else if ((namelist.count() > 0) && (emaillist.count() == 0)) |
2700 | foundUid = namelist[0].uid(); | 2714 | foundUid = namelist[0].uid(); |
2701 | else | 2715 | else |
2702 | { | 2716 | { |
2703 | for (int i = 0; i < namelist.count(); i++) | 2717 | for (int i = 0; i < namelist.count(); i++) |
2704 | { | 2718 | { |
2705 | for (int j = 0; j < emaillist.count(); j++) | 2719 | for (int j = 0; j < emaillist.count(); j++) |
2706 | { | 2720 | { |
2707 | if (namelist[i] == emaillist[j]) | 2721 | if (namelist[i] == emaillist[j]) |
2708 | { | 2722 | { |
2709 | foundUid = namelist[i].uid(); | 2723 | foundUid = namelist[i].uid(); |
2710 | } | 2724 | } |
2711 | } | 2725 | } |
2712 | } | 2726 | } |
2713 | } | 2727 | } |
2714 | } | 2728 | } |
2715 | else | 2729 | else |
2716 | { | 2730 | { |
2717 | foundUid = uid; | 2731 | foundUid = uid; |
2718 | } | 2732 | } |
2719 | 2733 | ||
2720 | if (!foundUid.isEmpty()) | 2734 | if (!foundUid.isEmpty()) |
2721 | { | 2735 | { |
2722 | 2736 | ||
2723 | // raise Ka/Pi if it is in the background | 2737 | // raise Ka/Pi if it is in the background |
2724 | #ifndef DESKTOP_VERSION | 2738 | #ifndef DESKTOP_VERSION |
2725 | #ifndef KORG_NODCOP | 2739 | #ifndef KORG_NODCOP |
2726 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); | 2740 | //QCopEnvelope e("QPE/Application/kapi", "raise()"); |
2727 | #endif | 2741 | #endif |
2728 | #endif | 2742 | #endif |
2729 | 2743 | ||
2730 | mMainWindow->showMaximized(); | 2744 | mMainWindow->showMaximized(); |
2731 | mMainWindow-> raise(); | 2745 | mMainWindow-> raise(); |
2732 | 2746 | ||
2733 | mViewManager->setSelected( "", false); | 2747 | mViewManager->setSelected( "", false); |
2734 | mViewManager->refreshView( "" ); | 2748 | mViewManager->refreshView( "" ); |
2735 | mViewManager->setSelected( foundUid, true ); | 2749 | mViewManager->setSelected( foundUid, true ); |
2736 | mViewManager->refreshView( foundUid ); | 2750 | mViewManager->refreshView( foundUid ); |
2737 | 2751 | ||
2738 | if ( !mMultipleViewsAtOnce ) | 2752 | if ( !mMultipleViewsAtOnce ) |
2739 | { | 2753 | { |
2740 | setDetailsVisible( true ); | 2754 | setDetailsVisible( true ); |
2741 | mActionDetails->setChecked(true); | 2755 | mActionDetails->setChecked(true); |
2742 | } | 2756 | } |
2743 | } | 2757 | } |
2744 | } | 2758 | } |
2745 | void KABCore::storagehowto() | 2759 | void KABCore::storagehowto() |
2746 | { | 2760 | { |
2747 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); | 2761 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); |
2748 | } | 2762 | } |
2749 | void KABCore::whatsnew() | 2763 | void KABCore::whatsnew() |
2750 | { | 2764 | { |
2751 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 2765 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
2752 | } | 2766 | } |
2753 | void KABCore::synchowto() | 2767 | void KABCore::synchowto() |
2754 | { | 2768 | { |
2755 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 2769 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
2756 | } | 2770 | } |
2757 | void KABCore::kdesynchowto() | 2771 | void KABCore::kdesynchowto() |
2758 | { | 2772 | { |
2759 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 2773 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
2760 | } | 2774 | } |
2761 | void KABCore::multisynchowto() | 2775 | void KABCore::multisynchowto() |
2762 | { | 2776 | { |
2763 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 2777 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
2764 | } | 2778 | } |
2765 | void KABCore::faq() | 2779 | void KABCore::faq() |
2766 | { | 2780 | { |
2767 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); | 2781 | KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); |
2768 | } | 2782 | } |
2769 | 2783 | ||
2770 | #include <libkcal/syncdefines.h> | 2784 | #include <libkcal/syncdefines.h> |
2771 | 2785 | ||
2772 | KABC::Addressee KABCore::getLastSyncAddressee() | 2786 | KABC::Addressee KABCore::getLastSyncAddressee() |
2773 | { | 2787 | { |
2774 | Addressee lse; | 2788 | Addressee lse; |
2775 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2789 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2776 | 2790 | ||
2777 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 2791 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
2778 | lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); | 2792 | lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); |
2779 | if (lse.isEmpty()) { | 2793 | if (lse.isEmpty()) { |
2780 | qDebug("KA: Creating new last-syncAddressee "); | 2794 | qDebug("KA: Creating new last-syncAddressee "); |
2781 | lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); | 2795 | lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); |
2782 | QString sum = ""; | 2796 | QString sum = ""; |
2783 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 2797 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
2784 | sum = "E: "; | 2798 | sum = "E: "; |
2785 | lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); | 2799 | lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); |
2786 | lse.setRevision( mLastAddressbookSync ); | 2800 | lse.setRevision( mLastAddressbookSync ); |
2787 | lse.setCategories( i18n("SyncEvent") ); | 2801 | lse.setCategories( i18n("SyncEvent") ); |
2788 | mAddressBook->insertAddressee( lse ); | 2802 | mAddressBook->insertAddressee( lse ); |
2789 | } | 2803 | } |
2790 | return lse; | 2804 | return lse; |
2791 | } | 2805 | } |
2792 | int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) | 2806 | int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) |
2793 | { | 2807 | { |
2794 | 2808 | ||
2795 | //void setZaurusId(int id); | 2809 | //void setZaurusId(int id); |
2796 | // int zaurusId() const; | 2810 | // int zaurusId() const; |
2797 | // void setZaurusUid(int id); | 2811 | // void setZaurusUid(int id); |
2798 | // int zaurusUid() const; | 2812 | // int zaurusUid() const; |
2799 | // void setZaurusStat(int id); | 2813 | // void setZaurusStat(int id); |
2800 | // int zaurusStat() const; | 2814 | // int zaurusStat() const; |
2801 | // 0 equal | 2815 | // 0 equal |
2802 | // 1 take local | 2816 | // 1 take local |
2803 | // 2 take remote | 2817 | // 2 take remote |
2804 | // 3 cancel | 2818 | // 3 cancel |
2805 | QDateTime lastSync = mLastAddressbookSync; | 2819 | QDateTime lastSync = mLastAddressbookSync; |
2806 | QDateTime localMod = local->revision(); | 2820 | QDateTime localMod = local->revision(); |
2807 | QDateTime remoteMod = remote->revision(); | 2821 | QDateTime remoteMod = remote->revision(); |
2808 | 2822 | ||
2809 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2823 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2810 | 2824 | ||
2811 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2825 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2812 | bool remCh, locCh; | 2826 | bool remCh, locCh; |
2813 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); | 2827 | remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); |
2814 | //if ( remCh ) | 2828 | //if ( remCh ) |
2815 | // qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); | 2829 | // qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); |
2816 | locCh = ( localMod > mLastAddressbookSync ); | 2830 | locCh = ( localMod > mLastAddressbookSync ); |
2817 | //qDebug("cahnged rem %d loc %d",remCh, locCh ); | 2831 | //qDebug("cahnged rem %d loc %d",remCh, locCh ); |
2818 | if ( !remCh && ! locCh ) { | 2832 | if ( !remCh && ! locCh ) { |
2819 | //qDebug("both not changed "); | 2833 | //qDebug("both not changed "); |
2820 | lastSync = localMod.addDays(1); | 2834 | lastSync = localMod.addDays(1); |
2821 | if ( mode <= SYNC_PREF_ASK ) | 2835 | if ( mode <= SYNC_PREF_ASK ) |
2822 | return 0; | 2836 | return 0; |
2823 | } else { | 2837 | } else { |
2824 | if ( locCh ) { | 2838 | if ( locCh ) { |
2825 | //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); | 2839 | //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); |
2826 | lastSync = localMod.addDays( -1 ); | 2840 | lastSync = localMod.addDays( -1 ); |
2827 | if ( !remCh ) | 2841 | if ( !remCh ) |
2828 | remoteMod =( lastSync.addDays( -1 ) ); | 2842 | remoteMod =( lastSync.addDays( -1 ) ); |
2829 | } else { | 2843 | } else { |
2830 | //qDebug(" not loc changed "); | 2844 | //qDebug(" not loc changed "); |
2831 | lastSync = localMod.addDays( 1 ); | 2845 | lastSync = localMod.addDays( 1 ); |
2832 | if ( remCh ) { | 2846 | if ( remCh ) { |
2833 | //qDebug("rem changed "); | 2847 | //qDebug("rem changed "); |
2834 | remoteMod =( lastSync.addDays( 1 ) ); | 2848 | remoteMod =( lastSync.addDays( 1 ) ); |
2835 | } | 2849 | } |
2836 | 2850 | ||
2837 | } | 2851 | } |
2838 | } | 2852 | } |
2839 | full = true; | 2853 | full = true; |
2840 | if ( mode < SYNC_PREF_ASK ) | 2854 | if ( mode < SYNC_PREF_ASK ) |
2841 | mode = SYNC_PREF_ASK; | 2855 | mode = SYNC_PREF_ASK; |
2842 | } else { | 2856 | } else { |
2843 | if ( localMod == remoteMod ) | 2857 | if ( localMod == remoteMod ) |
2844 | return 0; | 2858 | return 0; |
2845 | 2859 | ||
2846 | } | 2860 | } |
2847 | //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec()); | 2861 | //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec()); |
2848 | //qDebug("lastsync %s ", lastSync.toString().latin1() ); | 2862 | //qDebug("lastsync %s ", lastSync.toString().latin1() ); |
2849 | //full = true; //debug only | 2863 | //full = true; //debug only |
2850 | if ( full ) { | 2864 | if ( full ) { |
2851 | bool equ = ( (*local) == (*remote) ); | 2865 | bool equ = ( (*local) == (*remote) ); |
2852 | if ( equ ) { | 2866 | if ( equ ) { |
2853 | //qDebug("equal "); | 2867 | //qDebug("equal "); |
2854 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2868 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2855 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); | 2869 | local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); |
2856 | } | 2870 | } |
2857 | if ( mode < SYNC_PREF_FORCE_LOCAL ) | 2871 | if ( mode < SYNC_PREF_FORCE_LOCAL ) |
2858 | return 0; | 2872 | return 0; |
2859 | 2873 | ||
2860 | }//else //debug only | 2874 | }//else //debug only |
2861 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); | 2875 | //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); |
2862 | } | 2876 | } |
2863 | int result; | 2877 | int result; |
2864 | bool localIsNew; | 2878 | bool localIsNew; |
2865 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); | 2879 | //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); |
2866 | 2880 | ||
2867 | if ( full && mode < SYNC_PREF_NEWEST ) | 2881 | if ( full && mode < SYNC_PREF_NEWEST ) |
2868 | mode = SYNC_PREF_ASK; | 2882 | mode = SYNC_PREF_ASK; |
2869 | 2883 | ||
2870 | switch( mode ) { | 2884 | switch( mode ) { |
2871 | case SYNC_PREF_LOCAL: | 2885 | case SYNC_PREF_LOCAL: |
2872 | if ( lastSync > remoteMod ) | 2886 | if ( lastSync > remoteMod ) |
2873 | return 1; | 2887 | return 1; |
2874 | if ( lastSync > localMod ) | 2888 | if ( lastSync > localMod ) |
2875 | return 2; | 2889 | return 2; |
2876 | return 1; | 2890 | return 1; |
2877 | break; | 2891 | break; |
2878 | case SYNC_PREF_REMOTE: | 2892 | case SYNC_PREF_REMOTE: |
2879 | if ( lastSync > localMod ) | 2893 | if ( lastSync > localMod ) |
2880 | return 2; | 2894 | return 2; |
2881 | if ( lastSync > remoteMod ) | 2895 | if ( lastSync > remoteMod ) |
2882 | return 1; | 2896 | return 1; |
2883 | return 2; | 2897 | return 2; |
2884 | break; | 2898 | break; |
2885 | case SYNC_PREF_NEWEST: | 2899 | case SYNC_PREF_NEWEST: |
2886 | if ( localMod > remoteMod ) | 2900 | if ( localMod > remoteMod ) |
2887 | return 1; | 2901 | return 1; |
2888 | else | 2902 | else |
2889 | return 2; | 2903 | return 2; |
2890 | break; | 2904 | break; |
2891 | case SYNC_PREF_ASK: | 2905 | case SYNC_PREF_ASK: |
2892 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 2906 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
2893 | if ( lastSync > remoteMod && lastSync > localMod) | 2907 | if ( lastSync > remoteMod && lastSync > localMod) |
2894 | return 0; | 2908 | return 0; |
2895 | if ( lastSync > remoteMod ) | 2909 | if ( lastSync > remoteMod ) |
2896 | return 1; | 2910 | return 1; |
2897 | if ( lastSync > localMod ) { | 2911 | if ( lastSync > localMod ) { |
2898 | return 2; | 2912 | return 2; |
2899 | } | 2913 | } |
2900 | localIsNew = localMod >= remoteMod; | 2914 | localIsNew = localMod >= remoteMod; |
2901 | //qDebug("conflict! ************************************** "); | 2915 | //qDebug("conflict! ************************************** "); |
2902 | { | 2916 | { |
2903 | KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this ); | 2917 | KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this ); |
2904 | result = acd.executeD(localIsNew); | 2918 | result = acd.executeD(localIsNew); |
2905 | return result; | 2919 | return result; |
2906 | } | 2920 | } |
2907 | break; | 2921 | break; |
2908 | case SYNC_PREF_FORCE_LOCAL: | 2922 | case SYNC_PREF_FORCE_LOCAL: |
2909 | return 1; | 2923 | return 1; |
2910 | break; | 2924 | break; |
2911 | case SYNC_PREF_FORCE_REMOTE: | 2925 | case SYNC_PREF_FORCE_REMOTE: |
2912 | return 2; | 2926 | return 2; |
2913 | break; | 2927 | break; |
2914 | 2928 | ||
2915 | default: | 2929 | default: |
2916 | // SYNC_PREF_TAKE_BOTH not implemented | 2930 | // SYNC_PREF_TAKE_BOTH not implemented |
2917 | break; | 2931 | break; |
2918 | } | 2932 | } |
2919 | return 0; | 2933 | return 0; |
2920 | } | 2934 | } |
2921 | 2935 | ||
2922 | 2936 | ||
2923 | bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) | 2937 | bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) |
2924 | { | 2938 | { |
2925 | bool syncOK = true; | 2939 | bool syncOK = true; |
2926 | int addedAddressee = 0; | 2940 | int addedAddressee = 0; |
2927 | int addedAddresseeR = 0; | 2941 | int addedAddresseeR = 0; |
2928 | int deletedAddresseeR = 0; | 2942 | int deletedAddresseeR = 0; |
2929 | int deletedAddresseeL = 0; | 2943 | int deletedAddresseeL = 0; |
2930 | int changedLocal = 0; | 2944 | int changedLocal = 0; |
2931 | int changedRemote = 0; | 2945 | int changedRemote = 0; |
2932 | int filteredIN = 0; | 2946 | int filteredIN = 0; |
2933 | int filteredOUT = 0; | 2947 | int filteredOUT = 0; |
2934 | 2948 | ||
2935 | QString mCurrentSyncName = syncManager->getCurrentSyncName(); | 2949 | QString mCurrentSyncName = syncManager->getCurrentSyncName(); |
2936 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 2950 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
2937 | 2951 | ||
2938 | //QPtrList<Addressee> el = local->rawAddressees(); | 2952 | //QPtrList<Addressee> el = local->rawAddressees(); |
2939 | Addressee addresseeR; | 2953 | Addressee addresseeR; |
2940 | QString uid; | 2954 | QString uid; |
2941 | int take; | 2955 | int take; |
2942 | Addressee addresseeL; | 2956 | Addressee addresseeL; |
2943 | Addressee addresseeRSync; | 2957 | Addressee addresseeRSync; |
2944 | Addressee addresseeLSync; | 2958 | Addressee addresseeLSync; |
2945 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); | 2959 | // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); |
2946 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); | 2960 | //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); |
2947 | bool fullDateRange = false; | 2961 | bool fullDateRange = false; |
2948 | local->resetTempSyncStat(); | 2962 | local->resetTempSyncStat(); |
2949 | mLastAddressbookSync = QDateTime::currentDateTime(); | 2963 | mLastAddressbookSync = QDateTime::currentDateTime(); |
2950 | if ( syncManager->syncWithDesktop() ) { | 2964 | if ( syncManager->syncWithDesktop() ) { |
2951 | // remote->removeSyncInfo( QString());//remove all info | 2965 | // remote->removeSyncInfo( QString());//remove all info |
2952 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { | 2966 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { |
2953 | mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; | 2967 | mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; |
2954 | qDebug("KA: using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); | 2968 | qDebug("KA: using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); |
2955 | } else { | 2969 | } else { |
2956 | qDebug("KA: KSyncManager::mRequestedSyncEvent has invalid datatime "); | 2970 | qDebug("KA: KSyncManager::mRequestedSyncEvent has invalid datatime "); |
2957 | } | 2971 | } |
2958 | } | 2972 | } |
2959 | QDateTime modifiedCalendar = mLastAddressbookSync; | 2973 | QDateTime modifiedCalendar = mLastAddressbookSync; |
2960 | addresseeLSync = getLastSyncAddressee(); | 2974 | addresseeLSync = getLastSyncAddressee(); |
2961 | qDebug("KA: Last Sync %s ", addresseeLSync.revision().toString().latin1()); | 2975 | qDebug("KA: Last Sync %s ", addresseeLSync.revision().toString().latin1()); |
2962 | addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); | 2976 | addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); |
2963 | if ( !addresseeR.isEmpty() ) { | 2977 | if ( !addresseeR.isEmpty() ) { |
2964 | addresseeRSync = addresseeR; | 2978 | addresseeRSync = addresseeR; |
2965 | remote->removeAddressee(addresseeR ); | 2979 | remote->removeAddressee(addresseeR ); |
2966 | 2980 | ||
2967 | } else { | 2981 | } else { |
2968 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 2982 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
2969 | addresseeRSync = addresseeLSync ; | 2983 | addresseeRSync = addresseeLSync ; |
2970 | } else { | 2984 | } else { |
2971 | //qDebug("FULLDATE 1"); | 2985 | //qDebug("FULLDATE 1"); |
2972 | fullDateRange = true; | 2986 | fullDateRange = true; |
2973 | Addressee newAdd; | 2987 | Addressee newAdd; |
2974 | addresseeRSync = newAdd; | 2988 | addresseeRSync = newAdd; |
2975 | addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); | 2989 | addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); |
2976 | addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); | 2990 | addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); |
2977 | addresseeRSync.setRevision( mLastAddressbookSync ); | 2991 | addresseeRSync.setRevision( mLastAddressbookSync ); |
2978 | addresseeRSync.setCategories( i18n("SyncAddressee") ); | 2992 | addresseeRSync.setCategories( i18n("SyncAddressee") ); |
2979 | } | 2993 | } |
2980 | } | 2994 | } |
2981 | if ( addresseeLSync.revision() == mLastAddressbookSync ) { | 2995 | if ( addresseeLSync.revision() == mLastAddressbookSync ) { |
2982 | // qDebug("FULLDATE 2"); | 2996 | // qDebug("FULLDATE 2"); |
2983 | fullDateRange = true; | 2997 | fullDateRange = true; |
2984 | } | 2998 | } |
2985 | if ( ! fullDateRange ) { | 2999 | if ( ! fullDateRange ) { |
2986 | if ( addresseeLSync.revision() != addresseeRSync.revision() ) { | 3000 | if ( addresseeLSync.revision() != addresseeRSync.revision() ) { |
2987 | 3001 | ||
2988 | // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); | 3002 | // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); |
2989 | //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); | 3003 | //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); |
2990 | fullDateRange = true; | 3004 | fullDateRange = true; |
2991 | //qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); | 3005 | //qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); |
2992 | } | 3006 | } |
2993 | } | 3007 | } |
2994 | // fullDateRange = true; // debug only! | 3008 | // fullDateRange = true; // debug only! |
2995 | if ( fullDateRange ) | 3009 | if ( fullDateRange ) |
2996 | mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); | 3010 | mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); |
2997 | else | 3011 | else |
2998 | mLastAddressbookSync = addresseeLSync.revision(); | 3012 | mLastAddressbookSync = addresseeLSync.revision(); |
2999 | // for resyncing if own file has changed | 3013 | // for resyncing if own file has changed |
3000 | // PENDING fixme later when implemented | 3014 | // PENDING fixme later when implemented |
3001 | #if 0 | 3015 | #if 0 |
3002 | if ( mCurrentSyncDevice == "deleteaftersync" ) { | 3016 | if ( mCurrentSyncDevice == "deleteaftersync" ) { |
3003 | mLastAddressbookSync = loadedFileVersion; | 3017 | mLastAddressbookSync = loadedFileVersion; |
3004 | qDebug("setting mLastAddressbookSync "); | 3018 | qDebug("setting mLastAddressbookSync "); |
3005 | } | 3019 | } |
3006 | #endif | 3020 | #endif |
3007 | 3021 | ||
3008 | 3022 | ||
3009 | // ********** setting filters **************** | 3023 | // ********** setting filters **************** |
3010 | Filter filterIN = mViewManager->getFilterByName( syncManager->mFilterInAB ); | 3024 | Filter filterIN = mViewManager->getFilterByName( syncManager->mFilterInAB ); |
3011 | Filter filterOUT = mViewManager->getFilterByName( syncManager->mFilterOutAB ); | 3025 | Filter filterOUT = mViewManager->getFilterByName( syncManager->mFilterOutAB ); |
3012 | 3026 | ||
3013 | //qDebug("*************************** "); | 3027 | //qDebug("*************************** "); |
3014 | // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); | 3028 | // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); |
3015 | QStringList er = remote->uidList(); | 3029 | QStringList er = remote->uidList(); |
3016 | Addressee inR ;//= er.first(); | 3030 | Addressee inR ;//= er.first(); |
3017 | Addressee inL; | 3031 | Addressee inL; |
3018 | 3032 | ||
3019 | syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); | 3033 | syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); |
3020 | 3034 | ||
3021 | int modulo = (er.count()/10)+1; | 3035 | int modulo = (er.count()/10)+1; |
3022 | int incCounter = 0; | 3036 | int incCounter = 0; |
3023 | while ( incCounter < er.count()) { | 3037 | while ( incCounter < er.count()) { |
3024 | if (syncManager->isProgressBarCanceled()) | 3038 | if (syncManager->isProgressBarCanceled()) |
3025 | return false; | 3039 | return false; |
3026 | if ( incCounter % modulo == 0 ) | 3040 | if ( incCounter % modulo == 0 ) |
3027 | syncManager->showProgressBar(incCounter); | 3041 | syncManager->showProgressBar(incCounter); |
3028 | 3042 | ||
3029 | uid = er[ incCounter ]; | 3043 | uid = er[ incCounter ]; |
3030 | bool skipIncidence = false; | 3044 | bool skipIncidence = false; |
3031 | if ( uid.left(19) == QString("last-syncAddressee-") ) | 3045 | if ( uid.left(19) == QString("last-syncAddressee-") ) |
3032 | skipIncidence = true; | 3046 | skipIncidence = true; |
3033 | QString idS,OidS; | 3047 | QString idS,OidS; |
3034 | qApp->processEvents(); | 3048 | qApp->processEvents(); |
3035 | if ( !skipIncidence ) { | 3049 | if ( !skipIncidence ) { |
3036 | inL = local->findByUid( uid ); | 3050 | inL = local->findByUid( uid ); |
3037 | inR = remote->findByUid( uid ); | 3051 | inR = remote->findByUid( uid ); |
3038 | //inL.setResource( 0 ); | 3052 | //inL.setResource( 0 ); |
3039 | //inR.setResource( 0 ); | 3053 | //inR.setResource( 0 ); |
3040 | if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars | 3054 | if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars |
3041 | if ( !inL.resource() || inL.resource()->includeInSync() ) { | 3055 | if ( !inL.resource() || inL.resource()->includeInSync() ) { |
3042 | if ( (take = takeAddressee( &inL, &inR, mode, fullDateRange )) ) { | 3056 | if ( (take = takeAddressee( &inL, &inR, mode, fullDateRange )) ) { |
3043 | //qDebug("take %d %s ", take, inL.summary().latin1()); | 3057 | //qDebug("take %d %s ", take, inL.summary().latin1()); |
3044 | if ( take == 3 ) | 3058 | if ( take == 3 ) |
3045 | return false; | 3059 | return false; |
3046 | if ( take == 1 ) {// take local ********************** | 3060 | if ( take == 1 ) {// take local ********************** |
3047 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 3061 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
3048 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 3062 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
3049 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 3063 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
3050 | local->insertAddressee( inL, false ); | 3064 | local->insertAddressee( inL, false ); |
3051 | idS = inR.externalUID(); | 3065 | idS = inR.externalUID(); |
3052 | OidS = inR.originalExternalUID(); | 3066 | OidS = inR.originalExternalUID(); |
3053 | } | 3067 | } |
3054 | else | 3068 | else |
3055 | idS = inR.IDStr(); | 3069 | idS = inR.IDStr(); |
3056 | remote->removeAddressee( inR ); | 3070 | remote->removeAddressee( inR ); |
3057 | inR = inL; | 3071 | inR = inL; |
3058 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 3072 | inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
3059 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 3073 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
3060 | inR.setOriginalExternalUID( OidS ); | 3074 | inR.setOriginalExternalUID( OidS ); |
3061 | inR.setExternalUID( idS ); | 3075 | inR.setExternalUID( idS ); |
3062 | if ( syncManager->syncWithDesktop() ) { | 3076 | if ( syncManager->syncWithDesktop() ) { |
3063 | inR.setIDStr("changed" ); | 3077 | inR.setIDStr("changed" ); |
3064 | } | 3078 | } |
3065 | //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); | 3079 | //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); |
3066 | } else { | 3080 | } else { |
3067 | inR.setIDStr( idS ); | 3081 | inR.setIDStr( idS ); |
3068 | } | 3082 | } |
3069 | inR.setResource( 0 ); | 3083 | inR.setResource( 0 ); |
3070 | remote->insertAddressee( inR , false); | 3084 | remote->insertAddressee( inR , false); |
3071 | ++changedRemote; | 3085 | ++changedRemote; |
3072 | } else { // take == 2 take remote ********************** | 3086 | } else { // take == 2 take remote ********************** |
3073 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 3087 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
3074 | if ( inR.revision().date().year() < 2004 ) | 3088 | if ( inR.revision().date().year() < 2004 ) |
3075 | inR.setRevision( modifiedCalendar ); | 3089 | inR.setRevision( modifiedCalendar ); |
3076 | } | 3090 | } |
3077 | idS = inL.IDStr(); | 3091 | idS = inL.IDStr(); |
3078 | local->removeAddressee( inL ); | 3092 | local->removeAddressee( inL ); |
3079 | inL = inR; | 3093 | inL = inR; |
3080 | inL.setIDStr( idS ); | 3094 | inL.setIDStr( idS ); |
3081 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 3095 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
3082 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 3096 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
3083 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 3097 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
3084 | } | 3098 | } |
3085 | inL.setResource( 0 ); | 3099 | inL.setResource( 0 ); |
3086 | local->insertAddressee( inL , false ); | 3100 | local->insertAddressee( inL , false ); |
3087 | ++changedLocal; | 3101 | ++changedLocal; |
3088 | } | 3102 | } |
3089 | } | 3103 | } |
3090 | } | 3104 | } |
3091 | } else { // no conflict ********** add or delete remote | 3105 | } else { // no conflict ********** add or delete remote |
3092 | if ( filterIN.name().isEmpty() || filterIN.filterAddressee( inR ) ) { | 3106 | if ( filterIN.name().isEmpty() || filterIN.filterAddressee( inR ) ) { |
3093 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 3107 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
3094 | QString des = addresseeLSync.note(); | 3108 | QString des = addresseeLSync.note(); |
3095 | if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 3109 | if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
3096 | inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 3110 | inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
3097 | remote->insertAddressee( inR, false ); | 3111 | remote->insertAddressee( inR, false ); |
3098 | ++deletedAddresseeR; | 3112 | ++deletedAddresseeR; |
3099 | } else { | 3113 | } else { |
3100 | inR.setRevision( modifiedCalendar ); | 3114 | inR.setRevision( modifiedCalendar ); |
3101 | remote->insertAddressee( inR, false ); | 3115 | remote->insertAddressee( inR, false ); |
3102 | inL = inR; | 3116 | inL = inR; |
3103 | inL.setIDStr( ":" ); | 3117 | inL.setIDStr( ":" ); |
3104 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); | 3118 | inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); |
3105 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); | 3119 | inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); |
3106 | inL.setResource( 0 ); | 3120 | inL.setResource( 0 ); |
3107 | local->insertAddressee( inL , false); | 3121 | local->insertAddressee( inL , false); |
3108 | ++addedAddressee; | 3122 | ++addedAddressee; |
3109 | } | 3123 | } |
3110 | } else { | 3124 | } else { |
3111 | if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { | 3125 | if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { |
3112 | inR.setRevision( modifiedCalendar ); | 3126 | inR.setRevision( modifiedCalendar ); |
3113 | remote->insertAddressee( inR, false ); | 3127 | remote->insertAddressee( inR, false ); |
3114 | inR.setResource( 0 ); | 3128 | inR.setResource( 0 ); |
3115 | local->insertAddressee( inR, false ); | 3129 | local->insertAddressee( inR, false ); |
3116 | ++addedAddressee; | 3130 | ++addedAddressee; |
3117 | } else { | 3131 | } else { |
3118 | // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); | 3132 | // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); |
3119 | remote->removeAddressee( inR ); | 3133 | remote->removeAddressee( inR ); |
3120 | ++deletedAddresseeR; | 3134 | ++deletedAddresseeR; |
3121 | } | 3135 | } |
3122 | } | 3136 | } |
3123 | } else { | 3137 | } else { |
3124 | ++filteredIN; | 3138 | ++filteredIN; |
3125 | } | 3139 | } |
3126 | } | 3140 | } |
3127 | } | 3141 | } |
3128 | ++incCounter; | 3142 | ++incCounter; |
3129 | } | 3143 | } |
3130 | er.clear(); | 3144 | er.clear(); |
3131 | QStringList el = local->uidList(); | 3145 | QStringList el = local->uidList(); |
3132 | modulo = (el.count()/10)+1; | 3146 | modulo = (el.count()/10)+1; |
3133 | 3147 | ||
3134 | syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); | 3148 | syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); |
3135 | incCounter = 0; | 3149 | incCounter = 0; |
3136 | while ( incCounter < el.count()) { | 3150 | while ( incCounter < el.count()) { |
3137 | qApp->processEvents(); | 3151 | qApp->processEvents(); |
3138 | if (syncManager->isProgressBarCanceled()) | 3152 | if (syncManager->isProgressBarCanceled()) |
3139 | return false; | 3153 | return false; |
3140 | if ( incCounter % modulo == 0 ) | 3154 | if ( incCounter % modulo == 0 ) |
3141 | syncManager->showProgressBar(incCounter); | 3155 | syncManager->showProgressBar(incCounter); |
3142 | uid = el[ incCounter ]; | 3156 | uid = el[ incCounter ]; |
3143 | bool skipIncidence = false; | 3157 | bool skipIncidence = false; |
3144 | if ( uid.left(19) == QString("last-syncAddressee-") ) | 3158 | if ( uid.left(19) == QString("last-syncAddressee-") ) |
3145 | skipIncidence = true; | 3159 | skipIncidence = true; |
3146 | if ( !skipIncidence ) { | 3160 | if ( !skipIncidence ) { |
3147 | inL = local->findByUid( uid ); | 3161 | inL = local->findByUid( uid ); |
3148 | if ( !inL.resource() || inL.resource()->includeInSync() ) { | 3162 | if ( !inL.resource() || inL.resource()->includeInSync() ) { |
3149 | inR = remote->findByUid( uid ); | 3163 | inR = remote->findByUid( uid ); |
3150 | if ( inR.isEmpty() ){ | 3164 | if ( inR.isEmpty() ){ |
3151 | if ( filterOUT.name().isEmpty() || filterOUT.filterAddressee( inL ) ) { | 3165 | if ( filterOUT.name().isEmpty() || filterOUT.filterAddressee( inL ) ) { |
3152 | // no conflict ********** add or delete local | 3166 | // no conflict ********** add or delete local |
3153 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 3167 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
3154 | if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 3168 | if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
3155 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); | 3169 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); |
3156 | local->removeAddressee( inL ); | 3170 | local->removeAddressee( inL ); |
3157 | ++deletedAddresseeL; | 3171 | ++deletedAddresseeL; |
3158 | } else { | 3172 | } else { |
3159 | if ( ! syncManager->mWriteBackExistingOnly ) { | 3173 | if ( ! syncManager->mWriteBackExistingOnly ) { |
3160 | inL.removeID(mCurrentSyncDevice ); | 3174 | inL.removeID(mCurrentSyncDevice ); |
3161 | ++addedAddresseeR; | 3175 | ++addedAddresseeR; |
3162 | inL.setRevision( modifiedCalendar ); | 3176 | inL.setRevision( modifiedCalendar ); |
3163 | local->insertAddressee( inL, false ); | 3177 | local->insertAddressee( inL, false ); |
3164 | inR = inL; | 3178 | inR = inL; |
3165 | inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); | 3179 | inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); |
3166 | inR.setResource( 0 ); | 3180 | inR.setResource( 0 ); |
3167 | remote->insertAddressee( inR, false ); | 3181 | remote->insertAddressee( inR, false ); |
3168 | } | 3182 | } |
3169 | } | 3183 | } |
3170 | } else { | 3184 | } else { |
3171 | if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { | 3185 | if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { |
3172 | //qDebug("data %s ", inL.revision().toString().latin1()); | 3186 | //qDebug("data %s ", inL.revision().toString().latin1()); |
3173 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); | 3187 | // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); |
3174 | local->removeAddressee( inL ); | 3188 | local->removeAddressee( inL ); |
3175 | ++deletedAddresseeL; | 3189 | ++deletedAddresseeL; |
3176 | } else { | 3190 | } else { |
3177 | if ( ! syncManager->mWriteBackExistingOnly ) { | 3191 | if ( ! syncManager->mWriteBackExistingOnly ) { |
3178 | ++addedAddresseeR; | 3192 | ++addedAddresseeR; |
3179 | inL.setRevision( modifiedCalendar ); | 3193 | inL.setRevision( modifiedCalendar ); |
3180 | local->insertAddressee( inL, false ); | 3194 | local->insertAddressee( inL, false ); |
3181 | inR = inL; | 3195 | inR = inL; |
3182 | inR.setIDStr( ":" ); | 3196 | inR.setIDStr( ":" ); |
3183 | inR.setResource( 0 ); | 3197 | inR.setResource( 0 ); |
3184 | remote->insertAddressee( inR, false ); | 3198 | remote->insertAddressee( inR, false ); |
3185 | } | 3199 | } |
3186 | } | 3200 | } |
3187 | } | 3201 | } |
3188 | } else { | 3202 | } else { |
3189 | ++filteredOUT; | 3203 | ++filteredOUT; |
3190 | } | 3204 | } |
3191 | } | 3205 | } |
3192 | } | 3206 | } |
3193 | } | 3207 | } |
3194 | ++incCounter; | 3208 | ++incCounter; |
3195 | } | 3209 | } |
3196 | el.clear(); | 3210 | el.clear(); |
3197 | syncManager->hideProgressBar(); | 3211 | syncManager->hideProgressBar(); |
3198 | mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); | 3212 | mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); |
3199 | // get rid of micro seconds | 3213 | // get rid of micro seconds |
3200 | QTime t = mLastAddressbookSync.time(); | 3214 | QTime t = mLastAddressbookSync.time(); |
3201 | mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); | 3215 | mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); |
3202 | addresseeLSync.setRevision( mLastAddressbookSync ); | 3216 | addresseeLSync.setRevision( mLastAddressbookSync ); |
3203 | addresseeRSync.setRevision( mLastAddressbookSync ); | 3217 | addresseeRSync.setRevision( mLastAddressbookSync ); |
3204 | addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; | 3218 | addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; |
3205 | addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); | 3219 | addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); |
3206 | addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; | 3220 | addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; |
3207 | addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); | 3221 | addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); |
3208 | addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; | 3222 | addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; |
3209 | addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); | 3223 | addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); |
3210 | addresseeRSync.setNote( "" ) ; | 3224 | addresseeRSync.setNote( "" ) ; |
3211 | addresseeLSync.setNote( "" ); | 3225 | addresseeLSync.setNote( "" ); |
3212 | 3226 | ||
3213 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) | 3227 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL) |
3214 | remote->insertAddressee( addresseeRSync, false ); | 3228 | remote->insertAddressee( addresseeRSync, false ); |
3215 | local->insertAddressee( addresseeLSync, false ); | 3229 | local->insertAddressee( addresseeLSync, false ); |
3216 | QString mes; | 3230 | QString mes; |
3217 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR, filteredIN, filteredOUT ); | 3231 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR, filteredIN, filteredOUT ); |
3218 | qDebug( mes ); | 3232 | qDebug( mes ); |
3219 | mes = i18n("Local addressbook changed!\n") +mes; | 3233 | mes = i18n("Local addressbook changed!\n") +mes; |
3220 | if ( syncManager->mShowSyncSummary ) { | 3234 | if ( syncManager->mShowSyncSummary ) { |
3221 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, | 3235 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, |
3222 | i18n("KA/Pi Synchronization"),i18n("Write back"))) { | 3236 | i18n("KA/Pi Synchronization"),i18n("Write back"))) { |
3223 | qDebug("KA: WB cancelled "); | 3237 | qDebug("KA: WB cancelled "); |
3224 | syncManager->mWriteBackFile = false; | 3238 | syncManager->mWriteBackFile = false; |
3225 | return syncOK; | 3239 | return syncOK; |
3226 | } | 3240 | } |
3227 | } | 3241 | } |
3228 | return syncOK; | 3242 | return syncOK; |
3229 | } | 3243 | } |
3230 | 3244 | ||
3231 | 3245 | ||
3232 | //this is a overwritten callbackmethods from the syncinterface | 3246 | //this is a overwritten callbackmethods from the syncinterface |
3233 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | 3247 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode) |
3234 | { | 3248 | { |
3235 | 3249 | ||
3236 | //pending prepare addresseeview for output | 3250 | //pending prepare addresseeview for output |
3237 | //pending detect, if remote file has REV field. if not switch to external sync | 3251 | //pending detect, if remote file has REV field. if not switch to external sync |
3238 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 3252 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
3239 | if ( manager != syncManager ) | 3253 | if ( manager != syncManager ) |
3240 | qDebug("KABCore::sync:: ERROR! :: manager != syncManager "); | 3254 | qDebug("KABCore::sync:: ERROR! :: manager != syncManager "); |
3241 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 3255 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
3242 | 3256 | ||
3243 | AddressBook abLocal(filename,"syncContact"); | 3257 | AddressBook abLocal(filename,"syncContact"); |
3244 | bool syncOK = false; | 3258 | bool syncOK = false; |
3245 | if ( abLocal.load() ) { | 3259 | if ( abLocal.load() ) { |
3246 | qDebug("KA: Sync::AB loaded %s,sync mode %d",filename.latin1(), mode ); | 3260 | qDebug("KA: Sync::AB loaded %s,sync mode %d",filename.latin1(), mode ); |
3247 | bool external = false; | 3261 | bool external = false; |
3248 | bool isXML = false; | 3262 | bool isXML = false; |
3249 | if ( filename.right(4) == ".xml") { | 3263 | if ( filename.right(4) == ".xml") { |
3250 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3264 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3251 | isXML = true; | 3265 | isXML = true; |
3252 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 3266 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
3253 | } else { | 3267 | } else { |
3254 | external = !manager->mIsKapiFile; | 3268 | external = !manager->mIsKapiFile; |
3255 | if ( external ) { | 3269 | if ( external ) { |
3256 | qDebug("KA: Sync::Setting vcf mode to external "); | 3270 | qDebug("KA: Sync::Setting vcf mode to external "); |
3257 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3271 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3258 | AddressBook::Iterator it; | 3272 | AddressBook::Iterator it; |
3259 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 3273 | for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
3260 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); | 3274 | (*it).setID( mCurrentSyncDevice, (*it).uid() ); |
3261 | (*it).computeCsum( mCurrentSyncDevice ); | 3275 | (*it).computeCsum( mCurrentSyncDevice ); |
3262 | } | 3276 | } |
3263 | } | 3277 | } |
3264 | } | 3278 | } |
3265 | //AddressBook::Iterator it; | 3279 | //AddressBook::Iterator it; |
3266 | //QStringList vcards; | 3280 | //QStringList vcards; |
3267 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { | 3281 | //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { |
3268 | // qDebug("Name %s ", (*it).familyName().latin1()); | 3282 | // qDebug("Name %s ", (*it).familyName().latin1()); |
3269 | //} | 3283 | //} |
3270 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); | 3284 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); |
3271 | syncManager->hideProgressBar(); | 3285 | syncManager->hideProgressBar(); |
3272 | if ( syncOK ) { | 3286 | if ( syncOK ) { |
3273 | if ( syncManager->mWriteBackFile ) | 3287 | if ( syncManager->mWriteBackFile ) |
3274 | { | 3288 | { |
3275 | if ( external ) | 3289 | if ( external ) |
3276 | abLocal.removeSyncAddressees( !isXML); | 3290 | abLocal.removeSyncAddressees( !isXML); |
3277 | qDebug("KA: Sync::Saving remote AB "); | 3291 | qDebug("KA: Sync::Saving remote AB "); |
3278 | if ( ! abLocal.saveAB()) | 3292 | if ( ! abLocal.saveAB()) |
3279 | qDebug("KA: sync::Error writing back AB to file "); | 3293 | qDebug("KA: sync::Error writing back AB to file "); |
3280 | if ( external ) { | 3294 | if ( external ) { |
3281 | // afterwrite processing | 3295 | // afterwrite processing |
3282 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); | 3296 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); |
3283 | } | 3297 | } |
3284 | } | 3298 | } |
3285 | } | 3299 | } |
3286 | setModified(); | 3300 | setModified(); |
3287 | 3301 | ||
3288 | } | 3302 | } |
3289 | abLocal.removeResources(); | 3303 | abLocal.removeResources(); |
3290 | if ( syncOK ) | 3304 | if ( syncOK ) |
3291 | mViewManager->refreshView(); | 3305 | mViewManager->refreshView(); |
3292 | return syncOK; | 3306 | return syncOK; |
3293 | 3307 | ||
3294 | } | 3308 | } |
3295 | void KABCore::removeSyncInfo( QString syncProfile) | 3309 | void KABCore::removeSyncInfo( QString syncProfile) |
3296 | { | 3310 | { |
3297 | qDebug("KA: AB:removeSyncInfo for profile %s ", syncProfile.latin1()); | 3311 | qDebug("KA: AB:removeSyncInfo for profile %s ", syncProfile.latin1()); |
3298 | mAddressBook->removeSyncInfo( syncProfile ); | 3312 | mAddressBook->removeSyncInfo( syncProfile ); |
3299 | setModified(); | 3313 | setModified(); |
3300 | } | 3314 | } |
3301 | 3315 | ||
3302 | 3316 | ||
3303 | //this is a overwritten callbackmethods from the syncinterface | 3317 | //this is a overwritten callbackmethods from the syncinterface |
3304 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) | 3318 | bool KABCore::syncExternal(KSyncManager* manager, QString resource) |
3305 | { | 3319 | { |
3306 | if ( resource == "phone" ) | 3320 | if ( resource == "phone" ) |
3307 | return syncPhone(); | 3321 | return syncPhone(); |
3308 | disableBR( true ); | 3322 | disableBR( true ); |
3309 | if ( manager != syncManager ) | 3323 | if ( manager != syncManager ) |
3310 | qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager "); | 3324 | qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager "); |
3311 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 3325 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
3312 | 3326 | ||
3313 | AddressBook abLocal( resource,"syncContact"); | 3327 | AddressBook abLocal( resource,"syncContact"); |
3314 | bool syncOK = false; | 3328 | bool syncOK = false; |
3315 | message(i18n("Loading DTM address data..."), false); | 3329 | message(i18n("Loading DTM address data..."), false); |
3316 | if ( abLocal.load() ) { | 3330 | if ( abLocal.load() ) { |
3317 | qDebug("KA: AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 3331 | qDebug("KA: AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
3318 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3332 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3319 | message(i18n("Sync preprocessing..."),false); | 3333 | message(i18n("Sync preprocessing..."),false); |
3320 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); | 3334 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); |
3321 | message(i18n("Synchronizing..."),false); | 3335 | message(i18n("Synchronizing..."),false); |
3322 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 3336 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
3323 | syncManager->hideProgressBar(); | 3337 | syncManager->hideProgressBar(); |
3324 | if ( syncOK ) { | 3338 | if ( syncOK ) { |
3325 | if ( syncManager->mWriteBackFile ) { | 3339 | if ( syncManager->mWriteBackFile ) { |
3326 | abLocal.removeSyncAddressees( false ); | 3340 | abLocal.removeSyncAddressees( false ); |
3327 | message(i18n("Saving DTM address data..."),false); | 3341 | message(i18n("Saving DTM address data..."),false); |
3328 | abLocal.saveAB(); | 3342 | abLocal.saveAB(); |
3329 | message(i18n("Sync postprocessing..."),false); | 3343 | message(i18n("Sync postprocessing..."),false); |
3330 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); | 3344 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); |
3331 | } | 3345 | } |
3332 | } else | 3346 | } else |
3333 | message( i18n("Sync cancelled or failed.") ); | 3347 | message( i18n("Sync cancelled or failed.") ); |
3334 | setModified(); | 3348 | setModified(); |
3335 | } | 3349 | } |
3336 | abLocal.removeResources(); | 3350 | abLocal.removeResources(); |
3337 | if ( syncOK ) { | 3351 | if ( syncOK ) { |
3338 | mViewManager->refreshView(); | 3352 | mViewManager->refreshView(); |
3339 | message(i18n("DTM syncing finished.")); | 3353 | message(i18n("DTM syncing finished.")); |
3340 | } | 3354 | } |
3341 | disableBR( false ); | 3355 | disableBR( false ); |
3342 | return syncOK; | 3356 | return syncOK; |
3343 | 3357 | ||
3344 | } | 3358 | } |
3345 | void KABCore::message( QString m, bool startTimer) | 3359 | void KABCore::message( QString m, bool startTimer) |
3346 | { | 3360 | { |
3347 | topLevelWidget()->setCaption( m ); | 3361 | topLevelWidget()->setCaption( m ); |
3348 | qApp->processEvents(); | 3362 | qApp->processEvents(); |
3349 | if ( startTimer ) | 3363 | if ( startTimer ) |
3350 | mMessageTimer->start( 15000, true ); | 3364 | mMessageTimer->start( 15000, true ); |
3351 | else | 3365 | else |
3352 | mMessageTimer->stop(); | 3366 | mMessageTimer->stop(); |
3353 | } | 3367 | } |
3354 | bool KABCore::syncPhone() | 3368 | bool KABCore::syncPhone() |
3355 | { | 3369 | { |
3356 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); | 3370 | QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); |
3357 | QString fileName = getPhoneFile(); | 3371 | QString fileName = getPhoneFile(); |
3358 | if ( !PhoneAccess::readFromPhone( fileName) ) { | 3372 | if ( !PhoneAccess::readFromPhone( fileName) ) { |
3359 | message(i18n("Phone access failed!")); | 3373 | message(i18n("Phone access failed!")); |
3360 | return false; | 3374 | return false; |
3361 | } | 3375 | } |
3362 | AddressBook abLocal( fileName,"syncContact"); | 3376 | AddressBook abLocal( fileName,"syncContact"); |
3363 | bool syncOK = false; | 3377 | bool syncOK = false; |
3364 | { | 3378 | { |
3365 | abLocal.importFromFile( fileName ); | 3379 | abLocal.importFromFile( fileName ); |
3366 | qDebug("KA: AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); | 3380 | qDebug("KA: AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); |
3367 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 3381 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
3368 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); | 3382 | abLocal.preparePhoneSync( mCurrentSyncDevice, true ); |
3369 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); | 3383 | abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); |
3370 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); | 3384 | syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); |
3371 | syncManager->hideProgressBar(); | 3385 | syncManager->hideProgressBar(); |
3372 | if ( syncOK ) { | 3386 | if ( syncOK ) { |
3373 | if ( syncManager->mWriteBackFile ) { | 3387 | if ( syncManager->mWriteBackFile ) { |
3374 | abLocal.removeSyncAddressees( true ); | 3388 | abLocal.removeSyncAddressees( true ); |
3375 | abLocal.saveABphone( fileName ); | 3389 | abLocal.saveABphone( fileName ); |
3376 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); | 3390 | abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); |
3377 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); | 3391 | //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); |
3378 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); | 3392 | abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); |
3379 | } | 3393 | } |
3380 | } | 3394 | } |
3381 | setModified(); | 3395 | setModified(); |
3382 | } | 3396 | } |
3383 | abLocal.removeResources(); | 3397 | abLocal.removeResources(); |
3384 | if ( syncOK ) | 3398 | if ( syncOK ) |
3385 | mViewManager->refreshView(); | 3399 | mViewManager->refreshView(); |
3386 | return syncOK; | 3400 | return syncOK; |
3387 | } | 3401 | } |
3388 | void KABCore::getFile( bool success ) | 3402 | void KABCore::getFile( bool success ) |
3389 | { | 3403 | { |
3390 | if ( ! success ) { | 3404 | if ( ! success ) { |
3391 | message( i18n("Error receiving file. Nothing changed!") ); | 3405 | message( i18n("Error receiving file. Nothing changed!") ); |
3392 | return; | 3406 | return; |
3393 | } | 3407 | } |
3394 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); | 3408 | int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); |
3395 | if ( count ) | 3409 | if ( count ) |
3396 | setModified( true ); | 3410 | setModified( true ); |
3397 | message( i18n("Pi-Sync successful!") ); | 3411 | message( i18n("Pi-Sync successful!") ); |
3398 | mViewManager->refreshView(); | 3412 | mViewManager->refreshView(); |
3399 | } | 3413 | } |
3400 | void KABCore::syncFileRequest() | 3414 | void KABCore::syncFileRequest() |
3401 | { | 3415 | { |
3402 | if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { | 3416 | if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { |
3403 | syncManager->slotSyncMenu( 999 ); | 3417 | syncManager->slotSyncMenu( 999 ); |
3404 | } | 3418 | } |
3405 | mAddressBook->export2File( sentSyncFile() ); | 3419 | mAddressBook->export2File( sentSyncFile() ); |
3406 | } | 3420 | } |
3407 | QString KABCore::sentSyncFile() | 3421 | QString KABCore::sentSyncFile() |
3408 | { | 3422 | { |
3409 | #ifdef DESKTOP_VERSION | 3423 | #ifdef DESKTOP_VERSION |
3410 | return locateLocal( "tmp", "copysyncab.vcf" ); | 3424 | return locateLocal( "tmp", "copysyncab.vcf" ); |
3411 | #else | 3425 | #else |
3412 | return QString( "/tmp/copysyncab.vcf" ); | 3426 | return QString( "/tmp/copysyncab.vcf" ); |
3413 | #endif | 3427 | #endif |
3414 | } | 3428 | } |
3415 | 3429 | ||
3416 | void KABCore::setCaptionBack() | 3430 | void KABCore::setCaptionBack() |
3417 | { | 3431 | { |
3418 | mMessageTimer->stop(); | 3432 | mMessageTimer->stop(); |
3419 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); | 3433 | topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); |
3420 | } | 3434 | } |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 80dbf08..6479a58 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -1,528 +1,530 @@ | |||
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 | #ifndef KABCORE_H | 24 | #ifndef KABCORE_H |
25 | #define KABCORE_H | 25 | #define KABCORE_H |
26 | 26 | ||
27 | #include <kabc/field.h> | 27 | #include <kabc/field.h> |
28 | 28 | ||
29 | #ifndef KAB_EMBEDDED | 29 | #ifndef KAB_EMBEDDED |
30 | #endif //KAB_EMBEDDED | 30 | #endif //KAB_EMBEDDED |
31 | #include <qdict.h> | 31 | #include <qdict.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | 33 | ||
34 | #include <qwidget.h> | 34 | #include <qwidget.h> |
35 | #include <qpopupmenu.h> | 35 | #include <qpopupmenu.h> |
36 | #include <ksyncmanager.h> | 36 | #include <ksyncmanager.h> |
37 | #ifndef DESKTOP_VERSION | 37 | #ifndef DESKTOP_VERSION |
38 | #include <qcopchannel_qws.h> | 38 | #include <qcopchannel_qws.h> |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | namespace KABC { | 41 | namespace KABC { |
42 | class AddressBook; | 42 | class AddressBook; |
43 | } | 43 | } |
44 | 44 | ||
45 | #ifndef KAB_EMBEDDED | 45 | #ifndef KAB_EMBEDDED |
46 | class KAboutData; | 46 | class KAboutData; |
47 | class KConfig; | 47 | class KConfig; |
48 | 48 | ||
49 | class KAddressBookService; | 49 | class KAddressBookService; |
50 | class LDAPSearchDialog; | 50 | class LDAPSearchDialog; |
51 | #else //KAB_EMBEDDED | 51 | #else //KAB_EMBEDDED |
52 | class KAddressBookMain; | 52 | class KAddressBookMain; |
53 | //US class QAction; | 53 | //US class QAction; |
54 | #endif //KAB_EMBEDDED | 54 | #endif //KAB_EMBEDDED |
55 | class KCMultiDialog; | 55 | class KCMultiDialog; |
56 | class KXMLGUIClient; | 56 | class KXMLGUIClient; |
57 | class ExtensionManager; | 57 | class ExtensionManager; |
58 | class XXPortManager; | 58 | class XXPortManager; |
59 | class JumpButtonBar; | 59 | class JumpButtonBar; |
60 | class IncSearchWidget; | 60 | class IncSearchWidget; |
61 | class KDGanttMinimizeSplitter; | 61 | class KDGanttMinimizeSplitter; |
62 | class KAction; | 62 | class KAction; |
63 | class KActionCollection; | 63 | class KActionCollection; |
64 | class KToggleAction; | 64 | class KToggleAction; |
65 | class KSyncProfile; | 65 | class KSyncProfile; |
66 | 66 | ||
67 | class QAction; | 67 | class QAction; |
68 | class QMenuBar; | 68 | class QMenuBar; |
69 | class QSplitter; | 69 | class QSplitter; |
70 | class ViewContainer; | 70 | class ViewContainer; |
71 | class ViewManager; | 71 | class ViewManager; |
72 | class AddresseeEditorDialog; | 72 | class AddresseeEditorDialog; |
73 | class Ir; | 73 | class Ir; |
74 | 74 | ||
75 | class KABCore : public QWidget, public KSyncInterface | 75 | class KABCore : public QWidget, public KSyncInterface |
76 | { | 76 | { |
77 | Q_OBJECT | 77 | Q_OBJECT |
78 | 78 | ||
79 | public: | 79 | public: |
80 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); | 80 | KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name = 0 ); |
81 | 81 | ||
82 | 82 | ||
83 | ~KABCore(); | 83 | ~KABCore(); |
84 | 84 | ||
85 | 85 | ||
86 | #ifdef KAB_EMBEDDED | 86 | #ifdef KAB_EMBEDDED |
87 | //US added functionality | 87 | //US added functionality |
88 | QPopupMenu* getViewMenu() {return viewMenu;} | 88 | QPopupMenu* getViewMenu() {return viewMenu;} |
89 | QPopupMenu* getFilterMenu() {return filterMenu;} | 89 | QPopupMenu* getFilterMenu() {return filterMenu;} |
90 | QPopupMenu* getSettingsMenu() {return settingsMenu;} | 90 | QPopupMenu* getSettingsMenu() {return settingsMenu;} |
91 | void addActionsManually(); | 91 | void addActionsManually(); |
92 | #endif //KAB_EMBEDDED | 92 | #endif //KAB_EMBEDDED |
93 | /** | 93 | /** |
94 | Restores the global settings. | 94 | Restores the global settings. |
95 | */ | 95 | */ |
96 | void restoreSettings(); | 96 | void restoreSettings(); |
97 | 97 | ||
98 | 98 | ||
99 | 99 | ||
100 | /** | 100 | /** |
101 | Returns a pointer to the StdAddressBook of the application. | 101 | Returns a pointer to the StdAddressBook of the application. |
102 | */ | 102 | */ |
103 | KABC::AddressBook *addressBook() const; | 103 | KABC::AddressBook *addressBook() const; |
104 | 104 | ||
105 | /** | 105 | /** |
106 | Returns a pointer to the KConfig object of the application. | 106 | Returns a pointer to the KConfig object of the application. |
107 | */ | 107 | */ |
108 | static KConfig *config(); | 108 | static KConfig *config(); |
109 | 109 | ||
110 | /** | 110 | /** |
111 | Returns a pointer to the global KActionCollection object. So | 111 | Returns a pointer to the global KActionCollection object. So |
112 | other classes can register their actions easily. | 112 | other classes can register their actions easily. |
113 | */ | 113 | */ |
114 | KActionCollection *actionCollection() const; | 114 | KActionCollection *actionCollection() const; |
115 | 115 | ||
116 | /** | 116 | /** |
117 | Returns the current search field of the Incremental Search Widget. | 117 | Returns the current search field of the Incremental Search Widget. |
118 | */ | 118 | */ |
119 | KABC::Field *currentSearchField() const; | 119 | KABC::Field *currentSearchField() const; |
120 | 120 | ||
121 | /** | 121 | /** |
122 | Returns the uid list of the currently selected contacts. | 122 | Returns the uid list of the currently selected contacts. |
123 | */ | 123 | */ |
124 | QStringList selectedUIDs() const; | 124 | QStringList selectedUIDs() const; |
125 | 125 | ||
126 | /** | 126 | /** |
127 | Displays the ResourceSelectDialog and returns the selected | 127 | Displays the ResourceSelectDialog and returns the selected |
128 | resource or a null pointer if no resource was selected by | 128 | resource or a null pointer if no resource was selected by |
129 | the user. | 129 | the user. |
130 | */ | 130 | */ |
131 | KABC::Resource *requestResource( QWidget *parent ); | 131 | KABC::Resource *requestResource( QWidget *parent ); |
132 | 132 | ||
133 | #ifndef KAB_EMBEDDED | 133 | #ifndef KAB_EMBEDDED |
134 | static KAboutData *createAboutData(); | 134 | static KAboutData *createAboutData(); |
135 | #endif //KAB_EMBEDDED | 135 | #endif //KAB_EMBEDDED |
136 | 136 | ||
137 | #ifdef KAB_EMBEDDED | 137 | #ifdef KAB_EMBEDDED |
138 | inline QPopupMenu* getImportMenu() { return ImportMenu;} | 138 | inline QPopupMenu* getImportMenu() { return ImportMenu;} |
139 | inline QPopupMenu* getExportMenu() { return ExportMenu;} | 139 | inline QPopupMenu* getExportMenu() { return ExportMenu;} |
140 | #endif //KAB_EMBEDDED | 140 | #endif //KAB_EMBEDDED |
141 | 141 | ||
142 | public slots: | 142 | public slots: |
143 | #ifdef KAB_EMBEDDED | 143 | #ifdef KAB_EMBEDDED |
144 | void createAboutData(); | 144 | void createAboutData(); |
145 | #endif //KAB_EMBEDDED | 145 | #endif //KAB_EMBEDDED |
146 | void setDetailsToggle(); | 146 | void setDetailsToggle(); |
147 | 147 | ||
148 | void showLicence(); | 148 | void showLicence(); |
149 | void faq(); | 149 | void faq(); |
150 | void whatsnew() ; | 150 | void whatsnew() ; |
151 | void synchowto() ; | 151 | void synchowto() ; |
152 | void storagehowto() ; | 152 | void storagehowto() ; |
153 | void multisynchowto() ; | 153 | void multisynchowto() ; |
154 | void kdesynchowto() ; | 154 | void kdesynchowto() ; |
155 | void writeToPhone(); | 155 | void writeToPhone(); |
156 | 156 | ||
157 | /** | 157 | /** |
158 | Is called whenever a contact is selected in the view. | 158 | Is called whenever a contact is selected in the view. |
159 | */ | 159 | */ |
160 | void setContactSelected( const QString &uid ); | 160 | void setContactSelected( const QString &uid ); |
161 | 161 | ||
162 | /** | 162 | /** |
163 | Opens the preferred mail composer with all selected contacts as | 163 | Opens the preferred mail composer with all selected contacts as |
164 | arguments. | 164 | arguments. |
165 | */ | 165 | */ |
166 | void sendMail(); | 166 | void sendMail(); |
167 | 167 | ||
168 | /** | 168 | /** |
169 | Opens the preferred mail composer with the given contacts as | 169 | Opens the preferred mail composer with the given contacts as |
170 | arguments. | 170 | arguments. |
171 | */ | 171 | */ |
172 | void sendMail( const QString& email ); | 172 | void sendMail( const QString& email ); |
173 | 173 | ||
174 | 174 | ||
175 | void mailVCard(); | 175 | void mailVCard(); |
176 | void mailVCard(const QStringList& uids); | 176 | void mailVCard(const QStringList& uids); |
177 | 177 | ||
178 | /** | 178 | /** |
179 | Beams the "WhoAmI contact. | 179 | Beams the "WhoAmI contact. |
180 | */ | 180 | */ |
181 | void beamMySelf(); | 181 | void beamMySelf(); |
182 | 182 | ||
183 | void beamVCard(); | 183 | void beamVCard(); |
184 | void export2phone(); | 184 | void export2phone(); |
185 | void beamVCard(const QStringList& uids); | 185 | void beamVCard(const QStringList& uids); |
186 | void beamDone( Ir *ir ); | 186 | void beamDone( Ir *ir ); |
187 | 187 | ||
188 | 188 | ||
189 | /** | 189 | /** |
190 | Starts the preferred web browser with the given URL as argument. | 190 | Starts the preferred web browser with the given URL as argument. |
191 | */ | 191 | */ |
192 | void browse( const QString& url ); | 192 | void browse( const QString& url ); |
193 | 193 | ||
194 | /** | 194 | /** |
195 | Select all contacts in the view. | 195 | Select all contacts in the view. |
196 | */ | 196 | */ |
197 | void selectAllContacts(); | 197 | void selectAllContacts(); |
198 | 198 | ||
199 | /** | 199 | /** |
200 | Deletes all selected contacts from the address book. | 200 | Deletes all selected contacts from the address book. |
201 | */ | 201 | */ |
202 | void deleteContacts(); | 202 | void deleteContacts(); |
203 | 203 | ||
204 | /** | 204 | /** |
205 | Deletes given contacts from the address book. | 205 | Deletes given contacts from the address book. |
206 | 206 | ||
207 | @param uids The uids of the contacts, which shall be deleted. | 207 | @param uids The uids of the contacts, which shall be deleted. |
208 | */ | 208 | */ |
209 | void deleteContacts( const QStringList &uids ); | 209 | void deleteContacts( const QStringList &uids ); |
210 | 210 | ||
211 | /** | 211 | /** |
212 | Copys the selected contacts into clipboard for later pasting. | 212 | Copys the selected contacts into clipboard for later pasting. |
213 | */ | 213 | */ |
214 | void copyContacts(); | 214 | void copyContacts(); |
215 | 215 | ||
216 | /** | 216 | /** |
217 | Cuts the selected contacts and stores them for later pasting. | 217 | Cuts the selected contacts and stores them for later pasting. |
218 | */ | 218 | */ |
219 | void cutContacts(); | 219 | void cutContacts(); |
220 | 220 | ||
221 | /** | 221 | /** |
222 | Paste contacts from clipboard into the address book. | 222 | Paste contacts from clipboard into the address book. |
223 | */ | 223 | */ |
224 | void pasteContacts(); | 224 | void pasteContacts(); |
225 | 225 | ||
226 | /** | 226 | /** |
227 | Paste given contacts into the address book. | 227 | Paste given contacts into the address book. |
228 | 228 | ||
229 | @param list The list of addressee, which shall be pasted. | 229 | @param list The list of addressee, which shall be pasted. |
230 | */ | 230 | */ |
231 | void pasteContacts( KABC::Addressee::List &list ); | 231 | void pasteContacts( KABC::Addressee::List &list ); |
232 | 232 | ||
233 | /** | 233 | /** |
234 | Sets the whoAmI contact, that is used by many other programs to | 234 | Sets the whoAmI contact, that is used by many other programs to |
235 | get personal information about the current user. | 235 | get personal information about the current user. |
236 | */ | 236 | */ |
237 | void setWhoAmI(); | 237 | void setWhoAmI(); |
238 | 238 | ||
239 | /** | 239 | /** |
240 | Displays the category dialog and applies the result to all | 240 | Displays the category dialog and applies the result to all |
241 | selected contacts. | 241 | selected contacts. |
242 | */ | 242 | */ |
243 | void setCategories(); | 243 | void setCategories(); |
244 | void manageCategories(); | 244 | void manageCategories(); |
245 | void editCategories(); | 245 | void editCategories(); |
246 | 246 | ||
247 | /** | 247 | /** |
248 | Sets the field list of the Incremental Search Widget. | 248 | Sets the field list of the Incremental Search Widget. |
249 | */ | 249 | */ |
250 | void setSearchFields( const KABC::Field::List &fields ); | 250 | void setSearchFields( const KABC::Field::List &fields ); |
251 | 251 | ||
252 | /** | 252 | /** |
253 | Search with the current search field for a contact, that matches | 253 | Search with the current search field for a contact, that matches |
254 | the given text, and selects it in the view. | 254 | the given text, and selects it in the view. |
255 | */ | 255 | */ |
256 | void incrementalSearch( const QString& text ); | 256 | void incrementalSearch( const QString& text ); |
257 | void incrementalSearchJump( const QString& text ); | 257 | void incrementalSearchJump( const QString& text ); |
258 | 258 | ||
259 | /** | 259 | /** |
260 | Marks the address book as modified. | 260 | Marks the address book as modified. |
261 | */ | 261 | */ |
262 | void setModified(); | 262 | void setModified(); |
263 | /** | 263 | /** |
264 | Marks the address book as modified without refreshing the view. | 264 | Marks the address book as modified without refreshing the view. |
265 | */ | 265 | */ |
266 | void setModifiedWOrefresh(); | 266 | void setModifiedWOrefresh(); |
267 | 267 | ||
268 | /** | 268 | /** |
269 | Marks the address book as modified concerning the argument. | 269 | Marks the address book as modified concerning the argument. |
270 | */ | 270 | */ |
271 | void setModified( bool modified ); | 271 | void setModified( bool modified ); |
272 | 272 | ||
273 | /** | 273 | /** |
274 | Returns whether the address book is modified. | 274 | Returns whether the address book is modified. |
275 | */ | 275 | */ |
276 | bool modified() const; | 276 | bool modified() const; |
277 | 277 | ||
278 | /** | 278 | /** |
279 | Called whenever an contact is modified in the contact editor | 279 | Called whenever an contact is modified in the contact editor |
280 | dialog or the quick edit. | 280 | dialog or the quick edit. |
281 | */ | 281 | */ |
282 | void contactModified( const KABC::Addressee &addr ); | 282 | void contactModified( const KABC::Addressee &addr ); |
283 | void addrModified( const KABC::Addressee &addr, bool updateDetails = true ); | 283 | void addrModified( const KABC::Addressee &addr, bool updateDetails = true ); |
284 | 284 | ||
285 | /** | 285 | /** |
286 | DCOP METHODS. | 286 | DCOP METHODS. |
287 | */ | 287 | */ |
288 | void addEmail( QString addr ); | 288 | void addEmail( QString addr ); |
289 | void importVCard( const KURL& url, bool showPreview ); | 289 | void importVCard( const KURL& url, bool showPreview ); |
290 | void importVCard( const QString& vCard, bool showPreview ); | 290 | void importVCard( const QString& vCard, bool showPreview ); |
291 | void newContact(); | 291 | void newContact(); |
292 | QString getNameByPhone( const QString& phone ); | 292 | QString getNameByPhone( const QString& phone ); |
293 | /** | 293 | /** |
294 | END DCOP METHODS | 294 | END DCOP METHODS |
295 | */ | 295 | */ |
296 | 296 | ||
297 | /** | 297 | /** |
298 | Saves the contents of the AddressBook back to disk. | 298 | Saves the contents of the AddressBook back to disk. |
299 | */ | 299 | */ |
300 | void save(); | 300 | void save(); |
301 | 301 | ||
302 | /** | 302 | /** |
303 | Undos the last command using the undo stack. | 303 | Undos the last command using the undo stack. |
304 | */ | 304 | */ |
305 | void undo(); | 305 | void undo(); |
306 | 306 | ||
307 | /** | 307 | /** |
308 | Redos the last command that was undone, using the redo stack. | 308 | Redos the last command that was undone, using the redo stack. |
309 | */ | 309 | */ |
310 | void redo(); | 310 | void redo(); |
311 | 311 | ||
312 | /** | 312 | /** |
313 | Shows the edit dialog for the given uid. If the uid is QString::null, | 313 | Shows the edit dialog for the given uid. If the uid is QString::null, |
314 | the method will try to find a selected addressee in the view. | 314 | the method will try to find a selected addressee in the view. |
315 | */ | 315 | */ |
316 | void editContact( const QString &uid /*US = QString::null*/ ); | 316 | void editContact( const QString &uid /*US = QString::null*/ ); |
317 | //US added a second method without defaultparameter | 317 | //US added a second method without defaultparameter |
318 | void editContact2(); | 318 | void editContact2(); |
319 | 319 | ||
320 | /** | 320 | /** |
321 | Shows or edits the detail view for the given uid. If the uid is QString::null, | 321 | Shows or edits the detail view for the given uid. If the uid is QString::null, |
322 | the method will try to find a selected addressee in the view. | 322 | the method will try to find a selected addressee in the view. |
323 | */ | 323 | */ |
324 | void executeContact( const QString &uid /*US = QString::null*/ ); | 324 | void executeContact( const QString &uid /*US = QString::null*/ ); |
325 | 325 | ||
326 | /** | 326 | /** |
327 | Launches the configuration dialog. | 327 | Launches the configuration dialog. |
328 | */ | 328 | */ |
329 | void openConfigDialog(); | 329 | void openConfigDialog(); |
330 | void openConfigGlobalDialog(); | ||
330 | 331 | ||
331 | /** | 332 | /** |
332 | Launches the ldap search dialog. | 333 | Launches the ldap search dialog. |
333 | */ | 334 | */ |
334 | void openLDAPDialog(); | 335 | void openLDAPDialog(); |
335 | 336 | ||
336 | /** | 337 | /** |
337 | Creates a KAddressBookPrinter, which will display the print | 338 | Creates a KAddressBookPrinter, which will display the print |
338 | dialog and do the printing. | 339 | dialog and do the printing. |
339 | */ | 340 | */ |
340 | void print(); | 341 | void print(); |
341 | 342 | ||
342 | /** | 343 | /** |
343 | Registers a new GUI client, so plugins can register its actions. | 344 | Registers a new GUI client, so plugins can register its actions. |
344 | */ | 345 | */ |
345 | void addGUIClient( KXMLGUIClient *client ); | 346 | void addGUIClient( KXMLGUIClient *client ); |
346 | 347 | ||
347 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); | 348 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); |
348 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 349 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); |
349 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); | 350 | void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); |
350 | 351 | ||
351 | 352 | ||
352 | signals: | 353 | signals: |
353 | void contactSelected( const QString &name ); | 354 | void contactSelected( const QString &name ); |
354 | void contactSelected( const QPixmap &pixmap ); | 355 | void contactSelected( const QPixmap &pixmap ); |
355 | public slots: | 356 | public slots: |
356 | void recieve(QString cmsg ); | 357 | void recieve(QString cmsg ); |
357 | void getFile( bool success ); | 358 | void getFile( bool success ); |
358 | void syncFileRequest(); | 359 | void syncFileRequest(); |
359 | void setDetailsVisible( bool visible ); | 360 | void setDetailsVisible( bool visible ); |
360 | void setDetailsToState(); | 361 | void setDetailsToState(); |
361 | 362 | ||
362 | void saveSettings(); | 363 | void saveSettings(); |
363 | 364 | ||
364 | private slots: | 365 | private slots: |
365 | void updateToolBar(); | 366 | void updateToolBar(); |
366 | void updateMainWindow(); | 367 | void updateMainWindow(); |
367 | void receive( const QCString& cmsg, const QByteArray& data ); | 368 | void receive( const QCString& cmsg, const QByteArray& data ); |
368 | void toggleBeamReceive( ); | 369 | void toggleBeamReceive( ); |
369 | void disableBR(bool); | 370 | void disableBR(bool); |
370 | void setJumpButtonBarVisible( bool visible ); | 371 | void setJumpButtonBarVisible( bool visible ); |
371 | void setJumpButtonBar( bool visible ); | 372 | void setJumpButtonBar( bool visible ); |
372 | void setCaptionBack(); | 373 | void setCaptionBack(); |
373 | void resizeAndCallContactdialog(); | 374 | void resizeAndCallContactdialog(); |
374 | void callContactdialog(); | 375 | void callContactdialog(); |
375 | 376 | ||
376 | void importFromOL(); | 377 | void importFromOL(); |
377 | void extensionModified( const KABC::Addressee::List &list ); | 378 | void extensionModified( const KABC::Addressee::List &list ); |
378 | void extensionChanged( int id ); | 379 | void extensionChanged( int id ); |
379 | void clipboardDataChanged(); | 380 | void clipboardDataChanged(); |
380 | void updateActionMenu(); | 381 | void updateActionMenu(); |
381 | void configureKeyBindings(); | 382 | void configureKeyBindings(); |
382 | void removeVoice(); | 383 | void removeVoice(); |
383 | void setFormattedName(); | 384 | void setFormattedName(); |
384 | #ifdef KAB_EMBEDDED | 385 | #ifdef KAB_EMBEDDED |
385 | void configureResources(); | 386 | void configureResources(); |
386 | #endif //KAB_EMBEDDED | 387 | #endif //KAB_EMBEDDED |
387 | 388 | ||
388 | void slotEditorDestroyed( const QString &uid ); | 389 | void slotEditorDestroyed( const QString &uid ); |
389 | void configurationChanged(); | 390 | void configurationChanged(); |
390 | void addressBookChanged(); | 391 | void addressBookChanged(); |
391 | 392 | ||
392 | private: | 393 | private: |
393 | QString mEmailSourceChannel; | 394 | QString mEmailSourceChannel; |
394 | QString mEmailSourceUID; | 395 | QString mEmailSourceUID; |
395 | void resizeEvent(QResizeEvent* e ); | 396 | void resizeEvent(QResizeEvent* e ); |
396 | bool mBRdisabled; | 397 | bool mBRdisabled; |
397 | #ifndef DESKTOP_VERSION | 398 | #ifndef DESKTOP_VERSION |
398 | QCopChannel* infrared; | 399 | QCopChannel* infrared; |
399 | #endif | 400 | #endif |
400 | QTimer *mMessageTimer; | 401 | QTimer *mMessageTimer; |
401 | void initGUI(); | 402 | void initGUI(); |
402 | void initActions(); | 403 | void initActions(); |
403 | QString getPhoneFile(); | 404 | QString getPhoneFile(); |
404 | 405 | ||
405 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, | 406 | AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, |
406 | const char *name = 0 ); | 407 | const char *name = 0 ); |
407 | 408 | ||
408 | KXMLGUIClient *mGUIClient; | 409 | KXMLGUIClient *mGUIClient; |
409 | 410 | ||
410 | KABC::AddressBook *mAddressBook; | 411 | KABC::AddressBook *mAddressBook; |
411 | 412 | ||
412 | ViewManager *mViewManager; | 413 | ViewManager *mViewManager; |
413 | // QSplitter *mDetailsSplitter; | 414 | // QSplitter *mDetailsSplitter; |
414 | KDGanttMinimizeSplitter *mExtensionBarSplitter; | 415 | KDGanttMinimizeSplitter *mExtensionBarSplitter; |
415 | ViewContainer *mDetails; | 416 | ViewContainer *mDetails; |
416 | KDGanttMinimizeSplitter* mMiniSplitter; | 417 | KDGanttMinimizeSplitter* mMiniSplitter; |
417 | XXPortManager *mXXPortManager; | 418 | XXPortManager *mXXPortManager; |
418 | JumpButtonBar *mJumpButtonBar; | 419 | JumpButtonBar *mJumpButtonBar; |
419 | IncSearchWidget *mIncSearchWidget; | 420 | IncSearchWidget *mIncSearchWidget; |
420 | ExtensionManager *mExtensionManager; | 421 | ExtensionManager *mExtensionManager; |
421 | 422 | ||
422 | KCMultiDialog *mConfigureDialog; | 423 | KCMultiDialog *mConfigureDialog; |
423 | 424 | ||
424 | #ifndef KAB_EMBEDDED | 425 | #ifndef KAB_EMBEDDED |
425 | LDAPSearchDialog *mLdapSearchDialog; | 426 | LDAPSearchDialog *mLdapSearchDialog; |
426 | #endif //KAB_EMBEDDED | 427 | #endif //KAB_EMBEDDED |
427 | // QDict<AddresseeEditorDialog> mEditorDict; | 428 | // QDict<AddresseeEditorDialog> mEditorDict; |
428 | AddresseeEditorDialog *mEditorDialog; | 429 | AddresseeEditorDialog *mEditorDialog; |
429 | bool mReadWrite; | 430 | bool mReadWrite; |
430 | bool mModified; | 431 | bool mModified; |
431 | bool mIsPart; | 432 | bool mIsPart; |
432 | bool mMultipleViewsAtOnce; | 433 | bool mMultipleViewsAtOnce; |
433 | 434 | ||
434 | 435 | ||
435 | //US file menu | 436 | //US file menu |
436 | KAction *mActionMail; | 437 | KAction *mActionMail; |
437 | KAction *mActionBeam; | 438 | KAction *mActionBeam; |
438 | KToggleAction *mActionBR; | 439 | KToggleAction *mActionBR; |
439 | KAction *mActionExport2phone; | 440 | KAction *mActionExport2phone; |
440 | KAction* mActionPrint; | 441 | KAction* mActionPrint; |
441 | KAction* mActionPrintDetails; | 442 | KAction* mActionPrintDetails; |
442 | KAction* mActionNewContact; | 443 | KAction* mActionNewContact; |
443 | KAction *mActionSave; | 444 | KAction *mActionSave; |
444 | KAction *mActionEditAddressee; | 445 | KAction *mActionEditAddressee; |
445 | KAction *mActionMailVCard; | 446 | KAction *mActionMailVCard; |
446 | KAction *mActionBeamVCard; | 447 | KAction *mActionBeamVCard; |
447 | 448 | ||
448 | KAction *mActionQuit; | 449 | KAction *mActionQuit; |
449 | 450 | ||
450 | //US edit menu | 451 | //US edit menu |
451 | KAction *mActionCopy; | 452 | KAction *mActionCopy; |
452 | KAction *mActionCut; | 453 | KAction *mActionCut; |
453 | KAction *mActionPaste; | 454 | KAction *mActionPaste; |
454 | KAction *mActionSelectAll; | 455 | KAction *mActionSelectAll; |
455 | KAction *mActionUndo; | 456 | KAction *mActionUndo; |
456 | KAction *mActionRedo; | 457 | KAction *mActionRedo; |
457 | KAction *mActionDelete; | 458 | KAction *mActionDelete; |
458 | 459 | ||
459 | //US settings menu | 460 | //US settings menu |
460 | KAction *mActionConfigResources; | 461 | KAction *mActionConfigResources; |
462 | KAction *mActionConfigGlobal; | ||
461 | KAction *mActionConfigKAddressbook; | 463 | KAction *mActionConfigKAddressbook; |
462 | KAction *mActionConfigShortcuts; | 464 | KAction *mActionConfigShortcuts; |
463 | KAction *mActionConfigureToolbars; | 465 | KAction *mActionConfigureToolbars; |
464 | KAction *mActionKeyBindings; | 466 | KAction *mActionKeyBindings; |
465 | KToggleAction *mActionJumpBar; | 467 | KToggleAction *mActionJumpBar; |
466 | KToggleAction *mActionDetails; | 468 | KToggleAction *mActionDetails; |
467 | KAction *mActionWhoAmI; | 469 | KAction *mActionWhoAmI; |
468 | KAction *mActionCategories; | 470 | KAction *mActionCategories; |
469 | KAction *mActionEditCategories; | 471 | KAction *mActionEditCategories; |
470 | KAction *mActionManageCategories; | 472 | KAction *mActionManageCategories; |
471 | KAction *mActionAboutKAddressbook; | 473 | KAction *mActionAboutKAddressbook; |
472 | KAction *mActionLicence; | 474 | KAction *mActionLicence; |
473 | KAction *mActionFaq; | 475 | KAction *mActionFaq; |
474 | KAction *mActionWN; | 476 | KAction *mActionWN; |
475 | KAction *mActionSyncHowto; | 477 | KAction *mActionSyncHowto; |
476 | KAction *mActionStorageHowto; | 478 | KAction *mActionStorageHowto; |
477 | KAction *mActionKdeSyncHowto; | 479 | KAction *mActionKdeSyncHowto; |
478 | KAction *mActionMultiSyncHowto; | 480 | KAction *mActionMultiSyncHowto; |
479 | 481 | ||
480 | KAction *mActionDeleteView; | 482 | KAction *mActionDeleteView; |
481 | 483 | ||
482 | QPopupMenu *viewMenu; | 484 | QPopupMenu *viewMenu; |
483 | QPopupMenu *filterMenu; | 485 | QPopupMenu *filterMenu; |
484 | QPopupMenu *settingsMenu; | 486 | QPopupMenu *settingsMenu; |
485 | QPopupMenu *changeMenu; | 487 | QPopupMenu *changeMenu; |
486 | QPopupMenu *beamMenu; | 488 | QPopupMenu *beamMenu; |
487 | //US QAction *mActionSave; | 489 | //US QAction *mActionSave; |
488 | QPopupMenu *ImportMenu; | 490 | QPopupMenu *ImportMenu; |
489 | QPopupMenu *ExportMenu; | 491 | QPopupMenu *ExportMenu; |
490 | //LR additional methods | 492 | //LR additional methods |
491 | KAction *mActionRemoveVoice; | 493 | KAction *mActionRemoveVoice; |
492 | KAction *mActionSetFormattedName; | 494 | KAction *mActionSetFormattedName; |
493 | KAction * mActionImportOL; | 495 | KAction * mActionImportOL; |
494 | 496 | ||
495 | #ifndef KAB_EMBEDDED | 497 | #ifndef KAB_EMBEDDED |
496 | KAddressBookService *mAddressBookService; | 498 | KAddressBookService *mAddressBookService; |
497 | #endif //KAB_EMBEDDED | 499 | #endif //KAB_EMBEDDED |
498 | 500 | ||
499 | class KABCorePrivate; | 501 | class KABCorePrivate; |
500 | KABCorePrivate *d; | 502 | KABCorePrivate *d; |
501 | //US bool mBlockSaveFlag; | 503 | //US bool mBlockSaveFlag; |
502 | 504 | ||
503 | #ifdef KAB_EMBEDDED | 505 | #ifdef KAB_EMBEDDED |
504 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | 506 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient |
505 | #endif //KAB_EMBEDDED | 507 | #endif //KAB_EMBEDDED |
506 | 508 | ||
507 | //this are the overwritten callbackmethods from the syncinterface | 509 | //this are the overwritten callbackmethods from the syncinterface |
508 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 510 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
509 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 511 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
510 | virtual void removeSyncInfo( QString syncProfile); | 512 | virtual void removeSyncInfo( QString syncProfile); |
511 | bool syncPhone(); | 513 | bool syncPhone(); |
512 | void message( QString m , bool startTimer = true); | 514 | void message( QString m , bool startTimer = true); |
513 | 515 | ||
514 | // LR ******************************* | 516 | // LR ******************************* |
515 | // sync stuff! | 517 | // sync stuff! |
516 | QString sentSyncFile(); | 518 | QString sentSyncFile(); |
517 | QPopupMenu *syncMenu; | 519 | QPopupMenu *syncMenu; |
518 | KSyncManager* syncManager; | 520 | KSyncManager* syncManager; |
519 | int mGlobalSyncMode; | 521 | int mGlobalSyncMode; |
520 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); | 522 | bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); |
521 | KABC::Addressee getLastSyncAddressee(); | 523 | KABC::Addressee getLastSyncAddressee(); |
522 | QDateTime mLastAddressbookSync; | 524 | QDateTime mLastAddressbookSync; |
523 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); | 525 | int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); |
524 | // ********************* | 526 | // ********************* |
525 | 527 | ||
526 | }; | 528 | }; |
527 | 529 | ||
528 | #endif | 530 | #endif |
diff --git a/kaddressbook/kcmconfigs/kcmkabconfig.h b/kaddressbook/kcmconfigs/kcmkabconfig.h index 2ecbfef..2af10d7 100644 --- a/kaddressbook/kcmconfigs/kcmkabconfig.h +++ b/kaddressbook/kcmconfigs/kcmkabconfig.h | |||
@@ -1,47 +1,47 @@ | |||
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 | #ifndef KCMKABCONFIG_H | 24 | #ifndef KCMKABCONFIG_H |
25 | #define KCMKABCONFIG_H | 25 | #define KCMKABCONFIG_H |
26 | 26 | ||
27 | #include <kcmodule.h> | 27 | #include <kcmodule.h> |
28 | 28 | ||
29 | class KABConfigWidget; | 29 | class KABConfigWidget; |
30 | class KABPrefs; | 30 | class KABPrefs; |
31 | 31 | ||
32 | class KCMKabConfig : public KCModule | 32 | class KCMKabConfig : public KCModule |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | 35 | ||
36 | public: | 36 | public: |
37 | KCMKabConfig( QWidget *parent = 0, const char *name = 0 ); | 37 | KCMKabConfig( QWidget *parent = 0, const char *name = 0 ); |
38 | 38 | public slots: | |
39 | virtual void load(); | 39 | virtual void load(); |
40 | virtual void save(); | 40 | virtual void save(); |
41 | virtual void defaults(); | 41 | virtual void defaults(); |
42 | 42 | ||
43 | private: | 43 | private: |
44 | KABConfigWidget *mConfigWidget; | 44 | KABConfigWidget *mConfigWidget; |
45 | }; | 45 | }; |
46 | 46 | ||
47 | #endif | 47 | #endif |
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 4794414..2a55127 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -998,3072 +998,3073 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b | |||
998 | 998 | ||
999 | // ************************************************ | 999 | // ************************************************ |
1000 | // ************************************************ | 1000 | // ************************************************ |
1001 | // ************************************************ | 1001 | // ************************************************ |
1002 | // We may have that lastSync > remoteMod AND lastSync > localMod | 1002 | // We may have that lastSync > remoteMod AND lastSync > localMod |
1003 | // BUT remoteMod != localMod | 1003 | // BUT remoteMod != localMod |
1004 | 1004 | ||
1005 | 1005 | ||
1006 | if ( full && mode < SYNC_PREF_NEWEST ) | 1006 | if ( full && mode < SYNC_PREF_NEWEST ) |
1007 | mode = SYNC_PREF_ASK; | 1007 | mode = SYNC_PREF_ASK; |
1008 | 1008 | ||
1009 | switch( mode ) { | 1009 | switch( mode ) { |
1010 | case SYNC_PREF_LOCAL: | 1010 | case SYNC_PREF_LOCAL: |
1011 | if ( lastSync > remoteMod ) | 1011 | if ( lastSync > remoteMod ) |
1012 | return 1; | 1012 | return 1; |
1013 | if ( lastSync > localMod ) | 1013 | if ( lastSync > localMod ) |
1014 | return 2; | 1014 | return 2; |
1015 | return 1; | 1015 | return 1; |
1016 | break; | 1016 | break; |
1017 | case SYNC_PREF_REMOTE: | 1017 | case SYNC_PREF_REMOTE: |
1018 | if ( lastSync > localMod ) | 1018 | if ( lastSync > localMod ) |
1019 | return 2; | 1019 | return 2; |
1020 | if ( lastSync > remoteMod ) | 1020 | if ( lastSync > remoteMod ) |
1021 | return 1; | 1021 | return 1; |
1022 | return 2; | 1022 | return 2; |
1023 | break; | 1023 | break; |
1024 | case SYNC_PREF_NEWEST: | 1024 | case SYNC_PREF_NEWEST: |
1025 | if ( localMod >= remoteMod ) | 1025 | if ( localMod >= remoteMod ) |
1026 | return 1; | 1026 | return 1; |
1027 | else | 1027 | else |
1028 | return 2; | 1028 | return 2; |
1029 | break; | 1029 | break; |
1030 | case SYNC_PREF_ASK: | 1030 | case SYNC_PREF_ASK: |
1031 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 1031 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
1032 | if ( lastSync > remoteMod && lastSync > localMod) | 1032 | if ( lastSync > remoteMod && lastSync > localMod) |
1033 | return 0; | 1033 | return 0; |
1034 | if ( lastSync > remoteMod ) | 1034 | if ( lastSync > remoteMod ) |
1035 | return 1; | 1035 | return 1; |
1036 | if ( lastSync > localMod ) | 1036 | if ( lastSync > localMod ) |
1037 | return 2; | 1037 | return 2; |
1038 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); | 1038 | //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); |
1039 | localIsNew = localMod >= remoteMod; | 1039 | localIsNew = localMod >= remoteMod; |
1040 | if ( localIsNew ) | 1040 | if ( localIsNew ) |
1041 | getEventViewerDialog()->setColorMode( 1 ); | 1041 | getEventViewerDialog()->setColorMode( 1 ); |
1042 | else | 1042 | else |
1043 | getEventViewerDialog()->setColorMode( 2 ); | 1043 | getEventViewerDialog()->setColorMode( 2 ); |
1044 | getEventViewerDialog()->setIncidence(local); | 1044 | getEventViewerDialog()->setIncidence(local); |
1045 | if ( localIsNew ) | 1045 | if ( localIsNew ) |
1046 | getEventViewerDialog()->setColorMode( 2 ); | 1046 | getEventViewerDialog()->setColorMode( 2 ); |
1047 | else | 1047 | else |
1048 | getEventViewerDialog()->setColorMode( 1 ); | 1048 | getEventViewerDialog()->setColorMode( 1 ); |
1049 | getEventViewerDialog()->addIncidence(remote); | 1049 | getEventViewerDialog()->addIncidence(remote); |
1050 | getEventViewerDialog()->setColorMode( 0 ); | 1050 | getEventViewerDialog()->setColorMode( 0 ); |
1051 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); | 1051 | //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); |
1052 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); | 1052 | getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); |
1053 | getEventViewerDialog()->showMe(); | 1053 | getEventViewerDialog()->showMe(); |
1054 | result = getEventViewerDialog()->executeS( localIsNew ); | 1054 | result = getEventViewerDialog()->executeS( localIsNew ); |
1055 | return result; | 1055 | return result; |
1056 | 1056 | ||
1057 | break; | 1057 | break; |
1058 | case SYNC_PREF_FORCE_LOCAL: | 1058 | case SYNC_PREF_FORCE_LOCAL: |
1059 | return 1; | 1059 | return 1; |
1060 | break; | 1060 | break; |
1061 | case SYNC_PREF_FORCE_REMOTE: | 1061 | case SYNC_PREF_FORCE_REMOTE: |
1062 | return 2; | 1062 | return 2; |
1063 | break; | 1063 | break; |
1064 | 1064 | ||
1065 | default: | 1065 | default: |
1066 | // SYNC_PREF_TAKE_BOTH not implemented | 1066 | // SYNC_PREF_TAKE_BOTH not implemented |
1067 | break; | 1067 | break; |
1068 | } | 1068 | } |
1069 | return 0; | 1069 | return 0; |
1070 | } | 1070 | } |
1071 | Event* CalendarView::getLastSyncEvent() | 1071 | Event* CalendarView::getLastSyncEvent() |
1072 | { | 1072 | { |
1073 | Event* lse; | 1073 | Event* lse; |
1074 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); | 1074 | //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); |
1075 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); | 1075 | lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice ); |
1076 | if (!lse) { | 1076 | if (!lse) { |
1077 | lse = new Event(); | 1077 | lse = new Event(); |
1078 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); | 1078 | lse->setUid( "last-syncEvent-"+mCurrentSyncDevice ); |
1079 | QString sum = ""; | 1079 | QString sum = ""; |
1080 | if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) | 1080 | if ( mSyncManager->mExternSyncProfiles.contains( mCurrentSyncDevice ) ) |
1081 | sum = "E: "; | 1081 | sum = "E: "; |
1082 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); | 1082 | lse->setSummary(sum+mCurrentSyncDevice + i18n(" - sync event")); |
1083 | lse->setDtStart( mLastCalendarSync ); | 1083 | lse->setDtStart( mLastCalendarSync ); |
1084 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 1084 | lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
1085 | lse->setCategories( i18n("SyncEvent") ); | 1085 | lse->setCategories( i18n("SyncEvent") ); |
1086 | lse->setReadOnly( true ); | 1086 | lse->setReadOnly( true ); |
1087 | mCalendar->addEvent( lse ); | 1087 | mCalendar->addEvent( lse ); |
1088 | } | 1088 | } |
1089 | 1089 | ||
1090 | return lse; | 1090 | return lse; |
1091 | 1091 | ||
1092 | } | 1092 | } |
1093 | 1093 | ||
1094 | // we check, if the to delete event has a id for a profile | 1094 | // we check, if the to delete event has a id for a profile |
1095 | // if yes, we set this id in the profile to delete | 1095 | // if yes, we set this id in the profile to delete |
1096 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) | 1096 | void CalendarView::checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ) |
1097 | { | 1097 | { |
1098 | if ( lastSync.count() == 0 ) { | 1098 | if ( lastSync.count() == 0 ) { |
1099 | //qDebug(" lastSync.count() == 0"); | 1099 | //qDebug(" lastSync.count() == 0"); |
1100 | return; | 1100 | return; |
1101 | } | 1101 | } |
1102 | if ( toDelete->typeID() == journalID ) | 1102 | if ( toDelete->typeID() == journalID ) |
1103 | return; | 1103 | return; |
1104 | 1104 | ||
1105 | Event* eve = lastSync.first(); | 1105 | Event* eve = lastSync.first(); |
1106 | 1106 | ||
1107 | while ( eve ) { | 1107 | while ( eve ) { |
1108 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name | 1108 | QString id = toDelete->getID( eve->uid().mid( 15 ) ); // this is the sync profile name |
1109 | if ( !id.isEmpty() ) { | 1109 | if ( !id.isEmpty() ) { |
1110 | QString des = eve->description(); | 1110 | QString des = eve->description(); |
1111 | QString pref = "e"; | 1111 | QString pref = "e"; |
1112 | if ( toDelete->typeID() == todoID ) | 1112 | if ( toDelete->typeID() == todoID ) |
1113 | pref = "t"; | 1113 | pref = "t"; |
1114 | des += pref+ id + ","; | 1114 | des += pref+ id + ","; |
1115 | eve->setReadOnly( false ); | 1115 | eve->setReadOnly( false ); |
1116 | eve->setDescription( des ); | 1116 | eve->setDescription( des ); |
1117 | //qDebug("setdes %s ", des.latin1()); | 1117 | //qDebug("setdes %s ", des.latin1()); |
1118 | eve->setReadOnly( true ); | 1118 | eve->setReadOnly( true ); |
1119 | } | 1119 | } |
1120 | eve = lastSync.next(); | 1120 | eve = lastSync.next(); |
1121 | } | 1121 | } |
1122 | 1122 | ||
1123 | } | 1123 | } |
1124 | void CalendarView::checkExternalId( Incidence * inc ) | 1124 | void CalendarView::checkExternalId( Incidence * inc ) |
1125 | { | 1125 | { |
1126 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; | 1126 | QPtrList<Event> lastSync = mCalendar->getExternLastSyncEvents() ; |
1127 | checkExternSyncEvent( lastSync, inc ); | 1127 | checkExternSyncEvent( lastSync, inc ); |
1128 | 1128 | ||
1129 | } | 1129 | } |
1130 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) | 1130 | bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) |
1131 | { | 1131 | { |
1132 | bool syncOK = true; | 1132 | bool syncOK = true; |
1133 | int addedEvent = 0; | 1133 | int addedEvent = 0; |
1134 | int addedEventR = 0; | 1134 | int addedEventR = 0; |
1135 | int deletedEventR = 0; | 1135 | int deletedEventR = 0; |
1136 | int deletedEventL = 0; | 1136 | int deletedEventL = 0; |
1137 | int changedLocal = 0; | 1137 | int changedLocal = 0; |
1138 | int changedRemote = 0; | 1138 | int changedRemote = 0; |
1139 | int filteredIN = 0; | 1139 | int filteredIN = 0; |
1140 | int filteredOUT = 0; | 1140 | int filteredOUT = 0; |
1141 | //QPtrList<Event> el = local->rawEvents(); | 1141 | //QPtrList<Event> el = local->rawEvents(); |
1142 | Event* eventR; | 1142 | Event* eventR; |
1143 | QString uid; | 1143 | QString uid; |
1144 | int take; | 1144 | int take; |
1145 | Event* eventL; | 1145 | Event* eventL; |
1146 | Event* eventRSync; | 1146 | Event* eventRSync; |
1147 | Event* eventLSync; | 1147 | Event* eventLSync; |
1148 | clearAllViews(); | 1148 | clearAllViews(); |
1149 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); | 1149 | QPtrList<Event> eventRSyncSharp = remote->getExternLastSyncEvents(); |
1150 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); | 1150 | QPtrList<Event> eventLSyncSharp = local->getExternLastSyncEvents(); |
1151 | bool fullDateRange = false; | 1151 | bool fullDateRange = false; |
1152 | local->resetTempSyncStat(); | 1152 | local->resetTempSyncStat(); |
1153 | mLastCalendarSync = QDateTime::currentDateTime(); | 1153 | mLastCalendarSync = QDateTime::currentDateTime(); |
1154 | if ( mSyncManager->syncWithDesktop() ) { | 1154 | if ( mSyncManager->syncWithDesktop() ) { |
1155 | remote->resetPilotStat(1); | 1155 | remote->resetPilotStat(1); |
1156 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { | 1156 | if ( KSyncManager::mRequestedSyncEvent.isValid() ) { |
1157 | mLastCalendarSync = KSyncManager::mRequestedSyncEvent; | 1157 | mLastCalendarSync = KSyncManager::mRequestedSyncEvent; |
1158 | qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); | 1158 | qDebug("KO: using extern time for calendar sync: %s ", mLastCalendarSync.toString().latin1() ); |
1159 | } else { | 1159 | } else { |
1160 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); | 1160 | qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); |
1161 | } | 1161 | } |
1162 | } | 1162 | } |
1163 | QDateTime modifiedCalendar = mLastCalendarSync; | 1163 | QDateTime modifiedCalendar = mLastCalendarSync; |
1164 | eventLSync = getLastSyncEvent(); | 1164 | eventLSync = getLastSyncEvent(); |
1165 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); | 1165 | eventR = remote->event("last-syncEvent-"+mCurrentSyncName ); |
1166 | if ( eventR ) { | 1166 | if ( eventR ) { |
1167 | eventRSync = (Event*) eventR->clone(); | 1167 | eventRSync = (Event*) eventR->clone(); |
1168 | remote->deleteEvent(eventR ); | 1168 | remote->deleteEvent(eventR ); |
1169 | 1169 | ||
1170 | } else { | 1170 | } else { |
1171 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { | 1171 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL || mSyncManager->syncWithDesktop()) { |
1172 | eventRSync = (Event*)eventLSync->clone(); | 1172 | eventRSync = (Event*)eventLSync->clone(); |
1173 | } else { | 1173 | } else { |
1174 | fullDateRange = true; | 1174 | fullDateRange = true; |
1175 | eventRSync = new Event(); | 1175 | eventRSync = new Event(); |
1176 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); | 1176 | eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); |
1177 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); | 1177 | eventRSync->setUid("last-syncEvent-"+mCurrentSyncName ); |
1178 | eventRSync->setDtStart( mLastCalendarSync ); | 1178 | eventRSync->setDtStart( mLastCalendarSync ); |
1179 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); | 1179 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); |
1180 | eventRSync->setCategories( i18n("SyncEvent") ); | 1180 | eventRSync->setCategories( i18n("SyncEvent") ); |
1181 | } | 1181 | } |
1182 | } | 1182 | } |
1183 | if ( eventLSync->dtStart() == mLastCalendarSync ) | 1183 | if ( eventLSync->dtStart() == mLastCalendarSync ) |
1184 | fullDateRange = true; | 1184 | fullDateRange = true; |
1185 | 1185 | ||
1186 | if ( ! fullDateRange ) { | 1186 | if ( ! fullDateRange ) { |
1187 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { | 1187 | if ( eventLSync->dtStart() != eventRSync->dtStart() ) { |
1188 | 1188 | ||
1189 | // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); | 1189 | // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); |
1190 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); | 1190 | //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); |
1191 | fullDateRange = true; | 1191 | fullDateRange = true; |
1192 | } | 1192 | } |
1193 | } | 1193 | } |
1194 | if ( mSyncManager->syncWithDesktop() ) { | 1194 | if ( mSyncManager->syncWithDesktop() ) { |
1195 | fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); | 1195 | fullDateRange = ( eventLSync->dtStart() <= mLastCalendarSync && eventLSync->dtStart().addSecs(1) >= mLastCalendarSync ); |
1196 | } | 1196 | } |
1197 | if ( fullDateRange ) | 1197 | if ( fullDateRange ) |
1198 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); | 1198 | mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); |
1199 | else | 1199 | else |
1200 | mLastCalendarSync = eventLSync->dtStart(); | 1200 | mLastCalendarSync = eventLSync->dtStart(); |
1201 | // for resyncing if own file has changed | 1201 | // for resyncing if own file has changed |
1202 | if ( mCurrentSyncDevice == "deleteaftersync" ) { | 1202 | if ( mCurrentSyncDevice == "deleteaftersync" ) { |
1203 | mLastCalendarSync = loadedFileVersion; | 1203 | mLastCalendarSync = loadedFileVersion; |
1204 | //qDebug("setting mLastCalendarSync "); | 1204 | //qDebug("setting mLastCalendarSync "); |
1205 | } | 1205 | } |
1206 | //qDebug("*************************** "); | 1206 | //qDebug("*************************** "); |
1207 | qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); | 1207 | qDebug("KO: mLastCalendarSync %s .Full: %d",mLastCalendarSync.toString().latin1(), fullDateRange); |
1208 | QPtrList<Incidence> er = remote->rawIncidences(); | 1208 | QPtrList<Incidence> er = remote->rawIncidences(); |
1209 | Incidence* inR = er.first(); | 1209 | Incidence* inR = er.first(); |
1210 | Incidence* inL; | 1210 | Incidence* inL; |
1211 | QProgressBar bar( er.count(),0 ); | 1211 | QProgressBar bar( er.count(),0 ); |
1212 | bar.setCaption (i18n("Syncing - close to abort!") ); | 1212 | bar.setCaption (i18n("Syncing - close to abort!") ); |
1213 | 1213 | ||
1214 | // ************** setting up filter ************* | 1214 | // ************** setting up filter ************* |
1215 | CalFilter *filterIN = 0; | 1215 | CalFilter *filterIN = 0; |
1216 | CalFilter *filterOUT = 0; | 1216 | CalFilter *filterOUT = 0; |
1217 | CalFilter *filter = mFilters.first(); | 1217 | CalFilter *filter = mFilters.first(); |
1218 | while(filter) { | 1218 | while(filter) { |
1219 | if ( filter->name() == mSyncManager->mFilterInCal ) | 1219 | if ( filter->name() == mSyncManager->mFilterInCal ) |
1220 | filterIN = filter; | 1220 | filterIN = filter; |
1221 | if ( filter->name() == mSyncManager->mFilterOutCal ) | 1221 | if ( filter->name() == mSyncManager->mFilterOutCal ) |
1222 | filterOUT = filter; | 1222 | filterOUT = filter; |
1223 | filter = mFilters.next(); | 1223 | filter = mFilters.next(); |
1224 | } | 1224 | } |
1225 | int w = 300; | 1225 | int w = 300; |
1226 | if ( QApplication::desktop()->width() < 320 ) | 1226 | if ( QApplication::desktop()->width() < 320 ) |
1227 | w = 220; | 1227 | w = 220; |
1228 | int h = bar.sizeHint().height() ; | 1228 | int h = bar.sizeHint().height() ; |
1229 | int dw = QApplication::desktop()->width(); | 1229 | int dw = QApplication::desktop()->width(); |
1230 | int dh = QApplication::desktop()->height(); | 1230 | int dh = QApplication::desktop()->height(); |
1231 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1231 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1232 | bar.show(); | 1232 | bar.show(); |
1233 | int modulo = (er.count()/10)+1; | 1233 | int modulo = (er.count()/10)+1; |
1234 | int incCounter = 0; | 1234 | int incCounter = 0; |
1235 | while ( inR ) { | 1235 | while ( inR ) { |
1236 | if ( ! bar.isVisible() ) | 1236 | if ( ! bar.isVisible() ) |
1237 | return false; | 1237 | return false; |
1238 | if ( incCounter % modulo == 0 ) | 1238 | if ( incCounter % modulo == 0 ) |
1239 | bar.setProgress( incCounter ); | 1239 | bar.setProgress( incCounter ); |
1240 | ++incCounter; | 1240 | ++incCounter; |
1241 | uid = inR->uid(); | 1241 | uid = inR->uid(); |
1242 | bool skipIncidence = false; | 1242 | bool skipIncidence = false; |
1243 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1243 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1244 | skipIncidence = true; | 1244 | skipIncidence = true; |
1245 | QString idS; | 1245 | QString idS; |
1246 | qApp->processEvents(); | 1246 | qApp->processEvents(); |
1247 | if ( !skipIncidence ) { | 1247 | if ( !skipIncidence ) { |
1248 | inL = local->incidence( uid ); | 1248 | inL = local->incidence( uid ); |
1249 | if ( inL ) { // maybe conflict - same uid in both calendars | 1249 | if ( inL ) { // maybe conflict - same uid in both calendars |
1250 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { | 1250 | if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { |
1251 | //qDebug("take %d %s ", take, inL->summary().latin1()); | 1251 | //qDebug("take %d %s ", take, inL->summary().latin1()); |
1252 | if ( take == 3 ) | 1252 | if ( take == 3 ) |
1253 | return false; | 1253 | return false; |
1254 | if ( take == 1 ) {// take local ********************** | 1254 | if ( take == 1 ) {// take local ********************** |
1255 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) | 1255 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) |
1256 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1256 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1257 | else | 1257 | else |
1258 | idS = inR->IDStr(); | 1258 | idS = inR->IDStr(); |
1259 | remote->deleteIncidence( inR ); | 1259 | remote->deleteIncidence( inR ); |
1260 | inR = inL->clone(); | 1260 | inR = inL->clone(); |
1261 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1261 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1262 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) | 1262 | if ( mGlobalSyncMode != SYNC_MODE_EXTERNAL ) |
1263 | inR->setIDStr( idS ); | 1263 | inR->setIDStr( idS ); |
1264 | remote->addIncidence( inR ); | 1264 | remote->addIncidence( inR ); |
1265 | if ( mSyncManager->syncWithDesktop() ) | 1265 | if ( mSyncManager->syncWithDesktop() ) |
1266 | inR->setPilotId( 2 ); | 1266 | inR->setPilotId( 2 ); |
1267 | ++changedRemote; | 1267 | ++changedRemote; |
1268 | } else {// take remote ********************** | 1268 | } else {// take remote ********************** |
1269 | idS = inL->IDStr(); | 1269 | idS = inL->IDStr(); |
1270 | int pid = inL->pilotId(); | 1270 | int pid = inL->pilotId(); |
1271 | local->deleteIncidence( inL ); | 1271 | local->deleteIncidence( inL ); |
1272 | inL = inR->clone(); | 1272 | inL = inR->clone(); |
1273 | if ( mSyncManager->syncWithDesktop() ) | 1273 | if ( mSyncManager->syncWithDesktop() ) |
1274 | inL->setPilotId( pid ); | 1274 | inL->setPilotId( pid ); |
1275 | inL->setIDStr( idS ); | 1275 | inL->setIDStr( idS ); |
1276 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1276 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1277 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1277 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1278 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1278 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1279 | } | 1279 | } |
1280 | local->addIncidence( inL ); | 1280 | local->addIncidence( inL ); |
1281 | ++changedLocal; | 1281 | ++changedLocal; |
1282 | } | 1282 | } |
1283 | } | 1283 | } |
1284 | } else { // no conflict ********** add or delete remote | 1284 | } else { // no conflict ********** add or delete remote |
1285 | if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ | 1285 | if ( !filterIN || filterIN->filterCalendarItem( inR ) ){ |
1286 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1286 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1287 | QString des = eventLSync->description(); | 1287 | QString des = eventLSync->description(); |
1288 | QString pref = "e"; | 1288 | QString pref = "e"; |
1289 | if ( inR->typeID() == todoID ) | 1289 | if ( inR->typeID() == todoID ) |
1290 | pref = "t"; | 1290 | pref = "t"; |
1291 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it | 1291 | if ( des.find(pref+ inR->getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it |
1292 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); | 1292 | inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); |
1293 | //remote->deleteIncidence( inR ); | 1293 | //remote->deleteIncidence( inR ); |
1294 | ++deletedEventR; | 1294 | ++deletedEventR; |
1295 | } else { | 1295 | } else { |
1296 | inR->setLastModified( modifiedCalendar ); | 1296 | inR->setLastModified( modifiedCalendar ); |
1297 | inL = inR->clone(); | 1297 | inL = inR->clone(); |
1298 | inL->setIDStr( ":" ); | 1298 | inL->setIDStr( ":" ); |
1299 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); | 1299 | inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); |
1300 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); | 1300 | inL->setID( mCurrentSyncDevice, inR->getID(mCurrentSyncDevice) ); |
1301 | local->addIncidence( inL ); | 1301 | local->addIncidence( inL ); |
1302 | ++addedEvent; | 1302 | ++addedEvent; |
1303 | 1303 | ||
1304 | } | 1304 | } |
1305 | } else { | 1305 | } else { |
1306 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { | 1306 | if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { |
1307 | inR->setLastModified( modifiedCalendar ); | 1307 | inR->setLastModified( modifiedCalendar ); |
1308 | inL = inR->clone(); | 1308 | inL = inR->clone(); |
1309 | inL->setIDStr( ":" ); | 1309 | inL->setIDStr( ":" ); |
1310 | local->addIncidence( inL ); | 1310 | local->addIncidence( inL ); |
1311 | ++addedEvent; | 1311 | ++addedEvent; |
1312 | 1312 | ||
1313 | } else { | 1313 | } else { |
1314 | checkExternSyncEvent(eventRSyncSharp, inR); | 1314 | checkExternSyncEvent(eventRSyncSharp, inR); |
1315 | remote->deleteIncidence( inR ); | 1315 | remote->deleteIncidence( inR ); |
1316 | ++deletedEventR; | 1316 | ++deletedEventR; |
1317 | } | 1317 | } |
1318 | } | 1318 | } |
1319 | } else { | 1319 | } else { |
1320 | ++filteredIN; | 1320 | ++filteredIN; |
1321 | } | 1321 | } |
1322 | } | 1322 | } |
1323 | } | 1323 | } |
1324 | inR = er.next(); | 1324 | inR = er.next(); |
1325 | } | 1325 | } |
1326 | QPtrList<Incidence> el = local->rawIncidences(); | 1326 | QPtrList<Incidence> el = local->rawIncidences(); |
1327 | inL = el.first(); | 1327 | inL = el.first(); |
1328 | modulo = (el.count()/10)+1; | 1328 | modulo = (el.count()/10)+1; |
1329 | bar.setCaption (i18n("Add / remove events") ); | 1329 | bar.setCaption (i18n("Add / remove events") ); |
1330 | bar.setTotalSteps ( el.count() ) ; | 1330 | bar.setTotalSteps ( el.count() ) ; |
1331 | bar.show(); | 1331 | bar.show(); |
1332 | incCounter = 0; | 1332 | incCounter = 0; |
1333 | 1333 | ||
1334 | while ( inL ) { | 1334 | while ( inL ) { |
1335 | 1335 | ||
1336 | qApp->processEvents(); | 1336 | qApp->processEvents(); |
1337 | if ( ! bar.isVisible() ) | 1337 | if ( ! bar.isVisible() ) |
1338 | return false; | 1338 | return false; |
1339 | if ( incCounter % modulo == 0 ) | 1339 | if ( incCounter % modulo == 0 ) |
1340 | bar.setProgress( incCounter ); | 1340 | bar.setProgress( incCounter ); |
1341 | ++incCounter; | 1341 | ++incCounter; |
1342 | uid = inL->uid(); | 1342 | uid = inL->uid(); |
1343 | bool skipIncidence = false; | 1343 | bool skipIncidence = false; |
1344 | if ( uid.left(15) == QString("last-syncEvent-") ) | 1344 | if ( uid.left(15) == QString("last-syncEvent-") ) |
1345 | skipIncidence = true; | 1345 | skipIncidence = true; |
1346 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID ) | 1346 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID ) |
1347 | skipIncidence = true; | 1347 | skipIncidence = true; |
1348 | if ( !skipIncidence ) { | 1348 | if ( !skipIncidence ) { |
1349 | inR = remote->incidence( uid ); | 1349 | inR = remote->incidence( uid ); |
1350 | if ( ! inR ) { | 1350 | if ( ! inR ) { |
1351 | if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ | 1351 | if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ |
1352 | // no conflict ********** add or delete local | 1352 | // no conflict ********** add or delete local |
1353 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { | 1353 | if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { |
1354 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { | 1354 | if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { |
1355 | checkExternSyncEvent(eventLSyncSharp, inL); | 1355 | checkExternSyncEvent(eventLSyncSharp, inL); |
1356 | local->deleteIncidence( inL ); | 1356 | local->deleteIncidence( inL ); |
1357 | ++deletedEventL; | 1357 | ++deletedEventL; |
1358 | } else { | 1358 | } else { |
1359 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1359 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1360 | inL->removeID(mCurrentSyncDevice ); | 1360 | inL->removeID(mCurrentSyncDevice ); |
1361 | ++addedEventR; | 1361 | ++addedEventR; |
1362 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); | 1362 | //qDebug("remote added Incidence %s ", inL->summary().latin1()); |
1363 | inL->setLastModified( modifiedCalendar ); | 1363 | inL->setLastModified( modifiedCalendar ); |
1364 | inR = inL->clone(); | 1364 | inR = inL->clone(); |
1365 | inR->setIDStr( ":" ); | 1365 | inR->setIDStr( ":" ); |
1366 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); | 1366 | inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); |
1367 | remote->addIncidence( inR ); | 1367 | remote->addIncidence( inR ); |
1368 | } | 1368 | } |
1369 | } | 1369 | } |
1370 | } else { | 1370 | } else { |
1371 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { | 1371 | if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { |
1372 | checkExternSyncEvent(eventLSyncSharp, inL); | 1372 | checkExternSyncEvent(eventLSyncSharp, inL); |
1373 | local->deleteIncidence( inL ); | 1373 | local->deleteIncidence( inL ); |
1374 | ++deletedEventL; | 1374 | ++deletedEventL; |
1375 | } else { | 1375 | } else { |
1376 | if ( ! mSyncManager->mWriteBackExistingOnly ) { | 1376 | if ( ! mSyncManager->mWriteBackExistingOnly ) { |
1377 | ++addedEventR; | 1377 | ++addedEventR; |
1378 | inL->setLastModified( modifiedCalendar ); | 1378 | inL->setLastModified( modifiedCalendar ); |
1379 | inR = inL->clone(); | 1379 | inR = inL->clone(); |
1380 | inR->setIDStr( ":" ); | 1380 | inR->setIDStr( ":" ); |
1381 | remote->addIncidence( inR ); | 1381 | remote->addIncidence( inR ); |
1382 | } | 1382 | } |
1383 | } | 1383 | } |
1384 | } | 1384 | } |
1385 | } else { | 1385 | } else { |
1386 | ++filteredOUT; | 1386 | ++filteredOUT; |
1387 | } | 1387 | } |
1388 | } | 1388 | } |
1389 | } | 1389 | } |
1390 | inL = el.next(); | 1390 | inL = el.next(); |
1391 | } | 1391 | } |
1392 | int delFut = 0; | 1392 | int delFut = 0; |
1393 | int remRem = 0; | 1393 | int remRem = 0; |
1394 | if ( mSyncManager->mWriteBackInFuture ) { | 1394 | if ( mSyncManager->mWriteBackInFuture ) { |
1395 | er = remote->rawIncidences(); | 1395 | er = remote->rawIncidences(); |
1396 | remRem = er.count(); | 1396 | remRem = er.count(); |
1397 | inR = er.first(); | 1397 | inR = er.first(); |
1398 | QDateTime dt; | 1398 | QDateTime dt; |
1399 | QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); | 1399 | QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) ); |
1400 | QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); | 1400 | QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 ); |
1401 | while ( inR ) { | 1401 | while ( inR ) { |
1402 | if ( inR->typeID() == todoID ) { | 1402 | if ( inR->typeID() == todoID ) { |
1403 | Todo * t = (Todo*)inR; | 1403 | Todo * t = (Todo*)inR; |
1404 | if ( t->hasDueDate() ) | 1404 | if ( t->hasDueDate() ) |
1405 | dt = t->dtDue(); | 1405 | dt = t->dtDue(); |
1406 | else | 1406 | else |
1407 | dt = cur.addSecs( 62 ); | 1407 | dt = cur.addSecs( 62 ); |
1408 | } | 1408 | } |
1409 | else if (inR->typeID() == eventID ) { | 1409 | else if (inR->typeID() == eventID ) { |
1410 | bool ok; | 1410 | bool ok; |
1411 | dt = inR->getNextOccurence( cur, &ok ); | 1411 | dt = inR->getNextOccurence( cur, &ok ); |
1412 | if ( !ok ) | 1412 | if ( !ok ) |
1413 | dt = cur.addSecs( -62 ); | 1413 | dt = cur.addSecs( -62 ); |
1414 | } | 1414 | } |
1415 | else | 1415 | else |
1416 | dt = inR->dtStart(); | 1416 | dt = inR->dtStart(); |
1417 | if ( dt < cur || dt > end ) { | 1417 | if ( dt < cur || dt > end ) { |
1418 | remote->deleteIncidence( inR ); | 1418 | remote->deleteIncidence( inR ); |
1419 | ++delFut; | 1419 | ++delFut; |
1420 | } | 1420 | } |
1421 | inR = er.next(); | 1421 | inR = er.next(); |
1422 | } | 1422 | } |
1423 | } | 1423 | } |
1424 | bar.hide(); | 1424 | bar.hide(); |
1425 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); | 1425 | mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); |
1426 | eventLSync->setReadOnly( false ); | 1426 | eventLSync->setReadOnly( false ); |
1427 | eventLSync->setDtStart( mLastCalendarSync ); | 1427 | eventLSync->setDtStart( mLastCalendarSync ); |
1428 | eventRSync->setDtStart( mLastCalendarSync ); | 1428 | eventRSync->setDtStart( mLastCalendarSync ); |
1429 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1429 | eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1430 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); | 1430 | eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); |
1431 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; | 1431 | eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; |
1432 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); | 1432 | eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); |
1433 | eventLSync->setReadOnly( true ); | 1433 | eventLSync->setReadOnly( true ); |
1434 | qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); | 1434 | qDebug("KO: Normal sync: %d ",mGlobalSyncMode == SYNC_MODE_NORMAL ); |
1435 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... | 1435 | if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... |
1436 | remote->addEvent( eventRSync ); | 1436 | remote->addEvent( eventRSync ); |
1437 | else | 1437 | else |
1438 | delete eventRSync; | 1438 | delete eventRSync; |
1439 | qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() ); | 1439 | qDebug("KO: Sync with desktop %d ",mSyncManager->syncWithDesktop() ); |
1440 | QString mes; | 1440 | QString mes; |
1441 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT ); | 1441 | mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n %d incoming filtered out\n %d outgoing filtered out\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR, filteredIN, filteredOUT ); |
1442 | QString delmess; | 1442 | QString delmess; |
1443 | if ( delFut ) { | 1443 | if ( delFut ) { |
1444 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut); | 1444 | delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut); |
1445 | mes += delmess; | 1445 | mes += delmess; |
1446 | } | 1446 | } |
1447 | mes = i18n("Local calendar changed!\n") +mes; | 1447 | mes = i18n("Local calendar changed!\n") +mes; |
1448 | mCalendar->checkAlarmForIncidence( 0, true ); | 1448 | mCalendar->checkAlarmForIncidence( 0, true ); |
1449 | qDebug( mes ); | 1449 | qDebug( mes ); |
1450 | if ( mSyncManager->mShowSyncSummary ) { | 1450 | if ( mSyncManager->mShowSyncSummary ) { |
1451 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, | 1451 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, |
1452 | i18n("KO/Pi Synchronization"),i18n("Write back"))) { | 1452 | i18n("KO/Pi Synchronization"),i18n("Write back"))) { |
1453 | qDebug("KO: WB cancelled "); | 1453 | qDebug("KO: WB cancelled "); |
1454 | mSyncManager->mWriteBackFile = false; | 1454 | mSyncManager->mWriteBackFile = false; |
1455 | return syncOK; | 1455 | return syncOK; |
1456 | } | 1456 | } |
1457 | } | 1457 | } |
1458 | return syncOK; | 1458 | return syncOK; |
1459 | } | 1459 | } |
1460 | 1460 | ||
1461 | void CalendarView::setSyncDevice( QString s ) | 1461 | void CalendarView::setSyncDevice( QString s ) |
1462 | { | 1462 | { |
1463 | mCurrentSyncDevice= s; | 1463 | mCurrentSyncDevice= s; |
1464 | } | 1464 | } |
1465 | void CalendarView::setSyncName( QString s ) | 1465 | void CalendarView::setSyncName( QString s ) |
1466 | { | 1466 | { |
1467 | mCurrentSyncName= s; | 1467 | mCurrentSyncName= s; |
1468 | } | 1468 | } |
1469 | bool CalendarView::syncCalendar(QString filename, int mode) | 1469 | bool CalendarView::syncCalendar(QString filename, int mode) |
1470 | { | 1470 | { |
1471 | //qDebug("syncCalendar %s ", filename.latin1()); | 1471 | //qDebug("syncCalendar %s ", filename.latin1()); |
1472 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 1472 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
1473 | CalendarLocal* calendar = new CalendarLocal(); | 1473 | CalendarLocal* calendar = new CalendarLocal(); |
1474 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1474 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1475 | FileStorage* storage = new FileStorage( calendar ); | 1475 | FileStorage* storage = new FileStorage( calendar ); |
1476 | bool syncOK = false; | 1476 | bool syncOK = false; |
1477 | storage->setFileName( filename ); | 1477 | storage->setFileName( filename ); |
1478 | // qDebug("loading ... "); | 1478 | // qDebug("loading ... "); |
1479 | if ( storage->load() ) { | 1479 | if ( storage->load() ) { |
1480 | getEventViewerDialog()->setSyncMode( true ); | 1480 | getEventViewerDialog()->setSyncMode( true ); |
1481 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); | 1481 | syncOK = synchronizeCalendar( mCalendar, calendar, mode ); |
1482 | getEventViewerDialog()->setSyncMode( false ); | 1482 | getEventViewerDialog()->setSyncMode( false ); |
1483 | if ( syncOK ) { | 1483 | if ( syncOK ) { |
1484 | if ( mSyncManager->mWriteBackFile ) | 1484 | if ( mSyncManager->mWriteBackFile ) |
1485 | { | 1485 | { |
1486 | storage->setSaveFormat( new ICalFormat() ); | 1486 | storage->setSaveFormat( new ICalFormat() ); |
1487 | storage->save(); | 1487 | storage->save(); |
1488 | } | 1488 | } |
1489 | } | 1489 | } |
1490 | setModified( true ); | 1490 | setModified( true ); |
1491 | } | 1491 | } |
1492 | delete storage; | 1492 | delete storage; |
1493 | delete calendar; | 1493 | delete calendar; |
1494 | if ( syncOK ) | 1494 | if ( syncOK ) |
1495 | updateView(); | 1495 | updateView(); |
1496 | return syncOK; | 1496 | return syncOK; |
1497 | } | 1497 | } |
1498 | 1498 | ||
1499 | void CalendarView::syncExternal( int mode ) | 1499 | void CalendarView::syncExternal( int mode ) |
1500 | { | 1500 | { |
1501 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 1501 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
1502 | 1502 | ||
1503 | qApp->processEvents(); | 1503 | qApp->processEvents(); |
1504 | CalendarLocal* calendar = new CalendarLocal(); | 1504 | CalendarLocal* calendar = new CalendarLocal(); |
1505 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1505 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1506 | bool syncOK = false; | 1506 | bool syncOK = false; |
1507 | bool loadSuccess = false; | 1507 | bool loadSuccess = false; |
1508 | PhoneFormat* phoneFormat = 0; | 1508 | PhoneFormat* phoneFormat = 0; |
1509 | emit tempDisableBR(true); | 1509 | emit tempDisableBR(true); |
1510 | #ifndef DESKTOP_VERSION | 1510 | #ifndef DESKTOP_VERSION |
1511 | SharpFormat* sharpFormat = 0; | 1511 | SharpFormat* sharpFormat = 0; |
1512 | if ( mode == 0 ) { // sharp | 1512 | if ( mode == 0 ) { // sharp |
1513 | sharpFormat = new SharpFormat () ; | 1513 | sharpFormat = new SharpFormat () ; |
1514 | loadSuccess = sharpFormat->load( calendar, mCalendar ); | 1514 | loadSuccess = sharpFormat->load( calendar, mCalendar ); |
1515 | 1515 | ||
1516 | } else | 1516 | } else |
1517 | #endif | 1517 | #endif |
1518 | if ( mode == 1 ) { // phone | 1518 | if ( mode == 1 ) { // phone |
1519 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, | 1519 | phoneFormat = new PhoneFormat (mCurrentSyncDevice, |
1520 | mSyncManager->mPhoneDevice, | 1520 | mSyncManager->mPhoneDevice, |
1521 | mSyncManager->mPhoneConnection, | 1521 | mSyncManager->mPhoneConnection, |
1522 | mSyncManager->mPhoneModel); | 1522 | mSyncManager->mPhoneModel); |
1523 | loadSuccess = phoneFormat->load( calendar,mCalendar); | 1523 | loadSuccess = phoneFormat->load( calendar,mCalendar); |
1524 | 1524 | ||
1525 | } else { | 1525 | } else { |
1526 | emit tempDisableBR(false); | 1526 | emit tempDisableBR(false); |
1527 | return; | 1527 | return; |
1528 | } | 1528 | } |
1529 | if ( loadSuccess ) { | 1529 | if ( loadSuccess ) { |
1530 | getEventViewerDialog()->setSyncMode( true ); | 1530 | getEventViewerDialog()->setSyncMode( true ); |
1531 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1531 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1532 | getEventViewerDialog()->setSyncMode( false ); | 1532 | getEventViewerDialog()->setSyncMode( false ); |
1533 | qApp->processEvents(); | 1533 | qApp->processEvents(); |
1534 | if ( syncOK ) { | 1534 | if ( syncOK ) { |
1535 | if ( mSyncManager->mWriteBackFile ) | 1535 | if ( mSyncManager->mWriteBackFile ) |
1536 | { | 1536 | { |
1537 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); | 1537 | QPtrList<Incidence> iL = mCalendar->rawIncidences(); |
1538 | Incidence* inc = iL.first(); | 1538 | Incidence* inc = iL.first(); |
1539 | if ( phoneFormat ) { | 1539 | if ( phoneFormat ) { |
1540 | while ( inc ) { | 1540 | while ( inc ) { |
1541 | inc->removeID(mCurrentSyncDevice); | 1541 | inc->removeID(mCurrentSyncDevice); |
1542 | inc = iL.next(); | 1542 | inc = iL.next(); |
1543 | } | 1543 | } |
1544 | } | 1544 | } |
1545 | #ifndef DESKTOP_VERSION | 1545 | #ifndef DESKTOP_VERSION |
1546 | if ( sharpFormat ) | 1546 | if ( sharpFormat ) |
1547 | sharpFormat->save(calendar); | 1547 | sharpFormat->save(calendar); |
1548 | #endif | 1548 | #endif |
1549 | if ( phoneFormat ) | 1549 | if ( phoneFormat ) |
1550 | phoneFormat->save(calendar); | 1550 | phoneFormat->save(calendar); |
1551 | iL = calendar->rawIncidences(); | 1551 | iL = calendar->rawIncidences(); |
1552 | inc = iL.first(); | 1552 | inc = iL.first(); |
1553 | Incidence* loc; | 1553 | Incidence* loc; |
1554 | while ( inc ) { | 1554 | while ( inc ) { |
1555 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { | 1555 | if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { |
1556 | loc = mCalendar->incidence(inc->uid() ); | 1556 | loc = mCalendar->incidence(inc->uid() ); |
1557 | if ( loc ) { | 1557 | if ( loc ) { |
1558 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); | 1558 | loc->setID(mCurrentSyncDevice, inc->getID(mCurrentSyncDevice) ); |
1559 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); | 1559 | loc->setCsum( mCurrentSyncDevice, inc->getCsum(mCurrentSyncDevice) ); |
1560 | } | 1560 | } |
1561 | } | 1561 | } |
1562 | inc = iL.next(); | 1562 | inc = iL.next(); |
1563 | } | 1563 | } |
1564 | Incidence* lse = getLastSyncEvent(); | 1564 | Incidence* lse = getLastSyncEvent(); |
1565 | if ( lse ) { | 1565 | if ( lse ) { |
1566 | lse->setReadOnly( false ); | 1566 | lse->setReadOnly( false ); |
1567 | lse->setDescription( "" ); | 1567 | lse->setDescription( "" ); |
1568 | lse->setReadOnly( true ); | 1568 | lse->setReadOnly( true ); |
1569 | } | 1569 | } |
1570 | } | 1570 | } |
1571 | } else { | 1571 | } else { |
1572 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); | 1572 | topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); |
1573 | } | 1573 | } |
1574 | setModified( true ); | 1574 | setModified( true ); |
1575 | } else { | 1575 | } else { |
1576 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; | 1576 | QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; |
1577 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), | 1577 | QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), |
1578 | question, i18n("Ok")) ; | 1578 | question, i18n("Ok")) ; |
1579 | 1579 | ||
1580 | } | 1580 | } |
1581 | delete calendar; | 1581 | delete calendar; |
1582 | updateView(); | 1582 | updateView(); |
1583 | emit tempDisableBR(false); | 1583 | emit tempDisableBR(false); |
1584 | return ;//syncOK; | 1584 | return ;//syncOK; |
1585 | 1585 | ||
1586 | } | 1586 | } |
1587 | 1587 | ||
1588 | bool CalendarView::importBday() | 1588 | bool CalendarView::importBday() |
1589 | { | 1589 | { |
1590 | #ifndef KORG_NOKABC | 1590 | #ifndef KORG_NOKABC |
1591 | 1591 | ||
1592 | #ifdef DESKTOP_VERSION | 1592 | #ifdef DESKTOP_VERSION |
1593 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 1593 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
1594 | KABC::AddressBook::Iterator it; | 1594 | KABC::AddressBook::Iterator it; |
1595 | int count = 0; | 1595 | int count = 0; |
1596 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1596 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1597 | ++count; | 1597 | ++count; |
1598 | } | 1598 | } |
1599 | QProgressBar bar(count,0 ); | 1599 | QProgressBar bar(count,0 ); |
1600 | int w = 300; | 1600 | int w = 300; |
1601 | if ( QApplication::desktop()->width() < 320 ) | 1601 | if ( QApplication::desktop()->width() < 320 ) |
1602 | w = 220; | 1602 | w = 220; |
1603 | int h = bar.sizeHint().height() ; | 1603 | int h = bar.sizeHint().height() ; |
1604 | int dw = QApplication::desktop()->width(); | 1604 | int dw = QApplication::desktop()->width(); |
1605 | int dh = QApplication::desktop()->height(); | 1605 | int dh = QApplication::desktop()->height(); |
1606 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1606 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1607 | bar.show(); | 1607 | bar.show(); |
1608 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); | 1608 | bar.setCaption (i18n("Reading addressbook - close to abort!") ); |
1609 | qApp->processEvents(); | 1609 | qApp->processEvents(); |
1610 | count = 0; | 1610 | count = 0; |
1611 | int addCount = 0; | 1611 | int addCount = 0; |
1612 | KCal::Attendee* a = 0; | 1612 | KCal::Attendee* a = 0; |
1613 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { | 1613 | for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { |
1614 | if ( ! bar.isVisible() ) | 1614 | if ( ! bar.isVisible() ) |
1615 | return false; | 1615 | return false; |
1616 | bar.setProgress( count++ ); | 1616 | bar.setProgress( count++ ); |
1617 | qApp->processEvents(); | 1617 | qApp->processEvents(); |
1618 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); | 1618 | //qDebug("add BDay %s %s", (*it).realName().latin1(),(*it).birthday().date().toString().latin1() ); |
1619 | if ( (*it).birthday().date().isValid() ){ | 1619 | if ( (*it).birthday().date().isValid() ){ |
1620 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1620 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1621 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) | 1621 | if ( addAnniversary( (*it).birthday().date(), (*it).assembledName(), a, true ) ) |
1622 | ++addCount; | 1622 | ++addCount; |
1623 | } | 1623 | } |
1624 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); | 1624 | QDate anni = KGlobal::locale()->readDate( (*it).custom("KADDRESSBOOK", "X-Anniversary" ), "%Y-%m-%d"); |
1625 | if ( anni.isValid() ){ | 1625 | if ( anni.isValid() ){ |
1626 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; | 1626 | a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; |
1627 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) | 1627 | if ( addAnniversary( anni, (*it).assembledName(), a, false ) ) |
1628 | ++addCount; | 1628 | ++addCount; |
1629 | } | 1629 | } |
1630 | } | 1630 | } |
1631 | updateView(); | 1631 | updateView(); |
1632 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1632 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1633 | #else //DESKTOP_VERSION | 1633 | #else //DESKTOP_VERSION |
1634 | 1634 | ||
1635 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 1635 | ExternalAppHandler::instance()->requestBirthdayListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
1636 | // the result should now arrive through method insertBirthdays | 1636 | // the result should now arrive through method insertBirthdays |
1637 | 1637 | ||
1638 | #endif //DESKTOP_VERSION | 1638 | #endif //DESKTOP_VERSION |
1639 | 1639 | ||
1640 | #endif //KORG_NOKABC | 1640 | #endif //KORG_NOKABC |
1641 | 1641 | ||
1642 | 1642 | ||
1643 | return true; | 1643 | return true; |
1644 | } | 1644 | } |
1645 | 1645 | ||
1646 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI | 1646 | // This method will be called from Ka/Pi as a response to requestBirthdayListFromKAPI |
1647 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, | 1647 | void CalendarView::insertBirthdays(const QString& uid, const QStringList& birthdayList, |
1648 | const QStringList& anniversaryList, const QStringList& realNameList, | 1648 | const QStringList& anniversaryList, const QStringList& realNameList, |
1649 | const QStringList& emailList, const QStringList& assembledNameList, | 1649 | const QStringList& emailList, const QStringList& assembledNameList, |
1650 | const QStringList& uidList) | 1650 | const QStringList& uidList) |
1651 | { | 1651 | { |
1652 | //qDebug("KO::CalendarView::insertBirthdays"); | 1652 | //qDebug("KO::CalendarView::insertBirthdays"); |
1653 | if (uid == this->name()) | 1653 | if (uid == this->name()) |
1654 | { | 1654 | { |
1655 | int count = birthdayList.count(); | 1655 | int count = birthdayList.count(); |
1656 | int addCount = 0; | 1656 | int addCount = 0; |
1657 | KCal::Attendee* a = 0; | 1657 | KCal::Attendee* a = 0; |
1658 | 1658 | ||
1659 | //qDebug("CalView 1 %i", count); | 1659 | //qDebug("CalView 1 %i", count); |
1660 | 1660 | ||
1661 | QProgressBar bar(count,0 ); | 1661 | QProgressBar bar(count,0 ); |
1662 | int w = 300; | 1662 | int w = 300; |
1663 | if ( QApplication::desktop()->width() < 320 ) | 1663 | if ( QApplication::desktop()->width() < 320 ) |
1664 | w = 220; | 1664 | w = 220; |
1665 | int h = bar.sizeHint().height() ; | 1665 | int h = bar.sizeHint().height() ; |
1666 | int dw = QApplication::desktop()->width(); | 1666 | int dw = QApplication::desktop()->width(); |
1667 | int dh = QApplication::desktop()->height(); | 1667 | int dh = QApplication::desktop()->height(); |
1668 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 1668 | bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
1669 | bar.show(); | 1669 | bar.show(); |
1670 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); | 1670 | bar.setCaption (i18n("inserting birthdays - close to abort!") ); |
1671 | qApp->processEvents(); | 1671 | qApp->processEvents(); |
1672 | 1672 | ||
1673 | QDate birthday; | 1673 | QDate birthday; |
1674 | QDate anniversary; | 1674 | QDate anniversary; |
1675 | QString realName; | 1675 | QString realName; |
1676 | QString email; | 1676 | QString email; |
1677 | QString assembledName; | 1677 | QString assembledName; |
1678 | QString uid; | 1678 | QString uid; |
1679 | bool ok = true; | 1679 | bool ok = true; |
1680 | for ( int i = 0; i < count; i++) | 1680 | for ( int i = 0; i < count; i++) |
1681 | { | 1681 | { |
1682 | if ( ! bar.isVisible() ) | 1682 | if ( ! bar.isVisible() ) |
1683 | return; | 1683 | return; |
1684 | bar.setProgress( i ); | 1684 | bar.setProgress( i ); |
1685 | qApp->processEvents(); | 1685 | qApp->processEvents(); |
1686 | 1686 | ||
1687 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); | 1687 | birthday = KGlobal::locale()->readDate(birthdayList[i], KLocale::ISODate, &ok); |
1688 | if (!ok) { | 1688 | if (!ok) { |
1689 | ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); | 1689 | ;//qDebug("CalendarView::insertBirthdays found invalid birthday: %s",birthdayList[i].latin1()); |
1690 | } | 1690 | } |
1691 | 1691 | ||
1692 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); | 1692 | anniversary = KGlobal::locale()->readDate(anniversaryList[i], KLocale::ISODate, &ok); |
1693 | if (!ok) { | 1693 | if (!ok) { |
1694 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); | 1694 | ;//qDebug("CalendarView::insertBirthdays found invalid anniversary: %s",anniversaryList[i].latin1()); |
1695 | } | 1695 | } |
1696 | realName = realNameList[i]; | 1696 | realName = realNameList[i]; |
1697 | email = emailList[i]; | 1697 | email = emailList[i]; |
1698 | assembledName = assembledNameList[i]; | 1698 | assembledName = assembledNameList[i]; |
1699 | uid = uidList[i]; | 1699 | uid = uidList[i]; |
1700 | //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); | 1700 | //qDebug("insert birthday in KO/Pi: %s,%s,%s,%s: %s, %s", realName.latin1(), email.latin1(), assembledName.latin1(), uid.latin1(), birthdayList[i].latin1(), anniversaryList[i].latin1() ); |
1701 | 1701 | ||
1702 | if ( birthday.isValid() ){ | 1702 | if ( birthday.isValid() ){ |
1703 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1703 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1704 | KCal::Attendee::ReqParticipant,uid) ; | 1704 | KCal::Attendee::ReqParticipant,uid) ; |
1705 | if ( addAnniversary( birthday, assembledName, a, true ) ) | 1705 | if ( addAnniversary( birthday, assembledName, a, true ) ) |
1706 | ++addCount; | 1706 | ++addCount; |
1707 | } | 1707 | } |
1708 | 1708 | ||
1709 | if ( anniversary.isValid() ){ | 1709 | if ( anniversary.isValid() ){ |
1710 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, | 1710 | a = new KCal::Attendee( realName, email,false,KCal::Attendee::NeedsAction, |
1711 | KCal::Attendee::ReqParticipant,uid) ; | 1711 | KCal::Attendee::ReqParticipant,uid) ; |
1712 | if ( addAnniversary( anniversary, assembledName, a, false ) ) | 1712 | if ( addAnniversary( anniversary, assembledName, a, false ) ) |
1713 | ++addCount; | 1713 | ++addCount; |
1714 | } | 1714 | } |
1715 | } | 1715 | } |
1716 | 1716 | ||
1717 | updateView(); | 1717 | updateView(); |
1718 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); | 1718 | topLevelWidget()->setCaption(QString::number( addCount )+ i18n(" birthdays/anniversaries added!")); |
1719 | 1719 | ||
1720 | } | 1720 | } |
1721 | 1721 | ||
1722 | } | 1722 | } |
1723 | 1723 | ||
1724 | 1724 | ||
1725 | 1725 | ||
1726 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) | 1726 | bool CalendarView::addAnniversary( QDate date, QString name, KCal::Attendee* a, bool birthday) |
1727 | { | 1727 | { |
1728 | //qDebug("addAnni "); | 1728 | //qDebug("addAnni "); |
1729 | Event * ev = new Event(); | 1729 | Event * ev = new Event(); |
1730 | ev->setOrganizer(KOPrefs::instance()->email()); | 1730 | ev->setOrganizer(KOPrefs::instance()->email()); |
1731 | if ( a ) { | 1731 | if ( a ) { |
1732 | ev->addAttendee( a ); | 1732 | ev->addAttendee( a ); |
1733 | } | 1733 | } |
1734 | QString kind; | 1734 | QString kind; |
1735 | if ( birthday ) { | 1735 | if ( birthday ) { |
1736 | kind = i18n( "Birthday" ); | 1736 | kind = i18n( "Birthday" ); |
1737 | ev->setSummary( name + " (" + QString::number(date.year()) +")"); | 1737 | ev->setSummary( name + " (" + QString::number(date.year()) +")"); |
1738 | } | 1738 | } |
1739 | else { | 1739 | else { |
1740 | kind = i18n( "Anniversary" ); | 1740 | kind = i18n( "Anniversary" ); |
1741 | ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); | 1741 | ev->setSummary( name + " (" + QString::number(date.year()) +") " + kind ); |
1742 | } | 1742 | } |
1743 | ev->setCategories( kind ); | 1743 | ev->setCategories( kind ); |
1744 | ev->setDtStart( QDateTime(date) ); | 1744 | ev->setDtStart( QDateTime(date) ); |
1745 | ev->setDtEnd( QDateTime(date) ); | 1745 | ev->setDtEnd( QDateTime(date) ); |
1746 | ev->setFloats( true ); | 1746 | ev->setFloats( true ); |
1747 | Recurrence * rec = ev->recurrence(); | 1747 | Recurrence * rec = ev->recurrence(); |
1748 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); | 1748 | rec->setYearly(Recurrence::rYearlyMonth,1,-1); |
1749 | rec->addYearlyNum( date.month() ); | 1749 | rec->addYearlyNum( date.month() ); |
1750 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { | 1750 | if ( !mCalendar->addAnniversaryNoDup( ev ) ) { |
1751 | delete ev; | 1751 | delete ev; |
1752 | return false; | 1752 | return false; |
1753 | } | 1753 | } |
1754 | return true; | 1754 | return true; |
1755 | 1755 | ||
1756 | } | 1756 | } |
1757 | bool CalendarView::importQtopia( const QString &categories, | 1757 | bool CalendarView::importQtopia( const QString &categories, |
1758 | const QString &datebook, | 1758 | const QString &datebook, |
1759 | const QString &todolist ) | 1759 | const QString &todolist ) |
1760 | { | 1760 | { |
1761 | 1761 | ||
1762 | QtopiaFormat qtopiaFormat; | 1762 | QtopiaFormat qtopiaFormat; |
1763 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1763 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1764 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); | 1764 | if ( !categories.isEmpty() ) qtopiaFormat.load( mCalendar, categories ); |
1765 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); | 1765 | if ( !datebook.isEmpty() ) qtopiaFormat.load( mCalendar, datebook ); |
1766 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); | 1766 | if ( !todolist.isEmpty() ) qtopiaFormat.load( mCalendar, todolist ); |
1767 | 1767 | ||
1768 | updateView(); | 1768 | updateView(); |
1769 | return true; | 1769 | return true; |
1770 | 1770 | ||
1771 | #if 0 | 1771 | #if 0 |
1772 | mGlobalSyncMode = SYNC_MODE_QTOPIA; | 1772 | mGlobalSyncMode = SYNC_MODE_QTOPIA; |
1773 | mCurrentSyncDevice = "qtopia-XML"; | 1773 | mCurrentSyncDevice = "qtopia-XML"; |
1774 | if ( mSyncManager->mAskForPreferences ) | 1774 | if ( mSyncManager->mAskForPreferences ) |
1775 | edit_sync_options(); | 1775 | edit_sync_options(); |
1776 | qApp->processEvents(); | 1776 | qApp->processEvents(); |
1777 | CalendarLocal* calendar = new CalendarLocal(); | 1777 | CalendarLocal* calendar = new CalendarLocal(); |
1778 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1778 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1779 | bool syncOK = false; | 1779 | bool syncOK = false; |
1780 | QtopiaFormat qtopiaFormat; | 1780 | QtopiaFormat qtopiaFormat; |
1781 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); | 1781 | qtopiaFormat.setCategoriesList ( &(KOPrefs::instance()->mCustomCategories)); |
1782 | bool loadOk = true; | 1782 | bool loadOk = true; |
1783 | if ( !categories.isEmpty() ) | 1783 | if ( !categories.isEmpty() ) |
1784 | loadOk = qtopiaFormat.load( calendar, categories ); | 1784 | loadOk = qtopiaFormat.load( calendar, categories ); |
1785 | if ( loadOk && !datebook.isEmpty() ) | 1785 | if ( loadOk && !datebook.isEmpty() ) |
1786 | loadOk = qtopiaFormat.load( calendar, datebook ); | 1786 | loadOk = qtopiaFormat.load( calendar, datebook ); |
1787 | if ( loadOk && !todolist.isEmpty() ) | 1787 | if ( loadOk && !todolist.isEmpty() ) |
1788 | loadOk = qtopiaFormat.load( calendar, todolist ); | 1788 | loadOk = qtopiaFormat.load( calendar, todolist ); |
1789 | 1789 | ||
1790 | if ( loadOk ) { | 1790 | if ( loadOk ) { |
1791 | getEventViewerDialog()->setSyncMode( true ); | 1791 | getEventViewerDialog()->setSyncMode( true ); |
1792 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); | 1792 | syncOK = synchronizeCalendar( mCalendar, calendar, mSyncManager->mSyncAlgoPrefs ); |
1793 | getEventViewerDialog()->setSyncMode( false ); | 1793 | getEventViewerDialog()->setSyncMode( false ); |
1794 | qApp->processEvents(); | 1794 | qApp->processEvents(); |
1795 | if ( syncOK ) { | 1795 | if ( syncOK ) { |
1796 | if ( mSyncManager->mWriteBackFile ) | 1796 | if ( mSyncManager->mWriteBackFile ) |
1797 | { | 1797 | { |
1798 | // write back XML file | 1798 | // write back XML file |
1799 | 1799 | ||
1800 | } | 1800 | } |
1801 | setModified( true ); | 1801 | setModified( true ); |
1802 | } | 1802 | } |
1803 | } else { | 1803 | } else { |
1804 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; | 1804 | QString question = i18n("Sorry, the file loading\ncommand failed!\n\nNothing synced!\n") ; |
1805 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), | 1805 | QMessageBox::information( 0, i18n("KO/Pi Sync - ERROR"), |
1806 | question, i18n("Ok")) ; | 1806 | question, i18n("Ok")) ; |
1807 | } | 1807 | } |
1808 | delete calendar; | 1808 | delete calendar; |
1809 | updateView(); | 1809 | updateView(); |
1810 | return syncOK; | 1810 | return syncOK; |
1811 | 1811 | ||
1812 | 1812 | ||
1813 | #endif | 1813 | #endif |
1814 | 1814 | ||
1815 | } | 1815 | } |
1816 | 1816 | ||
1817 | void CalendarView::setSyncEventsReadOnly() | 1817 | void CalendarView::setSyncEventsReadOnly() |
1818 | { | 1818 | { |
1819 | Event * ev; | 1819 | Event * ev; |
1820 | QPtrList<Event> eL = mCalendar->rawEvents(); | 1820 | QPtrList<Event> eL = mCalendar->rawEvents(); |
1821 | ev = eL.first(); | 1821 | ev = eL.first(); |
1822 | while ( ev ) { | 1822 | while ( ev ) { |
1823 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | 1823 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) |
1824 | ev->setReadOnly( true ); | 1824 | ev->setReadOnly( true ); |
1825 | ev = eL.next(); | 1825 | ev = eL.next(); |
1826 | } | 1826 | } |
1827 | } | 1827 | } |
1828 | bool CalendarView::openCalendar(QString filename, bool merge) | 1828 | bool CalendarView::openCalendar(QString filename, bool merge) |
1829 | { | 1829 | { |
1830 | 1830 | ||
1831 | if (filename.isEmpty()) { | 1831 | if (filename.isEmpty()) { |
1832 | return false; | 1832 | return false; |
1833 | } | 1833 | } |
1834 | 1834 | ||
1835 | if (!QFile::exists(filename)) { | 1835 | if (!QFile::exists(filename)) { |
1836 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); | 1836 | KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); |
1837 | return false; | 1837 | return false; |
1838 | } | 1838 | } |
1839 | 1839 | ||
1840 | globalFlagBlockAgenda = 1; | 1840 | globalFlagBlockAgenda = 1; |
1841 | clearAllViews(); | 1841 | clearAllViews(); |
1842 | if (!merge) { | 1842 | if (!merge) { |
1843 | mViewManager->setDocumentId( filename ); | 1843 | mViewManager->setDocumentId( filename ); |
1844 | mCalendar->close(); | 1844 | mCalendar->close(); |
1845 | } | 1845 | } |
1846 | mStorage->setFileName( filename ); | 1846 | mStorage->setFileName( filename ); |
1847 | 1847 | ||
1848 | if ( mStorage->load() ) { | 1848 | if ( mStorage->load() ) { |
1849 | if ( merge ) ;//setModified( true ); | 1849 | if ( merge ) ;//setModified( true ); |
1850 | else { | 1850 | else { |
1851 | //setModified( true ); | 1851 | //setModified( true ); |
1852 | mViewManager->setDocumentId( filename ); | 1852 | mViewManager->setDocumentId( filename ); |
1853 | mDialogManager->setDocumentId( filename ); | 1853 | mDialogManager->setDocumentId( filename ); |
1854 | mTodoList->setDocumentId( filename ); | 1854 | mTodoList->setDocumentId( filename ); |
1855 | } | 1855 | } |
1856 | globalFlagBlockAgenda = 2; | 1856 | globalFlagBlockAgenda = 2; |
1857 | // if ( getLastSyncEvent() ) | 1857 | // if ( getLastSyncEvent() ) |
1858 | // getLastSyncEvent()->setReadOnly( true ); | 1858 | // getLastSyncEvent()->setReadOnly( true ); |
1859 | mCalendar->reInitAlarmSettings(); | 1859 | mCalendar->reInitAlarmSettings(); |
1860 | setSyncEventsReadOnly(); | 1860 | setSyncEventsReadOnly(); |
1861 | updateUnmanagedViews(); | 1861 | updateUnmanagedViews(); |
1862 | updateView(); | 1862 | updateView(); |
1863 | if ( filename != MainWindow::defaultFileName() ) { | 1863 | if ( filename != MainWindow::defaultFileName() ) { |
1864 | saveCalendar( MainWindow::defaultFileName() ); | 1864 | saveCalendar( MainWindow::defaultFileName() ); |
1865 | } else { | 1865 | } else { |
1866 | QFileInfo finf ( MainWindow::defaultFileName()); | 1866 | QFileInfo finf ( MainWindow::defaultFileName()); |
1867 | if ( finf.exists() ) { | 1867 | if ( finf.exists() ) { |
1868 | setLoadedFileVersion( finf.lastModified () ); | 1868 | setLoadedFileVersion( finf.lastModified () ); |
1869 | } | 1869 | } |
1870 | } | 1870 | } |
1871 | return true; | 1871 | return true; |
1872 | } else { | 1872 | } else { |
1873 | // while failing to load, the calendar object could | 1873 | // while failing to load, the calendar object could |
1874 | // have become partially populated. Clear it out. | 1874 | // have become partially populated. Clear it out. |
1875 | if ( !merge ) { | 1875 | if ( !merge ) { |
1876 | mCalendar->close(); | 1876 | mCalendar->close(); |
1877 | mViewManager->setDocumentId( filename ); | 1877 | mViewManager->setDocumentId( filename ); |
1878 | mDialogManager->setDocumentId( filename ); | 1878 | mDialogManager->setDocumentId( filename ); |
1879 | mTodoList->setDocumentId( filename ); | 1879 | mTodoList->setDocumentId( filename ); |
1880 | } | 1880 | } |
1881 | 1881 | ||
1882 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); | 1882 | //KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); |
1883 | 1883 | ||
1884 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); | 1884 | QTimer::singleShot ( 1, this, SLOT ( showOpenError() ) ); |
1885 | globalFlagBlockAgenda = 2; | 1885 | globalFlagBlockAgenda = 2; |
1886 | mCalendar->reInitAlarmSettings(); | 1886 | mCalendar->reInitAlarmSettings(); |
1887 | setSyncEventsReadOnly(); | 1887 | setSyncEventsReadOnly(); |
1888 | updateUnmanagedViews(); | 1888 | updateUnmanagedViews(); |
1889 | updateView(); | 1889 | updateView(); |
1890 | } | 1890 | } |
1891 | return false; | 1891 | return false; |
1892 | } | 1892 | } |
1893 | void CalendarView::showOpenError() | 1893 | void CalendarView::showOpenError() |
1894 | { | 1894 | { |
1895 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); | 1895 | KMessageBox::error(this,i18n("Couldn't load calendar\n.")); |
1896 | } | 1896 | } |
1897 | void CalendarView::setLoadedFileVersion(QDateTime dt) | 1897 | void CalendarView::setLoadedFileVersion(QDateTime dt) |
1898 | { | 1898 | { |
1899 | loadedFileVersion = dt; | 1899 | loadedFileVersion = dt; |
1900 | } | 1900 | } |
1901 | bool CalendarView::checkFileChanged(QString fn) | 1901 | bool CalendarView::checkFileChanged(QString fn) |
1902 | { | 1902 | { |
1903 | QFileInfo finf ( fn ); | 1903 | QFileInfo finf ( fn ); |
1904 | if ( !finf.exists() ) | 1904 | if ( !finf.exists() ) |
1905 | return true; | 1905 | return true; |
1906 | QDateTime dt = finf.lastModified (); | 1906 | QDateTime dt = finf.lastModified (); |
1907 | if ( dt <= loadedFileVersion ) | 1907 | if ( dt <= loadedFileVersion ) |
1908 | return false; | 1908 | return false; |
1909 | return true; | 1909 | return true; |
1910 | 1910 | ||
1911 | } | 1911 | } |
1912 | void CalendarView::watchSavedFile() | 1912 | void CalendarView::watchSavedFile() |
1913 | { | 1913 | { |
1914 | QFileInfo finf ( MainWindow::defaultFileName()); | 1914 | QFileInfo finf ( MainWindow::defaultFileName()); |
1915 | if ( !finf.exists() ) | 1915 | if ( !finf.exists() ) |
1916 | return; | 1916 | return; |
1917 | QDateTime dt = finf.lastModified (); | 1917 | QDateTime dt = finf.lastModified (); |
1918 | if ( dt < loadedFileVersion ) { | 1918 | if ( dt < loadedFileVersion ) { |
1919 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); | 1919 | //qDebug("watch %s %s ", dt.toString().latin1(), loadedFileVersion.toString().latin1()); |
1920 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); | 1920 | QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) ); |
1921 | return; | 1921 | return; |
1922 | } | 1922 | } |
1923 | loadedFileVersion = dt; | 1923 | loadedFileVersion = dt; |
1924 | } | 1924 | } |
1925 | 1925 | ||
1926 | bool CalendarView::checkFileVersion(QString fn) | 1926 | bool CalendarView::checkFileVersion(QString fn) |
1927 | { | 1927 | { |
1928 | QFileInfo finf ( fn ); | 1928 | QFileInfo finf ( fn ); |
1929 | if ( !finf.exists() ) | 1929 | if ( !finf.exists() ) |
1930 | return true; | 1930 | return true; |
1931 | QDateTime dt = finf.lastModified (); | 1931 | QDateTime dt = finf.lastModified (); |
1932 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); | 1932 | //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); |
1933 | //qDebug("file on disk version %s",dt.toString().latin1()); | 1933 | //qDebug("file on disk version %s",dt.toString().latin1()); |
1934 | if ( dt <= loadedFileVersion ) | 1934 | if ( dt <= loadedFileVersion ) |
1935 | return true; | 1935 | return true; |
1936 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , | 1936 | int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) , |
1937 | i18n("KO/Pi Warning"),i18n("Overwrite"), | 1937 | i18n("KO/Pi Warning"),i18n("Overwrite"), |
1938 | i18n("Sync+save")); | 1938 | i18n("Sync+save")); |
1939 | 1939 | ||
1940 | if ( km == KMessageBox::Cancel ) | 1940 | if ( km == KMessageBox::Cancel ) |
1941 | return false; | 1941 | return false; |
1942 | if ( km == KMessageBox::Yes ) | 1942 | if ( km == KMessageBox::Yes ) |
1943 | return true; | 1943 | return true; |
1944 | 1944 | ||
1945 | setSyncDevice("deleteaftersync" ); | 1945 | setSyncDevice("deleteaftersync" ); |
1946 | mSyncManager->mAskForPreferences = true; | 1946 | mSyncManager->mAskForPreferences = true; |
1947 | mSyncManager->mSyncAlgoPrefs = 3; | 1947 | mSyncManager->mSyncAlgoPrefs = 3; |
1948 | mSyncManager->mWriteBackFile = false; | 1948 | mSyncManager->mWriteBackFile = false; |
1949 | mSyncManager->mWriteBackExistingOnly = false; | 1949 | mSyncManager->mWriteBackExistingOnly = false; |
1950 | mSyncManager->mShowSyncSummary = false; | 1950 | mSyncManager->mShowSyncSummary = false; |
1951 | syncCalendar( fn, 3 ); | 1951 | syncCalendar( fn, 3 ); |
1952 | Event * e = getLastSyncEvent(); | 1952 | Event * e = getLastSyncEvent(); |
1953 | if ( e ) | 1953 | if ( e ) |
1954 | deleteEvent ( e ); | 1954 | deleteEvent ( e ); |
1955 | updateView(); | 1955 | updateView(); |
1956 | return true; | 1956 | return true; |
1957 | } | 1957 | } |
1958 | 1958 | ||
1959 | bool CalendarView::saveCalendar( QString filename ) | 1959 | bool CalendarView::saveCalendar( QString filename ) |
1960 | { | 1960 | { |
1961 | 1961 | ||
1962 | // Store back all unsaved data into calendar object | 1962 | // Store back all unsaved data into calendar object |
1963 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); | 1963 | // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); |
1964 | if ( mViewManager->currentView() ) | 1964 | if ( mViewManager->currentView() ) |
1965 | mViewManager->currentView()->flushView(); | 1965 | mViewManager->currentView()->flushView(); |
1966 | 1966 | ||
1967 | 1967 | ||
1968 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); | 1968 | QDateTime lfv = QDateTime::currentDateTime().addSecs( -2); |
1969 | mStorage->setSaveFormat( new ICalFormat() ); | 1969 | mStorage->setSaveFormat( new ICalFormat() ); |
1970 | mStorage->setFileName( filename ); | 1970 | mStorage->setFileName( filename ); |
1971 | bool success; | 1971 | bool success; |
1972 | success = mStorage->save(); | 1972 | success = mStorage->save(); |
1973 | if ( !success ) { | 1973 | if ( !success ) { |
1974 | return false; | 1974 | return false; |
1975 | } | 1975 | } |
1976 | if ( filename == MainWindow::defaultFileName() ) { | 1976 | if ( filename == MainWindow::defaultFileName() ) { |
1977 | setLoadedFileVersion( lfv ); | 1977 | setLoadedFileVersion( lfv ); |
1978 | watchSavedFile(); | 1978 | watchSavedFile(); |
1979 | } | 1979 | } |
1980 | return true; | 1980 | return true; |
1981 | } | 1981 | } |
1982 | 1982 | ||
1983 | void CalendarView::closeCalendar() | 1983 | void CalendarView::closeCalendar() |
1984 | { | 1984 | { |
1985 | 1985 | ||
1986 | // child windows no longer valid | 1986 | // child windows no longer valid |
1987 | clearAllViews(); | 1987 | clearAllViews(); |
1988 | emit closingDown(); | 1988 | emit closingDown(); |
1989 | 1989 | ||
1990 | mCalendar->close(); | 1990 | mCalendar->close(); |
1991 | setModified(false); | 1991 | setModified(false); |
1992 | updateView(); | 1992 | updateView(); |
1993 | } | 1993 | } |
1994 | 1994 | ||
1995 | void CalendarView::archiveCalendar() | 1995 | void CalendarView::archiveCalendar() |
1996 | { | 1996 | { |
1997 | mDialogManager->showArchiveDialog(); | 1997 | mDialogManager->showArchiveDialog(); |
1998 | } | 1998 | } |
1999 | 1999 | ||
2000 | 2000 | ||
2001 | void CalendarView::readSettings() | 2001 | void CalendarView::readSettings() |
2002 | { | 2002 | { |
2003 | 2003 | ||
2004 | 2004 | ||
2005 | // mViewManager->showAgendaView(); | 2005 | // mViewManager->showAgendaView(); |
2006 | QString str; | 2006 | QString str; |
2007 | //qDebug("CalendarView::readSettings() "); | 2007 | //qDebug("CalendarView::readSettings() "); |
2008 | // read settings from the KConfig, supplying reasonable | 2008 | // read settings from the KConfig, supplying reasonable |
2009 | // defaults where none are to be found | 2009 | // defaults where none are to be found |
2010 | KConfig *config = KOGlobals::config(); | 2010 | KConfig *config = KOGlobals::config(); |
2011 | #ifndef KORG_NOSPLITTER | 2011 | #ifndef KORG_NOSPLITTER |
2012 | config->setGroup("KOrganizer Geometry"); | 2012 | config->setGroup("KOrganizer Geometry"); |
2013 | 2013 | ||
2014 | QValueList<int> sizes = config->readIntListEntry("Separator1"); | 2014 | QValueList<int> sizes = config->readIntListEntry("Separator1"); |
2015 | if (sizes.count() != 2) { | 2015 | if (sizes.count() != 2) { |
2016 | sizes << mDateNavigator->minimumSizeHint().width(); | 2016 | sizes << mDateNavigator->minimumSizeHint().width(); |
2017 | sizes << 300; | 2017 | sizes << 300; |
2018 | } | 2018 | } |
2019 | mPanner->setSizes(sizes); | 2019 | mPanner->setSizes(sizes); |
2020 | 2020 | ||
2021 | sizes = config->readIntListEntry("Separator2"); | 2021 | sizes = config->readIntListEntry("Separator2"); |
2022 | if ( ( mResourceView && sizes.count() == 4 ) || | 2022 | if ( ( mResourceView && sizes.count() == 4 ) || |
2023 | ( !mResourceView && sizes.count() == 3 ) ) { | 2023 | ( !mResourceView && sizes.count() == 3 ) ) { |
2024 | mLeftSplitter->setSizes(sizes); | 2024 | mLeftSplitter->setSizes(sizes); |
2025 | } | 2025 | } |
2026 | #endif | 2026 | #endif |
2027 | globalFlagBlockAgenda = 1; | 2027 | globalFlagBlockAgenda = 1; |
2028 | mViewManager->showAgendaView(); | 2028 | mViewManager->showAgendaView(); |
2029 | //mViewManager->readSettings( config ); | 2029 | //mViewManager->readSettings( config ); |
2030 | mTodoList->restoreLayout(config,QString("Todo Layout")); | 2030 | mTodoList->restoreLayout(config,QString("Todo Layout")); |
2031 | readFilterSettings(config); | 2031 | readFilterSettings(config); |
2032 | 2032 | ||
2033 | #ifdef DESKTOP_VERSION | 2033 | #ifdef DESKTOP_VERSION |
2034 | config->setGroup("WidgetLayout"); | 2034 | config->setGroup("WidgetLayout"); |
2035 | QStringList list; | 2035 | QStringList list; |
2036 | list = config->readListEntry("MainLayout"); | 2036 | list = config->readListEntry("MainLayout"); |
2037 | int x,y,w,h; | 2037 | int x,y,w,h; |
2038 | if ( ! list.isEmpty() ) { | 2038 | if ( ! list.isEmpty() ) { |
2039 | x = list[0].toInt(); | 2039 | x = list[0].toInt(); |
2040 | y = list[1].toInt(); | 2040 | y = list[1].toInt(); |
2041 | w = list[2].toInt(); | 2041 | w = list[2].toInt(); |
2042 | h = list[3].toInt(); | 2042 | h = list[3].toInt(); |
2043 | KApplication::testCoords( &x,&y,&w,&h ); | 2043 | KApplication::testCoords( &x,&y,&w,&h ); |
2044 | topLevelWidget()->setGeometry(x,y,w,h); | 2044 | topLevelWidget()->setGeometry(x,y,w,h); |
2045 | 2045 | ||
2046 | } else { | 2046 | } else { |
2047 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); | 2047 | topLevelWidget()->setGeometry( 40 ,40 , 640, 440); |
2048 | } | 2048 | } |
2049 | list = config->readListEntry("EditEventLayout"); | 2049 | list = config->readListEntry("EditEventLayout"); |
2050 | if ( ! list.isEmpty() ) { | 2050 | if ( ! list.isEmpty() ) { |
2051 | x = list[0].toInt(); | 2051 | x = list[0].toInt(); |
2052 | y = list[1].toInt(); | 2052 | y = list[1].toInt(); |
2053 | w = list[2].toInt(); | 2053 | w = list[2].toInt(); |
2054 | h = list[3].toInt(); | 2054 | h = list[3].toInt(); |
2055 | KApplication::testCoords( &x,&y,&w,&h ); | 2055 | KApplication::testCoords( &x,&y,&w,&h ); |
2056 | mEventEditor->setGeometry(x,y,w,h); | 2056 | mEventEditor->setGeometry(x,y,w,h); |
2057 | 2057 | ||
2058 | } | 2058 | } |
2059 | list = config->readListEntry("EditTodoLayout"); | 2059 | list = config->readListEntry("EditTodoLayout"); |
2060 | if ( ! list.isEmpty() ) { | 2060 | if ( ! list.isEmpty() ) { |
2061 | x = list[0].toInt(); | 2061 | x = list[0].toInt(); |
2062 | y = list[1].toInt(); | 2062 | y = list[1].toInt(); |
2063 | w = list[2].toInt(); | 2063 | w = list[2].toInt(); |
2064 | h = list[3].toInt(); | 2064 | h = list[3].toInt(); |
2065 | KApplication::testCoords( &x,&y,&w,&h ); | 2065 | KApplication::testCoords( &x,&y,&w,&h ); |
2066 | mTodoEditor->setGeometry(x,y,w,h); | 2066 | mTodoEditor->setGeometry(x,y,w,h); |
2067 | 2067 | ||
2068 | } | 2068 | } |
2069 | list = config->readListEntry("ViewerLayout"); | 2069 | list = config->readListEntry("ViewerLayout"); |
2070 | if ( ! list.isEmpty() ) { | 2070 | if ( ! list.isEmpty() ) { |
2071 | x = list[0].toInt(); | 2071 | x = list[0].toInt(); |
2072 | y = list[1].toInt(); | 2072 | y = list[1].toInt(); |
2073 | w = list[2].toInt(); | 2073 | w = list[2].toInt(); |
2074 | h = list[3].toInt(); | 2074 | h = list[3].toInt(); |
2075 | KApplication::testCoords( &x,&y,&w,&h ); | 2075 | KApplication::testCoords( &x,&y,&w,&h ); |
2076 | getEventViewerDialog()->setGeometry(x,y,w,h); | 2076 | getEventViewerDialog()->setGeometry(x,y,w,h); |
2077 | } | 2077 | } |
2078 | #endif | 2078 | #endif |
2079 | config->setGroup( "Views" ); | 2079 | config->setGroup( "Views" ); |
2080 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); | 2080 | int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); |
2081 | 2081 | ||
2082 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); | 2082 | QValueList<int> sizes = config->readIntListEntry("Left Splitter Frame"); |
2083 | 2083 | ||
2084 | int resetval = 0; | 2084 | int resetval = 0; |
2085 | int maxVal = 0; | 2085 | int maxVal = 0; |
2086 | if (sizes.count() != 3) { | 2086 | if (sizes.count() != 3) { |
2087 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2087 | if ( KOPrefs::instance()->mVerticalScreen ) { |
2088 | resetval = mDateNavigator->sizeHint().width()+2; | 2088 | resetval = mDateNavigator->sizeHint().width()+2; |
2089 | } else { | 2089 | } else { |
2090 | resetval = mDateNavigator->sizeHint().height()+2; | 2090 | resetval = mDateNavigator->sizeHint().height()+2; |
2091 | } | 2091 | } |
2092 | } | 2092 | } |
2093 | if ( resetval ) { | 2093 | if ( resetval ) { |
2094 | sizes.clear(); | 2094 | sizes.clear(); |
2095 | if ( KOPrefs::instance()->mVerticalScreen ) { | 2095 | if ( KOPrefs::instance()->mVerticalScreen ) { |
2096 | maxVal = QApplication::desktop()->width() -10; | 2096 | maxVal = QApplication::desktop()->width() -10; |
2097 | } else { | 2097 | } else { |
2098 | maxVal = QApplication::desktop()->height()-10; | 2098 | maxVal = QApplication::desktop()->height()-10; |
2099 | } | 2099 | } |
2100 | sizes << resetval; | 2100 | sizes << resetval; |
2101 | if ( maxVal < resetval + resetval) | 2101 | if ( maxVal < resetval + resetval) |
2102 | resetval = maxVal - resetval; | 2102 | resetval = maxVal - resetval; |
2103 | sizes << resetval; | 2103 | sizes << resetval; |
2104 | sizes << 100; | 2104 | sizes << 100; |
2105 | } | 2105 | } |
2106 | mLeftFrame->setSizes(sizes); | 2106 | mLeftFrame->setSizes(sizes); |
2107 | sizes = config->readIntListEntry("Main Splitter Frame"); | 2107 | sizes = config->readIntListEntry("Main Splitter Frame"); |
2108 | resetval = 0; | 2108 | resetval = 0; |
2109 | maxVal = 0; | 2109 | maxVal = 0; |
2110 | if (sizes.count() != 2) { | 2110 | if (sizes.count() != 2) { |
2111 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2111 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
2112 | resetval = mDateNavigator->sizeHint().width()+2; | 2112 | resetval = mDateNavigator->sizeHint().width()+2; |
2113 | } else { | 2113 | } else { |
2114 | resetval = mDateNavigator->sizeHint().height()+2; | 2114 | resetval = mDateNavigator->sizeHint().height()+2; |
2115 | } | 2115 | } |
2116 | } | 2116 | } |
2117 | if ( resetval ) { | 2117 | if ( resetval ) { |
2118 | sizes.clear(); | 2118 | sizes.clear(); |
2119 | if ( !KOPrefs::instance()->mVerticalScreen ) { | 2119 | if ( !KOPrefs::instance()->mVerticalScreen ) { |
2120 | maxVal = QApplication::desktop()->width() -10; | 2120 | maxVal = QApplication::desktop()->width() -10; |
2121 | } else { | 2121 | } else { |
2122 | maxVal = QApplication::desktop()->height()-10; | 2122 | maxVal = QApplication::desktop()->height()-10; |
2123 | } | 2123 | } |
2124 | sizes << resetval; | 2124 | sizes << resetval; |
2125 | if ( maxVal < resetval + resetval) | 2125 | if ( maxVal < resetval + resetval) |
2126 | resetval = maxVal - resetval; | 2126 | resetval = maxVal - resetval; |
2127 | sizes << resetval; | 2127 | sizes << resetval; |
2128 | } | 2128 | } |
2129 | mMainFrame->setSizes(sizes); | 2129 | mMainFrame->setSizes(sizes); |
2130 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 2130 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
2131 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 2131 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
2132 | else mNavigator->selectDates( dateCount ); | 2132 | else mNavigator->selectDates( dateCount ); |
2133 | // mViewManager->readSettings( config ); | 2133 | // mViewManager->readSettings( config ); |
2134 | updateConfig(); | 2134 | updateConfig(); |
2135 | globalFlagBlockAgenda = 2; | 2135 | globalFlagBlockAgenda = 2; |
2136 | mViewManager->readSettings( config ); | 2136 | mViewManager->readSettings( config ); |
2137 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); | 2137 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); |
2138 | } | 2138 | } |
2139 | 2139 | ||
2140 | 2140 | ||
2141 | void CalendarView::writeSettings() | 2141 | void CalendarView::writeSettings() |
2142 | { | 2142 | { |
2143 | // kdDebug() << "CalendarView::writeSettings" << endl; | 2143 | // kdDebug() << "CalendarView::writeSettings" << endl; |
2144 | 2144 | ||
2145 | KConfig *config = KOGlobals::config(); | 2145 | KConfig *config = KOGlobals::config(); |
2146 | 2146 | ||
2147 | mViewManager->writeSettings( config ); | 2147 | mViewManager->writeSettings( config ); |
2148 | mTodoList->saveLayout(config,QString("Todo Layout")); | 2148 | mTodoList->saveLayout(config,QString("Todo Layout")); |
2149 | mDialogManager->writeSettings( config ); | 2149 | mDialogManager->writeSettings( config ); |
2150 | //KOPrefs::instance()->usrWriteConfig(); | 2150 | //KOPrefs::instance()->usrWriteConfig(); |
2151 | KOPrefs::instance()->writeConfig(); | 2151 | KOPrefs::instance()->writeConfig(); |
2152 | 2152 | ||
2153 | writeFilterSettings(config); | 2153 | writeFilterSettings(config); |
2154 | config->setGroup( "AppRun" ); | 2154 | config->setGroup( "AppRun" ); |
2155 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 2155 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
2156 | config->writeEntry( "LatestProgramStop", dt.secsTo( QDateTime::currentDateTime() ) ); | 2156 | config->writeEntry( "LatestProgramStop", dt.secsTo( QDateTime::currentDateTime() ) ); |
2157 | config->setGroup( "Views" ); | 2157 | config->setGroup( "Views" ); |
2158 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 2158 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
2159 | 2159 | ||
2160 | QValueList<int> listINT = mLeftFrame->sizes(); | 2160 | QValueList<int> listINT = mLeftFrame->sizes(); |
2161 | config->writeEntry("Left Splitter Frame",listINT); | 2161 | config->writeEntry("Left Splitter Frame",listINT); |
2162 | QValueList<int> listINT2 = mMainFrame->sizes(); | 2162 | QValueList<int> listINT2 = mMainFrame->sizes(); |
2163 | config->writeEntry("Main Splitter Frame",listINT2); | 2163 | config->writeEntry("Main Splitter Frame",listINT2); |
2164 | #ifdef DESKTOP_VERSION | 2164 | #ifdef DESKTOP_VERSION |
2165 | config->setGroup("WidgetLayout"); | 2165 | config->setGroup("WidgetLayout"); |
2166 | QStringList list ;//= config->readListEntry("MainLayout"); | 2166 | QStringList list ;//= config->readListEntry("MainLayout"); |
2167 | int x,y,w,h; | 2167 | int x,y,w,h; |
2168 | QWidget* wid; | 2168 | QWidget* wid; |
2169 | wid = topLevelWidget(); | 2169 | wid = topLevelWidget(); |
2170 | x = wid->geometry().x(); | 2170 | x = wid->geometry().x(); |
2171 | y = wid->geometry().y(); | 2171 | y = wid->geometry().y(); |
2172 | w = wid->width(); | 2172 | w = wid->width(); |
2173 | h = wid->height(); | 2173 | h = wid->height(); |
2174 | list.clear(); | 2174 | list.clear(); |
2175 | list << QString::number( x ); | 2175 | list << QString::number( x ); |
2176 | list << QString::number( y ); | 2176 | list << QString::number( y ); |
2177 | list << QString::number( w ); | 2177 | list << QString::number( w ); |
2178 | list << QString::number( h ); | 2178 | list << QString::number( h ); |
2179 | config->writeEntry("MainLayout",list ); | 2179 | config->writeEntry("MainLayout",list ); |
2180 | 2180 | ||
2181 | wid = mEventEditor; | 2181 | wid = mEventEditor; |
2182 | x = wid->geometry().x(); | 2182 | x = wid->geometry().x(); |
2183 | y = wid->geometry().y(); | 2183 | y = wid->geometry().y(); |
2184 | w = wid->width(); | 2184 | w = wid->width(); |
2185 | h = wid->height(); | 2185 | h = wid->height(); |
2186 | list.clear(); | 2186 | list.clear(); |
2187 | list << QString::number( x ); | 2187 | list << QString::number( x ); |
2188 | list << QString::number( y ); | 2188 | list << QString::number( y ); |
2189 | list << QString::number( w ); | 2189 | list << QString::number( w ); |
2190 | list << QString::number( h ); | 2190 | list << QString::number( h ); |
2191 | config->writeEntry("EditEventLayout",list ); | 2191 | config->writeEntry("EditEventLayout",list ); |
2192 | 2192 | ||
2193 | wid = mTodoEditor; | 2193 | wid = mTodoEditor; |
2194 | x = wid->geometry().x(); | 2194 | x = wid->geometry().x(); |
2195 | y = wid->geometry().y(); | 2195 | y = wid->geometry().y(); |
2196 | w = wid->width(); | 2196 | w = wid->width(); |
2197 | h = wid->height(); | 2197 | h = wid->height(); |
2198 | list.clear(); | 2198 | list.clear(); |
2199 | list << QString::number( x ); | 2199 | list << QString::number( x ); |
2200 | list << QString::number( y ); | 2200 | list << QString::number( y ); |
2201 | list << QString::number( w ); | 2201 | list << QString::number( w ); |
2202 | list << QString::number( h ); | 2202 | list << QString::number( h ); |
2203 | config->writeEntry("EditTodoLayout",list ); | 2203 | config->writeEntry("EditTodoLayout",list ); |
2204 | wid = getEventViewerDialog(); | 2204 | wid = getEventViewerDialog(); |
2205 | x = wid->geometry().x(); | 2205 | x = wid->geometry().x(); |
2206 | y = wid->geometry().y(); | 2206 | y = wid->geometry().y(); |
2207 | w = wid->width(); | 2207 | w = wid->width(); |
2208 | h = wid->height(); | 2208 | h = wid->height(); |
2209 | list.clear(); | 2209 | list.clear(); |
2210 | list << QString::number( x ); | 2210 | list << QString::number( x ); |
2211 | list << QString::number( y ); | 2211 | list << QString::number( y ); |
2212 | list << QString::number( w ); | 2212 | list << QString::number( w ); |
2213 | list << QString::number( h ); | 2213 | list << QString::number( h ); |
2214 | config->writeEntry("ViewerLayout",list ); | 2214 | config->writeEntry("ViewerLayout",list ); |
2215 | wid = mDialogManager->getSearchDialog(); | 2215 | wid = mDialogManager->getSearchDialog(); |
2216 | if ( wid ) { | 2216 | if ( wid ) { |
2217 | x = wid->geometry().x(); | 2217 | x = wid->geometry().x(); |
2218 | y = wid->geometry().y(); | 2218 | y = wid->geometry().y(); |
2219 | w = wid->width(); | 2219 | w = wid->width(); |
2220 | h = wid->height(); | 2220 | h = wid->height(); |
2221 | list.clear(); | 2221 | list.clear(); |
2222 | list << QString::number( x ); | 2222 | list << QString::number( x ); |
2223 | list << QString::number( y ); | 2223 | list << QString::number( y ); |
2224 | list << QString::number( w ); | 2224 | list << QString::number( w ); |
2225 | list << QString::number( h ); | 2225 | list << QString::number( h ); |
2226 | config->writeEntry("SearchLayout",list ); | 2226 | config->writeEntry("SearchLayout",list ); |
2227 | } | 2227 | } |
2228 | #endif | 2228 | #endif |
2229 | 2229 | ||
2230 | 2230 | ||
2231 | config->sync(); | 2231 | config->sync(); |
2232 | } | 2232 | } |
2233 | 2233 | ||
2234 | void CalendarView::readFilterSettings(KConfig *config) | 2234 | void CalendarView::readFilterSettings(KConfig *config) |
2235 | { | 2235 | { |
2236 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 2236 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
2237 | 2237 | ||
2238 | mFilters.clear(); | 2238 | mFilters.clear(); |
2239 | 2239 | ||
2240 | config->setGroup("General"); | 2240 | config->setGroup("General"); |
2241 | QStringList filterList = config->readListEntry("CalendarFilters"); | 2241 | QStringList filterList = config->readListEntry("CalendarFilters"); |
2242 | 2242 | ||
2243 | QStringList::ConstIterator it = filterList.begin(); | 2243 | QStringList::ConstIterator it = filterList.begin(); |
2244 | QStringList::ConstIterator end = filterList.end(); | 2244 | QStringList::ConstIterator end = filterList.end(); |
2245 | while(it != end) { | 2245 | while(it != end) { |
2246 | // kdDebug() << " filter: " << (*it) << endl; | 2246 | // kdDebug() << " filter: " << (*it) << endl; |
2247 | 2247 | ||
2248 | CalFilter *filter; | 2248 | CalFilter *filter; |
2249 | filter = new CalFilter(*it); | 2249 | filter = new CalFilter(*it); |
2250 | config->setGroup("Filter_" + (*it).utf8()); | 2250 | config->setGroup("Filter_" + (*it).utf8()); |
2251 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 2251 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
2252 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 2252 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
2253 | filter->setCategoryList(config->readListEntry("CategoryList")); | 2253 | filter->setCategoryList(config->readListEntry("CategoryList")); |
2254 | mFilters.append(filter); | 2254 | mFilters.append(filter); |
2255 | 2255 | ||
2256 | ++it; | 2256 | ++it; |
2257 | } | 2257 | } |
2258 | 2258 | ||
2259 | if (mFilters.count() == 0) { | 2259 | if (mFilters.count() == 0) { |
2260 | CalFilter *filter = new CalFilter(i18n("Default")); | 2260 | CalFilter *filter = new CalFilter(i18n("Default")); |
2261 | mFilters.append(filter); | 2261 | mFilters.append(filter); |
2262 | } | 2262 | } |
2263 | mFilterView->updateFilters(); | 2263 | mFilterView->updateFilters(); |
2264 | config->setGroup("FilterView"); | 2264 | config->setGroup("FilterView"); |
2265 | 2265 | ||
2266 | mFilterView->blockSignals(true); | 2266 | mFilterView->blockSignals(true); |
2267 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2267 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2268 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2268 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2269 | mFilterView->blockSignals(false); | 2269 | mFilterView->blockSignals(false); |
2270 | // We do it manually to avoid it being done twice by the above calls | 2270 | // We do it manually to avoid it being done twice by the above calls |
2271 | updateFilter(); | 2271 | updateFilter(); |
2272 | } | 2272 | } |
2273 | 2273 | ||
2274 | void CalendarView::writeFilterSettings(KConfig *config) | 2274 | void CalendarView::writeFilterSettings(KConfig *config) |
2275 | { | 2275 | { |
2276 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2276 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2277 | 2277 | ||
2278 | QStringList filterList; | 2278 | QStringList filterList; |
2279 | 2279 | ||
2280 | CalFilter *filter = mFilters.first(); | 2280 | CalFilter *filter = mFilters.first(); |
2281 | while(filter) { | 2281 | while(filter) { |
2282 | // kdDebug() << " fn: " << filter->name() << endl; | 2282 | // kdDebug() << " fn: " << filter->name() << endl; |
2283 | filterList << filter->name(); | 2283 | filterList << filter->name(); |
2284 | config->setGroup("Filter_" + filter->name().utf8()); | 2284 | config->setGroup("Filter_" + filter->name().utf8()); |
2285 | config->writeEntry("Criteria",filter->criteria()); | 2285 | config->writeEntry("Criteria",filter->criteria()); |
2286 | config->writeEntry("CategoryList",filter->categoryList()); | 2286 | config->writeEntry("CategoryList",filter->categoryList()); |
2287 | filter = mFilters.next(); | 2287 | filter = mFilters.next(); |
2288 | } | 2288 | } |
2289 | config->setGroup("General"); | 2289 | config->setGroup("General"); |
2290 | config->writeEntry("CalendarFilters",filterList); | 2290 | config->writeEntry("CalendarFilters",filterList); |
2291 | 2291 | ||
2292 | config->setGroup("FilterView"); | 2292 | config->setGroup("FilterView"); |
2293 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2293 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2294 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2294 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2295 | } | 2295 | } |
2296 | 2296 | ||
2297 | 2297 | ||
2298 | void CalendarView::goToday() | 2298 | void CalendarView::goToday() |
2299 | { | 2299 | { |
2300 | if ( mViewManager->currentView()->isMonthView() ) | 2300 | if ( mViewManager->currentView()->isMonthView() ) |
2301 | mNavigator->selectTodayMonth(); | 2301 | mNavigator->selectTodayMonth(); |
2302 | else | 2302 | else |
2303 | mNavigator->selectToday(); | 2303 | mNavigator->selectToday(); |
2304 | } | 2304 | } |
2305 | 2305 | ||
2306 | void CalendarView::goNext() | 2306 | void CalendarView::goNext() |
2307 | { | 2307 | { |
2308 | mNavigator->selectNext(); | 2308 | mNavigator->selectNext(); |
2309 | } | 2309 | } |
2310 | 2310 | ||
2311 | void CalendarView::goPrevious() | 2311 | void CalendarView::goPrevious() |
2312 | { | 2312 | { |
2313 | mNavigator->selectPrevious(); | 2313 | mNavigator->selectPrevious(); |
2314 | } | 2314 | } |
2315 | void CalendarView::goNextMonth() | 2315 | void CalendarView::goNextMonth() |
2316 | { | 2316 | { |
2317 | mNavigator->selectNextMonth(); | 2317 | mNavigator->selectNextMonth(); |
2318 | } | 2318 | } |
2319 | 2319 | ||
2320 | void CalendarView::goPreviousMonth() | 2320 | void CalendarView::goPreviousMonth() |
2321 | { | 2321 | { |
2322 | mNavigator->selectPreviousMonth(); | 2322 | mNavigator->selectPreviousMonth(); |
2323 | } | 2323 | } |
2324 | void CalendarView::writeLocale() | 2324 | void CalendarView::writeLocale() |
2325 | { | 2325 | { |
2326 | //KPimGlobalPrefs::instance()->setGlobalConfig(); | 2326 | //KPimGlobalPrefs::instance()->setGlobalConfig(); |
2327 | #if 0 | 2327 | #if 0 |
2328 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); | 2328 | KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); |
2329 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); | 2329 | KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); |
2330 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); | 2330 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); |
2331 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); | 2331 | KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); |
2332 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; | 2332 | QString dummy = KOPrefs::instance()->mUserDateFormatLong; |
2333 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 2333 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
2334 | dummy = KOPrefs::instance()->mUserDateFormatShort; | 2334 | dummy = KOPrefs::instance()->mUserDateFormatShort; |
2335 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 2335 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
2336 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, | 2336 | KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, |
2337 | KOPrefs::instance()->mDaylightsavingStart, | 2337 | KOPrefs::instance()->mDaylightsavingStart, |
2338 | KOPrefs::instance()->mDaylightsavingEnd ); | 2338 | KOPrefs::instance()->mDaylightsavingEnd ); |
2339 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); | 2339 | KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); |
2340 | #endif | 2340 | #endif |
2341 | } | 2341 | } |
2342 | void CalendarView::updateConfig() | 2342 | void CalendarView::updateConfig() |
2343 | { | 2343 | { |
2344 | writeLocale(); | 2344 | writeLocale(); |
2345 | if ( KOPrefs::instance()->mUseAppColors ) | 2345 | if ( KOPrefs::instance()->mUseAppColors ) |
2346 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2346 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2347 | emit configChanged(); | 2347 | emit configChanged(); |
2348 | mTodoList->updateConfig(); | 2348 | mTodoList->updateConfig(); |
2349 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2349 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2350 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2350 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2351 | // To make the "fill window" configurations work | 2351 | // To make the "fill window" configurations work |
2352 | //mViewManager->raiseCurrentView(); | 2352 | //mViewManager->raiseCurrentView(); |
2353 | } | 2353 | } |
2354 | 2354 | ||
2355 | 2355 | ||
2356 | void CalendarView::eventChanged(Event *event) | 2356 | void CalendarView::eventChanged(Event *event) |
2357 | { | 2357 | { |
2358 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2358 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2359 | //updateUnmanagedViews(); | 2359 | //updateUnmanagedViews(); |
2360 | } | 2360 | } |
2361 | 2361 | ||
2362 | void CalendarView::eventAdded(Event *event) | 2362 | void CalendarView::eventAdded(Event *event) |
2363 | { | 2363 | { |
2364 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2364 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2365 | } | 2365 | } |
2366 | 2366 | ||
2367 | void CalendarView::eventToBeDeleted(Event *) | 2367 | void CalendarView::eventToBeDeleted(Event *) |
2368 | { | 2368 | { |
2369 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2369 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2370 | } | 2370 | } |
2371 | 2371 | ||
2372 | void CalendarView::eventDeleted() | 2372 | void CalendarView::eventDeleted() |
2373 | { | 2373 | { |
2374 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2374 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2375 | } | 2375 | } |
2376 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2376 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2377 | { | 2377 | { |
2378 | changeIncidenceDisplay((Incidence *)which, action); | 2378 | changeIncidenceDisplay((Incidence *)which, action); |
2379 | mDateNavigator->updateView(); //LR | 2379 | mDateNavigator->updateView(); //LR |
2380 | //mDialogManager->updateSearchDialog(); | 2380 | //mDialogManager->updateSearchDialog(); |
2381 | 2381 | ||
2382 | if (which) { | 2382 | if (which) { |
2383 | mViewManager->updateWNview(); | 2383 | mViewManager->updateWNview(); |
2384 | //mTodoList->updateView(); | 2384 | //mTodoList->updateView(); |
2385 | } | 2385 | } |
2386 | 2386 | ||
2387 | } | 2387 | } |
2388 | 2388 | ||
2389 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 2389 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
2390 | { | 2390 | { |
2391 | updateUnmanagedViews(); | 2391 | updateUnmanagedViews(); |
2392 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 2392 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
2393 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 2393 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
2394 | mCalendar->checkAlarmForIncidence( 0, true ); | 2394 | mCalendar->checkAlarmForIncidence( 0, true ); |
2395 | if ( mEventViewerDialog ) | 2395 | if ( mEventViewerDialog ) |
2396 | mEventViewerDialog->hide(); | 2396 | mEventViewerDialog->hide(); |
2397 | } | 2397 | } |
2398 | else | 2398 | else |
2399 | mCalendar->checkAlarmForIncidence( which , false ); | 2399 | mCalendar->checkAlarmForIncidence( which , false ); |
2400 | } | 2400 | } |
2401 | 2401 | ||
2402 | // most of the changeEventDisplays() right now just call the view's | 2402 | // most of the changeEventDisplays() right now just call the view's |
2403 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 2403 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
2404 | void CalendarView::changeEventDisplay(Event *which, int action) | 2404 | void CalendarView::changeEventDisplay(Event *which, int action) |
2405 | { | 2405 | { |
2406 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 2406 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
2407 | changeIncidenceDisplay((Incidence *)which, action); | 2407 | changeIncidenceDisplay((Incidence *)which, action); |
2408 | mDateNavigator->updateView(); | 2408 | mDateNavigator->updateView(); |
2409 | //mDialogManager->updateSearchDialog(); | 2409 | //mDialogManager->updateSearchDialog(); |
2410 | 2410 | ||
2411 | if (which) { | 2411 | if (which) { |
2412 | // If there is an event view visible update the display | 2412 | // If there is an event view visible update the display |
2413 | mViewManager->currentView()->changeEventDisplay(which,action); | 2413 | mViewManager->currentView()->changeEventDisplay(which,action); |
2414 | // TODO: check, if update needed | 2414 | // TODO: check, if update needed |
2415 | // if (which->getTodoStatus()) { | 2415 | // if (which->getTodoStatus()) { |
2416 | mTodoList->updateView(); | 2416 | mTodoList->updateView(); |
2417 | // } | 2417 | // } |
2418 | } else { | 2418 | } else { |
2419 | mViewManager->currentView()->updateView(); | 2419 | mViewManager->currentView()->updateView(); |
2420 | } | 2420 | } |
2421 | } | 2421 | } |
2422 | 2422 | ||
2423 | 2423 | ||
2424 | void CalendarView::updateTodoViews() | 2424 | void CalendarView::updateTodoViews() |
2425 | { | 2425 | { |
2426 | mTodoList->updateView(); | 2426 | mTodoList->updateView(); |
2427 | mViewManager->currentView()->updateView(); | 2427 | mViewManager->currentView()->updateView(); |
2428 | 2428 | ||
2429 | } | 2429 | } |
2430 | 2430 | ||
2431 | 2431 | ||
2432 | void CalendarView::updateView(const QDate &start, const QDate &end) | 2432 | void CalendarView::updateView(const QDate &start, const QDate &end) |
2433 | { | 2433 | { |
2434 | mTodoList->updateView(); | 2434 | mTodoList->updateView(); |
2435 | mViewManager->updateView(start, end); | 2435 | mViewManager->updateView(start, end); |
2436 | //mDateNavigator->updateView(); | 2436 | //mDateNavigator->updateView(); |
2437 | } | 2437 | } |
2438 | 2438 | ||
2439 | void CalendarView::clearAllViews() | 2439 | void CalendarView::clearAllViews() |
2440 | { | 2440 | { |
2441 | mTodoList->clearList(); | 2441 | mTodoList->clearList(); |
2442 | mViewManager->clearAllViews(); | 2442 | mViewManager->clearAllViews(); |
2443 | SearchDialog * sd = mDialogManager->getSearchDialog(); | 2443 | SearchDialog * sd = mDialogManager->getSearchDialog(); |
2444 | if ( sd ) { | 2444 | if ( sd ) { |
2445 | KOListView* kol = sd->listview(); | 2445 | KOListView* kol = sd->listview(); |
2446 | if ( kol ) | 2446 | if ( kol ) |
2447 | kol->clearList(); | 2447 | kol->clearList(); |
2448 | } | 2448 | } |
2449 | } | 2449 | } |
2450 | void CalendarView::updateView() | 2450 | void CalendarView::updateView() |
2451 | { | 2451 | { |
2452 | DateList tmpList = mNavigator->selectedDates(); | 2452 | DateList tmpList = mNavigator->selectedDates(); |
2453 | 2453 | ||
2454 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2454 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2455 | mTodoList->updateView(); | 2455 | mTodoList->updateView(); |
2456 | // We assume that the navigator only selects consecutive days. | 2456 | // We assume that the navigator only selects consecutive days. |
2457 | updateView( tmpList.first(), tmpList.last() ); | 2457 | updateView( tmpList.first(), tmpList.last() ); |
2458 | } | 2458 | } |
2459 | 2459 | ||
2460 | void CalendarView::updateUnmanagedViews() | 2460 | void CalendarView::updateUnmanagedViews() |
2461 | { | 2461 | { |
2462 | mDateNavigator->updateDayMatrix(); | 2462 | mDateNavigator->updateDayMatrix(); |
2463 | } | 2463 | } |
2464 | 2464 | ||
2465 | int CalendarView::msgItemDelete(const QString name) | 2465 | int CalendarView::msgItemDelete(const QString name) |
2466 | { | 2466 | { |
2467 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 2467 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2468 | i18n("This item will be\npermanently deleted."), | 2468 | i18n("This item will be\npermanently deleted."), |
2469 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2469 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2470 | } | 2470 | } |
2471 | 2471 | ||
2472 | 2472 | ||
2473 | void CalendarView::edit_cut() | 2473 | void CalendarView::edit_cut() |
2474 | { | 2474 | { |
2475 | Event *anEvent=0; | 2475 | Event *anEvent=0; |
2476 | 2476 | ||
2477 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2477 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2478 | 2478 | ||
2479 | if (mViewManager->currentView()->isEventView()) { | 2479 | if (mViewManager->currentView()->isEventView()) { |
2480 | if ( incidence && incidence->typeID() == eventID ) { | 2480 | if ( incidence && incidence->typeID() == eventID ) { |
2481 | anEvent = static_cast<Event *>(incidence); | 2481 | anEvent = static_cast<Event *>(incidence); |
2482 | } | 2482 | } |
2483 | } | 2483 | } |
2484 | 2484 | ||
2485 | if (!anEvent) { | 2485 | if (!anEvent) { |
2486 | KNotifyClient::beep(); | 2486 | KNotifyClient::beep(); |
2487 | return; | 2487 | return; |
2488 | } | 2488 | } |
2489 | DndFactory factory( mCalendar ); | 2489 | DndFactory factory( mCalendar ); |
2490 | factory.cutIncidence(anEvent); | 2490 | factory.cutIncidence(anEvent); |
2491 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2491 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2492 | } | 2492 | } |
2493 | 2493 | ||
2494 | void CalendarView::edit_copy() | 2494 | void CalendarView::edit_copy() |
2495 | { | 2495 | { |
2496 | Event *anEvent=0; | 2496 | Event *anEvent=0; |
2497 | 2497 | ||
2498 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2498 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2499 | 2499 | ||
2500 | if (mViewManager->currentView()->isEventView()) { | 2500 | if (mViewManager->currentView()->isEventView()) { |
2501 | if ( incidence && incidence->typeID() == eventID ) { | 2501 | if ( incidence && incidence->typeID() == eventID ) { |
2502 | anEvent = static_cast<Event *>(incidence); | 2502 | anEvent = static_cast<Event *>(incidence); |
2503 | } | 2503 | } |
2504 | } | 2504 | } |
2505 | 2505 | ||
2506 | if (!anEvent) { | 2506 | if (!anEvent) { |
2507 | KNotifyClient::beep(); | 2507 | KNotifyClient::beep(); |
2508 | return; | 2508 | return; |
2509 | } | 2509 | } |
2510 | DndFactory factory( mCalendar ); | 2510 | DndFactory factory( mCalendar ); |
2511 | factory.copyIncidence(anEvent); | 2511 | factory.copyIncidence(anEvent); |
2512 | } | 2512 | } |
2513 | 2513 | ||
2514 | void CalendarView::edit_paste() | 2514 | void CalendarView::edit_paste() |
2515 | { | 2515 | { |
2516 | QDate date = mNavigator->selectedDates().first(); | 2516 | QDate date = mNavigator->selectedDates().first(); |
2517 | 2517 | ||
2518 | DndFactory factory( mCalendar ); | 2518 | DndFactory factory( mCalendar ); |
2519 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); | 2519 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); |
2520 | 2520 | ||
2521 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2521 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2522 | } | 2522 | } |
2523 | void CalendarView::edit_global_options() | 2523 | void CalendarView::edit_global_options() |
2524 | { | 2524 | { |
2525 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; | 2525 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; |
2526 | emit save(); | 2526 | emit save(); |
2527 | emit saveStopTimer(); | 2527 | emit saveStopTimer(); |
2528 | mDialogManager->showGlobalOptionsDialog(); | 2528 | mDialogManager->showGlobalOptionsDialog(); |
2529 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { | 2529 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { |
2530 | emit saveStopTimer(); | 2530 | emit saveStopTimer(); |
2531 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), | 2531 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto apply timezone changes?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), |
2532 | i18n("Timezone settings"),i18n("Reload"))) { | 2532 | i18n("Timezone settings"),i18n("Reload"))) { |
2533 | qDebug("KO: TZ reload cancelled "); | 2533 | qDebug("KO: TZ reload cancelled "); |
2534 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | ||
2534 | return; | 2535 | return; |
2535 | } | 2536 | } |
2536 | qDebug("KO: Timezone change "); | 2537 | qDebug("KO: Timezone change "); |
2537 | openCalendar( MainWindow::defaultFileName() ); | 2538 | openCalendar( MainWindow::defaultFileName() ); |
2538 | setModified(true); | 2539 | setModified(true); |
2539 | } | 2540 | } |
2540 | else | 2541 | else |
2541 | qDebug("KO: No tz change "); | 2542 | qDebug("KO: No tz change "); |
2542 | } | 2543 | } |
2543 | void CalendarView::edit_options() | 2544 | void CalendarView::edit_options() |
2544 | { | 2545 | { |
2545 | mDialogManager->showOptionsDialog(); | 2546 | mDialogManager->showOptionsDialog(); |
2546 | } | 2547 | } |
2547 | 2548 | ||
2548 | 2549 | ||
2549 | void CalendarView::slotSelectPickerDate( QDate d) | 2550 | void CalendarView::slotSelectPickerDate( QDate d) |
2550 | { | 2551 | { |
2551 | mDateFrame->hide(); | 2552 | mDateFrame->hide(); |
2552 | if ( mDatePickerMode == 1 ) { | 2553 | if ( mDatePickerMode == 1 ) { |
2553 | mNavigator->slotDaySelect( d ); | 2554 | mNavigator->slotDaySelect( d ); |
2554 | } else if ( mDatePickerMode == 2 ) { | 2555 | } else if ( mDatePickerMode == 2 ) { |
2555 | if ( mMoveIncidence->typeID() == todoID ) { | 2556 | if ( mMoveIncidence->typeID() == todoID ) { |
2556 | Todo * to = (Todo *) mMoveIncidence; | 2557 | Todo * to = (Todo *) mMoveIncidence; |
2557 | QTime tim; | 2558 | QTime tim; |
2558 | int len = 0; | 2559 | int len = 0; |
2559 | if ( to->hasStartDate() && to->hasDueDate() ) | 2560 | if ( to->hasStartDate() && to->hasDueDate() ) |
2560 | len = to->dtStart().secsTo( to->dtDue()); | 2561 | len = to->dtStart().secsTo( to->dtDue()); |
2561 | if ( to->hasDueDate() ) | 2562 | if ( to->hasDueDate() ) |
2562 | tim = to->dtDue().time(); | 2563 | tim = to->dtDue().time(); |
2563 | else { | 2564 | else { |
2564 | tim = QTime ( 0,0,0 ); | 2565 | tim = QTime ( 0,0,0 ); |
2565 | to->setFloats( true ); | 2566 | to->setFloats( true ); |
2566 | to->setHasDueDate( true ); | 2567 | to->setHasDueDate( true ); |
2567 | } | 2568 | } |
2568 | QDateTime dt ( d,tim ); | 2569 | QDateTime dt ( d,tim ); |
2569 | to->setDtDue( dt ); | 2570 | to->setDtDue( dt ); |
2570 | 2571 | ||
2571 | if ( to->hasStartDate() ) { | 2572 | if ( to->hasStartDate() ) { |
2572 | if ( len>0 ) | 2573 | if ( len>0 ) |
2573 | to->setDtStart(to->dtDue().addSecs( -len )); | 2574 | to->setDtStart(to->dtDue().addSecs( -len )); |
2574 | else | 2575 | else |
2575 | if (to->dtStart() > to->dtDue() ) | 2576 | if (to->dtStart() > to->dtDue() ) |
2576 | to->setDtStart(to->dtDue().addDays( -3 )); | 2577 | to->setDtStart(to->dtDue().addDays( -3 )); |
2577 | } | 2578 | } |
2578 | 2579 | ||
2579 | todoChanged( to ); | 2580 | todoChanged( to ); |
2580 | } else { | 2581 | } else { |
2581 | if ( mMoveIncidence->doesRecur() ) { | 2582 | if ( mMoveIncidence->doesRecur() ) { |
2582 | #if 0 | 2583 | #if 0 |
2583 | // PENDING implement this | 2584 | // PENDING implement this |
2584 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); | 2585 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); |
2585 | mCalendar()->addIncidence( newInc ); | 2586 | mCalendar()->addIncidence( newInc ); |
2586 | if ( mMoveIncidence->typeID() == todoID ) | 2587 | if ( mMoveIncidence->typeID() == todoID ) |
2587 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); | 2588 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); |
2588 | else | 2589 | else |
2589 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); | 2590 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); |
2590 | mMoveIncidence = newInc; | 2591 | mMoveIncidence = newInc; |
2591 | 2592 | ||
2592 | #endif | 2593 | #endif |
2593 | } | 2594 | } |
2594 | QTime tim = mMoveIncidence->dtStart().time(); | 2595 | QTime tim = mMoveIncidence->dtStart().time(); |
2595 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 2596 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |
2596 | QDateTime dt ( d,tim ); | 2597 | QDateTime dt ( d,tim ); |
2597 | mMoveIncidence->setDtStart( dt ); | 2598 | mMoveIncidence->setDtStart( dt ); |
2598 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); | 2599 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); |
2599 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); | 2600 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); |
2600 | } | 2601 | } |
2601 | 2602 | ||
2602 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); | 2603 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); |
2603 | } | 2604 | } |
2604 | } | 2605 | } |
2605 | 2606 | ||
2606 | void CalendarView::removeCategories() | 2607 | void CalendarView::removeCategories() |
2607 | { | 2608 | { |
2608 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2609 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2609 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2610 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2610 | QStringList catIncList; | 2611 | QStringList catIncList; |
2611 | QStringList newCatList; | 2612 | QStringList newCatList; |
2612 | Incidence* inc = incList.first(); | 2613 | Incidence* inc = incList.first(); |
2613 | int i; | 2614 | int i; |
2614 | int count = 0; | 2615 | int count = 0; |
2615 | while ( inc ) { | 2616 | while ( inc ) { |
2616 | newCatList.clear(); | 2617 | newCatList.clear(); |
2617 | catIncList = inc->categories() ; | 2618 | catIncList = inc->categories() ; |
2618 | for( i = 0; i< catIncList.count(); ++i ) { | 2619 | for( i = 0; i< catIncList.count(); ++i ) { |
2619 | if ( catList.contains (catIncList[i])) | 2620 | if ( catList.contains (catIncList[i])) |
2620 | newCatList.append( catIncList[i] ); | 2621 | newCatList.append( catIncList[i] ); |
2621 | } | 2622 | } |
2622 | newCatList.sort(); | 2623 | newCatList.sort(); |
2623 | inc->setCategories( newCatList.join(",") ); | 2624 | inc->setCategories( newCatList.join(",") ); |
2624 | inc = incList.next(); | 2625 | inc = incList.next(); |
2625 | } | 2626 | } |
2626 | } | 2627 | } |
2627 | 2628 | ||
2628 | int CalendarView::addCategories() | 2629 | int CalendarView::addCategories() |
2629 | { | 2630 | { |
2630 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 2631 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
2631 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 2632 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
2632 | QStringList catIncList; | 2633 | QStringList catIncList; |
2633 | Incidence* inc = incList.first(); | 2634 | Incidence* inc = incList.first(); |
2634 | int i; | 2635 | int i; |
2635 | int count = 0; | 2636 | int count = 0; |
2636 | while ( inc ) { | 2637 | while ( inc ) { |
2637 | catIncList = inc->categories() ; | 2638 | catIncList = inc->categories() ; |
2638 | for( i = 0; i< catIncList.count(); ++i ) { | 2639 | for( i = 0; i< catIncList.count(); ++i ) { |
2639 | if ( !catList.contains (catIncList[i])) { | 2640 | if ( !catList.contains (catIncList[i])) { |
2640 | catList.append( catIncList[i] ); | 2641 | catList.append( catIncList[i] ); |
2641 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2642 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2642 | ++count; | 2643 | ++count; |
2643 | } | 2644 | } |
2644 | } | 2645 | } |
2645 | inc = incList.next(); | 2646 | inc = incList.next(); |
2646 | } | 2647 | } |
2647 | catList.sort(); | 2648 | catList.sort(); |
2648 | KOPrefs::instance()->mCustomCategories = catList; | 2649 | KOPrefs::instance()->mCustomCategories = catList; |
2649 | return count; | 2650 | return count; |
2650 | } | 2651 | } |
2651 | 2652 | ||
2652 | void CalendarView::manageCategories() | 2653 | void CalendarView::manageCategories() |
2653 | { | 2654 | { |
2654 | KOCatPrefs* cp = new KOCatPrefs(); | 2655 | KOCatPrefs* cp = new KOCatPrefs(); |
2655 | cp->show(); | 2656 | cp->show(); |
2656 | int w =cp->sizeHint().width() ; | 2657 | int w =cp->sizeHint().width() ; |
2657 | int h = cp->sizeHint().height() ; | 2658 | int h = cp->sizeHint().height() ; |
2658 | int dw = QApplication::desktop()->width(); | 2659 | int dw = QApplication::desktop()->width(); |
2659 | int dh = QApplication::desktop()->height(); | 2660 | int dh = QApplication::desktop()->height(); |
2660 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2661 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2661 | if ( !cp->exec() ) { | 2662 | if ( !cp->exec() ) { |
2662 | delete cp; | 2663 | delete cp; |
2663 | return; | 2664 | return; |
2664 | } | 2665 | } |
2665 | int count = 0; | 2666 | int count = 0; |
2666 | if ( cp->addCat() ) { | 2667 | if ( cp->addCat() ) { |
2667 | count = addCategories(); | 2668 | count = addCategories(); |
2668 | if ( count ) { | 2669 | if ( count ) { |
2669 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); | 2670 | topLevelWidget()->setCaption(QString::number( count )+ i18n(" Categories added to list! ")); |
2670 | writeSettings(); | 2671 | writeSettings(); |
2671 | } else | 2672 | } else |
2672 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); | 2673 | topLevelWidget()->setCaption(QString::number( 0 )+ i18n(" Categories added to list! ")); |
2673 | } else { | 2674 | } else { |
2674 | removeCategories(); | 2675 | removeCategories(); |
2675 | updateView(); | 2676 | updateView(); |
2676 | } | 2677 | } |
2677 | delete cp; | 2678 | delete cp; |
2678 | } | 2679 | } |
2679 | 2680 | ||
2680 | void CalendarView::beamIncidence(Incidence * Inc) | 2681 | void CalendarView::beamIncidence(Incidence * Inc) |
2681 | { | 2682 | { |
2682 | QPtrList<Incidence> delSel ; | 2683 | QPtrList<Incidence> delSel ; |
2683 | delSel.append(Inc); | 2684 | delSel.append(Inc); |
2684 | beamIncidenceList( delSel ); | 2685 | beamIncidenceList( delSel ); |
2685 | } | 2686 | } |
2686 | void CalendarView::beamCalendar() | 2687 | void CalendarView::beamCalendar() |
2687 | { | 2688 | { |
2688 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); | 2689 | QPtrList<Incidence> delSel = mCalendar->rawIncidences(); |
2689 | //qDebug("beamCalendar() "); | 2690 | //qDebug("beamCalendar() "); |
2690 | beamIncidenceList( delSel ); | 2691 | beamIncidenceList( delSel ); |
2691 | } | 2692 | } |
2692 | void CalendarView::beamFilteredCalendar() | 2693 | void CalendarView::beamFilteredCalendar() |
2693 | { | 2694 | { |
2694 | QPtrList<Incidence> delSel = mCalendar->incidences(); | 2695 | QPtrList<Incidence> delSel = mCalendar->incidences(); |
2695 | //qDebug("beamFilteredCalendar() "); | 2696 | //qDebug("beamFilteredCalendar() "); |
2696 | beamIncidenceList( delSel ); | 2697 | beamIncidenceList( delSel ); |
2697 | } | 2698 | } |
2698 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) | 2699 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) |
2699 | { | 2700 | { |
2700 | if ( beamDialog->exec () == QDialog::Rejected ) | 2701 | if ( beamDialog->exec () == QDialog::Rejected ) |
2701 | return; | 2702 | return; |
2702 | #ifdef DESKTOP_VERSION | 2703 | #ifdef DESKTOP_VERSION |
2703 | QString fn = locateLocal( "tmp", "kopibeamfile" ); | 2704 | QString fn = locateLocal( "tmp", "kopibeamfile" ); |
2704 | #else | 2705 | #else |
2705 | QString fn = "/tmp/kopibeamfile"; | 2706 | QString fn = "/tmp/kopibeamfile"; |
2706 | #endif | 2707 | #endif |
2707 | QString mes; | 2708 | QString mes; |
2708 | bool createbup = true; | 2709 | bool createbup = true; |
2709 | if ( createbup ) { | 2710 | if ( createbup ) { |
2710 | QString description = "\n"; | 2711 | QString description = "\n"; |
2711 | CalendarLocal* cal = new CalendarLocal(); | 2712 | CalendarLocal* cal = new CalendarLocal(); |
2712 | if ( beamDialog->beamLocal() ) | 2713 | if ( beamDialog->beamLocal() ) |
2713 | cal->setLocalTime(); | 2714 | cal->setLocalTime(); |
2714 | else | 2715 | else |
2715 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2716 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2716 | Incidence *incidence = delSel.first(); | 2717 | Incidence *incidence = delSel.first(); |
2717 | bool addText = false; | 2718 | bool addText = false; |
2718 | if ( delSel.count() < 10 ) | 2719 | if ( delSel.count() < 10 ) |
2719 | addText = true; | 2720 | addText = true; |
2720 | else { | 2721 | else { |
2721 | description.sprintf(i18n(" %d items?"),delSel.count() ); | 2722 | description.sprintf(i18n(" %d items?"),delSel.count() ); |
2722 | } | 2723 | } |
2723 | while ( incidence ) { | 2724 | while ( incidence ) { |
2724 | Incidence *in = incidence->clone(); | 2725 | Incidence *in = incidence->clone(); |
2725 | if ( ! in->summary().isEmpty() ) { | 2726 | if ( ! in->summary().isEmpty() ) { |
2726 | in->setDescription(""); | 2727 | in->setDescription(""); |
2727 | } else { | 2728 | } else { |
2728 | in->setSummary( in->description().left(20)); | 2729 | in->setSummary( in->description().left(20)); |
2729 | in->setDescription(""); | 2730 | in->setDescription(""); |
2730 | } | 2731 | } |
2731 | if ( addText ) | 2732 | if ( addText ) |
2732 | description += in->summary() + "\n"; | 2733 | description += in->summary() + "\n"; |
2733 | cal->addIncidence( in ); | 2734 | cal->addIncidence( in ); |
2734 | incidence = delSel.next(); | 2735 | incidence = delSel.next(); |
2735 | } | 2736 | } |
2736 | if ( beamDialog->beamVcal() ) { | 2737 | if ( beamDialog->beamVcal() ) { |
2737 | fn += ".vcs"; | 2738 | fn += ".vcs"; |
2738 | FileStorage storage( cal, fn, new VCalFormat ); | 2739 | FileStorage storage( cal, fn, new VCalFormat ); |
2739 | storage.save(); | 2740 | storage.save(); |
2740 | } else { | 2741 | } else { |
2741 | fn += ".ics"; | 2742 | fn += ".ics"; |
2742 | FileStorage storage( cal, fn, new ICalFormat( ) ); | 2743 | FileStorage storage( cal, fn, new ICalFormat( ) ); |
2743 | storage.save(); | 2744 | storage.save(); |
2744 | } | 2745 | } |
2745 | delete cal; | 2746 | delete cal; |
2746 | mes = i18n("KO/Pi: Ready for beaming"); | 2747 | mes = i18n("KO/Pi: Ready for beaming"); |
2747 | topLevelWidget()->setCaption(mes); | 2748 | topLevelWidget()->setCaption(mes); |
2748 | KApplication::convert2latin1( fn ); | 2749 | KApplication::convert2latin1( fn ); |
2749 | #ifndef DESKTOP_VERSION | 2750 | #ifndef DESKTOP_VERSION |
2750 | Ir *ir = new Ir( this ); | 2751 | Ir *ir = new Ir( this ); |
2751 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 2752 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
2752 | ir->send( fn, description, "text/x-vCalendar" ); | 2753 | ir->send( fn, description, "text/x-vCalendar" ); |
2753 | #endif | 2754 | #endif |
2754 | } | 2755 | } |
2755 | } | 2756 | } |
2756 | void CalendarView::beamDone( Ir *ir ) | 2757 | void CalendarView::beamDone( Ir *ir ) |
2757 | { | 2758 | { |
2758 | #ifndef DESKTOP_VERSION | 2759 | #ifndef DESKTOP_VERSION |
2759 | delete ir; | 2760 | delete ir; |
2760 | #endif | 2761 | #endif |
2761 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); | 2762 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); |
2762 | topLevelWidget()->raise(); | 2763 | topLevelWidget()->raise(); |
2763 | } | 2764 | } |
2764 | 2765 | ||
2765 | void CalendarView::moveIncidence(Incidence * inc ) | 2766 | void CalendarView::moveIncidence(Incidence * inc ) |
2766 | { | 2767 | { |
2767 | if ( !inc ) return; | 2768 | if ( !inc ) return; |
2768 | showDatePickerPopup(); | 2769 | showDatePickerPopup(); |
2769 | mDatePickerMode = 2; | 2770 | mDatePickerMode = 2; |
2770 | mMoveIncidence = inc ; | 2771 | mMoveIncidence = inc ; |
2771 | QDate da; | 2772 | QDate da; |
2772 | if ( mMoveIncidence->typeID() == todoID ) { | 2773 | if ( mMoveIncidence->typeID() == todoID ) { |
2773 | Todo * to = (Todo *) mMoveIncidence; | 2774 | Todo * to = (Todo *) mMoveIncidence; |
2774 | if ( to->hasDueDate() ) | 2775 | if ( to->hasDueDate() ) |
2775 | da = to->dtDue().date(); | 2776 | da = to->dtDue().date(); |
2776 | else | 2777 | else |
2777 | da = QDate::currentDate(); | 2778 | da = QDate::currentDate(); |
2778 | } else { | 2779 | } else { |
2779 | da = mMoveIncidence->dtStart().date(); | 2780 | da = mMoveIncidence->dtStart().date(); |
2780 | } | 2781 | } |
2781 | //PENDING set date for recurring incidence to date of recurrence | 2782 | //PENDING set date for recurring incidence to date of recurrence |
2782 | //mMoveIncidenceOldDate; | 2783 | //mMoveIncidenceOldDate; |
2783 | mDatePicker->setDate( da ); | 2784 | mDatePicker->setDate( da ); |
2784 | } | 2785 | } |
2785 | void CalendarView::showDatePickerPopup() | 2786 | void CalendarView::showDatePickerPopup() |
2786 | { | 2787 | { |
2787 | if ( mDateFrame->isVisible() ) | 2788 | if ( mDateFrame->isVisible() ) |
2788 | mDateFrame->hide(); | 2789 | mDateFrame->hide(); |
2789 | else { | 2790 | else { |
2790 | int offX = 0, offY = 0; | 2791 | int offX = 0, offY = 0; |
2791 | #ifdef DESKTOP_VERSION | 2792 | #ifdef DESKTOP_VERSION |
2792 | int w =mDatePicker->sizeHint().width() ; | 2793 | int w =mDatePicker->sizeHint().width() ; |
2793 | int h = mDatePicker->sizeHint().height() ; | 2794 | int h = mDatePicker->sizeHint().height() ; |
2794 | int dw = topLevelWidget()->width(); | 2795 | int dw = topLevelWidget()->width(); |
2795 | int dh = topLevelWidget()->height(); | 2796 | int dh = topLevelWidget()->height(); |
2796 | offX = topLevelWidget()->x(); | 2797 | offX = topLevelWidget()->x(); |
2797 | offY = topLevelWidget()->y(); | 2798 | offY = topLevelWidget()->y(); |
2798 | #else | 2799 | #else |
2799 | int w =mDatePicker->sizeHint().width() ; | 2800 | int w =mDatePicker->sizeHint().width() ; |
2800 | int h = mDatePicker->sizeHint().height() ; | 2801 | int h = mDatePicker->sizeHint().height() ; |
2801 | int dw = QApplication::desktop()->width(); | 2802 | int dw = QApplication::desktop()->width(); |
2802 | int dh = QApplication::desktop()->height(); | 2803 | int dh = QApplication::desktop()->height(); |
2803 | #endif | 2804 | #endif |
2804 | mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); | 2805 | mDateFrame->setGeometry( (dw-w)/2+offX, (dh - h )/2+offY ,w,h ); |
2805 | mDateFrame->show(); | 2806 | mDateFrame->show(); |
2806 | } | 2807 | } |
2807 | } | 2808 | } |
2808 | void CalendarView::showDatePicker( ) | 2809 | void CalendarView::showDatePicker( ) |
2809 | { | 2810 | { |
2810 | showDatePickerPopup(); | 2811 | showDatePickerPopup(); |
2811 | mDatePickerMode = 1; | 2812 | mDatePickerMode = 1; |
2812 | mDatePicker->setDate( mNavigator->selectedDates().first() ); | 2813 | mDatePicker->setDate( mNavigator->selectedDates().first() ); |
2813 | } | 2814 | } |
2814 | 2815 | ||
2815 | void CalendarView::showEventEditor() | 2816 | void CalendarView::showEventEditor() |
2816 | { | 2817 | { |
2817 | #ifdef DESKTOP_VERSION | 2818 | #ifdef DESKTOP_VERSION |
2818 | int x,y,w,h; | 2819 | int x,y,w,h; |
2819 | x = mEventEditor->geometry().x(); | 2820 | x = mEventEditor->geometry().x(); |
2820 | y = mEventEditor->geometry().y(); | 2821 | y = mEventEditor->geometry().y(); |
2821 | w = mEventEditor->width(); | 2822 | w = mEventEditor->width(); |
2822 | h = mEventEditor->height(); | 2823 | h = mEventEditor->height(); |
2823 | mEventEditor->show(); | 2824 | mEventEditor->show(); |
2824 | mEventEditor->setGeometry(x,y,w,h); | 2825 | mEventEditor->setGeometry(x,y,w,h); |
2825 | #else | 2826 | #else |
2826 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { | 2827 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { |
2827 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); | 2828 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
2828 | qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); | 2829 | qDebug("KO: CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); |
2829 | qApp->processEvents(); | 2830 | qApp->processEvents(); |
2830 | delete mEventEditor; | 2831 | delete mEventEditor; |
2831 | mEventEditor = mDialogManager->getEventEditor(); | 2832 | mEventEditor = mDialogManager->getEventEditor(); |
2832 | topLevelWidget()->setCaption( i18n("") ); | 2833 | topLevelWidget()->setCaption( i18n("") ); |
2833 | } | 2834 | } |
2834 | mEventEditor->showMaximized(); | 2835 | mEventEditor->showMaximized(); |
2835 | #endif | 2836 | #endif |
2836 | } | 2837 | } |
2837 | void CalendarView::showTodoEditor() | 2838 | void CalendarView::showTodoEditor() |
2838 | { | 2839 | { |
2839 | #ifdef DESKTOP_VERSION | 2840 | #ifdef DESKTOP_VERSION |
2840 | int x,y,w,h; | 2841 | int x,y,w,h; |
2841 | x = mTodoEditor->geometry().x(); | 2842 | x = mTodoEditor->geometry().x(); |
2842 | y = mTodoEditor->geometry().y(); | 2843 | y = mTodoEditor->geometry().y(); |
2843 | w = mTodoEditor->width(); | 2844 | w = mTodoEditor->width(); |
2844 | h = mTodoEditor->height(); | 2845 | h = mTodoEditor->height(); |
2845 | mTodoEditor->show(); | 2846 | mTodoEditor->show(); |
2846 | mTodoEditor->setGeometry(x,y,w,h); | 2847 | mTodoEditor->setGeometry(x,y,w,h); |
2847 | #else | 2848 | #else |
2848 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { | 2849 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { |
2849 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); | 2850 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
2850 | qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); | 2851 | qDebug("KO: CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); |
2851 | qApp->processEvents(); | 2852 | qApp->processEvents(); |
2852 | delete mTodoEditor; | 2853 | delete mTodoEditor; |
2853 | mTodoEditor = mDialogManager->getTodoEditor(); | 2854 | mTodoEditor = mDialogManager->getTodoEditor(); |
2854 | topLevelWidget()->setCaption( i18n("") ); | 2855 | topLevelWidget()->setCaption( i18n("") ); |
2855 | } | 2856 | } |
2856 | mTodoEditor->showMaximized(); | 2857 | mTodoEditor->showMaximized(); |
2857 | #endif | 2858 | #endif |
2858 | } | 2859 | } |
2859 | 2860 | ||
2860 | void CalendarView::cloneIncidence() | 2861 | void CalendarView::cloneIncidence() |
2861 | { | 2862 | { |
2862 | Incidence *incidence = currentSelection(); | 2863 | Incidence *incidence = currentSelection(); |
2863 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2864 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2864 | if ( incidence ) { | 2865 | if ( incidence ) { |
2865 | cloneIncidence(incidence); | 2866 | cloneIncidence(incidence); |
2866 | } | 2867 | } |
2867 | } | 2868 | } |
2868 | void CalendarView::moveIncidence() | 2869 | void CalendarView::moveIncidence() |
2869 | { | 2870 | { |
2870 | Incidence *incidence = currentSelection(); | 2871 | Incidence *incidence = currentSelection(); |
2871 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2872 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2872 | if ( incidence ) { | 2873 | if ( incidence ) { |
2873 | moveIncidence(incidence); | 2874 | moveIncidence(incidence); |
2874 | } | 2875 | } |
2875 | } | 2876 | } |
2876 | void CalendarView::beamIncidence() | 2877 | void CalendarView::beamIncidence() |
2877 | { | 2878 | { |
2878 | Incidence *incidence = currentSelection(); | 2879 | Incidence *incidence = currentSelection(); |
2879 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2880 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2880 | if ( incidence ) { | 2881 | if ( incidence ) { |
2881 | beamIncidence(incidence); | 2882 | beamIncidence(incidence); |
2882 | } | 2883 | } |
2883 | } | 2884 | } |
2884 | void CalendarView::toggleCancelIncidence() | 2885 | void CalendarView::toggleCancelIncidence() |
2885 | { | 2886 | { |
2886 | Incidence *incidence = currentSelection(); | 2887 | Incidence *incidence = currentSelection(); |
2887 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2888 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2888 | if ( incidence ) { | 2889 | if ( incidence ) { |
2889 | cancelIncidence(incidence); | 2890 | cancelIncidence(incidence); |
2890 | } | 2891 | } |
2891 | } | 2892 | } |
2892 | 2893 | ||
2893 | 2894 | ||
2894 | void CalendarView::cancelIncidence(Incidence * inc ) | 2895 | void CalendarView::cancelIncidence(Incidence * inc ) |
2895 | { | 2896 | { |
2896 | inc->setCancelled( ! inc->cancelled() ); | 2897 | inc->setCancelled( ! inc->cancelled() ); |
2897 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); | 2898 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); |
2898 | updateView(); | 2899 | updateView(); |
2899 | } | 2900 | } |
2900 | void CalendarView::cloneIncidence(Incidence * orgInc ) | 2901 | void CalendarView::cloneIncidence(Incidence * orgInc ) |
2901 | { | 2902 | { |
2902 | Incidence * newInc = orgInc->clone(); | 2903 | Incidence * newInc = orgInc->clone(); |
2903 | newInc->recreate(); | 2904 | newInc->recreate(); |
2904 | 2905 | ||
2905 | if ( newInc->typeID() == todoID ) { | 2906 | if ( newInc->typeID() == todoID ) { |
2906 | Todo* t = (Todo*) newInc; | 2907 | Todo* t = (Todo*) newInc; |
2907 | bool cloneSub = false; | 2908 | bool cloneSub = false; |
2908 | if ( orgInc->relations().count() ) { | 2909 | if ( orgInc->relations().count() ) { |
2909 | int result = KMessageBox::warningYesNoCancel(this, | 2910 | int result = KMessageBox::warningYesNoCancel(this, |
2910 | i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( newInc->summary().left ( 25 ) ), | 2911 | i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( newInc->summary().left ( 25 ) ), |
2911 | i18n("Todo has subtodos"), | 2912 | i18n("Todo has subtodos"), |
2912 | i18n("Yes"), | 2913 | i18n("Yes"), |
2913 | i18n("No")); | 2914 | i18n("No")); |
2914 | 2915 | ||
2915 | if ( result == KMessageBox::Cancel ) { | 2916 | if ( result == KMessageBox::Cancel ) { |
2916 | delete t; | 2917 | delete t; |
2917 | return; | 2918 | return; |
2918 | } | 2919 | } |
2919 | if (result == KMessageBox::Yes) cloneSub = true; | 2920 | if (result == KMessageBox::Yes) cloneSub = true; |
2920 | } | 2921 | } |
2921 | showTodoEditor(); | 2922 | showTodoEditor(); |
2922 | mTodoEditor->editTodo( t ); | 2923 | mTodoEditor->editTodo( t ); |
2923 | if ( mTodoEditor->exec() ) { | 2924 | if ( mTodoEditor->exec() ) { |
2924 | if ( cloneSub ) { | 2925 | if ( cloneSub ) { |
2925 | orgInc->cloneRelations( t ); | 2926 | orgInc->cloneRelations( t ); |
2926 | mCalendar->addIncidenceBranch( t ); | 2927 | mCalendar->addIncidenceBranch( t ); |
2927 | updateView(); | 2928 | updateView(); |
2928 | 2929 | ||
2929 | } else { | 2930 | } else { |
2930 | mCalendar->addTodo( t ); | 2931 | mCalendar->addTodo( t ); |
2931 | updateView(); | 2932 | updateView(); |
2932 | } | 2933 | } |
2933 | } else { | 2934 | } else { |
2934 | delete t; | 2935 | delete t; |
2935 | } | 2936 | } |
2936 | } | 2937 | } |
2937 | else { | 2938 | else { |
2938 | Event* e = (Event*) newInc; | 2939 | Event* e = (Event*) newInc; |
2939 | showEventEditor(); | 2940 | showEventEditor(); |
2940 | mEventEditor->editEvent( e ); | 2941 | mEventEditor->editEvent( e ); |
2941 | if ( mEventEditor->exec() ) { | 2942 | if ( mEventEditor->exec() ) { |
2942 | mCalendar->addEvent( e ); | 2943 | mCalendar->addEvent( e ); |
2943 | updateView(); | 2944 | updateView(); |
2944 | } else { | 2945 | } else { |
2945 | delete e; | 2946 | delete e; |
2946 | } | 2947 | } |
2947 | } | 2948 | } |
2948 | setActiveWindow(); | 2949 | setActiveWindow(); |
2949 | } | 2950 | } |
2950 | 2951 | ||
2951 | void CalendarView::newEvent() | 2952 | void CalendarView::newEvent() |
2952 | { | 2953 | { |
2953 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. | 2954 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. |
2954 | KOAgendaView *aView = mViewManager->agendaView(); | 2955 | KOAgendaView *aView = mViewManager->agendaView(); |
2955 | if (aView) { | 2956 | if (aView) { |
2956 | if (aView->selectionStart().isValid()) { | 2957 | if (aView->selectionStart().isValid()) { |
2957 | if (aView->selectedIsAllDay()) { | 2958 | if (aView->selectedIsAllDay()) { |
2958 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); | 2959 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); |
2959 | } else { | 2960 | } else { |
2960 | newEvent(aView->selectionStart(),aView->selectionEnd()); | 2961 | newEvent(aView->selectionStart(),aView->selectionEnd()); |
2961 | } | 2962 | } |
2962 | return; | 2963 | return; |
2963 | } | 2964 | } |
2964 | } | 2965 | } |
2965 | 2966 | ||
2966 | QDate date = mNavigator->selectedDates().first(); | 2967 | QDate date = mNavigator->selectedDates().first(); |
2967 | QDateTime current = QDateTime::currentDateTime(); | 2968 | QDateTime current = QDateTime::currentDateTime(); |
2968 | if ( date <= current.date() ) { | 2969 | if ( date <= current.date() ) { |
2969 | int hour = current.time().hour() +1; | 2970 | int hour = current.time().hour() +1; |
2970 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), | 2971 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), |
2971 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 2972 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
2972 | } else | 2973 | } else |
2973 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), | 2974 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), |
2974 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + | 2975 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + |
2975 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 2976 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
2976 | } | 2977 | } |
2977 | 2978 | ||
2978 | void CalendarView::newEvent(QDateTime fh) | 2979 | void CalendarView::newEvent(QDateTime fh) |
2979 | { | 2980 | { |
2980 | newEvent(fh, | 2981 | newEvent(fh, |
2981 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); | 2982 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); |
2982 | } | 2983 | } |
2983 | 2984 | ||
2984 | void CalendarView::newEvent(QDate dt) | 2985 | void CalendarView::newEvent(QDate dt) |
2985 | { | 2986 | { |
2986 | newEvent(QDateTime(dt, QTime(0,0,0)), | 2987 | newEvent(QDateTime(dt, QTime(0,0,0)), |
2987 | QDateTime(dt, QTime(0,0,0)), true); | 2988 | QDateTime(dt, QTime(0,0,0)), true); |
2988 | } | 2989 | } |
2989 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) | 2990 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint) |
2990 | { | 2991 | { |
2991 | newEvent(fromHint, toHint, false); | 2992 | newEvent(fromHint, toHint, false); |
2992 | } | 2993 | } |
2993 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) | 2994 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) |
2994 | { | 2995 | { |
2995 | 2996 | ||
2996 | showEventEditor(); | 2997 | showEventEditor(); |
2997 | mEventEditor->newEvent(fromHint,toHint,allDay); | 2998 | mEventEditor->newEvent(fromHint,toHint,allDay); |
2998 | if ( mFilterView->filtersEnabled() ) { | 2999 | if ( mFilterView->filtersEnabled() ) { |
2999 | CalFilter *filter = mFilterView->selectedFilter(); | 3000 | CalFilter *filter = mFilterView->selectedFilter(); |
3000 | if (filter && filter->showCategories()) { | 3001 | if (filter && filter->showCategories()) { |
3001 | mEventEditor->setCategories(filter->categoryList().join(",") ); | 3002 | mEventEditor->setCategories(filter->categoryList().join(",") ); |
3002 | } | 3003 | } |
3003 | if ( filter ) | 3004 | if ( filter ) |
3004 | mEventEditor->setSecrecy( filter->getSecrecy() ); | 3005 | mEventEditor->setSecrecy( filter->getSecrecy() ); |
3005 | } | 3006 | } |
3006 | mEventEditor->exec(); | 3007 | mEventEditor->exec(); |
3007 | setActiveWindow(); | 3008 | setActiveWindow(); |
3008 | } | 3009 | } |
3009 | void CalendarView::todoAdded(Todo * t) | 3010 | void CalendarView::todoAdded(Todo * t) |
3010 | { | 3011 | { |
3011 | 3012 | ||
3012 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); | 3013 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); |
3013 | updateTodoViews(); | 3014 | updateTodoViews(); |
3014 | } | 3015 | } |
3015 | void CalendarView::todoChanged(Todo * t) | 3016 | void CalendarView::todoChanged(Todo * t) |
3016 | { | 3017 | { |
3017 | emit todoModified( t, 4 ); | 3018 | emit todoModified( t, 4 ); |
3018 | // updateTodoViews(); | 3019 | // updateTodoViews(); |
3019 | } | 3020 | } |
3020 | void CalendarView::todoToBeDeleted(Todo *) | 3021 | void CalendarView::todoToBeDeleted(Todo *) |
3021 | { | 3022 | { |
3022 | //qDebug("todoToBeDeleted(Todo *) "); | 3023 | //qDebug("todoToBeDeleted(Todo *) "); |
3023 | updateTodoViews(); | 3024 | updateTodoViews(); |
3024 | } | 3025 | } |
3025 | void CalendarView::todoDeleted() | 3026 | void CalendarView::todoDeleted() |
3026 | { | 3027 | { |
3027 | //qDebug(" todoDeleted()"); | 3028 | //qDebug(" todoDeleted()"); |
3028 | updateTodoViews(); | 3029 | updateTodoViews(); |
3029 | } | 3030 | } |
3030 | 3031 | ||
3031 | 3032 | ||
3032 | void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) | 3033 | void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) |
3033 | { | 3034 | { |
3034 | showTodoEditor(); | 3035 | showTodoEditor(); |
3035 | mTodoEditor->newTodo(dt,0,allday); | 3036 | mTodoEditor->newTodo(dt,0,allday); |
3036 | if ( mFilterView->filtersEnabled() ) { | 3037 | if ( mFilterView->filtersEnabled() ) { |
3037 | CalFilter *filter = mFilterView->selectedFilter(); | 3038 | CalFilter *filter = mFilterView->selectedFilter(); |
3038 | if (filter && filter->showCategories()) { | 3039 | if (filter && filter->showCategories()) { |
3039 | mTodoEditor->setCategories(filter->categoryList().join(",") ); | 3040 | mTodoEditor->setCategories(filter->categoryList().join(",") ); |
3040 | } | 3041 | } |
3041 | if ( filter ) | 3042 | if ( filter ) |
3042 | mTodoEditor->setSecrecy( filter->getSecrecy() ); | 3043 | mTodoEditor->setSecrecy( filter->getSecrecy() ); |
3043 | } | 3044 | } |
3044 | mTodoEditor->exec(); | 3045 | mTodoEditor->exec(); |
3045 | setActiveWindow(); | 3046 | setActiveWindow(); |
3046 | } | 3047 | } |
3047 | 3048 | ||
3048 | void CalendarView::newTodo() | 3049 | void CalendarView::newTodo() |
3049 | { | 3050 | { |
3050 | newTodoDateTime( QDateTime(),true ); | 3051 | newTodoDateTime( QDateTime(),true ); |
3051 | } | 3052 | } |
3052 | 3053 | ||
3053 | void CalendarView::newSubTodo() | 3054 | void CalendarView::newSubTodo() |
3054 | { | 3055 | { |
3055 | Todo *todo = selectedTodo(); | 3056 | Todo *todo = selectedTodo(); |
3056 | if ( todo ) newSubTodo( todo ); | 3057 | if ( todo ) newSubTodo( todo ); |
3057 | } | 3058 | } |
3058 | 3059 | ||
3059 | void CalendarView::newSubTodo(Todo *parentEvent) | 3060 | void CalendarView::newSubTodo(Todo *parentEvent) |
3060 | { | 3061 | { |
3061 | 3062 | ||
3062 | showTodoEditor(); | 3063 | showTodoEditor(); |
3063 | mTodoEditor->newTodo(QDateTime(),parentEvent,true); | 3064 | mTodoEditor->newTodo(QDateTime(),parentEvent,true); |
3064 | mTodoEditor->exec(); | 3065 | mTodoEditor->exec(); |
3065 | setActiveWindow(); | 3066 | setActiveWindow(); |
3066 | } | 3067 | } |
3067 | 3068 | ||
3068 | void CalendarView::newFloatingEvent() | 3069 | void CalendarView::newFloatingEvent() |
3069 | { | 3070 | { |
3070 | DateList tmpList = mNavigator->selectedDates(); | 3071 | DateList tmpList = mNavigator->selectedDates(); |
3071 | QDate date = tmpList.first(); | 3072 | QDate date = tmpList.first(); |
3072 | 3073 | ||
3073 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), | 3074 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), |
3074 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); | 3075 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); |
3075 | } | 3076 | } |
3076 | 3077 | ||
3077 | 3078 | ||
3078 | void CalendarView::editEvent( Event *event ) | 3079 | void CalendarView::editEvent( Event *event ) |
3079 | { | 3080 | { |
3080 | 3081 | ||
3081 | if ( !event ) return; | 3082 | if ( !event ) return; |
3082 | if ( event->isReadOnly() ) { | 3083 | if ( event->isReadOnly() ) { |
3083 | showEvent( event ); | 3084 | showEvent( event ); |
3084 | return; | 3085 | return; |
3085 | } | 3086 | } |
3086 | showEventEditor(); | 3087 | showEventEditor(); |
3087 | mEventEditor->editEvent( event , mFlagEditDescription); | 3088 | mEventEditor->editEvent( event , mFlagEditDescription); |
3088 | mEventEditor->exec(); | 3089 | mEventEditor->exec(); |
3089 | setActiveWindow(); | 3090 | setActiveWindow(); |
3090 | 3091 | ||
3091 | } | 3092 | } |
3092 | void CalendarView::editJournal( Journal *jour ) | 3093 | void CalendarView::editJournal( Journal *jour ) |
3093 | { | 3094 | { |
3094 | if ( !jour ) return; | 3095 | if ( !jour ) return; |
3095 | mDialogManager->hideSearchDialog(); | 3096 | mDialogManager->hideSearchDialog(); |
3096 | mViewManager->showJournalView(); | 3097 | mViewManager->showJournalView(); |
3097 | mNavigator->slotDaySelect( jour->dtStart().date() ); | 3098 | mNavigator->slotDaySelect( jour->dtStart().date() ); |
3098 | } | 3099 | } |
3099 | void CalendarView::editTodo( Todo *todo ) | 3100 | void CalendarView::editTodo( Todo *todo ) |
3100 | { | 3101 | { |
3101 | if ( !todo ) return; | 3102 | if ( !todo ) return; |
3102 | 3103 | ||
3103 | if ( todo->isReadOnly() ) { | 3104 | if ( todo->isReadOnly() ) { |
3104 | showTodo( todo ); | 3105 | showTodo( todo ); |
3105 | return; | 3106 | return; |
3106 | } | 3107 | } |
3107 | showTodoEditor(); | 3108 | showTodoEditor(); |
3108 | mTodoEditor->editTodo( todo ,mFlagEditDescription); | 3109 | mTodoEditor->editTodo( todo ,mFlagEditDescription); |
3109 | mTodoEditor->exec(); | 3110 | mTodoEditor->exec(); |
3110 | setActiveWindow(); | 3111 | setActiveWindow(); |
3111 | 3112 | ||
3112 | } | 3113 | } |
3113 | 3114 | ||
3114 | KOEventViewerDialog* CalendarView::getEventViewerDialog() | 3115 | KOEventViewerDialog* CalendarView::getEventViewerDialog() |
3115 | { | 3116 | { |
3116 | if ( !mEventViewerDialog ) { | 3117 | if ( !mEventViewerDialog ) { |
3117 | mEventViewerDialog = new KOEventViewerDialog(0); | 3118 | mEventViewerDialog = new KOEventViewerDialog(0); |
3118 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); | 3119 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); |
3119 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); | 3120 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); |
3120 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), | 3121 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), |
3121 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 3122 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
3122 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), | 3123 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), |
3123 | viewManager(), SLOT( showAgendaView( bool ) ) ); | 3124 | viewManager(), SLOT( showAgendaView( bool ) ) ); |
3124 | connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), | 3125 | connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), |
3125 | this, SLOT( slotViewerClosed() ) ); | 3126 | this, SLOT( slotViewerClosed() ) ); |
3126 | connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), | 3127 | connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), |
3127 | this, SLOT( todoChanged(Todo *) ) ); | 3128 | this, SLOT( todoChanged(Todo *) ) ); |
3128 | mEventViewerDialog->resize( 640, 480 ); | 3129 | mEventViewerDialog->resize( 640, 480 ); |
3129 | 3130 | ||
3130 | } | 3131 | } |
3131 | return mEventViewerDialog; | 3132 | return mEventViewerDialog; |
3132 | } | 3133 | } |
3133 | void CalendarView::showEvent(Event *event) | 3134 | void CalendarView::showEvent(Event *event) |
3134 | { | 3135 | { |
3135 | getEventViewerDialog()->setEvent(event); | 3136 | getEventViewerDialog()->setEvent(event); |
3136 | getEventViewerDialog()->showMe(); | 3137 | getEventViewerDialog()->showMe(); |
3137 | } | 3138 | } |
3138 | 3139 | ||
3139 | void CalendarView::showTodo(Todo *event) | 3140 | void CalendarView::showTodo(Todo *event) |
3140 | { | 3141 | { |
3141 | getEventViewerDialog()->setTodo(event); | 3142 | getEventViewerDialog()->setTodo(event); |
3142 | getEventViewerDialog()->showMe(); | 3143 | getEventViewerDialog()->showMe(); |
3143 | } | 3144 | } |
3144 | void CalendarView::showJournal( Journal *jour ) | 3145 | void CalendarView::showJournal( Journal *jour ) |
3145 | { | 3146 | { |
3146 | getEventViewerDialog()->setJournal(jour); | 3147 | getEventViewerDialog()->setJournal(jour); |
3147 | getEventViewerDialog()->showMe(); | 3148 | getEventViewerDialog()->showMe(); |
3148 | 3149 | ||
3149 | } | 3150 | } |
3150 | // void CalendarView::todoModified (Todo *event, int changed) | 3151 | // void CalendarView::todoModified (Todo *event, int changed) |
3151 | // { | 3152 | // { |
3152 | // // if (mDialogList.find (event) != mDialogList.end ()) { | 3153 | // // if (mDialogList.find (event) != mDialogList.end ()) { |
3153 | // // kdDebug() << "Todo modified and open" << endl; | 3154 | // // kdDebug() << "Todo modified and open" << endl; |
3154 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; | 3155 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; |
3155 | // // temp->modified (changed); | 3156 | // // temp->modified (changed); |
3156 | 3157 | ||
3157 | // // } | 3158 | // // } |
3158 | 3159 | ||
3159 | // mViewManager->updateView(); | 3160 | // mViewManager->updateView(); |
3160 | // } | 3161 | // } |
3161 | 3162 | ||
3162 | void CalendarView::appointment_show() | 3163 | void CalendarView::appointment_show() |
3163 | { | 3164 | { |
3164 | Event *anEvent = 0; | 3165 | Event *anEvent = 0; |
3165 | 3166 | ||
3166 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 3167 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
3167 | 3168 | ||
3168 | if (mViewManager->currentView()->isEventView()) { | 3169 | if (mViewManager->currentView()->isEventView()) { |
3169 | if ( incidence && incidence->typeID() == eventID ) { | 3170 | if ( incidence && incidence->typeID() == eventID ) { |
3170 | anEvent = static_cast<Event *>(incidence); | 3171 | anEvent = static_cast<Event *>(incidence); |
3171 | } | 3172 | } |
3172 | } | 3173 | } |
3173 | 3174 | ||
3174 | if (!anEvent) { | 3175 | if (!anEvent) { |
3175 | KNotifyClient::beep(); | 3176 | KNotifyClient::beep(); |
3176 | return; | 3177 | return; |
3177 | } | 3178 | } |
3178 | 3179 | ||
3179 | showEvent(anEvent); | 3180 | showEvent(anEvent); |
3180 | } | 3181 | } |
3181 | 3182 | ||
3182 | void CalendarView::appointment_edit() | 3183 | void CalendarView::appointment_edit() |
3183 | { | 3184 | { |
3184 | Event *anEvent = 0; | 3185 | Event *anEvent = 0; |
3185 | 3186 | ||
3186 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 3187 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
3187 | 3188 | ||
3188 | if (mViewManager->currentView()->isEventView()) { | 3189 | if (mViewManager->currentView()->isEventView()) { |
3189 | if ( incidence && incidence->typeID() == eventID ) { | 3190 | if ( incidence && incidence->typeID() == eventID ) { |
3190 | anEvent = static_cast<Event *>(incidence); | 3191 | anEvent = static_cast<Event *>(incidence); |
3191 | } | 3192 | } |
3192 | } | 3193 | } |
3193 | 3194 | ||
3194 | if (!anEvent) { | 3195 | if (!anEvent) { |
3195 | KNotifyClient::beep(); | 3196 | KNotifyClient::beep(); |
3196 | return; | 3197 | return; |
3197 | } | 3198 | } |
3198 | 3199 | ||
3199 | editEvent(anEvent); | 3200 | editEvent(anEvent); |
3200 | } | 3201 | } |
3201 | 3202 | ||
3202 | void CalendarView::appointment_delete() | 3203 | void CalendarView::appointment_delete() |
3203 | { | 3204 | { |
3204 | Event *anEvent = 0; | 3205 | Event *anEvent = 0; |
3205 | 3206 | ||
3206 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 3207 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
3207 | 3208 | ||
3208 | if (mViewManager->currentView()->isEventView()) { | 3209 | if (mViewManager->currentView()->isEventView()) { |
3209 | if ( incidence && incidence->typeID() == eventID ) { | 3210 | if ( incidence && incidence->typeID() == eventID ) { |
3210 | anEvent = static_cast<Event *>(incidence); | 3211 | anEvent = static_cast<Event *>(incidence); |
3211 | } | 3212 | } |
3212 | } | 3213 | } |
3213 | 3214 | ||
3214 | if (!anEvent) { | 3215 | if (!anEvent) { |
3215 | KNotifyClient::beep(); | 3216 | KNotifyClient::beep(); |
3216 | return; | 3217 | return; |
3217 | } | 3218 | } |
3218 | 3219 | ||
3219 | deleteEvent(anEvent); | 3220 | deleteEvent(anEvent); |
3220 | } | 3221 | } |
3221 | 3222 | ||
3222 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) | 3223 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) |
3223 | { | 3224 | { |
3224 | if (!sub) return; | 3225 | if (!sub) return; |
3225 | if ( sub->relatedTo() == parent ) | 3226 | if ( sub->relatedTo() == parent ) |
3226 | return; | 3227 | return; |
3227 | sub->setRelatedTo(parent); | 3228 | sub->setRelatedTo(parent); |
3228 | sub->updated(); | 3229 | sub->updated(); |
3229 | setModified(true); | 3230 | setModified(true); |
3230 | updateView(); | 3231 | updateView(); |
3231 | } | 3232 | } |
3232 | void CalendarView::todo_unsub(Todo *anTodo ) | 3233 | void CalendarView::todo_unsub(Todo *anTodo ) |
3233 | { | 3234 | { |
3234 | todo_resub( 0, anTodo ); | 3235 | todo_resub( 0, anTodo ); |
3235 | } | 3236 | } |
3236 | 3237 | ||
3237 | void CalendarView::deleteTodo(Todo *todo) | 3238 | void CalendarView::deleteTodo(Todo *todo) |
3238 | { | 3239 | { |
3239 | if (!todo) { | 3240 | if (!todo) { |
3240 | KNotifyClient::beep(); | 3241 | KNotifyClient::beep(); |
3241 | return; | 3242 | return; |
3242 | } | 3243 | } |
3243 | if (KOPrefs::instance()->mConfirm) { | 3244 | if (KOPrefs::instance()->mConfirm) { |
3244 | QString text = todo->summary().left(20); | 3245 | QString text = todo->summary().left(20); |
3245 | if (!todo->relations().isEmpty()) { | 3246 | if (!todo->relations().isEmpty()) { |
3246 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); | 3247 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); |
3247 | 3248 | ||
3248 | } | 3249 | } |
3249 | switch (msgItemDelete(text)) { | 3250 | switch (msgItemDelete(text)) { |
3250 | case KMessageBox::Continue: // OK | 3251 | case KMessageBox::Continue: // OK |
3251 | bool deleteT = false; | 3252 | bool deleteT = false; |
3252 | if (!todo->relations().isEmpty()) { | 3253 | if (!todo->relations().isEmpty()) { |
3253 | deleteT = removeCompletedSubTodos( todo ); | 3254 | deleteT = removeCompletedSubTodos( todo ); |
3254 | } | 3255 | } |
3255 | // deleteT == true: todo already deleted in removeCompletedSubTodos | 3256 | // deleteT == true: todo already deleted in removeCompletedSubTodos |
3256 | if ( !deleteT ) { | 3257 | if ( !deleteT ) { |
3257 | checkExternalId( todo ); | 3258 | checkExternalId( todo ); |
3258 | calendar()->deleteTodo(todo); | 3259 | calendar()->deleteTodo(todo); |
3259 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 3260 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
3260 | updateView(); | 3261 | updateView(); |
3261 | } | 3262 | } |
3262 | break; | 3263 | break; |
3263 | } // switch | 3264 | } // switch |
3264 | } else { | 3265 | } else { |
3265 | checkExternalId( todo ); | 3266 | checkExternalId( todo ); |
3266 | mCalendar->deleteTodo(todo); | 3267 | mCalendar->deleteTodo(todo); |
3267 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 3268 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
3268 | updateView(); | 3269 | updateView(); |
3269 | } | 3270 | } |
3270 | 3271 | ||
3271 | emit updateSearchDialog(); | 3272 | emit updateSearchDialog(); |
3272 | } | 3273 | } |
3273 | void CalendarView::deleteJournal(Journal *jour) | 3274 | void CalendarView::deleteJournal(Journal *jour) |
3274 | { | 3275 | { |
3275 | if (!jour) { | 3276 | if (!jour) { |
3276 | KNotifyClient::beep(); | 3277 | KNotifyClient::beep(); |
3277 | return; | 3278 | return; |
3278 | } | 3279 | } |
3279 | if (KOPrefs::instance()->mConfirm) { | 3280 | if (KOPrefs::instance()->mConfirm) { |
3280 | switch (msgItemDelete( jour->description().left(20))) { | 3281 | switch (msgItemDelete( jour->description().left(20))) { |
3281 | case KMessageBox::Continue: // OK | 3282 | case KMessageBox::Continue: // OK |
3282 | calendar()->deleteJournal(jour); | 3283 | calendar()->deleteJournal(jour); |
3283 | updateView(); | 3284 | updateView(); |
3284 | break; | 3285 | break; |
3285 | } // switch | 3286 | } // switch |
3286 | } else { | 3287 | } else { |
3287 | calendar()->deleteJournal(jour);; | 3288 | calendar()->deleteJournal(jour);; |
3288 | updateView(); | 3289 | updateView(); |
3289 | } | 3290 | } |
3290 | emit updateSearchDialog(); | 3291 | emit updateSearchDialog(); |
3291 | } | 3292 | } |
3292 | 3293 | ||
3293 | void CalendarView::deleteEvent(Event *anEvent) | 3294 | void CalendarView::deleteEvent(Event *anEvent) |
3294 | { | 3295 | { |
3295 | if (!anEvent) { | 3296 | if (!anEvent) { |
3296 | KNotifyClient::beep(); | 3297 | KNotifyClient::beep(); |
3297 | return; | 3298 | return; |
3298 | } | 3299 | } |
3299 | 3300 | ||
3300 | if (anEvent->recurrence()->doesRecur()) { | 3301 | if (anEvent->recurrence()->doesRecur()) { |
3301 | QDate itemDate = mViewManager->currentSelectionDate(); | 3302 | QDate itemDate = mViewManager->currentSelectionDate(); |
3302 | int km; | 3303 | int km; |
3303 | if (!itemDate.isValid()) { | 3304 | if (!itemDate.isValid()) { |
3304 | //kdDebug() << "Date Not Valid" << endl; | 3305 | //kdDebug() << "Date Not Valid" << endl; |
3305 | if (KOPrefs::instance()->mConfirm) { | 3306 | if (KOPrefs::instance()->mConfirm) { |
3306 | km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + | 3307 | km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + |
3307 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), | 3308 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), |
3308 | i18n("KO/Pi Confirmation"),i18n("Delete All")); | 3309 | i18n("KO/Pi Confirmation"),i18n("Delete All")); |
3309 | if ( km == KMessageBox::Continue ) | 3310 | if ( km == KMessageBox::Continue ) |
3310 | km = KMessageBox::No; // No = all below | 3311 | km = KMessageBox::No; // No = all below |
3311 | } else | 3312 | } else |
3312 | km = KMessageBox::No; | 3313 | km = KMessageBox::No; |
3313 | } else { | 3314 | } else { |
3314 | km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) + | 3315 | km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) + |
3315 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ | 3316 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ |
3316 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), | 3317 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), |
3317 | i18n("KO/Pi Confirmation"),i18n("Current"), | 3318 | i18n("KO/Pi Confirmation"),i18n("Current"), |
3318 | i18n("All")); | 3319 | i18n("All")); |
3319 | } | 3320 | } |
3320 | switch(km) { | 3321 | switch(km) { |
3321 | 3322 | ||
3322 | case KMessageBox::No: // Continue // all | 3323 | case KMessageBox::No: // Continue // all |
3323 | //qDebug("KMessageBox::No "); | 3324 | //qDebug("KMessageBox::No "); |
3324 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 3325 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
3325 | schedule(Scheduler::Cancel,anEvent); | 3326 | schedule(Scheduler::Cancel,anEvent); |
3326 | 3327 | ||
3327 | checkExternalId( anEvent); | 3328 | checkExternalId( anEvent); |
3328 | mCalendar->deleteEvent(anEvent); | 3329 | mCalendar->deleteEvent(anEvent); |
3329 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); | 3330 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); |
3330 | break; | 3331 | break; |
3331 | 3332 | ||
3332 | // Disabled because it does not work | 3333 | // Disabled because it does not work |
3333 | //#if 0 | 3334 | //#if 0 |
3334 | case KMessageBox::Yes: // just this one | 3335 | case KMessageBox::Yes: // just this one |
3335 | //QDate qd = mNavigator->selectedDates().first(); | 3336 | //QDate qd = mNavigator->selectedDates().first(); |
3336 | //if (!qd.isValid()) { | 3337 | //if (!qd.isValid()) { |
3337 | // kdDebug() << "no date selected, or invalid date" << endl; | 3338 | // kdDebug() << "no date selected, or invalid date" << endl; |
3338 | // KNotifyClient::beep(); | 3339 | // KNotifyClient::beep(); |
3339 | // return; | 3340 | // return; |
3340 | //} | 3341 | //} |
3341 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); | 3342 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); |
3342 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { | 3343 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { |
3343 | anEvent->addExDate(itemDate); | 3344 | anEvent->addExDate(itemDate); |
3344 | int duration = anEvent->recurrence()->duration(); | 3345 | int duration = anEvent->recurrence()->duration(); |
3345 | if ( duration > 0 ) { | 3346 | if ( duration > 0 ) { |
3346 | anEvent->recurrence()->setDuration( duration - 1 ); | 3347 | anEvent->recurrence()->setDuration( duration - 1 ); |
3347 | } | 3348 | } |
3348 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); | 3349 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); |
3349 | } | 3350 | } |
3350 | break; | 3351 | break; |
3351 | //#endif | 3352 | //#endif |
3352 | } // switch | 3353 | } // switch |
3353 | } else { | 3354 | } else { |
3354 | if (KOPrefs::instance()->mConfirm) { | 3355 | if (KOPrefs::instance()->mConfirm) { |
3355 | switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + | 3356 | switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + |
3356 | i18n("\nAre you sure you want\nto delete this event?"), | 3357 | i18n("\nAre you sure you want\nto delete this event?"), |
3357 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { | 3358 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { |
3358 | case KMessageBox::Continue: // OK | 3359 | case KMessageBox::Continue: // OK |
3359 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 3360 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
3360 | schedule(Scheduler::Cancel,anEvent); | 3361 | schedule(Scheduler::Cancel,anEvent); |
3361 | checkExternalId( anEvent); | 3362 | checkExternalId( anEvent); |
3362 | mCalendar->deleteEvent(anEvent); | 3363 | mCalendar->deleteEvent(anEvent); |
3363 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 3364 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
3364 | break; | 3365 | break; |
3365 | } // switch | 3366 | } // switch |
3366 | } else { | 3367 | } else { |
3367 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 3368 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
3368 | schedule(Scheduler::Cancel,anEvent); | 3369 | schedule(Scheduler::Cancel,anEvent); |
3369 | checkExternalId( anEvent); | 3370 | checkExternalId( anEvent); |
3370 | mCalendar->deleteEvent(anEvent); | 3371 | mCalendar->deleteEvent(anEvent); |
3371 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 3372 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
3372 | } | 3373 | } |
3373 | } // if-else | 3374 | } // if-else |
3374 | emit updateSearchDialog(); | 3375 | emit updateSearchDialog(); |
3375 | } | 3376 | } |
3376 | 3377 | ||
3377 | bool CalendarView::deleteEvent(const QString &uid) | 3378 | bool CalendarView::deleteEvent(const QString &uid) |
3378 | { | 3379 | { |
3379 | Event *ev = mCalendar->event(uid); | 3380 | Event *ev = mCalendar->event(uid); |
3380 | if (ev) { | 3381 | if (ev) { |
3381 | deleteEvent(ev); | 3382 | deleteEvent(ev); |
3382 | return true; | 3383 | return true; |
3383 | } else { | 3384 | } else { |
3384 | return false; | 3385 | return false; |
3385 | } | 3386 | } |
3386 | } | 3387 | } |
3387 | 3388 | ||
3388 | /*****************************************************************************/ | 3389 | /*****************************************************************************/ |
3389 | 3390 | ||
3390 | void CalendarView::action_mail() | 3391 | void CalendarView::action_mail() |
3391 | { | 3392 | { |
3392 | #ifndef KORG_NOMAIL | 3393 | #ifndef KORG_NOMAIL |
3393 | KOMailClient mailClient; | 3394 | KOMailClient mailClient; |
3394 | 3395 | ||
3395 | Incidence *incidence = currentSelection(); | 3396 | Incidence *incidence = currentSelection(); |
3396 | 3397 | ||
3397 | if (!incidence) { | 3398 | if (!incidence) { |
3398 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 3399 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
3399 | return; | 3400 | return; |
3400 | } | 3401 | } |
3401 | if(incidence->attendeeCount() == 0 ) { | 3402 | if(incidence->attendeeCount() == 0 ) { |
3402 | KMessageBox::sorry(this, | 3403 | KMessageBox::sorry(this, |
3403 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 3404 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
3404 | return; | 3405 | return; |
3405 | } | 3406 | } |
3406 | 3407 | ||
3407 | CalendarLocal cal_tmp; | 3408 | CalendarLocal cal_tmp; |
3408 | Event *event = 0; | 3409 | Event *event = 0; |
3409 | Event *ev = 0; | 3410 | Event *ev = 0; |
3410 | if ( incidence && incidence->typeID() == eventID ) { | 3411 | if ( incidence && incidence->typeID() == eventID ) { |
3411 | event = static_cast<Event *>(incidence); | 3412 | event = static_cast<Event *>(incidence); |
3412 | ev = new Event(*event); | 3413 | ev = new Event(*event); |
3413 | cal_tmp.addEvent(ev); | 3414 | cal_tmp.addEvent(ev); |
3414 | } | 3415 | } |
3415 | ICalFormat mForm(); | 3416 | ICalFormat mForm(); |
3416 | QString attachment = mForm.toString( &cal_tmp ); | 3417 | QString attachment = mForm.toString( &cal_tmp ); |
3417 | if (ev) delete(ev); | 3418 | if (ev) delete(ev); |
3418 | 3419 | ||
3419 | mailClient.mailAttendees(currentSelection(), attachment); | 3420 | mailClient.mailAttendees(currentSelection(), attachment); |
3420 | 3421 | ||
3421 | #endif | 3422 | #endif |
3422 | 3423 | ||
3423 | #if 0 | 3424 | #if 0 |
3424 | Event *anEvent = 0; | 3425 | Event *anEvent = 0; |
3425 | if (mViewManager->currentView()->isEventView()) { | 3426 | if (mViewManager->currentView()->isEventView()) { |
3426 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); | 3427 | anEvent = dynamic_cast<Event *>((mViewManager->currentView()->selectedIncidences()).first()); |
3427 | } | 3428 | } |
3428 | 3429 | ||
3429 | if (!anEvent) { | 3430 | if (!anEvent) { |
3430 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); | 3431 | KMessageBox::sorry(this,i18n("Can't generate mail:\nNo event selected.")); |
3431 | return; | 3432 | return; |
3432 | } | 3433 | } |
3433 | if(anEvent->attendeeCount() == 0 ) { | 3434 | if(anEvent->attendeeCount() == 0 ) { |
3434 | KMessageBox::sorry(this, | 3435 | KMessageBox::sorry(this, |
3435 | i18n("Can't generate mail:\nNo attendees defined.\n")); | 3436 | i18n("Can't generate mail:\nNo attendees defined.\n")); |
3436 | return; | 3437 | return; |
3437 | } | 3438 | } |
3438 | 3439 | ||
3439 | mailobject.emailEvent(anEvent); | 3440 | mailobject.emailEvent(anEvent); |
3440 | #endif | 3441 | #endif |
3441 | } | 3442 | } |
3442 | 3443 | ||
3443 | 3444 | ||
3444 | void CalendarView::schedule_publish(Incidence *incidence) | 3445 | void CalendarView::schedule_publish(Incidence *incidence) |
3445 | { | 3446 | { |
3446 | Event *event = 0; | 3447 | Event *event = 0; |
3447 | Todo *todo = 0; | 3448 | Todo *todo = 0; |
3448 | 3449 | ||
3449 | if (incidence == 0) { | 3450 | if (incidence == 0) { |
3450 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 3451 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
3451 | if (incidence == 0) { | 3452 | if (incidence == 0) { |
3452 | incidence = mTodoList->selectedIncidences().first(); | 3453 | incidence = mTodoList->selectedIncidences().first(); |
3453 | } | 3454 | } |
3454 | } | 3455 | } |
3455 | if ( incidence && incidence->typeID() == eventID ) { | 3456 | if ( incidence && incidence->typeID() == eventID ) { |
3456 | event = static_cast<Event *>(incidence); | 3457 | event = static_cast<Event *>(incidence); |
3457 | } else { | 3458 | } else { |
3458 | if ( incidence && incidence->typeID() == todoID ) { | 3459 | if ( incidence && incidence->typeID() == todoID ) { |
3459 | todo = static_cast<Todo *>(incidence); | 3460 | todo = static_cast<Todo *>(incidence); |
3460 | } | 3461 | } |
3461 | } | 3462 | } |
3462 | 3463 | ||
3463 | if (!event && !todo) { | 3464 | if (!event && !todo) { |
3464 | KMessageBox::sorry(this,i18n("No event selected.")); | 3465 | KMessageBox::sorry(this,i18n("No event selected.")); |
3465 | return; | 3466 | return; |
3466 | } | 3467 | } |
3467 | 3468 | ||
3468 | PublishDialog *publishdlg = new PublishDialog(); | 3469 | PublishDialog *publishdlg = new PublishDialog(); |
3469 | if (incidence->attendeeCount()>0) { | 3470 | if (incidence->attendeeCount()>0) { |
3470 | QPtrList<Attendee> attendees = incidence->attendees(); | 3471 | QPtrList<Attendee> attendees = incidence->attendees(); |
3471 | attendees.first(); | 3472 | attendees.first(); |
3472 | while ( attendees.current()!=0 ) { | 3473 | while ( attendees.current()!=0 ) { |
3473 | publishdlg->addAttendee(attendees.current()); | 3474 | publishdlg->addAttendee(attendees.current()); |
3474 | attendees.next(); | 3475 | attendees.next(); |
3475 | } | 3476 | } |
3476 | } | 3477 | } |
3477 | bool send = true; | 3478 | bool send = true; |
3478 | if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { | 3479 | if ( KOPrefs::instance()->mMailClient == KOPrefs::MailClientSendmail ) { |
3479 | if ( publishdlg->exec() != QDialog::Accepted ) | 3480 | if ( publishdlg->exec() != QDialog::Accepted ) |
3480 | send = false; | 3481 | send = false; |
3481 | } | 3482 | } |
3482 | if ( send ) { | 3483 | if ( send ) { |
3483 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3484 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3484 | if ( event ) { | 3485 | if ( event ) { |
3485 | Event *ev = new Event(*event); | 3486 | Event *ev = new Event(*event); |
3486 | ev->registerObserver(0); | 3487 | ev->registerObserver(0); |
3487 | ev->clearAttendees(); | 3488 | ev->clearAttendees(); |
3488 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { | 3489 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { |
3489 | delete(ev); | 3490 | delete(ev); |
3490 | } | 3491 | } |
3491 | } else { | 3492 | } else { |
3492 | if ( todo ) { | 3493 | if ( todo ) { |
3493 | Todo *ev = new Todo(*todo); | 3494 | Todo *ev = new Todo(*todo); |
3494 | ev->registerObserver(0); | 3495 | ev->registerObserver(0); |
3495 | ev->clearAttendees(); | 3496 | ev->clearAttendees(); |
3496 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { | 3497 | if (!dlg->addMessage(ev,Scheduler::Publish,publishdlg->addresses())) { |
3497 | delete(ev); | 3498 | delete(ev); |
3498 | } | 3499 | } |
3499 | } | 3500 | } |
3500 | } | 3501 | } |
3501 | } | 3502 | } |
3502 | delete publishdlg; | 3503 | delete publishdlg; |
3503 | } | 3504 | } |
3504 | 3505 | ||
3505 | void CalendarView::schedule_request(Incidence *incidence) | 3506 | void CalendarView::schedule_request(Incidence *incidence) |
3506 | { | 3507 | { |
3507 | schedule(Scheduler::Request,incidence); | 3508 | schedule(Scheduler::Request,incidence); |
3508 | } | 3509 | } |
3509 | 3510 | ||
3510 | void CalendarView::schedule_refresh(Incidence *incidence) | 3511 | void CalendarView::schedule_refresh(Incidence *incidence) |
3511 | { | 3512 | { |
3512 | schedule(Scheduler::Refresh,incidence); | 3513 | schedule(Scheduler::Refresh,incidence); |
3513 | } | 3514 | } |
3514 | 3515 | ||
3515 | void CalendarView::schedule_cancel(Incidence *incidence) | 3516 | void CalendarView::schedule_cancel(Incidence *incidence) |
3516 | { | 3517 | { |
3517 | schedule(Scheduler::Cancel,incidence); | 3518 | schedule(Scheduler::Cancel,incidence); |
3518 | } | 3519 | } |
3519 | 3520 | ||
3520 | void CalendarView::schedule_add(Incidence *incidence) | 3521 | void CalendarView::schedule_add(Incidence *incidence) |
3521 | { | 3522 | { |
3522 | schedule(Scheduler::Add,incidence); | 3523 | schedule(Scheduler::Add,incidence); |
3523 | } | 3524 | } |
3524 | 3525 | ||
3525 | void CalendarView::schedule_reply(Incidence *incidence) | 3526 | void CalendarView::schedule_reply(Incidence *incidence) |
3526 | { | 3527 | { |
3527 | schedule(Scheduler::Reply,incidence); | 3528 | schedule(Scheduler::Reply,incidence); |
3528 | } | 3529 | } |
3529 | 3530 | ||
3530 | void CalendarView::schedule_counter(Incidence *incidence) | 3531 | void CalendarView::schedule_counter(Incidence *incidence) |
3531 | { | 3532 | { |
3532 | schedule(Scheduler::Counter,incidence); | 3533 | schedule(Scheduler::Counter,incidence); |
3533 | } | 3534 | } |
3534 | 3535 | ||
3535 | void CalendarView::schedule_declinecounter(Incidence *incidence) | 3536 | void CalendarView::schedule_declinecounter(Incidence *incidence) |
3536 | { | 3537 | { |
3537 | schedule(Scheduler::Declinecounter,incidence); | 3538 | schedule(Scheduler::Declinecounter,incidence); |
3538 | } | 3539 | } |
3539 | 3540 | ||
3540 | void CalendarView::schedule_publish_freebusy(int daysToPublish) | 3541 | void CalendarView::schedule_publish_freebusy(int daysToPublish) |
3541 | { | 3542 | { |
3542 | QDateTime start = QDateTime::currentDateTime(); | 3543 | QDateTime start = QDateTime::currentDateTime(); |
3543 | QDateTime end = start.addDays(daysToPublish); | 3544 | QDateTime end = start.addDays(daysToPublish); |
3544 | 3545 | ||
3545 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); | 3546 | FreeBusy *freebusy = new FreeBusy(mCalendar, start, end); |
3546 | freebusy->setOrganizer(KOPrefs::instance()->email()); | 3547 | freebusy->setOrganizer(KOPrefs::instance()->email()); |
3547 | 3548 | ||
3548 | 3549 | ||
3549 | PublishDialog *publishdlg = new PublishDialog(); | 3550 | PublishDialog *publishdlg = new PublishDialog(); |
3550 | if ( publishdlg->exec() == QDialog::Accepted ) { | 3551 | if ( publishdlg->exec() == QDialog::Accepted ) { |
3551 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3552 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3552 | if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { | 3553 | if (!dlg->addMessage(freebusy,Scheduler::Publish,publishdlg->addresses())) { |
3553 | delete(freebusy); | 3554 | delete(freebusy); |
3554 | } | 3555 | } |
3555 | } | 3556 | } |
3556 | delete publishdlg; | 3557 | delete publishdlg; |
3557 | } | 3558 | } |
3558 | 3559 | ||
3559 | void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) | 3560 | void CalendarView::schedule(Scheduler::Method method, Incidence *incidence) |
3560 | { | 3561 | { |
3561 | Event *event = 0; | 3562 | Event *event = 0; |
3562 | Todo *todo = 0; | 3563 | Todo *todo = 0; |
3563 | 3564 | ||
3564 | if (incidence == 0) { | 3565 | if (incidence == 0) { |
3565 | incidence = mViewManager->currentView()->selectedIncidences().first(); | 3566 | incidence = mViewManager->currentView()->selectedIncidences().first(); |
3566 | if (incidence == 0) { | 3567 | if (incidence == 0) { |
3567 | incidence = mTodoList->selectedIncidences().first(); | 3568 | incidence = mTodoList->selectedIncidences().first(); |
3568 | } | 3569 | } |
3569 | } | 3570 | } |
3570 | if ( incidence && incidence->typeID() == eventID ) { | 3571 | if ( incidence && incidence->typeID() == eventID ) { |
3571 | event = static_cast<Event *>(incidence); | 3572 | event = static_cast<Event *>(incidence); |
3572 | } | 3573 | } |
3573 | if ( incidence && incidence->typeID() == todoID ) { | 3574 | if ( incidence && incidence->typeID() == todoID ) { |
3574 | todo = static_cast<Todo *>(incidence); | 3575 | todo = static_cast<Todo *>(incidence); |
3575 | } | 3576 | } |
3576 | 3577 | ||
3577 | if (!event && !todo) { | 3578 | if (!event && !todo) { |
3578 | KMessageBox::sorry(this,i18n("No event selected.")); | 3579 | KMessageBox::sorry(this,i18n("No event selected.")); |
3579 | return; | 3580 | return; |
3580 | } | 3581 | } |
3581 | 3582 | ||
3582 | if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { | 3583 | if( incidence->attendeeCount() == 0 && method != Scheduler::Publish ) { |
3583 | KMessageBox::sorry(this,i18n("The event has no attendees.")); | 3584 | KMessageBox::sorry(this,i18n("The event has no attendees.")); |
3584 | return; | 3585 | return; |
3585 | } | 3586 | } |
3586 | 3587 | ||
3587 | Event *ev = 0; | 3588 | Event *ev = 0; |
3588 | if (event) ev = new Event(*event); | 3589 | if (event) ev = new Event(*event); |
3589 | Todo *to = 0; | 3590 | Todo *to = 0; |
3590 | if (todo) to = new Todo(*todo); | 3591 | if (todo) to = new Todo(*todo); |
3591 | 3592 | ||
3592 | if (method == Scheduler::Reply || method == Scheduler::Refresh) { | 3593 | if (method == Scheduler::Reply || method == Scheduler::Refresh) { |
3593 | Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 3594 | Attendee *me = incidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
3594 | if (!me) { | 3595 | if (!me) { |
3595 | KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); | 3596 | KMessageBox::sorry(this,i18n("Could not find your attendee entry.\nPlease check the emails.")); |
3596 | return; | 3597 | return; |
3597 | } | 3598 | } |
3598 | if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { | 3599 | if (me->status()==Attendee::NeedsAction && me->RSVP() && method==Scheduler::Reply) { |
3599 | StatusDialog *statdlg = new StatusDialog(this); | 3600 | StatusDialog *statdlg = new StatusDialog(this); |
3600 | if (!statdlg->exec()==QDialog::Accepted) return; | 3601 | if (!statdlg->exec()==QDialog::Accepted) return; |
3601 | me->setStatus( statdlg->status() ); | 3602 | me->setStatus( statdlg->status() ); |
3602 | delete(statdlg); | 3603 | delete(statdlg); |
3603 | } | 3604 | } |
3604 | Attendee *menew = new Attendee(*me); | 3605 | Attendee *menew = new Attendee(*me); |
3605 | if (ev) { | 3606 | if (ev) { |
3606 | ev->clearAttendees(); | 3607 | ev->clearAttendees(); |
3607 | ev->addAttendee(menew,false); | 3608 | ev->addAttendee(menew,false); |
3608 | } else { | 3609 | } else { |
3609 | if (to) { | 3610 | if (to) { |
3610 | todo->clearAttendees(); | 3611 | todo->clearAttendees(); |
3611 | todo->addAttendee(menew,false); | 3612 | todo->addAttendee(menew,false); |
3612 | } | 3613 | } |
3613 | } | 3614 | } |
3614 | } | 3615 | } |
3615 | 3616 | ||
3616 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); | 3617 | OutgoingDialog *dlg = mDialogManager->outgoingDialog(); |
3617 | if (ev) { | 3618 | if (ev) { |
3618 | if ( !dlg->addMessage(ev,method) ) delete(ev); | 3619 | if ( !dlg->addMessage(ev,method) ) delete(ev); |
3619 | } else { | 3620 | } else { |
3620 | if (to) { | 3621 | if (to) { |
3621 | if ( !dlg->addMessage(to,method) ) delete(to); | 3622 | if ( !dlg->addMessage(to,method) ) delete(to); |
3622 | } | 3623 | } |
3623 | } | 3624 | } |
3624 | } | 3625 | } |
3625 | 3626 | ||
3626 | void CalendarView::openAddressbook() | 3627 | void CalendarView::openAddressbook() |
3627 | { | 3628 | { |
3628 | KRun::runCommand("kaddressbook"); | 3629 | KRun::runCommand("kaddressbook"); |
3629 | } | 3630 | } |
3630 | 3631 | ||
3631 | void CalendarView::setModified(bool modified) | 3632 | void CalendarView::setModified(bool modified) |
3632 | { | 3633 | { |
3633 | if ( modified ) | 3634 | if ( modified ) |
3634 | emit signalmodified(); | 3635 | emit signalmodified(); |
3635 | if (mModified != modified) { | 3636 | if (mModified != modified) { |
3636 | mModified = modified; | 3637 | mModified = modified; |
3637 | emit modifiedChanged(mModified); | 3638 | emit modifiedChanged(mModified); |
3638 | } | 3639 | } |
3639 | } | 3640 | } |
3640 | 3641 | ||
3641 | bool CalendarView::isReadOnly() | 3642 | bool CalendarView::isReadOnly() |
3642 | { | 3643 | { |
3643 | return mReadOnly; | 3644 | return mReadOnly; |
3644 | } | 3645 | } |
3645 | 3646 | ||
3646 | void CalendarView::setReadOnly(bool readOnly) | 3647 | void CalendarView::setReadOnly(bool readOnly) |
3647 | { | 3648 | { |
3648 | if (mReadOnly != readOnly) { | 3649 | if (mReadOnly != readOnly) { |
3649 | mReadOnly = readOnly; | 3650 | mReadOnly = readOnly; |
3650 | emit readOnlyChanged(mReadOnly); | 3651 | emit readOnlyChanged(mReadOnly); |
3651 | } | 3652 | } |
3652 | } | 3653 | } |
3653 | 3654 | ||
3654 | bool CalendarView::isModified() | 3655 | bool CalendarView::isModified() |
3655 | { | 3656 | { |
3656 | return mModified; | 3657 | return mModified; |
3657 | } | 3658 | } |
3658 | void CalendarView::slotprintSelInc() | 3659 | void CalendarView::slotprintSelInc() |
3659 | { | 3660 | { |
3660 | if ( currentSelection() == 0 ) { | 3661 | if ( currentSelection() == 0 ) { |
3661 | KMessageBox::sorry(this,i18n("There is nothing selected!")); | 3662 | KMessageBox::sorry(this,i18n("There is nothing selected!")); |
3662 | return; | 3663 | return; |
3663 | } | 3664 | } |
3664 | showIncidence(); | 3665 | showIncidence(); |
3665 | getEventViewerDialog()->print(); | 3666 | getEventViewerDialog()->print(); |
3666 | 3667 | ||
3667 | } | 3668 | } |
3668 | void CalendarView::printSetup() | 3669 | void CalendarView::printSetup() |
3669 | { | 3670 | { |
3670 | #ifndef KORG_NOPRINTER | 3671 | #ifndef KORG_NOPRINTER |
3671 | createPrinter(); | 3672 | createPrinter(); |
3672 | 3673 | ||
3673 | mCalPrinter->setupPrinter(); | 3674 | mCalPrinter->setupPrinter(); |
3674 | #endif | 3675 | #endif |
3675 | } | 3676 | } |
3676 | 3677 | ||
3677 | void CalendarView::print() | 3678 | void CalendarView::print() |
3678 | { | 3679 | { |
3679 | #ifndef KORG_NOPRINTER | 3680 | #ifndef KORG_NOPRINTER |
3680 | createPrinter(); | 3681 | createPrinter(); |
3681 | 3682 | ||
3682 | DateList tmpDateList = mNavigator->selectedDates(); | 3683 | DateList tmpDateList = mNavigator->selectedDates(); |
3683 | mCalPrinter->print(CalPrinter::Month, | 3684 | mCalPrinter->print(CalPrinter::Month, |
3684 | tmpDateList.first(), tmpDateList.last()); | 3685 | tmpDateList.first(), tmpDateList.last()); |
3685 | #endif | 3686 | #endif |
3686 | } | 3687 | } |
3687 | 3688 | ||
3688 | void CalendarView::printPreview() | 3689 | void CalendarView::printPreview() |
3689 | { | 3690 | { |
3690 | #ifndef KORG_NOPRINTER | 3691 | #ifndef KORG_NOPRINTER |
3691 | kdDebug() << "CalendarView::printPreview()" << endl; | 3692 | kdDebug() << "CalendarView::printPreview()" << endl; |
3692 | 3693 | ||
3693 | createPrinter(); | 3694 | createPrinter(); |
3694 | 3695 | ||
3695 | DateList tmpDateList = mNavigator->selectedDates(); | 3696 | DateList tmpDateList = mNavigator->selectedDates(); |
3696 | 3697 | ||
3697 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), | 3698 | mViewManager->currentView()->printPreview(mCalPrinter,tmpDateList.first(), |
3698 | tmpDateList.last()); | 3699 | tmpDateList.last()); |
3699 | #endif | 3700 | #endif |
3700 | } | 3701 | } |
3701 | 3702 | ||
3702 | void CalendarView::exportICalendar() | 3703 | void CalendarView::exportICalendar() |
3703 | { | 3704 | { |
3704 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); | 3705 | QString filename = KFileDialog::getSaveFileName("icalout.ics",i18n("*.ics|ICalendars"),this); |
3705 | 3706 | ||
3706 | // Force correct extension | 3707 | // Force correct extension |
3707 | if (filename.right(4) != ".ics") filename += ".ics"; | 3708 | if (filename.right(4) != ".ics") filename += ".ics"; |
3708 | 3709 | ||
3709 | FileStorage storage( mCalendar, filename, new ICalFormat() ); | 3710 | FileStorage storage( mCalendar, filename, new ICalFormat() ); |
3710 | storage.save(); | 3711 | storage.save(); |
3711 | } | 3712 | } |
3712 | 3713 | ||
3713 | bool CalendarView::exportVCalendar( QString filename ) | 3714 | bool CalendarView::exportVCalendar( QString filename ) |
3714 | { | 3715 | { |
3715 | if (mCalendar->journals().count() > 0) { | 3716 | if (mCalendar->journals().count() > 0) { |
3716 | int result = KMessageBox::warningContinueCancel(this, | 3717 | int result = KMessageBox::warningContinueCancel(this, |
3717 | i18n("The journal entries can not be\nexported to a vCalendar file."), | 3718 | i18n("The journal entries can not be\nexported to a vCalendar file."), |
3718 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), | 3719 | i18n("Data Loss Warning"),i18n("Proceed"),i18n("Cancel"), |
3719 | true); | 3720 | true); |
3720 | if (result != KMessageBox::Continue) return false; | 3721 | if (result != KMessageBox::Continue) return false; |
3721 | } | 3722 | } |
3722 | 3723 | ||
3723 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); | 3724 | //QString filename = KFileDialog::getSaveFileName("vcalout.vcs",i18n("*.vcs|VCalendars"),this); |
3724 | 3725 | ||
3725 | // Force correct extension | 3726 | // Force correct extension |
3726 | if (filename.right(4) != ".vcs") filename += ".vcs"; | 3727 | if (filename.right(4) != ".vcs") filename += ".vcs"; |
3727 | 3728 | ||
3728 | FileStorage storage( mCalendar, filename, new VCalFormat ); | 3729 | FileStorage storage( mCalendar, filename, new VCalFormat ); |
3729 | return storage.save(); | 3730 | return storage.save(); |
3730 | 3731 | ||
3731 | } | 3732 | } |
3732 | 3733 | ||
3733 | void CalendarView::eventUpdated(Incidence *) | 3734 | void CalendarView::eventUpdated(Incidence *) |
3734 | { | 3735 | { |
3735 | setModified(); | 3736 | setModified(); |
3736 | // Don't call updateView here. The code, which has caused the update of the | 3737 | // Don't call updateView here. The code, which has caused the update of the |
3737 | // event is responsible for updating the view. | 3738 | // event is responsible for updating the view. |
3738 | // updateView(); | 3739 | // updateView(); |
3739 | } | 3740 | } |
3740 | 3741 | ||
3741 | void CalendarView::adaptNavigationUnits() | 3742 | void CalendarView::adaptNavigationUnits() |
3742 | { | 3743 | { |
3743 | if (mViewManager->currentView()->isEventView()) { | 3744 | if (mViewManager->currentView()->isEventView()) { |
3744 | int days = mViewManager->currentView()->currentDateCount(); | 3745 | int days = mViewManager->currentView()->currentDateCount(); |
3745 | if (days == 1) { | 3746 | if (days == 1) { |
3746 | emit changeNavStringPrev(i18n("&Previous Day")); | 3747 | emit changeNavStringPrev(i18n("&Previous Day")); |
3747 | emit changeNavStringNext(i18n("&Next Day")); | 3748 | emit changeNavStringNext(i18n("&Next Day")); |
3748 | } else { | 3749 | } else { |
3749 | emit changeNavStringPrev(i18n("&Previous Week")); | 3750 | emit changeNavStringPrev(i18n("&Previous Week")); |
3750 | emit changeNavStringNext(i18n("&Next Week")); | 3751 | emit changeNavStringNext(i18n("&Next Week")); |
3751 | } | 3752 | } |
3752 | } | 3753 | } |
3753 | } | 3754 | } |
3754 | 3755 | ||
3755 | void CalendarView::processMainViewSelection( Incidence *incidence ) | 3756 | void CalendarView::processMainViewSelection( Incidence *incidence ) |
3756 | { | 3757 | { |
3757 | if ( incidence ) mTodoList->clearSelection(); | 3758 | if ( incidence ) mTodoList->clearSelection(); |
3758 | processIncidenceSelection( incidence ); | 3759 | processIncidenceSelection( incidence ); |
3759 | } | 3760 | } |
3760 | 3761 | ||
3761 | void CalendarView::processTodoListSelection( Incidence *incidence ) | 3762 | void CalendarView::processTodoListSelection( Incidence *incidence ) |
3762 | { | 3763 | { |
3763 | if ( incidence && mViewManager->currentView() ) { | 3764 | if ( incidence && mViewManager->currentView() ) { |
3764 | mViewManager->currentView()->clearSelection(); | 3765 | mViewManager->currentView()->clearSelection(); |
3765 | } | 3766 | } |
3766 | processIncidenceSelection( incidence ); | 3767 | processIncidenceSelection( incidence ); |
3767 | } | 3768 | } |
3768 | 3769 | ||
3769 | void CalendarView::processIncidenceSelection( Incidence *incidence ) | 3770 | void CalendarView::processIncidenceSelection( Incidence *incidence ) |
3770 | { | 3771 | { |
3771 | if ( incidence == mSelectedIncidence ) return; | 3772 | if ( incidence == mSelectedIncidence ) return; |
3772 | 3773 | ||
3773 | mSelectedIncidence = incidence; | 3774 | mSelectedIncidence = incidence; |
3774 | 3775 | ||
3775 | emit incidenceSelected( mSelectedIncidence ); | 3776 | emit incidenceSelected( mSelectedIncidence ); |
3776 | 3777 | ||
3777 | if ( incidence && incidence->typeID() == eventID ) { | 3778 | if ( incidence && incidence->typeID() == eventID ) { |
3778 | Event *event = static_cast<Event *>( incidence ); | 3779 | Event *event = static_cast<Event *>( incidence ); |
3779 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 3780 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
3780 | emit organizerEventsSelected( true ); | 3781 | emit organizerEventsSelected( true ); |
3781 | } else { | 3782 | } else { |
3782 | emit organizerEventsSelected(false); | 3783 | emit organizerEventsSelected(false); |
3783 | } | 3784 | } |
3784 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 3785 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
3785 | KOPrefs::instance()->email() ) ) { | 3786 | KOPrefs::instance()->email() ) ) { |
3786 | emit groupEventsSelected( true ); | 3787 | emit groupEventsSelected( true ); |
3787 | } else { | 3788 | } else { |
3788 | emit groupEventsSelected(false); | 3789 | emit groupEventsSelected(false); |
3789 | } | 3790 | } |
3790 | return; | 3791 | return; |
3791 | } else { | 3792 | } else { |
3792 | if ( incidence && incidence->typeID() == todoID ) { | 3793 | if ( incidence && incidence->typeID() == todoID ) { |
3793 | emit todoSelected( true ); | 3794 | emit todoSelected( true ); |
3794 | Todo *event = static_cast<Todo *>( incidence ); | 3795 | Todo *event = static_cast<Todo *>( incidence ); |
3795 | if ( event->organizer() == KOPrefs::instance()->email() ) { | 3796 | if ( event->organizer() == KOPrefs::instance()->email() ) { |
3796 | emit organizerEventsSelected( true ); | 3797 | emit organizerEventsSelected( true ); |
3797 | } else { | 3798 | } else { |
3798 | emit organizerEventsSelected(false); | 3799 | emit organizerEventsSelected(false); |
3799 | } | 3800 | } |
3800 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, | 3801 | if (event->attendeeByMails( KOPrefs::instance()->mAdditionalMails, |
3801 | KOPrefs::instance()->email() ) ) { | 3802 | KOPrefs::instance()->email() ) ) { |
3802 | emit groupEventsSelected( true ); | 3803 | emit groupEventsSelected( true ); |
3803 | } else { | 3804 | } else { |
3804 | emit groupEventsSelected(false); | 3805 | emit groupEventsSelected(false); |
3805 | } | 3806 | } |
3806 | return; | 3807 | return; |
3807 | } else { | 3808 | } else { |
3808 | emit todoSelected( false ); | 3809 | emit todoSelected( false ); |
3809 | emit organizerEventsSelected(false); | 3810 | emit organizerEventsSelected(false); |
3810 | emit groupEventsSelected(false); | 3811 | emit groupEventsSelected(false); |
3811 | } | 3812 | } |
3812 | return; | 3813 | return; |
3813 | } | 3814 | } |
3814 | 3815 | ||
3815 | /* if ( incidence && incidence->typeID() == todoID ) { | 3816 | /* if ( incidence && incidence->typeID() == todoID ) { |
3816 | emit todoSelected( true ); | 3817 | emit todoSelected( true ); |
3817 | } else { | 3818 | } else { |
3818 | emit todoSelected( false ); | 3819 | emit todoSelected( false ); |
3819 | }*/ | 3820 | }*/ |
3820 | } | 3821 | } |
3821 | 3822 | ||
3822 | 3823 | ||
3823 | void CalendarView::checkClipboard() | 3824 | void CalendarView::checkClipboard() |
3824 | { | 3825 | { |
3825 | #ifndef KORG_NODND | 3826 | #ifndef KORG_NODND |
3826 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { | 3827 | if (ICalDrag::canDecode(QApplication::clipboard()->data())) { |
3827 | emit pasteEnabled(true); | 3828 | emit pasteEnabled(true); |
3828 | } else { | 3829 | } else { |
3829 | emit pasteEnabled(false); | 3830 | emit pasteEnabled(false); |
3830 | } | 3831 | } |
3831 | #endif | 3832 | #endif |
3832 | } | 3833 | } |
3833 | 3834 | ||
3834 | void CalendarView::showDates(const DateList &selectedDates) | 3835 | void CalendarView::showDates(const DateList &selectedDates) |
3835 | { | 3836 | { |
3836 | // kdDebug() << "CalendarView::selectDates()" << endl; | 3837 | // kdDebug() << "CalendarView::selectDates()" << endl; |
3837 | 3838 | ||
3838 | 3839 | ||
3839 | if ( !mBlockShowDates ) { | 3840 | if ( !mBlockShowDates ) { |
3840 | if ( mViewManager->currentView() ) { | 3841 | if ( mViewManager->currentView() ) { |
3841 | updateView( selectedDates.first(), selectedDates.last() ); | 3842 | updateView( selectedDates.first(), selectedDates.last() ); |
3842 | } else { | 3843 | } else { |
3843 | mViewManager->showAgendaView(); | 3844 | mViewManager->showAgendaView(); |
3844 | } | 3845 | } |
3845 | } | 3846 | } |
3846 | 3847 | ||
3847 | QDate date = selectedDates.first(); | 3848 | QDate date = selectedDates.first(); |
3848 | if ( ! date.isValid() ) { | 3849 | if ( ! date.isValid() ) { |
3849 | topLevelWidget()->setCaption(""); | 3850 | topLevelWidget()->setCaption(""); |
3850 | return; | 3851 | return; |
3851 | } | 3852 | } |
3852 | 3853 | ||
3853 | QString selDates; | 3854 | QString selDates; |
3854 | selDates = KGlobal::locale()->formatDate( date, true); | 3855 | selDates = KGlobal::locale()->formatDate( date, true); |
3855 | if (selectedDates.first() < selectedDates.last() ) | 3856 | if (selectedDates.first() < selectedDates.last() ) |
3856 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); | 3857 | selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); |
3857 | else { | 3858 | else { |
3858 | QString addString; | 3859 | QString addString; |
3859 | if ( date == QDateTime::currentDateTime().date() ) | 3860 | if ( date == QDateTime::currentDateTime().date() ) |
3860 | addString = i18n("Today"); | 3861 | addString = i18n("Today"); |
3861 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) | 3862 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
3862 | addString = i18n("Tomorrow"); | 3863 | addString = i18n("Tomorrow"); |
3863 | else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) | 3864 | else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) |
3864 | addString = i18n("Yesterday"); | 3865 | addString = i18n("Yesterday"); |
3865 | else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) | 3866 | else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) |
3866 | addString = i18n("Day before yesterday"); | 3867 | addString = i18n("Day before yesterday"); |
3867 | else if ( date == QDateTime::currentDateTime().date().addDays(2) ) | 3868 | else if ( date == QDateTime::currentDateTime().date().addDays(2) ) |
3868 | addString = i18n("Day after tomorrow"); | 3869 | addString = i18n("Day after tomorrow"); |
3869 | if ( !addString.isEmpty() ) { | 3870 | if ( !addString.isEmpty() ) { |
3870 | topLevelWidget()->setCaption( addString+", " + selDates ); | 3871 | topLevelWidget()->setCaption( addString+", " + selDates ); |
3871 | return; | 3872 | return; |
3872 | } | 3873 | } |
3873 | } | 3874 | } |
3874 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); | 3875 | topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); |
3875 | 3876 | ||
3876 | } | 3877 | } |
3877 | 3878 | ||
3878 | QPtrList<CalFilter> CalendarView::filters() | 3879 | QPtrList<CalFilter> CalendarView::filters() |
3879 | { | 3880 | { |
3880 | return mFilters; | 3881 | return mFilters; |
3881 | 3882 | ||
3882 | } | 3883 | } |
3883 | void CalendarView::editFilters() | 3884 | void CalendarView::editFilters() |
3884 | { | 3885 | { |
3885 | // kdDebug() << "CalendarView::editFilters()" << endl; | 3886 | // kdDebug() << "CalendarView::editFilters()" << endl; |
3886 | 3887 | ||
3887 | CalFilter *filter = mFilters.first(); | 3888 | CalFilter *filter = mFilters.first(); |
3888 | while(filter) { | 3889 | while(filter) { |
3889 | kdDebug() << " Filter: " << filter->name() << endl; | 3890 | kdDebug() << " Filter: " << filter->name() << endl; |
3890 | filter = mFilters.next(); | 3891 | filter = mFilters.next(); |
3891 | } | 3892 | } |
3892 | 3893 | ||
3893 | mDialogManager->showFilterEditDialog(&mFilters); | 3894 | mDialogManager->showFilterEditDialog(&mFilters); |
3894 | } | 3895 | } |
3895 | void CalendarView::toggleFilter() | 3896 | void CalendarView::toggleFilter() |
3896 | { | 3897 | { |
3897 | showFilter(! mFilterView->isVisible()); | 3898 | showFilter(! mFilterView->isVisible()); |
3898 | } | 3899 | } |
3899 | 3900 | ||
3900 | KOFilterView *CalendarView::filterView() | 3901 | KOFilterView *CalendarView::filterView() |
3901 | { | 3902 | { |
3902 | return mFilterView; | 3903 | return mFilterView; |
3903 | } | 3904 | } |
3904 | void CalendarView::selectFilter( int fil ) | 3905 | void CalendarView::selectFilter( int fil ) |
3905 | { | 3906 | { |
3906 | mFilterView->setSelectedFilter( fil ); | 3907 | mFilterView->setSelectedFilter( fil ); |
3907 | } | 3908 | } |
3908 | void CalendarView::showFilter(bool visible) | 3909 | void CalendarView::showFilter(bool visible) |
3909 | { | 3910 | { |
3910 | if (visible) mFilterView->show(); | 3911 | if (visible) mFilterView->show(); |
3911 | else mFilterView->hide(); | 3912 | else mFilterView->hide(); |
3912 | } | 3913 | } |
3913 | void CalendarView::toggleFilerEnabled( ) | 3914 | void CalendarView::toggleFilerEnabled( ) |
3914 | { | 3915 | { |
3915 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); | 3916 | mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); |
3916 | if ( !mFilterView->filtersEnabled() ) | 3917 | if ( !mFilterView->filtersEnabled() ) |
3917 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); | 3918 | topLevelWidget()->setCaption( i18n("Filter disabled ") ); |
3918 | 3919 | ||
3919 | } | 3920 | } |
3920 | void CalendarView::updateFilter() | 3921 | void CalendarView::updateFilter() |
3921 | { | 3922 | { |
3922 | CalFilter *filter = mFilterView->selectedFilter(); | 3923 | CalFilter *filter = mFilterView->selectedFilter(); |
3923 | if (filter) { | 3924 | if (filter) { |
3924 | QString mess; | 3925 | QString mess; |
3925 | if (mFilterView->filtersEnabled()) { | 3926 | if (mFilterView->filtersEnabled()) { |
3926 | mess = i18n("Filter selected: ")+filter->name(); | 3927 | mess = i18n("Filter selected: ")+filter->name(); |
3927 | filter->setEnabled(true); | 3928 | filter->setEnabled(true); |
3928 | } | 3929 | } |
3929 | else filter->setEnabled(false); | 3930 | else filter->setEnabled(false); |
3930 | mCalendar->setFilter(filter); | 3931 | mCalendar->setFilter(filter); |
3931 | updateView(); | 3932 | updateView(); |
3932 | if ( !mess.isEmpty() ) | 3933 | if ( !mess.isEmpty() ) |
3933 | topLevelWidget()->setCaption( mess ); | 3934 | topLevelWidget()->setCaption( mess ); |
3934 | 3935 | ||
3935 | } | 3936 | } |
3936 | } | 3937 | } |
3937 | 3938 | ||
3938 | void CalendarView::filterEdited() | 3939 | void CalendarView::filterEdited() |
3939 | { | 3940 | { |
3940 | mFilterView->updateFilters(); | 3941 | mFilterView->updateFilters(); |
3941 | updateFilter(); | 3942 | updateFilter(); |
3942 | writeSettings(); | 3943 | writeSettings(); |
3943 | } | 3944 | } |
3944 | 3945 | ||
3945 | 3946 | ||
3946 | void CalendarView::takeOverEvent() | 3947 | void CalendarView::takeOverEvent() |
3947 | { | 3948 | { |
3948 | Incidence *incidence = currentSelection(); | 3949 | Incidence *incidence = currentSelection(); |
3949 | 3950 | ||
3950 | if (!incidence) return; | 3951 | if (!incidence) return; |
3951 | 3952 | ||
3952 | incidence->setOrganizer(KOPrefs::instance()->email()); | 3953 | incidence->setOrganizer(KOPrefs::instance()->email()); |
3953 | incidence->recreate(); | 3954 | incidence->recreate(); |
3954 | incidence->setReadOnly(false); | 3955 | incidence->setReadOnly(false); |
3955 | 3956 | ||
3956 | updateView(); | 3957 | updateView(); |
3957 | } | 3958 | } |
3958 | 3959 | ||
3959 | void CalendarView::takeOverCalendar() | 3960 | void CalendarView::takeOverCalendar() |
3960 | { | 3961 | { |
3961 | // TODO: Create Calendar::allIncidences() function and use it here | 3962 | // TODO: Create Calendar::allIncidences() function and use it here |
3962 | 3963 | ||
3963 | clearAllViews(); | 3964 | clearAllViews(); |
3964 | QPtrList<Event> events = mCalendar->events(); | 3965 | QPtrList<Event> events = mCalendar->events(); |
3965 | for(uint i=0; i<events.count(); ++i) { | 3966 | for(uint i=0; i<events.count(); ++i) { |
3966 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3967 | events.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3967 | events.at(i)->recreate(); | 3968 | events.at(i)->recreate(); |
3968 | events.at(i)->setReadOnly(false); | 3969 | events.at(i)->setReadOnly(false); |
3969 | } | 3970 | } |
3970 | 3971 | ||
3971 | QPtrList<Todo> todos = mCalendar->todos(); | 3972 | QPtrList<Todo> todos = mCalendar->todos(); |
3972 | for(uint i=0; i<todos.count(); ++i) { | 3973 | for(uint i=0; i<todos.count(); ++i) { |
3973 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3974 | todos.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3974 | todos.at(i)->recreate(); | 3975 | todos.at(i)->recreate(); |
3975 | todos.at(i)->setReadOnly(false); | 3976 | todos.at(i)->setReadOnly(false); |
3976 | } | 3977 | } |
3977 | 3978 | ||
3978 | QPtrList<Journal> journals = mCalendar->journals(); | 3979 | QPtrList<Journal> journals = mCalendar->journals(); |
3979 | for(uint i=0; i<journals.count(); ++i) { | 3980 | for(uint i=0; i<journals.count(); ++i) { |
3980 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); | 3981 | journals.at(i)->setOrganizer(KOPrefs::instance()->email()); |
3981 | journals.at(i)->recreate(); | 3982 | journals.at(i)->recreate(); |
3982 | journals.at(i)->setReadOnly(false); | 3983 | journals.at(i)->setReadOnly(false); |
3983 | } | 3984 | } |
3984 | 3985 | ||
3985 | updateView(); | 3986 | updateView(); |
3986 | } | 3987 | } |
3987 | 3988 | ||
3988 | void CalendarView::showIntro() | 3989 | void CalendarView::showIntro() |
3989 | { | 3990 | { |
3990 | kdDebug() << "To be implemented." << endl; | 3991 | kdDebug() << "To be implemented." << endl; |
3991 | } | 3992 | } |
3992 | 3993 | ||
3993 | QWidgetStack *CalendarView::viewStack() | 3994 | QWidgetStack *CalendarView::viewStack() |
3994 | { | 3995 | { |
3995 | return mRightFrame; | 3996 | return mRightFrame; |
3996 | } | 3997 | } |
3997 | 3998 | ||
3998 | QWidget *CalendarView::leftFrame() | 3999 | QWidget *CalendarView::leftFrame() |
3999 | { | 4000 | { |
4000 | return ( QWidget *)mLeftFrame; | 4001 | return ( QWidget *)mLeftFrame; |
4001 | } | 4002 | } |
4002 | 4003 | ||
4003 | DateNavigator *CalendarView::dateNavigator() | 4004 | DateNavigator *CalendarView::dateNavigator() |
4004 | { | 4005 | { |
4005 | return mNavigator; | 4006 | return mNavigator; |
4006 | } | 4007 | } |
4007 | 4008 | ||
4008 | KDateNavigator* CalendarView::dateNavigatorWidget() | 4009 | KDateNavigator* CalendarView::dateNavigatorWidget() |
4009 | { | 4010 | { |
4010 | return mDateNavigator->navigatorView(); | 4011 | return mDateNavigator->navigatorView(); |
4011 | } | 4012 | } |
4012 | void CalendarView::toggleDateNavigatorWidget() | 4013 | void CalendarView::toggleDateNavigatorWidget() |
4013 | { | 4014 | { |
4014 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; | 4015 | KOPrefs::instance()->mShowDateNavigator = !KOPrefs::instance()->mShowDateNavigator ; |
4015 | 4016 | ||
4016 | if (!KOPrefs::instance()->mShowDateNavigator ) | 4017 | if (!KOPrefs::instance()->mShowDateNavigator ) |
4017 | mDateNavigator->hide(); | 4018 | mDateNavigator->hide(); |
4018 | else | 4019 | else |
4019 | mDateNavigator->show(); | 4020 | mDateNavigator->show(); |
4020 | } | 4021 | } |
4021 | void CalendarView::addView(KOrg::BaseView *view) | 4022 | void CalendarView::addView(KOrg::BaseView *view) |
4022 | { | 4023 | { |
4023 | mViewManager->addView(view); | 4024 | mViewManager->addView(view); |
4024 | } | 4025 | } |
4025 | 4026 | ||
4026 | void CalendarView::showView(KOrg::BaseView *view) | 4027 | void CalendarView::showView(KOrg::BaseView *view) |
4027 | { | 4028 | { |
4028 | mViewManager->showView(view, mLeftFrame->isVisible()); | 4029 | mViewManager->showView(view, mLeftFrame->isVisible()); |
4029 | } | 4030 | } |
4030 | 4031 | ||
4031 | Incidence *CalendarView::currentSelection() | 4032 | Incidence *CalendarView::currentSelection() |
4032 | { | 4033 | { |
4033 | return mViewManager->currentSelection(); | 4034 | return mViewManager->currentSelection(); |
4034 | } | 4035 | } |
4035 | void CalendarView::toggleAllDaySize() | 4036 | void CalendarView::toggleAllDaySize() |
4036 | { | 4037 | { |
4037 | /* | 4038 | /* |
4038 | if ( KOPrefs::instance()->mAllDaySize > 47 ) | 4039 | if ( KOPrefs::instance()->mAllDaySize > 47 ) |
4039 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; | 4040 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize /2; |
4040 | else | 4041 | else |
4041 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; | 4042 | KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize *2; |
4042 | */ | 4043 | */ |
4043 | viewManager()->agendaView()->toggleAllDay(); | 4044 | viewManager()->agendaView()->toggleAllDay(); |
4044 | } | 4045 | } |
4045 | void CalendarView::toggleExpand() | 4046 | void CalendarView::toggleExpand() |
4046 | { | 4047 | { |
4047 | // if ( mLeftFrame->isHidden() ) { | 4048 | // if ( mLeftFrame->isHidden() ) { |
4048 | // mLeftFrame->show(); | 4049 | // mLeftFrame->show(); |
4049 | // emit calendarViewExpanded( false ); | 4050 | // emit calendarViewExpanded( false ); |
4050 | // } else { | 4051 | // } else { |
4051 | // mLeftFrame->hide(); | 4052 | // mLeftFrame->hide(); |
4052 | // emit calendarViewExpanded( true ); | 4053 | // emit calendarViewExpanded( true ); |
4053 | // } | 4054 | // } |
4054 | //qDebug(" CalendarView::toggleExpand()"); | 4055 | //qDebug(" CalendarView::toggleExpand()"); |
4055 | globalFlagBlockAgenda = 1; | 4056 | globalFlagBlockAgenda = 1; |
4056 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); | 4057 | emit calendarViewExpanded( !mLeftFrame->isHidden() ); |
4057 | globalFlagBlockAgenda = 5; | 4058 | globalFlagBlockAgenda = 5; |
4058 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); | 4059 | mViewManager->raiseCurrentView( !mLeftFrame->isHidden() ); |
4059 | //mViewManager->showView( 0, true ); | 4060 | //mViewManager->showView( 0, true ); |
4060 | } | 4061 | } |
4061 | 4062 | ||
4062 | void CalendarView::calendarModified( bool modified, Calendar * ) | 4063 | void CalendarView::calendarModified( bool modified, Calendar * ) |
4063 | { | 4064 | { |
4064 | setModified( modified ); | 4065 | setModified( modified ); |
4065 | } | 4066 | } |
4066 | 4067 | ||
4067 | Todo *CalendarView::selectedTodo() | 4068 | Todo *CalendarView::selectedTodo() |
4068 | { | 4069 | { |
4069 | Incidence *incidence = currentSelection(); | 4070 | Incidence *incidence = currentSelection(); |
diff --git a/korganizer/kodialogmanager.cpp b/korganizer/kodialogmanager.cpp index aa30c52..3dfa344 100644 --- a/korganizer/kodialogmanager.cpp +++ b/korganizer/kodialogmanager.cpp | |||
@@ -1,368 +1,355 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | 3 | ||
4 | Copyright (c) 2001 | 4 | Copyright (c) 2001 |
5 | Cornelius Schumacher <schumacher@kde.org> | 5 | Cornelius Schumacher <schumacher@kde.org> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
9 | the Free Software Foundation; either version 2 of the License, or | 9 | the Free Software Foundation; either version 2 of the License, or |
10 | (at your option) any later version. | 10 | (at your option) any later version. |
11 | 11 | ||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software | 18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <libkdepim/categoryeditdialog.h> | 22 | #include <libkdepim/categoryeditdialog.h> |
23 | 23 | ||
24 | #include "calendarview.h" | 24 | #include "calendarview.h" |
25 | #include "incomingdialog.h" | 25 | #include "incomingdialog.h" |
26 | #include "outgoingdialog.h" | 26 | #include "outgoingdialog.h" |
27 | #include "koprefsdialog.h" | 27 | #include "koprefsdialog.h" |
28 | #include "koeventeditor.h" | 28 | #include "koeventeditor.h" |
29 | #include "koprefs.h" | 29 | #include "koprefs.h" |
30 | #include "datenavigator.h" | 30 | #include "datenavigator.h" |
31 | #include "kotodoeditor.h" | 31 | #include "kotodoeditor.h" |
32 | #include "searchdialog.h" | 32 | #include "searchdialog.h" |
33 | #include "filtereditdialog.h" | 33 | #include "filtereditdialog.h" |
34 | #ifndef KORG_NOPLUGINS | 34 | #ifndef KORG_NOPLUGINS |
35 | #include "plugindialog.h" | 35 | #include "plugindialog.h" |
36 | #endif | 36 | #endif |
37 | #ifndef KORG_NOARCHIVE | 37 | #ifndef KORG_NOARCHIVE |
38 | #include "archivedialog.h" | 38 | #include "archivedialog.h" |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | #include "kconfig.h" | 41 | #include "kconfig.h" |
42 | #include "kodialogmanager.h" | 42 | #include "kodialogmanager.h" |
43 | #include <kapplication.h> | 43 | #include <kapplication.h> |
44 | 44 | ||
45 | KODialogManager::KODialogManager( CalendarView *mainView ) : | 45 | KODialogManager::KODialogManager( CalendarView *mainView ) : |
46 | QObject(), mMainView( mainView ) | 46 | QObject(), mMainView( mainView ) |
47 | { | 47 | { |
48 | mOutgoingDialog = 0; | 48 | mOutgoingDialog = 0; |
49 | mIncomingDialog = 0; | 49 | mIncomingDialog = 0; |
50 | mOptionsDialog = 0; | 50 | mOptionsDialog = 0; |
51 | mSearchDialog = 0; | 51 | mSearchDialog = 0; |
52 | mArchiveDialog = 0; | 52 | mArchiveDialog = 0; |
53 | mFilterEditDialog = 0; | 53 | mFilterEditDialog = 0; |
54 | mPluginDialog = 0; | 54 | mPluginDialog = 0; |
55 | 55 | ||
56 | // mCategoryEditDialog = new KPIM::CategoryEditDialog(KOPrefs::instance(),mMainView); | 56 | // mCategoryEditDialog = new KPIM::CategoryEditDialog(KOPrefs::instance(),mMainView); |
57 | //KOGlobals::fitDialogToScreen( mCategoryEditDialog ); | 57 | //KOGlobals::fitDialogToScreen( mCategoryEditDialog ); |
58 | } | 58 | } |
59 | 59 | ||
60 | KODialogManager::~KODialogManager() | 60 | KODialogManager::~KODialogManager() |
61 | { | 61 | { |
62 | delete mOutgoingDialog; | 62 | delete mOutgoingDialog; |
63 | delete mIncomingDialog; | 63 | delete mIncomingDialog; |
64 | delete mOptionsDialog; | 64 | delete mOptionsDialog; |
65 | delete mSearchDialog; | 65 | delete mSearchDialog; |
66 | #ifndef KORG_NOARCHIVE | 66 | #ifndef KORG_NOARCHIVE |
67 | delete mArchiveDialog; | 67 | delete mArchiveDialog; |
68 | #endif | 68 | #endif |
69 | delete mFilterEditDialog; | 69 | delete mFilterEditDialog; |
70 | #ifndef KORG_NOPLUGINS | 70 | #ifndef KORG_NOPLUGINS |
71 | delete mPluginDialog; | 71 | delete mPluginDialog; |
72 | #endif | 72 | #endif |
73 | } | 73 | } |
74 | 74 | ||
75 | OutgoingDialog *KODialogManager::outgoingDialog() | 75 | OutgoingDialog *KODialogManager::outgoingDialog() |
76 | { | 76 | { |
77 | createOutgoingDialog(); | 77 | createOutgoingDialog(); |
78 | return mOutgoingDialog; | 78 | return mOutgoingDialog; |
79 | } | 79 | } |
80 | 80 | ||
81 | void KODialogManager::createOutgoingDialog() | 81 | void KODialogManager::createOutgoingDialog() |
82 | { | 82 | { |
83 | if (!mOutgoingDialog) { | 83 | if (!mOutgoingDialog) { |
84 | mOutgoingDialog = new OutgoingDialog(mMainView->calendar(),mMainView); | 84 | mOutgoingDialog = new OutgoingDialog(mMainView->calendar(),mMainView); |
85 | if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog); | 85 | if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog); |
86 | connect(mOutgoingDialog,SIGNAL(numMessagesChanged(int)), | 86 | connect(mOutgoingDialog,SIGNAL(numMessagesChanged(int)), |
87 | mMainView,SIGNAL(numOutgoingChanged(int))); | 87 | mMainView,SIGNAL(numOutgoingChanged(int))); |
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
91 | void KODialogManager::showGlobalOptionsDialog( bool showSync ) | 91 | void KODialogManager::showGlobalOptionsDialog( bool showSync ) |
92 | { | 92 | { |
93 | if (!mOptionsDialog) { | 93 | KPimPrefsGlobalDialog gc ( mMainView ); |
94 | mOptionsDialog = new KOPrefsDialog(0); | 94 | if ( showSync ) |
95 | connect(mOptionsDialog,SIGNAL(configChanged()), | 95 | gc.showTZconfig(); |
96 | mMainView,SLOT(updateConfig())); | 96 | gc.exec(); |
97 | } | ||
98 | mOptionsDialog->readConfig(); | ||
99 | #ifndef DESKTOP_VERSION | ||
100 | mOptionsDialog->showMaximized(); | ||
101 | #else | ||
102 | mOptionsDialog->show(); | ||
103 | #endif | ||
104 | if ( showSync ) | ||
105 | mOptionsDialog->showSyncPage(); | ||
106 | mOptionsDialog->exec(); | ||
107 | delete mOptionsDialog; | ||
108 | mOptionsDialog = 0; | ||
109 | } | 97 | } |
110 | void KODialogManager::showOptionsDialog( bool showSync ) | 98 | void KODialogManager::showOptionsDialog( bool showSync ) |
111 | { | 99 | { |
112 | 100 | ||
113 | if (!mOptionsDialog) { | 101 | if (!mOptionsDialog) { |
114 | mOptionsDialog = new KOPrefsDialog(mMainView); | 102 | mOptionsDialog = new KOPrefsDialog(mMainView); |
115 | connect(mOptionsDialog,SIGNAL(configChanged()), | 103 | connect(mOptionsDialog,SIGNAL(configChanged()), |
116 | mMainView,SLOT(updateConfig())); | 104 | mMainView,SLOT(updateConfig())); |
117 | } | 105 | } |
118 | mOptionsDialog->readConfig(); | 106 | mOptionsDialog->readConfig(); |
119 | #ifndef DESKTOP_VERSION | 107 | #ifndef DESKTOP_VERSION |
120 | mOptionsDialog->showMaximized(); | 108 | mOptionsDialog->showMaximized(); |
121 | #else | 109 | #else |
122 | mOptionsDialog->show(); | 110 | mOptionsDialog->show(); |
123 | #endif | 111 | #endif |
124 | if ( showSync ) | 112 | |
125 | mOptionsDialog->showSyncPage(); | ||
126 | mOptionsDialog->exec(); | 113 | mOptionsDialog->exec(); |
127 | delete mOptionsDialog; | 114 | delete mOptionsDialog; |
128 | mOptionsDialog = 0; | 115 | mOptionsDialog = 0; |
129 | } | 116 | } |
130 | void KODialogManager::showSyncOptions() | 117 | void KODialogManager::showSyncOptions() |
131 | { | 118 | { |
132 | showGlobalOptionsDialog( true ); | 119 | showGlobalOptionsDialog( true ); |
133 | 120 | ||
134 | } | 121 | } |
135 | void KODialogManager::showOutgoingDialog() | 122 | void KODialogManager::showOutgoingDialog() |
136 | { | 123 | { |
137 | createOutgoingDialog(); | 124 | createOutgoingDialog(); |
138 | mOutgoingDialog->show(); | 125 | mOutgoingDialog->show(); |
139 | mOutgoingDialog->raise(); | 126 | mOutgoingDialog->raise(); |
140 | } | 127 | } |
141 | 128 | ||
142 | IncomingDialog *KODialogManager::incomingDialog() | 129 | IncomingDialog *KODialogManager::incomingDialog() |
143 | { | 130 | { |
144 | createOutgoingDialog(); | 131 | createOutgoingDialog(); |
145 | if (!mIncomingDialog) { | 132 | if (!mIncomingDialog) { |
146 | mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); | 133 | mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); |
147 | connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), | 134 | connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), |
148 | mMainView,SIGNAL(numIncomingChanged(int))); | 135 | mMainView,SIGNAL(numIncomingChanged(int))); |
149 | connect(mIncomingDialog,SIGNAL(calendarUpdated()), | 136 | connect(mIncomingDialog,SIGNAL(calendarUpdated()), |
150 | mMainView,SLOT(updateView())); | 137 | mMainView,SLOT(updateView())); |
151 | } | 138 | } |
152 | return mIncomingDialog; | 139 | return mIncomingDialog; |
153 | } | 140 | } |
154 | 141 | ||
155 | void KODialogManager::createIncomingDialog() | 142 | void KODialogManager::createIncomingDialog() |
156 | { | 143 | { |
157 | createOutgoingDialog(); | 144 | createOutgoingDialog(); |
158 | if (!mIncomingDialog) { | 145 | if (!mIncomingDialog) { |
159 | mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); | 146 | mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); |
160 | connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), | 147 | connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), |
161 | mMainView,SIGNAL(numIncomingChanged(int))); | 148 | mMainView,SIGNAL(numIncomingChanged(int))); |
162 | connect(mIncomingDialog,SIGNAL(calendarUpdated()), | 149 | connect(mIncomingDialog,SIGNAL(calendarUpdated()), |
163 | mMainView,SLOT(updateView())); | 150 | mMainView,SLOT(updateView())); |
164 | } | 151 | } |
165 | } | 152 | } |
166 | 153 | ||
167 | void KODialogManager::showIncomingDialog() | 154 | void KODialogManager::showIncomingDialog() |
168 | { | 155 | { |
169 | createIncomingDialog(); | 156 | createIncomingDialog(); |
170 | mIncomingDialog->show(); | 157 | mIncomingDialog->show(); |
171 | mIncomingDialog->raise(); | 158 | mIncomingDialog->raise(); |
172 | } | 159 | } |
173 | /* | 160 | /* |
174 | void KODialogManager::showCategoryEditDialog() | 161 | void KODialogManager::showCategoryEditDialog() |
175 | { | 162 | { |
176 | mCategoryEditDialog->show(); | 163 | mCategoryEditDialog->show(); |
177 | } | 164 | } |
178 | */ | 165 | */ |
179 | void KODialogManager::hideSearchDialog() | 166 | void KODialogManager::hideSearchDialog() |
180 | { | 167 | { |
181 | if (mSearchDialog) | 168 | if (mSearchDialog) |
182 | mSearchDialog->hide(); | 169 | mSearchDialog->hide(); |
183 | } | 170 | } |
184 | 171 | ||
185 | void KODialogManager::showSearchDialog() | 172 | void KODialogManager::showSearchDialog() |
186 | { | 173 | { |
187 | if (!mSearchDialog) { | 174 | if (!mSearchDialog) { |
188 | mSearchDialog = new SearchDialog(mMainView->calendar(),mMainView); | 175 | mSearchDialog = new SearchDialog(mMainView->calendar(),mMainView); |
189 | KOListView * lview = mSearchDialog->listview(); | 176 | KOListView * lview = mSearchDialog->listview(); |
190 | 177 | ||
191 | connect(lview, SIGNAL(showIncidenceSignal(Incidence *)), | 178 | connect(lview, SIGNAL(showIncidenceSignal(Incidence *)), |
192 | mMainView, SLOT(showIncidence(Incidence *))); | 179 | mMainView, SLOT(showIncidence(Incidence *))); |
193 | connect(lview, SIGNAL(editIncidenceSignal(Incidence *)), | 180 | connect(lview, SIGNAL(editIncidenceSignal(Incidence *)), |
194 | mMainView, SLOT(editIncidence(Incidence *))); | 181 | mMainView, SLOT(editIncidence(Incidence *))); |
195 | connect(lview, SIGNAL(deleteIncidenceSignal(Incidence *)), | 182 | connect(lview, SIGNAL(deleteIncidenceSignal(Incidence *)), |
196 | mMainView, SLOT(deleteIncidence(Incidence *))); | 183 | mMainView, SLOT(deleteIncidence(Incidence *))); |
197 | connect(lview, SIGNAL(cloneIncidenceSignal(Incidence *)), | 184 | connect(lview, SIGNAL(cloneIncidenceSignal(Incidence *)), |
198 | mMainView, SLOT(cloneIncidence(Incidence *))); | 185 | mMainView, SLOT(cloneIncidence(Incidence *))); |
199 | connect(lview, SIGNAL(beamIncidenceSignal(Incidence *)), | 186 | connect(lview, SIGNAL(beamIncidenceSignal(Incidence *)), |
200 | mMainView, SLOT(beamIncidence(Incidence *))); | 187 | mMainView, SLOT(beamIncidence(Incidence *))); |
201 | connect(lview, SIGNAL(moveIncidenceSignal(Incidence *)), | 188 | connect(lview, SIGNAL(moveIncidenceSignal(Incidence *)), |
202 | mMainView, SLOT(moveIncidence(Incidence *))); | 189 | mMainView, SLOT(moveIncidence(Incidence *))); |
203 | connect(lview, SIGNAL(beamIncidenceList(QPtrList<Incidence> )), | 190 | connect(lview, SIGNAL(beamIncidenceList(QPtrList<Incidence> )), |
204 | mMainView, SLOT(beamIncidenceList(QPtrList<Incidence> ))); | 191 | mMainView, SLOT(beamIncidenceList(QPtrList<Incidence> ))); |
205 | 192 | ||
206 | connect(mMainView, SIGNAL(configChanged()), mSearchDialog, SLOT(updateConfig())); | 193 | connect(mMainView, SIGNAL(configChanged()), mSearchDialog, SLOT(updateConfig())); |
207 | connect(mMainView, SIGNAL(updateSearchDialog()), mSearchDialog, SLOT(updateList())); | 194 | connect(mMainView, SIGNAL(updateSearchDialog()), mSearchDialog, SLOT(updateList())); |
208 | // connect( lview, SIGNAL( incidenceSelected( Incidence * ) ), | 195 | // connect( lview, SIGNAL( incidenceSelected( Incidence * ) ), |
209 | // mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); | 196 | // mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); |
210 | #ifndef DESKTOP_VERSION | 197 | #ifndef DESKTOP_VERSION |
211 | mSearchDialog->setMaximumSize( QApplication::desktop()->size()); | 198 | mSearchDialog->setMaximumSize( QApplication::desktop()->size()); |
212 | mSearchDialog->showMaximized(); | 199 | mSearchDialog->showMaximized(); |
213 | #else | 200 | #else |
214 | KConfig *config = KOGlobals::config(); | 201 | KConfig *config = KOGlobals::config(); |
215 | config->setGroup("WidgetLayout"); | 202 | config->setGroup("WidgetLayout"); |
216 | QStringList list; | 203 | QStringList list; |
217 | list = config->readListEntry("SearchLayout"); | 204 | list = config->readListEntry("SearchLayout"); |
218 | int x,y,w,h; | 205 | int x,y,w,h; |
219 | if ( ! list.isEmpty() ) { | 206 | if ( ! list.isEmpty() ) { |
220 | x = list[0].toInt(); | 207 | x = list[0].toInt(); |
221 | y = list[1].toInt(); | 208 | y = list[1].toInt(); |
222 | w = list[2].toInt(); | 209 | w = list[2].toInt(); |
223 | h = list[3].toInt(); | 210 | h = list[3].toInt(); |
224 | KApplication::testCoords( &x,&y,&w,&h ); | 211 | KApplication::testCoords( &x,&y,&w,&h ); |
225 | mSearchDialog->setGeometry(x,y,w,h); | 212 | mSearchDialog->setGeometry(x,y,w,h); |
226 | 213 | ||
227 | } | 214 | } |
228 | 215 | ||
229 | #endif | 216 | #endif |
230 | } | 217 | } |
231 | // make sure the widget is on top again | 218 | // make sure the widget is on top again |
232 | #ifdef DESKTOP_VERSION | 219 | #ifdef DESKTOP_VERSION |
233 | mSearchDialog->show(); | 220 | mSearchDialog->show(); |
234 | #else | 221 | #else |
235 | mSearchDialog->setMaximumSize( QApplication::desktop()->size()); | 222 | mSearchDialog->setMaximumSize( QApplication::desktop()->size()); |
236 | mSearchDialog->showMaximized(); | 223 | mSearchDialog->showMaximized(); |
237 | #endif | 224 | #endif |
238 | mSearchDialog->raiseAndSelect(); | 225 | mSearchDialog->raiseAndSelect(); |
239 | } | 226 | } |
240 | 227 | ||
241 | SearchDialog * KODialogManager::getSearchDialog() | 228 | SearchDialog * KODialogManager::getSearchDialog() |
242 | { | 229 | { |
243 | return mSearchDialog; | 230 | return mSearchDialog; |
244 | } | 231 | } |
245 | void KODialogManager::showArchiveDialog() | 232 | void KODialogManager::showArchiveDialog() |
246 | { | 233 | { |
247 | #ifndef KORG_NOARCHIVE | 234 | #ifndef KORG_NOARCHIVE |
248 | if (!mArchiveDialog) { | 235 | if (!mArchiveDialog) { |
249 | mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView); | 236 | mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView); |
250 | connect(mArchiveDialog,SIGNAL(eventsDeleted()), | 237 | connect(mArchiveDialog,SIGNAL(eventsDeleted()), |
251 | mMainView,SLOT(updateView())); | 238 | mMainView,SLOT(updateView())); |
252 | } | 239 | } |
253 | mArchiveDialog->show(); | 240 | mArchiveDialog->show(); |
254 | mArchiveDialog->raise(); | 241 | mArchiveDialog->raise(); |
255 | 242 | ||
256 | // Workaround. | 243 | // Workaround. |
257 | QApplication::restoreOverrideCursor(); | 244 | QApplication::restoreOverrideCursor(); |
258 | #endif | 245 | #endif |
259 | } | 246 | } |
260 | 247 | ||
261 | void KODialogManager::showFilterEditDialog(QPtrList<CalFilter> *filters) | 248 | void KODialogManager::showFilterEditDialog(QPtrList<CalFilter> *filters) |
262 | { | 249 | { |
263 | if (!mFilterEditDialog) { | 250 | if (!mFilterEditDialog) { |
264 | mFilterEditDialog = new FilterEditDialog(filters,mMainView); | 251 | mFilterEditDialog = new FilterEditDialog(filters,mMainView); |
265 | connect(mFilterEditDialog,SIGNAL(filterChanged()), | 252 | connect(mFilterEditDialog,SIGNAL(filterChanged()), |
266 | mMainView,SLOT(filterEdited())); | 253 | mMainView,SLOT(filterEdited())); |
267 | 254 | ||
268 | } | 255 | } |
269 | 256 | ||
270 | #ifndef DESKTOP_VERSION | 257 | #ifndef DESKTOP_VERSION |
271 | mFilterEditDialog->showMaximized(); | 258 | mFilterEditDialog->showMaximized(); |
272 | #else | 259 | #else |
273 | mFilterEditDialog->show(); | 260 | mFilterEditDialog->show(); |
274 | #endif | 261 | #endif |
275 | mFilterEditDialog->raise(); | 262 | mFilterEditDialog->raise(); |
276 | } | 263 | } |
277 | 264 | ||
278 | void KODialogManager::showPluginDialog() | 265 | void KODialogManager::showPluginDialog() |
279 | { | 266 | { |
280 | #ifndef KORG_NOPLUGINS | 267 | #ifndef KORG_NOPLUGINS |
281 | if (!mPluginDialog) { | 268 | if (!mPluginDialog) { |
282 | mPluginDialog = new PluginDialog(mMainView); | 269 | mPluginDialog = new PluginDialog(mMainView); |
283 | connect(mPluginDialog,SIGNAL(configChanged()), | 270 | connect(mPluginDialog,SIGNAL(configChanged()), |
284 | mMainView,SLOT(updateConfig())); | 271 | mMainView,SLOT(updateConfig())); |
285 | } | 272 | } |
286 | mPluginDialog->show(); | 273 | mPluginDialog->show(); |
287 | mPluginDialog->raise(); | 274 | mPluginDialog->raise(); |
288 | #endif | 275 | #endif |
289 | } | 276 | } |
290 | 277 | ||
291 | KOEventEditor *KODialogManager::getEventEditor() | 278 | KOEventEditor *KODialogManager::getEventEditor() |
292 | { | 279 | { |
293 | KOEventEditor *eventEditor = new KOEventEditor( mMainView->calendar(), | 280 | KOEventEditor *eventEditor = new KOEventEditor( mMainView->calendar(), |
294 | mMainView ); | 281 | mMainView ); |
295 | 282 | ||
296 | connect(eventEditor,SIGNAL(eventAdded(Event *)), | 283 | connect(eventEditor,SIGNAL(eventAdded(Event *)), |
297 | mMainView,SLOT(eventAdded(Event *))); | 284 | mMainView,SLOT(eventAdded(Event *))); |
298 | connect(eventEditor,SIGNAL(eventChanged(Event *)), | 285 | connect(eventEditor,SIGNAL(eventChanged(Event *)), |
299 | mMainView,SLOT(eventChanged(Event *))); | 286 | mMainView,SLOT(eventChanged(Event *))); |
300 | connect(eventEditor,SIGNAL(eventDeleted()), | 287 | connect(eventEditor,SIGNAL(eventDeleted()), |
301 | mMainView,SLOT(eventDeleted())); | 288 | mMainView,SLOT(eventDeleted())); |
302 | connect(eventEditor,SIGNAL(deleteAttendee(Incidence *)), | 289 | connect(eventEditor,SIGNAL(deleteAttendee(Incidence *)), |
303 | mMainView,SLOT(schedule_cancel(Incidence *))); | 290 | mMainView,SLOT(schedule_cancel(Incidence *))); |
304 | connect( eventEditor, SIGNAL(jumpToTime( const QDate &)), | 291 | connect( eventEditor, SIGNAL(jumpToTime( const QDate &)), |
305 | mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 292 | mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
306 | connect( eventEditor, SIGNAL( showAgendaView( bool)), | 293 | connect( eventEditor, SIGNAL( showAgendaView( bool)), |
307 | mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); | 294 | mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); |
308 | 295 | ||
309 | // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), | 296 | // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), |
310 | // eventEditor,SLOT(updateCategoryConfig())); | 297 | // eventEditor,SLOT(updateCategoryConfig())); |
311 | // connect(eventEditor,SIGNAL(editCategories()), | 298 | // connect(eventEditor,SIGNAL(editCategories()), |
312 | // mCategoryEditDialog,SLOT(show())); | 299 | // mCategoryEditDialog,SLOT(show())); |
313 | connect(eventEditor,SIGNAL(dialogClose(Incidence*)), | 300 | connect(eventEditor,SIGNAL(dialogClose(Incidence*)), |
314 | mMainView,SLOT(dialogClosing(Incidence*))); | 301 | mMainView,SLOT(dialogClosing(Incidence*))); |
315 | 302 | ||
316 | //connect(mMainView,SIGNAL(closingDown()),eventEditor,SLOT(reject())); | 303 | //connect(mMainView,SIGNAL(closingDown()),eventEditor,SLOT(reject())); |
317 | 304 | ||
318 | #ifndef DESKTOP_VERSION | 305 | #ifndef DESKTOP_VERSION |
319 | eventEditor->resize( QApplication::desktop()->width() -20, 100 ); | 306 | eventEditor->resize( QApplication::desktop()->width() -20, 100 ); |
320 | #endif | 307 | #endif |
321 | return eventEditor; | 308 | return eventEditor; |
322 | } | 309 | } |
323 | 310 | ||
324 | KOTodoEditor *KODialogManager::getTodoEditor() | 311 | KOTodoEditor *KODialogManager::getTodoEditor() |
325 | { | 312 | { |
326 | KOTodoEditor *todoEditor = new KOTodoEditor( mMainView->calendar(), | 313 | KOTodoEditor *todoEditor = new KOTodoEditor( mMainView->calendar(), |
327 | mMainView ); | 314 | mMainView ); |
328 | 315 | ||
329 | // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), | 316 | // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), |
330 | // todoEditor,SLOT(updateCategoryConfig())); | 317 | // todoEditor,SLOT(updateCategoryConfig())); |
331 | // connect(todoEditor,SIGNAL(editCategories()),mCategoryEditDialog,SLOT(show())); | 318 | // connect(todoEditor,SIGNAL(editCategories()),mCategoryEditDialog,SLOT(show())); |
332 | 319 | ||
333 | connect(todoEditor,SIGNAL(todoAdded(Todo *)), | 320 | connect(todoEditor,SIGNAL(todoAdded(Todo *)), |
334 | mMainView,SLOT(todoAdded(Todo *))); | 321 | mMainView,SLOT(todoAdded(Todo *))); |
335 | connect(todoEditor,SIGNAL(todoChanged(Todo *)), | 322 | connect(todoEditor,SIGNAL(todoChanged(Todo *)), |
336 | mMainView,SLOT(todoChanged(Todo *))); | 323 | mMainView,SLOT(todoChanged(Todo *))); |
337 | connect(todoEditor,SIGNAL(todoDeleted()), | 324 | connect(todoEditor,SIGNAL(todoDeleted()), |
338 | mMainView,SLOT(todoDeleted())); | 325 | mMainView,SLOT(todoDeleted())); |
339 | connect(todoEditor,SIGNAL(dialogClose(Incidence*)), | 326 | connect(todoEditor,SIGNAL(dialogClose(Incidence*)), |
340 | mMainView,SLOT(dialogClosing(Incidence*))); | 327 | mMainView,SLOT(dialogClosing(Incidence*))); |
341 | connect( todoEditor, SIGNAL(jumpToTime( const QDate &)), | 328 | connect( todoEditor, SIGNAL(jumpToTime( const QDate &)), |
342 | mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 329 | mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
343 | connect( todoEditor, SIGNAL( showAgendaView( bool)), | 330 | connect( todoEditor, SIGNAL( showAgendaView( bool)), |
344 | mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); | 331 | mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); |
345 | // connect(todoEditor,SIGNAL(deleteAttendee(Incidence *)), | 332 | // connect(todoEditor,SIGNAL(deleteAttendee(Incidence *)), |
346 | // mMainView,SLOT(schedule_cancel(Incidence *))); | 333 | // mMainView,SLOT(schedule_cancel(Incidence *))); |
347 | //connect(mMainView,SIGNAL(closingDown()),todoEditor,SLOT(reject())); | 334 | //connect(mMainView,SIGNAL(closingDown()),todoEditor,SLOT(reject())); |
348 | #ifndef DESKTOP_VERSION | 335 | #ifndef DESKTOP_VERSION |
349 | todoEditor->resize( QApplication::desktop()->width() -20, 100 ); | 336 | todoEditor->resize( QApplication::desktop()->width() -20, 100 ); |
350 | #endif | 337 | #endif |
351 | return todoEditor; | 338 | return todoEditor; |
352 | } | 339 | } |
353 | 340 | ||
354 | void KODialogManager::updateSearchDialog() | 341 | void KODialogManager::updateSearchDialog() |
355 | { | 342 | { |
356 | if (mSearchDialog) mSearchDialog->updateView(); | 343 | if (mSearchDialog) mSearchDialog->updateView(); |
357 | } | 344 | } |
358 | 345 | ||
359 | void KODialogManager::setDocumentId( const QString &id ) | 346 | void KODialogManager::setDocumentId( const QString &id ) |
360 | { | 347 | { |
361 | if (mOutgoingDialog) mOutgoingDialog->setDocumentId( id ); | 348 | if (mOutgoingDialog) mOutgoingDialog->setDocumentId( id ); |
362 | } | 349 | } |
363 | 350 | ||
364 | void KODialogManager::writeSettings( KConfig *config ) | 351 | void KODialogManager::writeSettings( KConfig *config ) |
365 | { | 352 | { |
366 | if (mSearchDialog) | 353 | if (mSearchDialog) |
367 | mSearchDialog->listview()->writeSettings(config,"SearchListView Layout"); | 354 | mSearchDialog->listview()->writeSettings(config,"SearchListView Layout"); |
368 | } | 355 | } |
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp index 4b5b66a..b782bb1 100644 --- a/korganizer/koprefsdialog.cpp +++ b/korganizer/koprefsdialog.cpp | |||
@@ -1,1755 +1,1497 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@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 <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qlabel.h> | 25 | #include <qlabel.h> |
26 | #include <qgroupbox.h> | 26 | #include <qgroupbox.h> |
27 | #include <qbuttongroup.h> | 27 | #include <qbuttongroup.h> |
28 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
29 | #include <qfont.h> | 29 | #include <qfont.h> |
30 | #include <qslider.h> | 30 | #include <qslider.h> |
31 | #include <qfile.h> | 31 | #include <qfile.h> |
32 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
33 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
34 | #include <qvbox.h> | 34 | #include <qvbox.h> |
35 | #include <qhbox.h> | 35 | #include <qhbox.h> |
36 | #include <qregexp.h> | 36 | #include <qregexp.h> |
37 | #include <qspinbox.h> | 37 | #include <qspinbox.h> |
38 | #include <qdatetime.h> | 38 | #include <qdatetime.h> |
39 | #include <qcheckbox.h> | 39 | #include <qcheckbox.h> |
40 | #include <qradiobutton.h> | 40 | #include <qradiobutton.h> |
41 | #include <qpushbutton.h> | 41 | #include <qpushbutton.h> |
42 | #include <qstrlist.h> | 42 | #include <qstrlist.h> |
43 | #include <qapplication.h> | 43 | #include <qapplication.h> |
44 | 44 | ||
45 | #include <kcolorbutton.h> | 45 | #include <kcolorbutton.h> |
46 | #include <kdebug.h> | 46 | #include <kdebug.h> |
47 | #include <klocale.h> | 47 | #include <klocale.h> |
48 | #include <kglobal.h> | 48 | #include <kglobal.h> |
49 | #include <kfontdialog.h> | 49 | #include <kfontdialog.h> |
50 | #include <kfiledialog.h> | 50 | #include <kfiledialog.h> |
51 | #include <kmessagebox.h> | 51 | #include <kmessagebox.h> |
52 | #include <kcolordialog.h> | 52 | #include <kcolordialog.h> |
53 | #include <kiconloader.h> | 53 | #include <kiconloader.h> |
54 | #include <kemailsettings.h> | 54 | #include <kemailsettings.h> |
55 | #include <kstandarddirs.h> | 55 | #include <kstandarddirs.h> |
56 | #include <kglobalsettings.h> | 56 | #include <kglobalsettings.h> |
57 | 57 | ||
58 | #include <kurlrequester.h> | 58 | #include <kurlrequester.h> |
59 | #include <klineedit.h> | 59 | #include <klineedit.h> |
60 | 60 | ||
61 | #if defined(USE_SOLARIS) | 61 | #if defined(USE_SOLARIS) |
62 | #include <sys/param.h> | 62 | #include <sys/param.h> |
63 | 63 | ||
64 | #define ZONEINFODIR "/usr/share/lib/zoneinfo" | 64 | #define ZONEINFODIR "/usr/share/lib/zoneinfo" |
65 | #define INITFILE "/etc/default/init" | 65 | #define INITFILE "/etc/default/init" |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | #include "koprefs.h" | 68 | #include "koprefs.h" |
69 | 69 | ||
70 | #include "koprefsdialog.h" | 70 | #include "koprefsdialog.h" |
71 | #include "kpimglobalprefs.h" | 71 | #include "kpimglobalprefs.h" |
72 | 72 | ||
73 | 73 | ||
74 | KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : | 74 | KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : |
75 | KPrefsDialog(KOPrefs::instance(),parent,name,true) | 75 | KPrefsDialog(KOPrefs::instance(),parent,name,true) |
76 | { | 76 | { |
77 | 77 | ||
78 | setFont( KGlobalSettings::generalMaxFont() ); | 78 | setFont( KGlobalSettings::generalMaxFont() ); |
79 | setCaption( i18n("Preferences - some settings need a restart (nr)")); | 79 | setCaption( i18n("Preferences - some settings need a restart (nr)")); |
80 | mCategoryDict.setAutoDelete(true); | 80 | mCategoryDict.setAutoDelete(true); |
81 | 81 | ||
82 | KGlobal::locale()->insertCatalogue("timezones"); | 82 | KGlobal::locale()->insertCatalogue("timezones"); |
83 | mSpacingHint = spacingHintSmall(); | 83 | mSpacingHint = spacingHintSmall(); |
84 | mMarginHint = marginHintSmall(); | 84 | mMarginHint = marginHintSmall(); |
85 | #ifndef DESKTOP_VERSION | 85 | #ifndef DESKTOP_VERSION |
86 | if ( QApplication::desktop()->height() == 480 ) | 86 | if ( QApplication::desktop()->height() == 480 ) |
87 | hideButtons(); | 87 | hideButtons(); |
88 | #endif | 88 | #endif |
89 | kdelibcfg = 0; | 89 | |
90 | if ( !parent ) | ||
91 | setupGlobalTab(); | ||
92 | else { | ||
93 | setupMainTab(); | 90 | setupMainTab(); |
94 | // setupLocaleTab(); | 91 | // setupLocaleTab(); |
95 | //setupTimeZoneTab(); | 92 | //setupTimeZoneTab(); |
96 | setupTimeTab(); | 93 | setupTimeTab(); |
97 | //setupLocaleDateTab(); | 94 | //setupLocaleDateTab(); |
98 | setupFontsTab(); | 95 | setupFontsTab(); |
99 | setupColorsTab(); | 96 | setupColorsTab(); |
100 | setupViewsTab(); | 97 | setupViewsTab(); |
101 | //setupSyncTab(); | 98 | //setupSyncTab(); |
102 | //setupSyncAlgTab(); | 99 | //setupSyncAlgTab(); |
103 | //setupPrinterTab(); | 100 | //setupPrinterTab(); |
104 | //setupGroupSchedulingTab(); | 101 | //setupGroupSchedulingTab(); |
105 | //setupGroupAutomationTab(); | 102 | //setupGroupAutomationTab(); |
106 | } | 103 | |
107 | 104 | ||
108 | } | 105 | } |
109 | 106 | ||
110 | 107 | ||
111 | KOPrefsDialog::~KOPrefsDialog() | 108 | KOPrefsDialog::~KOPrefsDialog() |
112 | { | 109 | { |
113 | } | 110 | } |
114 | void KOPrefsDialog::setupGlobalTab() | 111 | void KOPrefsDialog::setupGlobalTab() |
115 | { | 112 | { |
116 | //QFrame *topFrame = addPage(i18n("Global"),0,0); | 113 | |
117 | kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), this, "KCMKdeLibConfig" ); | ||
118 | setMainWidget( kdelibcfg ); | ||
119 | setCaption( i18n("KDE-Pim Global Settings")); | ||
120 | |||
121 | 114 | ||
122 | } | 115 | } |
123 | void KOPrefsDialog::setupLocaleDateTab() | 116 | void KOPrefsDialog::setupLocaleDateTab() |
124 | { | 117 | { |
125 | #if 0 | 118 | #if 0 |
126 | QFrame *topFrame = addPage(i18n("Date Format"),0,0); | 119 | QFrame *topFrame = addPage(i18n("Date Format"),0,0); |
127 | QGridLayout *topLayout = new QGridLayout(topFrame,3,2); | 120 | QGridLayout *topLayout = new QGridLayout(topFrame,3,2); |
128 | topLayout->setSpacing(mSpacingHint); | 121 | topLayout->setSpacing(mSpacingHint); |
129 | topLayout->setMargin(mMarginHint); | 122 | topLayout->setMargin(mMarginHint); |
130 | int iii = 0; | 123 | int iii = 0; |
131 | 124 | ||
132 | 125 | ||
133 | KPrefsDialogWidRadios *syncPrefsGroup = | 126 | KPrefsDialogWidRadios *syncPrefsGroup = |
134 | addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); | 127 | addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); |
135 | QString format; | 128 | QString format; |
136 | if ( QApplication::desktop()->width() < 480 ) | 129 | if ( QApplication::desktop()->width() < 480 ) |
137 | format = "(%d.%m.%Y)"; | 130 | format = "(%d.%m.%Y)"; |
138 | else | 131 | else |
139 | format = "(%d.%m.%Y|%A %d %B %Y)"; | 132 | format = "(%d.%m.%Y|%A %d %B %Y)"; |
140 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); | 133 | syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); |
141 | if ( QApplication::desktop()->width() < 480 ) | 134 | if ( QApplication::desktop()->width() < 480 ) |
142 | format = "(%m.%d.%Y)"; | 135 | format = "(%m.%d.%Y)"; |
143 | else | 136 | else |
144 | format = "(%m.%d.%Y|%A %B %d %Y)"; | 137 | format = "(%m.%d.%Y|%A %B %d %Y)"; |
145 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); | 138 | syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); |
146 | if ( QApplication::desktop()->width() < 480 ) | 139 | if ( QApplication::desktop()->width() < 480 ) |
147 | format = "(%Y-%m-%d)"; | 140 | format = "(%Y-%m-%d)"; |
148 | else | 141 | else |
149 | format = "(%Y-%m-%d|%A %Y %B %d)"; | 142 | format = "(%Y-%m-%d|%A %Y %B %d)"; |
150 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); | 143 | syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); |
151 | syncPrefsGroup->addRadio(i18n("User defined")); | 144 | syncPrefsGroup->addRadio(i18n("User defined")); |
152 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 145 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
153 | ++iii; | 146 | ++iii; |
154 | ++iii; | 147 | ++iii; |
155 | QLabel * lab; | 148 | QLabel * lab; |
156 | mUserDateFormatLong = new QLineEdit(topFrame); | 149 | mUserDateFormatLong = new QLineEdit(topFrame); |
157 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); | 150 | lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); |
158 | topLayout->addWidget(lab ,iii,0); | 151 | topLayout->addWidget(lab ,iii,0); |
159 | topLayout->addWidget(mUserDateFormatLong,iii,1); | 152 | topLayout->addWidget(mUserDateFormatLong,iii,1); |
160 | ++iii; | 153 | ++iii; |
161 | mUserDateFormatShort = new QLineEdit(topFrame); | 154 | mUserDateFormatShort = new QLineEdit(topFrame); |
162 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); | 155 | lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); |
163 | topLayout->addWidget(lab ,iii,0); | 156 | topLayout->addWidget(lab ,iii,0); |
164 | topLayout->addWidget(mUserDateFormatShort,iii,1); | 157 | topLayout->addWidget(mUserDateFormatShort,iii,1); |
165 | ++iii; | 158 | ++iii; |
166 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); | 159 | lab = new QLabel( i18n("Monday 19 April 2004: %A %d %B %Y"), topFrame); |
167 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 160 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
168 | ++iii; | 161 | ++iii; |
169 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); | 162 | lab = new QLabel( i18n("Mon 19.04.04: %a %d.%m.%y"), topFrame); |
170 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 163 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
171 | ++iii; | 164 | ++iii; |
172 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); | 165 | lab = new QLabel( i18n("Mon, 19.Apr.04: %a, %d.%b.%y"), topFrame); |
173 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); | 166 | topLayout->addMultiCellWidget(lab ,iii,iii,0,1); |
174 | ++iii; | 167 | ++iii; |
175 | #endif | 168 | #endif |
176 | 169 | ||
177 | } | 170 | } |
178 | 171 | ||
179 | void KOPrefsDialog::setupLocaleTab() | 172 | void KOPrefsDialog::setupLocaleTab() |
180 | { | 173 | { |
181 | #if 0 | 174 | #if 0 |
182 | QFrame *topFrame = addPage(i18n("Locale"),0,0); | 175 | QFrame *topFrame = addPage(i18n("Locale"),0,0); |
183 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | 176 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); |
184 | topLayout->setSpacing(mSpacingHint); | 177 | topLayout->setSpacing(mSpacingHint); |
185 | topLayout->setMargin(mMarginHint); | 178 | topLayout->setMargin(mMarginHint); |
186 | int iii = 0; | 179 | int iii = 0; |
187 | KPrefsDialogWidRadios *syncPrefsGroup = | 180 | KPrefsDialogWidRadios *syncPrefsGroup = |
188 | addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); | 181 | addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); |
189 | syncPrefsGroup->addRadio(i18n("English")); | 182 | syncPrefsGroup->addRadio(i18n("English")); |
190 | syncPrefsGroup->addRadio(i18n("German")); | 183 | syncPrefsGroup->addRadio(i18n("German")); |
191 | syncPrefsGroup->addRadio(i18n("French")); | 184 | syncPrefsGroup->addRadio(i18n("French")); |
192 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); | 185 | syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); |
193 | if ( QApplication::desktop()->width() < 300 ) | 186 | if ( QApplication::desktop()->width() < 300 ) |
194 | ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | 187 | ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); |
195 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 188 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
196 | ++iii; | 189 | ++iii; |
197 | 190 | ||
198 | syncPrefsGroup = | 191 | syncPrefsGroup = |
199 | addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); | 192 | addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); |
200 | if ( QApplication::desktop()->width() > 300 ) | 193 | if ( QApplication::desktop()->width() > 300 ) |
201 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | 194 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); |
202 | syncPrefsGroup->addRadio(i18n("24:00")); | 195 | syncPrefsGroup->addRadio(i18n("24:00")); |
203 | syncPrefsGroup->addRadio(i18n("12:00am")); | 196 | syncPrefsGroup->addRadio(i18n("12:00am")); |
204 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); | 197 | syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); |
205 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | 198 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); |
206 | ++iii; | 199 | ++iii; |
207 | KPrefsDialogWidBool *sb; | 200 | KPrefsDialogWidBool *sb; |
208 | if ( QApplication::desktop()->width() < 300 ) { | 201 | if ( QApplication::desktop()->width() < 300 ) { |
209 | sb = | 202 | sb = |
210 | addWidBool(i18n("Week starts on Sunday"), | 203 | addWidBool(i18n("Week starts on Sunday"), |
211 | &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); | 204 | &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); |
212 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 205 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
213 | ++iii; | 206 | ++iii; |
214 | sb = | 207 | sb = |
215 | addWidBool(i18n("Use short date in (WN/E) view"), | 208 | addWidBool(i18n("Use short date in (WN/E) view"), |
216 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); | 209 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); |
217 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 210 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
218 | } | 211 | } |
219 | else { | 212 | else { |
220 | QWidget * hb = new QWidget( topFrame ); | 213 | QWidget * hb = new QWidget( topFrame ); |
221 | QHBoxLayout *hbLayout = new QHBoxLayout(hb); | 214 | QHBoxLayout *hbLayout = new QHBoxLayout(hb); |
222 | sb = | 215 | sb = |
223 | addWidBool(i18n("Week starts on Sunday"), | 216 | addWidBool(i18n("Week starts on Sunday"), |
224 | &(KOPrefs::instance()->mWeekStartsOnSunday),hb); | 217 | &(KOPrefs::instance()->mWeekStartsOnSunday),hb); |
225 | hbLayout->addWidget(sb->checkBox() ); | 218 | hbLayout->addWidget(sb->checkBox() ); |
226 | sb = | 219 | sb = |
227 | addWidBool(i18n("Use short date in (WN/E) view"), | 220 | addWidBool(i18n("Use short date in (WN/E) view"), |
228 | &(KOPrefs::instance()->mShortDateInViewer),hb); | 221 | &(KOPrefs::instance()->mShortDateInViewer),hb); |
229 | hbLayout->addWidget(sb->checkBox() ); | 222 | hbLayout->addWidget(sb->checkBox() ); |
230 | topLayout->addMultiCellWidget(hb, iii,iii,0,1); | 223 | topLayout->addMultiCellWidget(hb, iii,iii,0,1); |
231 | 224 | ||
232 | } | 225 | } |
233 | // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION | 226 | // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION |
234 | #if 0 | 227 | #if 0 |
235 | ++iii; | 228 | ++iii; |
236 | sb = | 229 | sb = |
237 | addWidBool(i18n("Quick load/save (w/o Unicode)"), | 230 | addWidBool(i18n("Quick load/save (w/o Unicode)"), |
238 | &(KOPrefs::instance()->mUseQuicksave),topFrame); | 231 | &(KOPrefs::instance()->mUseQuicksave),topFrame); |
239 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | 232 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); |
240 | #endif | 233 | #endif |
241 | #endif | 234 | #endif |
242 | } | 235 | } |
243 | void KOPrefsDialog::showSyncPage() | ||
244 | { | ||
245 | // showPage ( 0 ) ; | ||
246 | kdelibcfg->showTimeZoneTab() ; | ||
247 | |||
248 | } | ||
249 | void KOPrefsDialog::setupSyncAlgTab() | ||
250 | { | ||
251 | #if 0 | ||
252 | QLabel * lab; | ||
253 | QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); | ||
254 | mSetupSyncAlgTab = topFrame; | ||
255 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | ||
256 | topLayout->setSpacing(mSpacingHint); | ||
257 | topLayout->setMargin(mMarginHint); | ||
258 | int iii = 0; | ||
259 | |||
260 | KPrefsDialogWidBool *sb = | ||
261 | addWidBool(i18n("Ask for preferences before syncing"), | ||
262 | &(KOPrefs::instance()->mAskForPreferences),topFrame); | ||
263 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | ||
264 | |||
265 | ++iii; | ||
266 | |||
267 | KPrefsDialogWidRadios *syncPrefsGroup = | ||
268 | addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), | ||
269 | topFrame); | ||
270 | syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); | ||
271 | syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); | ||
272 | syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); | ||
273 | syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); | ||
274 | syncPrefsGroup->addRadio(i18n("Force take local entry always")); | ||
275 | syncPrefsGroup->addRadio(i18n("Force take remote entry always")); | ||
276 | topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); | ||
277 | ++iii; | ||
278 | sb = | ||
279 | addWidBool(i18n("Show summary after syncing"), | ||
280 | &(KOPrefs::instance()->mShowSyncSummary),topFrame); | ||
281 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | ||
282 | |||
283 | ++iii; | ||
284 | #endif | ||
285 | |||
286 | |||
287 | |||
288 | } | ||
289 | |||
290 | |||
291 | void KOPrefsDialog::setupSyncTab() | ||
292 | { | ||
293 | #if 0 | ||
294 | QLabel * lab; | ||
295 | QFrame *topFrame = addPage(i18n("Sync Network"),0,0); | ||
296 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | ||
297 | topLayout->setSpacing(mSpacingHint); | ||
298 | topLayout->setMargin(mMarginHint); | ||
299 | lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); | ||
300 | int iii = 0; | ||
301 | topLayout->addMultiCellWidget(lab , iii,iii,0,1); | ||
302 | ++iii; | ||
303 | |||
304 | mRemoteIPEdit = new QLineEdit(topFrame); | ||
305 | lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); | ||
306 | topLayout->addWidget(lab ,iii,0); | ||
307 | topLayout->addWidget(mRemoteIPEdit,iii,1); | ||
308 | ++iii; | ||
309 | mRemoteUser = new QLineEdit(topFrame); | ||
310 | lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); | ||
311 | topLayout->addWidget(lab ,iii,0); | ||
312 | topLayout->addWidget(mRemoteUser, iii,1); | ||
313 | ++iii; | ||
314 | |||
315 | mRemoteFile = new QLineEdit(topFrame); | ||
316 | lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); | ||
317 | topLayout->addWidget(lab ,iii,0); | ||
318 | topLayout->addWidget(mRemoteFile,iii,1); | ||
319 | ++iii; | ||
320 | |||
321 | mLocalTempFile = new QLineEdit(topFrame); | ||
322 | lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); | ||
323 | topLayout->addWidget(lab ,iii,0); | ||
324 | topLayout->addWidget(mLocalTempFile,iii,1); | ||
325 | ++iii; | ||
326 | |||
327 | KPrefsDialogWidBool *wb = | ||
328 | addWidBool(i18n("Write back synced file"), | ||
329 | &(KOPrefs::instance()->mWriteBackFile),topFrame); | ||
330 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); | ||
331 | ++iii; | ||
332 | wb = | ||
333 | addWidBool(i18n("Write back existing entries only"), | ||
334 | &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); | ||
335 | topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); | ||
336 | ++iii; | ||
337 | |||
338 | #endif | ||
339 | } | ||
340 | 236 | ||
341 | void KOPrefsDialog::setupMainTab() | 237 | void KOPrefsDialog::setupMainTab() |
342 | { | 238 | { |
343 | QFrame *topFrame = addPage(i18n("General"),0,0); | 239 | QFrame *topFrame = addPage(i18n("General"),0,0); |
344 | // DesktopIcon("identity",KIcon::SizeMedium)); | 240 | // DesktopIcon("identity",KIcon::SizeMedium)); |
345 | 241 | ||
346 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); | 242 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); |
347 | topLayout->setSpacing(mSpacingHint); | 243 | topLayout->setSpacing(mSpacingHint); |
348 | topLayout->setMargin(mMarginHint); | 244 | topLayout->setMargin(mMarginHint); |
349 | 245 | ||
350 | // KPrefsDialogWidBool *emailControlCenter = | 246 | // KPrefsDialogWidBool *emailControlCenter = |
351 | // addWidBool(i18n("&Use email settings from Control Center"), | 247 | // addWidBool(i18n("&Use email settings from Control Center"), |
352 | // &(KOPrefs::instance()->mEmailControlCenter),topFrame); | 248 | // &(KOPrefs::instance()->mEmailControlCenter),topFrame); |
353 | // topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); | 249 | // topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); |
354 | // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), | 250 | // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), |
355 | // SLOT(toggleEmailSettings(bool))); | 251 | // SLOT(toggleEmailSettings(bool))); |
356 | 252 | ||
357 | mNameEdit = new QLineEdit(topFrame); | 253 | mNameEdit = new QLineEdit(topFrame); |
358 | mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); | 254 | mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); |
359 | topLayout->addWidget(mNameLabel,0,0); | 255 | topLayout->addWidget(mNameLabel,0,0); |
360 | topLayout->addWidget(mNameEdit,0,1); | 256 | topLayout->addWidget(mNameEdit,0,1); |
361 | 257 | ||
362 | mEmailEdit = new QLineEdit(topFrame); | 258 | mEmailEdit = new QLineEdit(topFrame); |
363 | mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); | 259 | mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); |
364 | topLayout->addWidget(mEmailLabel,1,0); | 260 | topLayout->addWidget(mEmailLabel,1,0); |
365 | topLayout->addWidget(mEmailEdit,1,1); | 261 | topLayout->addWidget(mEmailEdit,1,1); |
366 | KPrefsDialogWidBool *wb; | 262 | KPrefsDialogWidBool *wb; |
367 | 263 | ||
368 | 264 | ||
369 | 265 | ||
370 | KPrefsDialogWidBool *widbool = addWidBool(i18n("Full menu bar(nr)"), | 266 | KPrefsDialogWidBool *widbool = addWidBool(i18n("Full menu bar(nr)"), |
371 | &(KOPrefs::instance()->mShowFullMenu),topFrame); | 267 | &(KOPrefs::instance()->mShowFullMenu),topFrame); |
372 | topLayout->addMultiCellWidget( widbool->checkBox(), 2,2,0,1); | 268 | topLayout->addMultiCellWidget( widbool->checkBox(), 2,2,0,1); |
373 | 269 | ||
374 | 270 | ||
375 | widbool = addWidBool(i18n("Mini icons in toolbar(nr)"), | 271 | widbool = addWidBool(i18n("Mini icons in toolbar(nr)"), |
376 | &(KOPrefs::instance()->mToolBarMiniIcons),topFrame); | 272 | &(KOPrefs::instance()->mToolBarMiniIcons),topFrame); |
377 | topLayout->addMultiCellWidget( widbool->checkBox(), 3,3,0,1); | 273 | topLayout->addMultiCellWidget( widbool->checkBox(), 3,3,0,1); |
378 | 274 | ||
379 | 275 | ||
380 | KPrefsDialogWidBool *verticalScreen = | 276 | KPrefsDialogWidBool *verticalScreen = |
381 | addWidBool(i18n("Show vertical screen (Needs restart)"), | 277 | addWidBool(i18n("Show vertical screen (Needs restart)"), |
382 | &(KOPrefs::instance()->mVerticalScreen),topFrame); | 278 | &(KOPrefs::instance()->mVerticalScreen),topFrame); |
383 | //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); | 279 | //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); |
384 | topLayout->addMultiCellWidget(verticalScreen->checkBox(),4,4,0,1); | 280 | topLayout->addMultiCellWidget(verticalScreen->checkBox(),4,4,0,1); |
385 | 281 | ||
386 | 282 | ||
387 | int iii = 5; | 283 | int iii = 5; |
388 | widbool = addWidBool(i18n("Block popup until mouse button release"), | 284 | widbool = addWidBool(i18n("Block popup until mouse button release"), |
389 | &(KOPrefs::instance()->mBlockPopupMenu),topFrame); | 285 | &(KOPrefs::instance()->mBlockPopupMenu),topFrame); |
390 | topLayout->addMultiCellWidget( widbool->checkBox(), iii,iii,0,1); | 286 | topLayout->addMultiCellWidget( widbool->checkBox(), iii,iii,0,1); |
391 | ++iii; | 287 | ++iii; |
392 | QHBox *dummy = new QHBox(topFrame); | 288 | QHBox *dummy = new QHBox(topFrame); |
393 | new QLabel(i18n("Days in Next-X-Days:"),dummy); | 289 | new QLabel(i18n("Days in Next-X-Days:"),dummy); |
394 | mNextXDaysSpin = new QSpinBox(2,14,1,dummy); | 290 | mNextXDaysSpin = new QSpinBox(2,14,1,dummy); |
395 | 291 | ||
396 | topLayout->addMultiCellWidget(dummy,iii,iii,0,1); | 292 | topLayout->addMultiCellWidget(dummy,iii,iii,0,1); |
397 | 293 | ||
398 | ++iii; | 294 | ++iii; |
399 | 295 | ||
400 | 296 | ||
401 | // KPrefsDialogWidBool *bcc = | 297 | // KPrefsDialogWidBool *bcc = |
402 | // addWidBool(i18n("Send copy to owner when mailing events"), | 298 | // addWidBool(i18n("Send copy to owner when mailing events"), |
403 | // &(KOPrefs::instance()->mBcc),topFrame); | 299 | // &(KOPrefs::instance()->mBcc),topFrame); |
404 | // topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); | 300 | // topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); |
405 | 301 | ||
406 | 302 | ||
407 | // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); | 303 | // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); |
408 | //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); | 304 | //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); |
409 | 305 | ||
410 | // addWidBool(i18n("Enable automatic saving of calendar"), | 306 | // addWidBool(i18n("Enable automatic saving of calendar"), |
411 | // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); | 307 | // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); |
412 | 308 | ||
413 | QHBox *intervalBox = new QHBox(topFrame); | 309 | QHBox *intervalBox = new QHBox(topFrame); |
414 | // intervalBox->setSpacing(mSpacingHint); | 310 | // intervalBox->setSpacing(mSpacingHint); |
415 | topLayout->addMultiCellWidget(intervalBox,iii,iii,0,1); | 311 | topLayout->addMultiCellWidget(intervalBox,iii,iii,0,1); |
416 | ++iii; | 312 | ++iii; |
417 | QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); | 313 | QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); |
418 | mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); | 314 | mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); |
419 | autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); | 315 | autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); |
420 | /* | 316 | /* |
421 | QHBox * agendasize = new QHBox ( topFrame ); | 317 | QHBox * agendasize = new QHBox ( topFrame ); |
422 | 318 | ||
423 | new QLabel (i18n("AllDayAgenda Height:"), agendasize ); | 319 | new QLabel (i18n("AllDayAgenda Height:"), agendasize ); |
424 | 320 | ||
425 | 321 | ||
426 | mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); | 322 | mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); |
427 | topLayout->addMultiCellWidget(agendasize,7,7,0,1); | 323 | topLayout->addMultiCellWidget(agendasize,7,7,0,1); |
428 | */ | 324 | */ |
429 | 325 | ||
430 | 326 | ||
431 | KPrefsDialogWidBool *ask = | 327 | KPrefsDialogWidBool *ask = |
432 | addWidBool(i18n("Ask for quit when closing KO/Pi"), | 328 | addWidBool(i18n("Ask for quit when closing KO/Pi"), |
433 | &(KOPrefs::instance()->mAskForQuit),topFrame); | 329 | &(KOPrefs::instance()->mAskForQuit),topFrame); |
434 | topLayout->addMultiCellWidget(ask->checkBox(),iii,iii,0,1); | 330 | topLayout->addMultiCellWidget(ask->checkBox(),iii,iii,0,1); |
435 | ++iii; | 331 | ++iii; |
436 | 332 | ||
437 | 333 | ||
438 | /* | 334 | /* |
439 | KPrefsDialogWidBool *confirmCheck = | 335 | KPrefsDialogWidBool *confirmCheck = |
440 | addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), | 336 | addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), |
441 | topFrame); | 337 | topFrame); |
442 | topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); | 338 | topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); |
443 | 339 | ||
444 | 340 | ||
445 | mEnableGroupScheduling = | 341 | mEnableGroupScheduling = |
446 | addWidBool(i18n("Enable group scheduling"), | 342 | addWidBool(i18n("Enable group scheduling"), |
447 | &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); | 343 | &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); |
448 | topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); | 344 | topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); |
449 | connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), | 345 | connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), |
450 | SLOT(warningGroupScheduling())); | 346 | SLOT(warningGroupScheduling())); |
451 | 347 | ||
452 | mEnableProjectView = | 348 | mEnableProjectView = |
453 | addWidBool(i18n("Enable project view"), | 349 | addWidBool(i18n("Enable project view"), |
454 | &(KOPrefs::instance()->mEnableProjectView),topFrame); | 350 | &(KOPrefs::instance()->mEnableProjectView),topFrame); |
455 | topLayout->addWidget(mEnableProjectView->checkBox(),9,0); | 351 | topLayout->addWidget(mEnableProjectView->checkBox(),9,0); |
456 | connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), | 352 | connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), |
457 | SLOT(warningProjectView())); | 353 | SLOT(warningProjectView())); |
458 | 354 | ||
459 | // Can't be disabled anymore | 355 | // Can't be disabled anymore |
460 | mEnableGroupScheduling->checkBox()->hide(); | 356 | mEnableGroupScheduling->checkBox()->hide(); |
461 | 357 | ||
462 | // Disable setting, because this feature now becomes stable | 358 | // Disable setting, because this feature now becomes stable |
463 | mEnableProjectView->checkBox()->hide(); | 359 | mEnableProjectView->checkBox()->hide(); |
464 | 360 | ||
465 | KPrefsDialogWidRadios *defaultFormatGroup = | 361 | KPrefsDialogWidRadios *defaultFormatGroup = |
466 | addWidRadios(i18n("Default Calendar Format"), | 362 | addWidRadios(i18n("Default Calendar Format"), |
467 | &(KOPrefs::instance()->mDefaultFormat),topFrame); | 363 | &(KOPrefs::instance()->mDefaultFormat),topFrame); |
468 | defaultFormatGroup->addRadio(i18n("vCalendar")); | 364 | defaultFormatGroup->addRadio(i18n("vCalendar")); |
469 | defaultFormatGroup->addRadio(i18n("iCalendar")); | 365 | defaultFormatGroup->addRadio(i18n("iCalendar")); |
470 | 366 | ||
471 | topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); | 367 | topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); |
472 | 368 | ||
473 | // Default format unconditionally is iCalendar | 369 | // Default format unconditionally is iCalendar |
474 | defaultFormatGroup->groupBox()->hide(); | 370 | defaultFormatGroup->groupBox()->hide(); |
475 | 371 | ||
476 | KPrefsDialogWidRadios *mailClientGroup = | 372 | KPrefsDialogWidRadios *mailClientGroup = |
477 | addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), | 373 | addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), |
478 | topFrame); | 374 | topFrame); |
479 | mailClientGroup->addRadio(i18n("KMail")); | 375 | mailClientGroup->addRadio(i18n("KMail")); |
480 | mailClientGroup->addRadio(i18n("Sendmail")); | 376 | mailClientGroup->addRadio(i18n("Sendmail")); |
481 | topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); | 377 | topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); |
482 | 378 | ||
483 | KPrefsDialogWidBool *htmlsave = | 379 | KPrefsDialogWidBool *htmlsave = |
484 | addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), | 380 | addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), |
485 | topFrame); | 381 | topFrame); |
486 | topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); | 382 | topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); |
487 | 383 | ||
488 | KPrefsDialogWidRadios *destinationGroup = | 384 | KPrefsDialogWidRadios *destinationGroup = |
489 | addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), | 385 | addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), |
490 | topFrame); | 386 | topFrame); |
491 | destinationGroup->addRadio(i18n("be added to the standard resource")); | 387 | destinationGroup->addRadio(i18n("be added to the standard resource")); |
492 | destinationGroup->addRadio(i18n("be asked which resource to use")); | 388 | destinationGroup->addRadio(i18n("be asked which resource to use")); |
493 | topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); | 389 | topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); |
494 | 390 | ||
495 | topLayout->setRowStretch(14,1); | 391 | topLayout->setRowStretch(14,1); |
496 | */ | 392 | */ |
497 | } | 393 | } |
498 | 394 | ||
499 | 395 | ||
500 | void KOPrefsDialog::setupTimeTab() | 396 | void KOPrefsDialog::setupTimeTab() |
501 | { | 397 | { |
502 | QFrame *topFrame = addPage(i18n("Time"),0,0); | 398 | QFrame *topFrame = addPage(i18n("Time"),0,0); |
503 | // DesktopIcon("clock",KIcon::SizeMedium)); | 399 | // DesktopIcon("clock",KIcon::SizeMedium)); |
504 | 400 | ||
505 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); | 401 | QGridLayout *topLayout = new QGridLayout(topFrame,4,2); |
506 | topLayout->setSpacing(mSpacingHint); | 402 | topLayout->setSpacing(mSpacingHint); |
507 | topLayout->setMargin(mMarginHint); | 403 | topLayout->setMargin(mMarginHint); |
508 | 404 | ||
509 | QHBox *dummy = new QHBox(topFrame); | 405 | QHBox *dummy = new QHBox(topFrame); |
510 | KPrefsDialogWidTime *dayBegins = | 406 | KPrefsDialogWidTime *dayBegins = |
511 | addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), | 407 | addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), |
512 | dummy); | 408 | dummy); |
513 | //topLayout->addWidget(dayBegins->label(),2,0); | 409 | //topLayout->addWidget(dayBegins->label(),2,0); |
514 | 410 | ||
515 | //topLayout->addWidget(dayBegins->spinBox(),2,1); | 411 | //topLayout->addWidget(dayBegins->spinBox(),2,1); |
516 | topLayout->addMultiCellWidget(dummy,0,0,0,1); | 412 | topLayout->addMultiCellWidget(dummy,0,0,0,1); |
517 | 413 | ||
518 | topLayout->addWidget(new QLabel(i18n("Default appointment time:"), | 414 | topLayout->addWidget(new QLabel(i18n("Default appointment time:"), |
519 | topFrame),1,0); | 415 | topFrame),1,0); |
520 | mStartTimeSpin = new QSpinBox(0,23,1,topFrame); | 416 | mStartTimeSpin = new QSpinBox(0,23,1,topFrame); |
521 | mStartTimeSpin->setSuffix(":00"); | 417 | mStartTimeSpin->setSuffix(":00"); |
522 | topLayout->addWidget(mStartTimeSpin,1,1); | 418 | topLayout->addWidget(mStartTimeSpin,1,1); |
523 | 419 | ||
524 | topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), | 420 | topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), |
525 | topFrame),2,0); | 421 | topFrame),2,0); |
526 | mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); | 422 | mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); |
527 | mDefaultDurationSpin->setSuffix(":00"); | 423 | mDefaultDurationSpin->setSuffix(":00"); |
528 | topLayout->addWidget(mDefaultDurationSpin,2,1); | 424 | topLayout->addWidget(mDefaultDurationSpin,2,1); |
529 | 425 | ||
530 | QStringList alarmList; | 426 | QStringList alarmList; |
531 | alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") | 427 | alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") |
532 | << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; | 428 | << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; |
533 | topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), | 429 | topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), |
534 | 3,0); | 430 | 3,0); |
535 | mAlarmTimeCombo = new QComboBox(topFrame); | 431 | mAlarmTimeCombo = new QComboBox(topFrame); |
536 | mAlarmTimeCombo->insertStringList(alarmList); | 432 | mAlarmTimeCombo->insertStringList(alarmList); |
537 | topLayout->addWidget(mAlarmTimeCombo,3,1); | 433 | topLayout->addWidget(mAlarmTimeCombo,3,1); |
538 | 434 | ||
539 | 435 | ||
540 | QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, | 436 | QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, |
541 | i18n("Working Hours"), | 437 | i18n("Working Hours"), |
542 | topFrame); | 438 | topFrame); |
543 | topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); | 439 | topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); |
544 | workingHoursGroup->layout()->setSpacing( 0 ); | 440 | workingHoursGroup->layout()->setSpacing( 0 ); |
545 | workingHoursGroup->layout()->setMargin( 4 ); | 441 | workingHoursGroup->layout()->setMargin( 4 ); |
546 | QHBox *workStartBox = new QHBox(workingHoursGroup); | 442 | QHBox *workStartBox = new QHBox(workingHoursGroup); |
547 | // workStartBox->setMargin( 0 ); | 443 | // workStartBox->setMargin( 0 ); |
548 | addWidTime(i18n("Daily starting hour:"), | 444 | addWidTime(i18n("Daily starting hour:"), |
549 | &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); | 445 | &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); |
550 | 446 | ||
551 | QHBox *workEndBox = new QHBox(workingHoursGroup); | 447 | QHBox *workEndBox = new QHBox(workingHoursGroup); |
552 | //workEndBox->setMargin( 0 ); | 448 | //workEndBox->setMargin( 0 ); |
553 | addWidTime(i18n("Daily ending hour:"), | 449 | addWidTime(i18n("Daily ending hour:"), |
554 | &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); | 450 | &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); |
555 | QVBox *excludeBox = new QVBox(workingHoursGroup); | 451 | QVBox *excludeBox = new QVBox(workingHoursGroup); |
556 | //excludeBox->setMargin( 0 ); | 452 | //excludeBox->setMargin( 0 ); |
557 | addWidBool(i18n("Exclude holidays"), | 453 | addWidBool(i18n("Exclude holidays"), |
558 | &(KOPrefs::instance()->mExcludeHolidays),excludeBox); | 454 | &(KOPrefs::instance()->mExcludeHolidays),excludeBox); |
559 | 455 | ||
560 | addWidBool(i18n("Exclude Saturdays"), | 456 | addWidBool(i18n("Exclude Saturdays"), |
561 | &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); | 457 | &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); |
562 | 458 | ||
563 | // KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), | 459 | // KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), |
564 | // &(KOPrefs::instance()->mMarcusBainsShowSeconds), | 460 | // &(KOPrefs::instance()->mMarcusBainsShowSeconds), |
565 | // topFrame); | 461 | // topFrame); |
566 | // topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); | 462 | // topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); |
567 | 463 | ||
568 | // topLayout->setRowStretch(6,1); | 464 | // topLayout->setRowStretch(6,1); |
569 | } | 465 | } |
570 | 466 | ||
571 | 467 | ||
572 | void KOPrefsDialog::setupViewsTab() | 468 | void KOPrefsDialog::setupViewsTab() |
573 | { | 469 | { |
574 | 470 | ||
575 | QFrame *topFrame = addPage(i18n("Views"),0,0); | 471 | QFrame *topFrame = addPage(i18n("Views"),0,0); |
576 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 472 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
577 | 473 | ||
578 | QGridLayout *topLayout = new QGridLayout(topFrame,6,1); | 474 | QGridLayout *topLayout = new QGridLayout(topFrame,6,1); |
579 | topLayout->setSpacing(mSpacingHint); | 475 | topLayout->setSpacing(mSpacingHint); |
580 | topLayout->setMargin(mMarginHint); | 476 | topLayout->setMargin(mMarginHint); |
581 | 477 | ||
582 | // QBoxLayout *dayBeginsLayout = new QHBoxLayout; | 478 | // QBoxLayout *dayBeginsLayout = new QHBoxLayout; |
583 | // topLayout->addLayout(dayBeginsLayout,0,0); | 479 | // topLayout->addLayout(dayBeginsLayout,0,0); |
584 | 480 | ||
585 | // KPrefsDialogWidTime *dayBegins = | 481 | // KPrefsDialogWidTime *dayBegins = |
586 | // addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), | 482 | // addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), |
587 | // topFrame); | 483 | // topFrame); |
588 | // dayBeginsLayout->addWidget(dayBegins->label()); | 484 | // dayBeginsLayout->addWidget(dayBegins->label()); |
589 | // dayBeginsLayout->addStretch(1); | 485 | // dayBeginsLayout->addStretch(1); |
590 | // dayBeginsLayout->addWidget(dayBegins->spinBox()); | 486 | // dayBeginsLayout->addWidget(dayBegins->spinBox()); |
591 | 487 | ||
592 | // QBoxLayout *nextDaysLayout = new QHBoxLayout; | 488 | // QBoxLayout *nextDaysLayout = new QHBoxLayout; |
593 | // topLayout->addLayout(nextDaysLayout,1,0); | 489 | // topLayout->addLayout(nextDaysLayout,1,0); |
594 | // nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); | 490 | // nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); |
595 | // mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); | 491 | // mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); |
596 | // nextDaysLayout->addStretch(1); | 492 | // nextDaysLayout->addStretch(1); |
597 | // nextDaysLayout->addWidget(mNextXDaysSpin); | 493 | // nextDaysLayout->addWidget(mNextXDaysSpin); |
598 | 494 | ||
599 | 495 | ||
600 | int ii = 0; | 496 | int ii = 0; |
601 | KPrefsDialogWidBool *dummy = | 497 | KPrefsDialogWidBool *dummy = |
602 | addWidBool(i18n("Edit item on doubleclick (if not, show)"), | 498 | addWidBool(i18n("Edit item on doubleclick (if not, show)"), |
603 | &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); | 499 | &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); |
604 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 500 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
605 | 501 | ||
606 | 502 | ||
607 | 503 | ||
608 | 504 | ||
609 | 505 | ||
610 | 506 | ||
611 | // topLayout->addWidget(hourSizeGroup,ii++,0); | 507 | // topLayout->addWidget(hourSizeGroup,ii++,0); |
612 | // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); | 508 | // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); |
613 | //topLayout->setRowStretch(11,1); | 509 | //topLayout->setRowStretch(11,1); |
614 | 510 | ||
615 | 511 | ||
616 | 512 | ||
617 | 513 | ||
618 | #if 0 | 514 | #if 0 |
619 | 515 | ||
620 | topFrame = addPage(i18n("ViewChange"),0,0); | 516 | topFrame = addPage(i18n("ViewChange"),0,0); |
621 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 517 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
622 | 518 | ||
623 | topLayout = new QGridLayout(topFrame,6,1); | 519 | topLayout = new QGridLayout(topFrame,6,1); |
624 | topLayout->setSpacing(mSpacingHint); | 520 | topLayout->setSpacing(mSpacingHint); |
625 | topLayout->setMargin(mMarginHint); | 521 | topLayout->setMargin(mMarginHint); |
626 | ii = 0; | 522 | ii = 0; |
627 | 523 | ||
628 | #endif | 524 | #endif |
629 | 525 | ||
630 | dummy = | 526 | dummy = |
631 | addWidBool(i18n("Hold fullscreen on view change"), | 527 | addWidBool(i18n("Hold fullscreen on view change"), |
632 | &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); | 528 | &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); |
633 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 529 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
634 | 530 | ||
635 | dummy = | 531 | dummy = |
636 | addWidBool(i18n("Hold non-fullscreen on view change"), | 532 | addWidBool(i18n("Hold non-fullscreen on view change"), |
637 | &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); | 533 | &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); |
638 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 534 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
639 | 535 | ||
640 | 536 | ||
641 | 537 | ||
642 | KPrefsDialogWidBool *fullViewMonth = | 538 | KPrefsDialogWidBool *fullViewMonth = |
643 | addWidBool(i18n("Next days view uses full window"), | 539 | addWidBool(i18n("Next days view uses full window"), |
644 | &(KOPrefs::instance()->mFullViewMonth),topFrame); | 540 | &(KOPrefs::instance()->mFullViewMonth),topFrame); |
645 | topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); | 541 | topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); |
646 | 542 | ||
647 | 543 | ||
648 | KPrefsDialogWidBool *fullViewTodo = | 544 | KPrefsDialogWidBool *fullViewTodo = |
649 | addWidBool(i18n("Event list view uses full window"), | 545 | addWidBool(i18n("Event list view uses full window"), |
650 | &(KOPrefs::instance()->mFullViewTodo),topFrame); | 546 | &(KOPrefs::instance()->mFullViewTodo),topFrame); |
651 | topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); | 547 | topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); |
652 | dummy = | 548 | dummy = |
653 | addWidBool(i18n("Listview uses monthly timespan"), | 549 | addWidBool(i18n("Listview uses monthly timespan"), |
654 | &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); | 550 | &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); |
655 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 551 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
656 | dummy = | 552 | dummy = |
657 | addWidBool(i18n("Highlight selection in Time Edit"), | 553 | addWidBool(i18n("Highlight selection in Time Edit"), |
658 | &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); | 554 | &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); |
659 | topLayout->addWidget( dummy->checkBox(), ii++,0); | 555 | topLayout->addWidget( dummy->checkBox(), ii++,0); |
660 | 556 | ||
661 | KPrefsDialogWidBool *dailyRecur = | 557 | KPrefsDialogWidBool *dailyRecur = |
662 | addWidBool(i18n("Show events that recur daily in date nav."), | 558 | addWidBool(i18n("Show events that recur daily in date nav."), |
663 | &(KOPrefs::instance()->mDailyRecur),topFrame); | 559 | &(KOPrefs::instance()->mDailyRecur),topFrame); |
664 | topLayout->addWidget(dailyRecur->checkBox(),ii++,0); | 560 | topLayout->addWidget(dailyRecur->checkBox(),ii++,0); |
665 | 561 | ||
666 | KPrefsDialogWidBool *weeklyRecur = | 562 | KPrefsDialogWidBool *weeklyRecur = |
667 | addWidBool(i18n("Show ev. that recur weekly in date nav."), | 563 | addWidBool(i18n("Show ev. that recur weekly in date nav."), |
668 | &(KOPrefs::instance()->mWeeklyRecur),topFrame); | 564 | &(KOPrefs::instance()->mWeeklyRecur),topFrame); |
669 | topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); | 565 | topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); |
670 | 566 | ||
671 | #ifdef DESKTOP_VERSION | 567 | #ifdef DESKTOP_VERSION |
672 | KPrefsDialogWidBool *enableToolTips = | 568 | KPrefsDialogWidBool *enableToolTips = |
673 | addWidBool(i18n("Enable tooltips displaying summary of ev."), | 569 | addWidBool(i18n("Enable tooltips displaying summary of ev."), |
674 | &(KOPrefs::instance()->mEnableToolTips),topFrame); | 570 | &(KOPrefs::instance()->mEnableToolTips),topFrame); |
675 | topLayout->addWidget(enableToolTips->checkBox(),ii++,0); | 571 | topLayout->addWidget(enableToolTips->checkBox(),ii++,0); |
676 | #endif | 572 | #endif |
677 | // ********************************************************* | 573 | // ********************************************************* |
678 | 574 | ||
679 | topFrame = addPage(i18n("Agenda View"),0,0); | 575 | topFrame = addPage(i18n("Agenda View"),0,0); |
680 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 576 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
681 | 577 | ||
682 | topLayout = new QGridLayout(topFrame,5,1); | 578 | topLayout = new QGridLayout(topFrame,5,1); |
683 | topLayout->setSpacing(mSpacingHint); | 579 | topLayout->setSpacing(mSpacingHint); |
684 | topLayout->setMargin(mMarginHint); | 580 | topLayout->setMargin(mMarginHint); |
685 | ii = 0; | 581 | ii = 0; |
686 | 582 | ||
687 | 583 | ||
688 | dummy = | 584 | dummy = |
689 | addWidBool(i18n("Show time in agenda items"), | 585 | addWidBool(i18n("Show time in agenda items"), |
690 | &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); | 586 | &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); |
691 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 587 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
692 | 588 | ||
693 | dummy = | 589 | dummy = |
694 | addWidBool(i18n("Highlight current day in agenda"), | 590 | addWidBool(i18n("Highlight current day in agenda"), |
695 | &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); | 591 | &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); |
696 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 592 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
697 | 593 | ||
698 | dummy = | 594 | dummy = |
699 | addWidBool(i18n("Use light color for highlight current day"), | 595 | addWidBool(i18n("Use light color for highlight current day"), |
700 | &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); | 596 | &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); |
701 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 597 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
702 | 598 | ||
703 | 599 | ||
704 | KPrefsDialogWidBool *marcusBainsEnabled = | 600 | KPrefsDialogWidBool *marcusBainsEnabled = |
705 | addWidBool(i18n("Show current time"), | 601 | addWidBool(i18n("Show current time"), |
706 | &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); | 602 | &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); |
707 | topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); | 603 | topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); |
708 | 604 | ||
709 | 605 | ||
710 | dummy = | 606 | dummy = |
711 | addWidBool(i18n("Set agenda to DayBeginsAt on change"), | 607 | addWidBool(i18n("Set agenda to DayBeginsAt on change"), |
712 | &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); | 608 | &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); |
713 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 609 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
714 | 610 | ||
715 | dummy = | 611 | dummy = |
716 | addWidBool(i18n("Set agenda to current time on change"), | 612 | addWidBool(i18n("Set agenda to current time on change"), |
717 | &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); | 613 | &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); |
718 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 614 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
719 | 615 | ||
720 | 616 | ||
721 | dummy = | 617 | dummy = |
722 | addWidBool(i18n("Allday Agenda view shows todos"), | 618 | addWidBool(i18n("Allday Agenda view shows todos"), |
723 | &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); | 619 | &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); |
724 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 620 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
725 | 621 | ||
726 | 622 | ||
727 | 623 | ||
728 | dummy = | 624 | dummy = |
729 | addWidBool(i18n("Agenda view shows completed todos"), | 625 | addWidBool(i18n("Agenda view shows completed todos"), |
730 | &(KOPrefs::instance()->mShowCompletedTodoInAgenda),topFrame); | 626 | &(KOPrefs::instance()->mShowCompletedTodoInAgenda),topFrame); |
731 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 627 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
732 | 628 | ||
733 | 629 | ||
734 | 630 | ||
735 | 631 | ||
736 | 632 | ||
737 | topFrame = addPage(i18n("Month View"),0,0); | 633 | topFrame = addPage(i18n("Month View"),0,0); |
738 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 634 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
739 | 635 | ||
740 | topLayout = new QGridLayout(topFrame,5,1); | 636 | topLayout = new QGridLayout(topFrame,5,1); |
741 | topLayout->setSpacing(mSpacingHint); | 637 | topLayout->setSpacing(mSpacingHint); |
742 | topLayout->setMargin(mMarginHint); | 638 | topLayout->setMargin(mMarginHint); |
743 | ii = 0; | 639 | ii = 0; |
744 | QLabel *lab; | 640 | QLabel *lab; |
745 | QHBox *habo = new QHBox( topFrame ); | 641 | QHBox *habo = new QHBox( topFrame ); |
746 | if ( QApplication::desktop()->width() <= 480 ) { | 642 | if ( QApplication::desktop()->width() <= 480 ) { |
747 | lab = new QLabel ( i18n("Show events that recur "), topFrame ); | 643 | lab = new QLabel ( i18n("Show events that recur "), topFrame ); |
748 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | 644 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); |
749 | ii++; | 645 | ii++; |
750 | } else { | 646 | } else { |
751 | new QLabel ( i18n("Show events that recur "), habo ); | 647 | new QLabel ( i18n("Show events that recur "), habo ); |
752 | } | 648 | } |
753 | dailyRecur = | 649 | dailyRecur = |
754 | addWidBool(i18n("daily"), | 650 | addWidBool(i18n("daily"), |
755 | &(KOPrefs::instance()->mMonthDailyRecur),habo); | 651 | &(KOPrefs::instance()->mMonthDailyRecur),habo); |
756 | // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); | 652 | // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); |
757 | 653 | ||
758 | weeklyRecur = | 654 | weeklyRecur = |
759 | addWidBool(i18n("weekly"), | 655 | addWidBool(i18n("weekly"), |
760 | &(KOPrefs::instance()->mMonthWeeklyRecur),habo); | 656 | &(KOPrefs::instance()->mMonthWeeklyRecur),habo); |
761 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | 657 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); |
762 | ii++; | 658 | ii++; |
763 | 659 | ||
764 | 660 | ||
765 | habo = new QHBox( topFrame ); | 661 | habo = new QHBox( topFrame ); |
766 | if ( QApplication::desktop()->width() <= 480 ) { | 662 | if ( QApplication::desktop()->width() <= 480 ) { |
767 | lab = new QLabel (i18n("Show in every cell ") , topFrame ); | 663 | lab = new QLabel (i18n("Show in every cell ") , topFrame ); |
768 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | 664 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); |
769 | ii++; | 665 | ii++; |
770 | 666 | ||
771 | } else { | 667 | } else { |
772 | new QLabel ( i18n("Show in every cell "), habo ); | 668 | new QLabel ( i18n("Show in every cell "), habo ); |
773 | } | 669 | } |
774 | weeklyRecur = | 670 | weeklyRecur = |
775 | addWidBool(i18n("short month"), | 671 | addWidBool(i18n("short month"), |
776 | &(KOPrefs::instance()->mMonthShowShort),habo); | 672 | &(KOPrefs::instance()->mMonthShowShort),habo); |
777 | weeklyRecur = | 673 | weeklyRecur = |
778 | addWidBool(i18n("icons"), | 674 | addWidBool(i18n("icons"), |
779 | &(KOPrefs::instance()->mMonthShowIcons),habo); | 675 | &(KOPrefs::instance()->mMonthShowIcons),habo); |
780 | weeklyRecur = | 676 | weeklyRecur = |
781 | addWidBool(i18n("times"), | 677 | addWidBool(i18n("times"), |
782 | &(KOPrefs::instance()->mMonthShowTimes),habo); | 678 | &(KOPrefs::instance()->mMonthShowTimes),habo); |
783 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | 679 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); |
784 | ii++; | 680 | ii++; |
785 | #ifdef DESKTOP_VERSION | 681 | #ifdef DESKTOP_VERSION |
786 | KPrefsDialogWidBool *enableMonthScroll = | 682 | KPrefsDialogWidBool *enableMonthScroll = |
787 | addWidBool(i18n("Enable scrollbars in month view cells"), | 683 | addWidBool(i18n("Enable scrollbars in month view cells"), |
788 | &(KOPrefs::instance()->mEnableMonthScroll),topFrame); | 684 | &(KOPrefs::instance()->mEnableMonthScroll),topFrame); |
789 | topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); | 685 | topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); |
790 | #endif | 686 | #endif |
791 | dummy = | 687 | dummy = |
792 | addWidBool(i18n("Week view mode uses bigger font"), | 688 | addWidBool(i18n("Week view mode uses bigger font"), |
793 | &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); | 689 | &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); |
794 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 690 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
795 | dummy = | 691 | dummy = |
796 | addWidBool(i18n("Show Sat/Sun together"), | 692 | addWidBool(i18n("Show Sat/Sun together"), |
797 | &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); | 693 | &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); |
798 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 694 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
799 | 695 | ||
800 | KPrefsDialogWidBool *coloredCategoriesInMonthView = | 696 | KPrefsDialogWidBool *coloredCategoriesInMonthView = |
801 | addWidBool(i18n("Month view uses category colors"), | 697 | addWidBool(i18n("Month view uses category colors"), |
802 | &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); | 698 | &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); |
803 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | 699 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); |
804 | 700 | ||
805 | dummy = | 701 | dummy = |
806 | addWidBool(i18n("Category colors are applied to text"), | 702 | addWidBool(i18n("Category colors are applied to text"), |
807 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); | 703 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); |
808 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 704 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
809 | coloredCategoriesInMonthView = | 705 | coloredCategoriesInMonthView = |
810 | addWidBool(i18n("Month view uses day colors"), | 706 | addWidBool(i18n("Month view uses day colors"), |
811 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); | 707 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); |
812 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | 708 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); |
813 | 709 | ||
814 | KPrefsDialogWidColor *holidayColor = | 710 | KPrefsDialogWidColor *holidayColor = |
815 | addWidColor(i18n("Day color odd months"), | 711 | addWidColor(i18n("Day color odd months"), |
816 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); | 712 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); |
817 | topLayout->addWidget(holidayColor->label(),ii,0); | 713 | topLayout->addWidget(holidayColor->label(),ii,0); |
818 | topLayout->addWidget(holidayColor->button(),ii++,1); | 714 | topLayout->addWidget(holidayColor->button(),ii++,1); |
819 | 715 | ||
820 | holidayColor = | 716 | holidayColor = |
821 | addWidColor(i18n("Day color even months"), | 717 | addWidColor(i18n("Day color even months"), |
822 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); | 718 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); |
823 | topLayout->addWidget(holidayColor->label(),ii,0); | 719 | topLayout->addWidget(holidayColor->label(),ii,0); |
824 | topLayout->addWidget(holidayColor->button(),ii++,1); | 720 | topLayout->addWidget(holidayColor->button(),ii++,1); |
825 | 721 | ||
826 | 722 | ||
827 | holidayColor = | 723 | holidayColor = |
828 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), | 724 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), |
829 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); | 725 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); |
830 | topLayout->addWidget(holidayColor->label(),ii,0); | 726 | topLayout->addWidget(holidayColor->label(),ii,0); |
831 | topLayout->addWidget(holidayColor->button(),ii++,1); | 727 | topLayout->addWidget(holidayColor->button(),ii++,1); |
832 | // *********************** What'sNext View | 728 | // *********************** What'sNext View |
833 | topFrame = addPage(i18n("What's Next View"),0,0); | 729 | topFrame = addPage(i18n("What's Next View"),0,0); |
834 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 730 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
835 | 731 | ||
836 | topLayout = new QGridLayout(topFrame,4,1); | 732 | topLayout = new QGridLayout(topFrame,4,1); |
837 | topLayout->setSpacing(mSpacingHint); | 733 | topLayout->setSpacing(mSpacingHint); |
838 | topLayout->setMargin(mMarginHint); | 734 | topLayout->setMargin(mMarginHint); |
839 | ii = 0; | 735 | ii = 0; |
840 | 736 | ||
841 | 737 | ||
842 | QHBox* hdummy = new QHBox(topFrame); | 738 | QHBox* hdummy = new QHBox(topFrame); |
843 | new QLabel(i18n("Days in What's Next:"),hdummy); | 739 | new QLabel(i18n("Days in What's Next:"),hdummy); |
844 | mWhatsNextSpin = new QSpinBox(1,14,1,hdummy); | 740 | mWhatsNextSpin = new QSpinBox(1,14,1,hdummy); |
845 | 741 | ||
846 | topLayout->addWidget(hdummy,ii++,0); | 742 | topLayout->addWidget(hdummy,ii++,0); |
847 | 743 | ||
848 | QHBox *prioBox = new QHBox(topFrame); | 744 | QHBox *prioBox = new QHBox(topFrame); |
849 | // intervalBox->setSpacing(mSpacingHint); | 745 | // intervalBox->setSpacing(mSpacingHint); |
850 | topLayout->addWidget(prioBox,ii++,0); | 746 | topLayout->addWidget(prioBox,ii++,0); |
851 | 747 | ||
852 | QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox); | 748 | QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox); |
853 | mPrioSpin = new QSpinBox(0,5,1,prioBox); | 749 | mPrioSpin = new QSpinBox(0,5,1,prioBox); |
854 | if ( QApplication::desktop()->width() < 300 ) | 750 | if ( QApplication::desktop()->width() < 300 ) |
855 | mPrioSpin->setFixedWidth( 40 ); | 751 | mPrioSpin->setFixedWidth( 40 ); |
856 | 752 | ||
857 | KPrefsDialogWidBool *passwdk = | 753 | KPrefsDialogWidBool *passwdk = |
858 | 754 | ||
859 | addWidBool(i18n("Show events that are done"), | 755 | addWidBool(i18n("Show events that are done"), |
860 | &(KOPrefs::instance()->mWNViewShowsPast),topFrame); | 756 | &(KOPrefs::instance()->mWNViewShowsPast),topFrame); |
861 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 757 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
862 | passwdk = | 758 | passwdk = |
863 | addWidBool(i18n("Show parent To-Do's"), | 759 | addWidBool(i18n("Show parent To-Do's"), |
864 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); | 760 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); |
865 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 761 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
866 | 762 | ||
867 | passwdk = | 763 | passwdk = |
868 | addWidBool(i18n("Show location"), | 764 | addWidBool(i18n("Show location"), |
869 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); | 765 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); |
870 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 766 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
871 | 767 | ||
872 | 768 | ||
873 | passwdk = | 769 | passwdk = |
874 | addWidBool(i18n("Use short date in WN+Event view"), | 770 | addWidBool(i18n("Use short date in WN+Event view"), |
875 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); | 771 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); |
876 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 772 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
877 | 773 | ||
878 | 774 | ||
879 | 775 | ||
880 | 776 | ||
881 | // *********************** Todo View | 777 | // *********************** Todo View |
882 | 778 | ||
883 | topFrame = addPage(i18n("Todo View"),0,0); | 779 | topFrame = addPage(i18n("Todo View"),0,0); |
884 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 780 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
885 | 781 | ||
886 | topLayout = new QGridLayout(topFrame,4,1); | 782 | topLayout = new QGridLayout(topFrame,4,1); |
887 | topLayout->setSpacing(mSpacingHint); | 783 | topLayout->setSpacing(mSpacingHint); |
888 | topLayout->setMargin(mMarginHint); | 784 | topLayout->setMargin(mMarginHint); |
889 | ii = 0; | 785 | ii = 0; |
890 | dummy = | 786 | dummy = |
891 | addWidBool(i18n("Hide not running Todos in To-do view"), | 787 | addWidBool(i18n("Hide not running Todos in To-do view"), |
892 | &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); | 788 | &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); |
893 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 789 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
894 | 790 | ||
895 | 791 | ||
896 | KPrefsDialogWidBool *showCompletedTodo = | 792 | KPrefsDialogWidBool *showCompletedTodo = |
897 | addWidBool(i18n("To-do view shows completed Todos"), | 793 | addWidBool(i18n("To-do view shows completed Todos"), |
898 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); | 794 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); |
899 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); | 795 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); |
900 | dummy = | 796 | dummy = |
901 | addWidBool(i18n("To-do view shows complete as 'xx %'"), | 797 | addWidBool(i18n("To-do view shows complete as 'xx %'"), |
902 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); | 798 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); |
903 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 799 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
904 | 800 | ||
905 | dummy = | 801 | dummy = |
906 | addWidBool(i18n("Small To-do view uses smaller font"), | 802 | addWidBool(i18n("Small To-do view uses smaller font"), |
907 | &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); | 803 | &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); |
908 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 804 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
909 | 805 | ||
910 | 806 | ||
911 | 807 | ||
912 | dummy = | 808 | dummy = |
913 | addWidBool(i18n("Todo view uses category colors"), | 809 | addWidBool(i18n("Todo view uses category colors"), |
914 | &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); | 810 | &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); |
915 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 811 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
916 | 812 | ||
917 | 813 | ||
918 | QWidget* wid = new QWidget( topFrame ); | 814 | QWidget* wid = new QWidget( topFrame ); |
919 | // Todo run today color | 815 | // Todo run today color |
920 | KPrefsDialogWidColor *todoRunColor = | 816 | KPrefsDialogWidColor *todoRunColor = |
921 | addWidColor(i18n("Color for running todos:"), | 817 | addWidColor(i18n("Color for running todos:"), |
922 | &(KOPrefs::instance()->mTodoRunColor),wid); | 818 | &(KOPrefs::instance()->mTodoRunColor),wid); |
923 | QHBoxLayout *widLayout = new QHBoxLayout(wid); | 819 | QHBoxLayout *widLayout = new QHBoxLayout(wid); |
924 | widLayout->addWidget( todoRunColor->label() ); | 820 | widLayout->addWidget( todoRunColor->label() ); |
925 | widLayout->addWidget( todoRunColor->button() ); | 821 | widLayout->addWidget( todoRunColor->button() ); |
926 | topLayout->addWidget(wid,ii++,0); | 822 | topLayout->addWidget(wid,ii++,0); |
927 | 823 | ||
928 | wid = new QWidget( topFrame ); | 824 | wid = new QWidget( topFrame ); |
929 | // Todo due today color | 825 | // Todo due today color |
930 | KPrefsDialogWidColor *todoDueTodayColor = | 826 | KPrefsDialogWidColor *todoDueTodayColor = |
931 | addWidColor(i18n("Todo due today color:"), | 827 | addWidColor(i18n("Todo due today color:"), |
932 | &(KOPrefs::instance()->mTodoDueTodayColor),wid); | 828 | &(KOPrefs::instance()->mTodoDueTodayColor),wid); |
933 | widLayout = new QHBoxLayout(wid); | 829 | widLayout = new QHBoxLayout(wid); |
934 | widLayout->addWidget( todoDueTodayColor->label() ); | 830 | widLayout->addWidget( todoDueTodayColor->label() ); |
935 | widLayout->addWidget( todoDueTodayColor->button() ); | 831 | widLayout->addWidget( todoDueTodayColor->button() ); |
936 | topLayout->addWidget(wid,ii++,0); | 832 | topLayout->addWidget(wid,ii++,0); |
937 | //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); | 833 | //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); |
938 | 834 | ||
939 | // Todo overdue color | 835 | // Todo overdue color |
940 | wid = new QWidget( topFrame ); | 836 | wid = new QWidget( topFrame ); |
941 | widLayout = new QHBoxLayout(wid); | 837 | widLayout = new QHBoxLayout(wid); |
942 | KPrefsDialogWidColor *todoOverdueColor = | 838 | KPrefsDialogWidColor *todoOverdueColor = |
943 | addWidColor(i18n("Todo overdue color:"), | 839 | addWidColor(i18n("Todo overdue color:"), |
944 | &(KOPrefs::instance()->mTodoOverdueColor),wid); | 840 | &(KOPrefs::instance()->mTodoOverdueColor),wid); |
945 | widLayout->addWidget(todoOverdueColor->label()); | 841 | widLayout->addWidget(todoOverdueColor->label()); |
946 | widLayout->addWidget(todoOverdueColor->button()); | 842 | widLayout->addWidget(todoOverdueColor->button()); |
947 | topLayout->addWidget(wid,ii++,0); | 843 | topLayout->addWidget(wid,ii++,0); |
948 | 844 | ||
949 | dummy = | 845 | dummy = |
950 | addWidBool(i18n("Colors are applied to text"), | 846 | addWidBool(i18n("Colors are applied to text"), |
951 | &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); | 847 | &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); |
952 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 848 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
953 | 849 | ||
954 | 850 | ||
955 | 851 | ||
956 | topFrame = addPage(i18n("View Options"),0,0); | 852 | topFrame = addPage(i18n("View Options"),0,0); |
957 | 853 | ||
958 | topLayout = new QGridLayout(topFrame,4,1); | 854 | topLayout = new QGridLayout(topFrame,4,1); |
959 | topLayout->setSpacing(mSpacingHint); | 855 | topLayout->setSpacing(mSpacingHint); |
960 | topLayout->setMargin(mMarginHint); | 856 | topLayout->setMargin(mMarginHint); |
961 | ii = 0; | 857 | ii = 0; |
962 | 858 | ||
963 | dummy = | 859 | dummy = |
964 | addWidBool(i18n("Show Sync Events"), | 860 | addWidBool(i18n("Show Sync Events"), |
965 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); | 861 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); |
966 | topLayout->addWidget(dummy->checkBox(), ii++,0); | 862 | topLayout->addWidget(dummy->checkBox(), ii++,0); |
967 | 863 | ||
968 | lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame); | 864 | lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame); |
969 | topLayout->addWidget(lab ,ii++,0); | 865 | topLayout->addWidget(lab ,ii++,0); |
970 | 866 | ||
971 | dummy = addWidBool(i18n("Details"), | 867 | dummy = addWidBool(i18n("Details"), |
972 | &(KOPrefs::instance()->mEVshowDetails),topFrame); | 868 | &(KOPrefs::instance()->mEVshowDetails),topFrame); |
973 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 869 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
974 | dummy = addWidBool(i18n("Created time"), | 870 | dummy = addWidBool(i18n("Created time"), |
975 | &(KOPrefs::instance()->mEVshowCreated),topFrame); | 871 | &(KOPrefs::instance()->mEVshowCreated),topFrame); |
976 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 872 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
977 | dummy = addWidBool(i18n("Last modified time"), | 873 | dummy = addWidBool(i18n("Last modified time"), |
978 | &(KOPrefs::instance()->mEVshowChanged),topFrame); | 874 | &(KOPrefs::instance()->mEVshowChanged),topFrame); |
979 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 875 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
980 | 876 | ||
981 | 877 | ||
982 | lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame); | 878 | lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame); |
983 | topLayout->addWidget(lab ,ii++,0); | 879 | topLayout->addWidget(lab ,ii++,0); |
984 | 880 | ||
985 | dummy = addWidBool(i18n("Details"), | 881 | dummy = addWidBool(i18n("Details"), |
986 | &(KOPrefs::instance()->mWTshowDetails),topFrame); | 882 | &(KOPrefs::instance()->mWTshowDetails),topFrame); |
987 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 883 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
988 | dummy = addWidBool(i18n("Created time"), | 884 | dummy = addWidBool(i18n("Created time"), |
989 | &(KOPrefs::instance()->mWTshowCreated),topFrame); | 885 | &(KOPrefs::instance()->mWTshowCreated),topFrame); |
990 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 886 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
991 | dummy = addWidBool(i18n("Last modified time"), | 887 | dummy = addWidBool(i18n("Last modified time"), |
992 | &(KOPrefs::instance()->mWTshowChanged),topFrame); | 888 | &(KOPrefs::instance()->mWTshowChanged),topFrame); |
993 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 889 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
994 | 890 | ||
995 | 891 | ||
996 | topFrame = addPage(i18n("Alarm"),0,0); | 892 | topFrame = addPage(i18n("Alarm"),0,0); |
997 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 893 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
998 | 894 | ||
999 | topLayout = new QGridLayout(topFrame,2,1); | 895 | topLayout = new QGridLayout(topFrame,2,1); |
1000 | topLayout->setSpacing(mSpacingHint); | 896 | topLayout->setSpacing(mSpacingHint); |
1001 | topLayout->setMargin(mMarginHint); | 897 | topLayout->setMargin(mMarginHint); |
1002 | int iii = 0; | 898 | int iii = 0; |
1003 | 899 | ||
1004 | dummy = | 900 | dummy = |
1005 | addWidBool(i18n("Use internal alarm notification"), | 901 | addWidBool(i18n("Use internal alarm notification"), |
1006 | &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); | 902 | &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); |
1007 | topLayout->addWidget(dummy->checkBox(),iii++,0); | 903 | topLayout->addWidget(dummy->checkBox(),iii++,0); |
1008 | lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); | 904 | lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); |
1009 | 905 | ||
1010 | topLayout->addWidget(lab ,iii++,0); | 906 | topLayout->addWidget(lab ,iii++,0); |
1011 | #ifndef DESKTOP_VERSION | 907 | #ifndef DESKTOP_VERSION |
1012 | lab->setAlignment( AlignLeft|WordBreak|AlignTop); | 908 | lab->setAlignment( AlignLeft|WordBreak|AlignTop); |
1013 | #else | 909 | #else |
1014 | lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 910 | lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
1015 | lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); | 911 | lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); |
1016 | #endif | 912 | #endif |
1017 | 913 | ||
1018 | QHBox* dummyBox = new QHBox(topFrame); | 914 | QHBox* dummyBox = new QHBox(topFrame); |
1019 | new QLabel(i18n("Play beeps count:"),dummyBox); | 915 | new QLabel(i18n("Play beeps count:"),dummyBox); |
1020 | mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); | 916 | mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); |
1021 | topLayout->addWidget(dummyBox,iii++,0); | 917 | topLayout->addWidget(dummyBox,iii++,0); |
1022 | 918 | ||
1023 | dummyBox = new QHBox(topFrame); | 919 | dummyBox = new QHBox(topFrame); |
1024 | new QLabel(i18n("Beeps interval in sec:"),dummyBox); | 920 | new QLabel(i18n("Beeps interval in sec:"),dummyBox); |
1025 | mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); | 921 | mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); |
1026 | topLayout->addWidget(dummyBox,iii++,0); | 922 | topLayout->addWidget(dummyBox,iii++,0); |
1027 | 923 | ||
1028 | dummyBox = new QHBox(topFrame); | 924 | dummyBox = new QHBox(topFrame); |
1029 | new QLabel(i18n("Default suspend time in min:"),dummyBox); | 925 | new QLabel(i18n("Default suspend time in min:"),dummyBox); |
1030 | mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); | 926 | mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); |
1031 | topLayout->addWidget(dummyBox,iii++,0); | 927 | topLayout->addWidget(dummyBox,iii++,0); |
1032 | 928 | ||
1033 | dummyBox = new QHBox(topFrame); | 929 | dummyBox = new QHBox(topFrame); |
1034 | new QLabel(i18n("Auto suspend count:"),dummyBox); | 930 | new QLabel(i18n("Auto suspend count:"),dummyBox); |
1035 | mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); | 931 | mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); |
1036 | topLayout->addWidget(dummyBox,iii++,0); | 932 | topLayout->addWidget(dummyBox,iii++,0); |
1037 | 933 | ||
1038 | 934 | ||
1039 | 935 | ||
1040 | QHBox* hbo = new QHBox ( topFrame ); | 936 | QHBox* hbo = new QHBox ( topFrame ); |
1041 | mDefaultAlarmFile = new QLineEdit(hbo); | 937 | mDefaultAlarmFile = new QLineEdit(hbo); |
1042 | QPushButton * loadTemplate = new QPushButton(hbo); | 938 | QPushButton * loadTemplate = new QPushButton(hbo); |
1043 | QPixmap icon; | 939 | QPixmap icon; |
1044 | if ( QApplication::desktop()->width() < 321 ) | 940 | if ( QApplication::desktop()->width() < 321 ) |
1045 | icon = SmallIcon("fileimport16"); | 941 | icon = SmallIcon("fileimport16"); |
1046 | else | 942 | else |
1047 | icon = SmallIcon("fileimport"); | 943 | icon = SmallIcon("fileimport"); |
1048 | loadTemplate->setIconSet (icon ) ; | 944 | loadTemplate->setIconSet (icon ) ; |
1049 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); | 945 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); |
1050 | int size = loadTemplate->sizeHint().height(); | 946 | int size = loadTemplate->sizeHint().height(); |
1051 | loadTemplate->setFixedSize( size, size ); | 947 | loadTemplate->setFixedSize( size, size ); |
1052 | //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); | 948 | //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); |
1053 | // topLayout->addWidget(lab ,iii++,0); | 949 | // topLayout->addWidget(lab ,iii++,0); |
1054 | lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); | 950 | lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); |
1055 | topLayout->addWidget(lab ,iii++,0); | 951 | topLayout->addWidget(lab ,iii++,0); |
1056 | topLayout->addWidget(hbo,iii++,0); | 952 | topLayout->addWidget(hbo,iii++,0); |
1057 | // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); | 953 | // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); |
1058 | 954 | ||
1059 | // topLayout->addWidget(lab ,iii++,0); | 955 | // topLayout->addWidget(lab ,iii++,0); |
1060 | // #ifndef DESKTOP_VERSION | 956 | // #ifndef DESKTOP_VERSION |
1061 | // lab->setAlignment( AlignLeft|WordBreak|AlignTop); | 957 | // lab->setAlignment( AlignLeft|WordBreak|AlignTop); |
1062 | // #else | 958 | // #else |
1063 | // lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 959 | // lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
1064 | // lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); | 960 | // lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); |
1065 | // #endif | 961 | // #endif |
1066 | 962 | ||
1067 | 963 | ||
1068 | } | 964 | } |
1069 | 965 | ||
1070 | void KOPrefsDialog::selectSoundFile() | 966 | void KOPrefsDialog::selectSoundFile() |
1071 | { | 967 | { |
1072 | QString fileName = mDefaultAlarmFile->text(); | 968 | QString fileName = mDefaultAlarmFile->text(); |
1073 | fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); | 969 | fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); |
1074 | if ( fileName.length() > 0 ) | 970 | if ( fileName.length() > 0 ) |
1075 | mDefaultAlarmFile->setText( fileName ); | 971 | mDefaultAlarmFile->setText( fileName ); |
1076 | } | 972 | } |
1077 | void KOPrefsDialog::setupFontsTab() | 973 | void KOPrefsDialog::setupFontsTab() |
1078 | { | 974 | { |
1079 | 975 | ||
1080 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); | 976 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); |
1081 | // DesktopIcon("fonts",KIcon::SizeMedium)); | 977 | // DesktopIcon("fonts",KIcon::SizeMedium)); |
1082 | 978 | ||
1083 | QGridLayout *topLayout = new QGridLayout(topFrame,7,3); | 979 | QGridLayout *topLayout = new QGridLayout(topFrame,7,3); |
1084 | topLayout->setSpacing(1); | 980 | topLayout->setSpacing(1); |
1085 | topLayout->setMargin(3); | 981 | topLayout->setMargin(3); |
1086 | KPrefsDialogWidFont * tVFont; | 982 | KPrefsDialogWidFont * tVFont; |
1087 | int i = 0; | 983 | int i = 0; |
1088 | KPrefsDialogWidFont *timeLabelsFont = | 984 | KPrefsDialogWidFont *timeLabelsFont = |
1089 | addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), | 985 | addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), |
1090 | &(KOPrefs::instance()->mDateNavigatorFont),topFrame); | 986 | &(KOPrefs::instance()->mDateNavigatorFont),topFrame); |
1091 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 987 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
1092 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 988 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
1093 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 989 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
1094 | ++i; | 990 | ++i; |
1095 | 991 | ||
1096 | 992 | ||
1097 | timeLabelsFont = | 993 | timeLabelsFont = |
1098 | addWidFont(i18n("Mon 15"),i18n("Date Labels:"), | 994 | addWidFont(i18n("Mon 15"),i18n("Date Labels:"), |
1099 | &(KOPrefs::instance()->mTimeLabelsFont),topFrame); | 995 | &(KOPrefs::instance()->mTimeLabelsFont),topFrame); |
1100 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 996 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
1101 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 997 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
1102 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 998 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
1103 | ++i; | 999 | ++i; |
1104 | 1000 | ||
1105 | KPrefsDialogWidFont *timeBarFont = | 1001 | KPrefsDialogWidFont *timeBarFont = |
1106 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), | 1002 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), |
1107 | &(KOPrefs::instance()->mTimeBarFont),topFrame); | 1003 | &(KOPrefs::instance()->mTimeBarFont),topFrame); |
1108 | topLayout->addWidget(timeBarFont->label(),i,0); | 1004 | topLayout->addWidget(timeBarFont->label(),i,0); |
1109 | topLayout->addWidget(timeBarFont->preview(),i,1); | 1005 | topLayout->addWidget(timeBarFont->preview(),i,1); |
1110 | topLayout->addWidget(timeBarFont->button(),i,2); | 1006 | topLayout->addWidget(timeBarFont->button(),i,2); |
1111 | ++i; | 1007 | ++i; |
1112 | 1008 | ||
1113 | 1009 | ||
1114 | KPrefsDialogWidFont *marcusBainsFont = | 1010 | KPrefsDialogWidFont *marcusBainsFont = |
1115 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), | 1011 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), |
1116 | &(KOPrefs::instance()->mMarcusBainsFont),topFrame); | 1012 | &(KOPrefs::instance()->mMarcusBainsFont),topFrame); |
1117 | topLayout->addWidget(marcusBainsFont->label(),i,0); | 1013 | topLayout->addWidget(marcusBainsFont->label(),i,0); |
1118 | topLayout->addWidget(marcusBainsFont->preview(),i,1); | 1014 | topLayout->addWidget(marcusBainsFont->preview(),i,1); |
1119 | topLayout->addWidget(marcusBainsFont->button(),i,2); | 1015 | topLayout->addWidget(marcusBainsFont->button(),i,2); |
1120 | ++i; | 1016 | ++i; |
1121 | 1017 | ||
1122 | tVFont = | 1018 | tVFont = |
1123 | addWidFont(i18n("Summary"),i18n("Event Viewer:"), | 1019 | addWidFont(i18n("Summary"),i18n("Event Viewer:"), |
1124 | &(KOPrefs::instance()->mEventViewFont),topFrame); | 1020 | &(KOPrefs::instance()->mEventViewFont),topFrame); |
1125 | topLayout->addWidget(tVFont->label(),i,0); | 1021 | topLayout->addWidget(tVFont->label(),i,0); |
1126 | topLayout->addWidget(tVFont->preview(),i,1); | 1022 | topLayout->addWidget(tVFont->preview(),i,1); |
1127 | topLayout->addWidget(tVFont->button(),i,2); | 1023 | topLayout->addWidget(tVFont->button(),i,2); |
1128 | ++i; | 1024 | ++i; |
1129 | 1025 | ||
1130 | 1026 | ||
1131 | 1027 | ||
1132 | tVFont = | 1028 | tVFont = |
1133 | addWidFont(i18n("Details"),i18n("EditorBox:"), | 1029 | addWidFont(i18n("Details"),i18n("EditorBox:"), |
1134 | &(KOPrefs::instance()->mEditBoxFont),topFrame); | 1030 | &(KOPrefs::instance()->mEditBoxFont),topFrame); |
1135 | topLayout->addWidget(tVFont->label(),i,0); | 1031 | topLayout->addWidget(tVFont->label(),i,0); |
1136 | topLayout->addWidget(tVFont->preview(),i,1); | 1032 | topLayout->addWidget(tVFont->preview(),i,1); |
1137 | topLayout->addWidget(tVFont->button(),i,2); | 1033 | topLayout->addWidget(tVFont->button(),i,2); |
1138 | ++i; | 1034 | ++i; |
1139 | 1035 | ||
1140 | 1036 | ||
1141 | 1037 | ||
1142 | topLayout->setColStretch(1,1); | 1038 | topLayout->setColStretch(1,1); |
1143 | topLayout->setRowStretch(4,1); | 1039 | topLayout->setRowStretch(4,1); |
1144 | 1040 | ||
1145 | 1041 | ||
1146 | i = 0; | 1042 | i = 0; |
1147 | topFrame = addPage(i18n("View Fonts"),0, | 1043 | topFrame = addPage(i18n("View Fonts"),0, |
1148 | DesktopIcon("fonts",KIcon::SizeMedium)); | 1044 | DesktopIcon("fonts",KIcon::SizeMedium)); |
1149 | 1045 | ||
1150 | topLayout = new QGridLayout(topFrame,7,3); | 1046 | topLayout = new QGridLayout(topFrame,7,3); |
1151 | topLayout->setSpacing(1); | 1047 | topLayout->setSpacing(1); |
1152 | topLayout->setMargin(3); | 1048 | topLayout->setMargin(3); |
1153 | 1049 | ||
1154 | tVFont = | 1050 | tVFont = |
1155 | addWidFont(i18n("Configure KO"),i18n("What's Next View:"), | 1051 | addWidFont(i18n("Configure KO"),i18n("What's Next View:"), |
1156 | &(KOPrefs::instance()->mWhatsNextFont),topFrame); | 1052 | &(KOPrefs::instance()->mWhatsNextFont),topFrame); |
1157 | topLayout->addWidget(tVFont->label(),i,0); | 1053 | topLayout->addWidget(tVFont->label(),i,0); |
1158 | topLayout->addWidget(tVFont->preview(),i,1); | 1054 | topLayout->addWidget(tVFont->preview(),i,1); |
1159 | topLayout->addWidget(tVFont->button(),i,2); | 1055 | topLayout->addWidget(tVFont->button(),i,2); |
1160 | ++i; | 1056 | ++i; |
1161 | KPrefsDialogWidFont *agendaViewFont = | 1057 | KPrefsDialogWidFont *agendaViewFont = |
1162 | addWidFont(i18n("Event text"),i18n("Agenda view:"), | 1058 | addWidFont(i18n("Event text"),i18n("Agenda view:"), |
1163 | &(KOPrefs::instance()->mAgendaViewFont),topFrame); | 1059 | &(KOPrefs::instance()->mAgendaViewFont),topFrame); |
1164 | topLayout->addWidget(agendaViewFont->label(),i,0); | 1060 | topLayout->addWidget(agendaViewFont->label(),i,0); |
1165 | topLayout->addWidget(agendaViewFont->preview(),i,1); | 1061 | topLayout->addWidget(agendaViewFont->preview(),i,1); |
1166 | topLayout->addWidget(agendaViewFont->button(),i,2); | 1062 | topLayout->addWidget(agendaViewFont->button(),i,2); |
1167 | ++i; | 1063 | ++i; |
1168 | 1064 | ||
1169 | 1065 | ||
1170 | KPrefsDialogWidFont *monthViewFont = | 1066 | KPrefsDialogWidFont *monthViewFont = |
1171 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), | 1067 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), |
1172 | i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); | 1068 | i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); |
1173 | topLayout->addWidget(monthViewFont->label(),i,0); | 1069 | topLayout->addWidget(monthViewFont->label(),i,0); |
1174 | topLayout->addWidget(monthViewFont->preview(),i,1); | 1070 | topLayout->addWidget(monthViewFont->preview(),i,1); |
1175 | topLayout->addWidget(monthViewFont->button(),i,2); | 1071 | topLayout->addWidget(monthViewFont->button(),i,2); |
1176 | ++i; | 1072 | ++i; |
1177 | 1073 | ||
1178 | 1074 | ||
1179 | KPrefsDialogWidFont *lVFont = | 1075 | KPrefsDialogWidFont *lVFont = |
1180 | addWidFont(i18n("Event"),i18n("List View:"), | 1076 | addWidFont(i18n("Event"),i18n("List View:"), |
1181 | &(KOPrefs::instance()->mListViewFont),topFrame); | 1077 | &(KOPrefs::instance()->mListViewFont),topFrame); |
1182 | topLayout->addWidget(lVFont->label(),i,0); | 1078 | topLayout->addWidget(lVFont->label(),i,0); |
1183 | topLayout->addWidget(lVFont->preview(),i,1); | 1079 | topLayout->addWidget(lVFont->preview(),i,1); |
1184 | topLayout->addWidget(lVFont->button(),i,2); | 1080 | topLayout->addWidget(lVFont->button(),i,2); |
1185 | ++i; | 1081 | ++i; |
1186 | 1082 | ||
1187 | 1083 | ||
1188 | tVFont = | 1084 | tVFont = |
1189 | addWidFont(i18n("ToDo"),i18n("ToDoView:"), | 1085 | addWidFont(i18n("ToDo"),i18n("ToDoView:"), |
1190 | &(KOPrefs::instance()->mTodoViewFont),topFrame); | 1086 | &(KOPrefs::instance()->mTodoViewFont),topFrame); |
1191 | topLayout->addWidget(tVFont->label(),i,0); | 1087 | topLayout->addWidget(tVFont->label(),i,0); |
1192 | topLayout->addWidget(tVFont->preview(),i,1); | 1088 | topLayout->addWidget(tVFont->preview(),i,1); |
1193 | topLayout->addWidget(tVFont->button(),i,2); | 1089 | topLayout->addWidget(tVFont->button(),i,2); |
1194 | ++i; | 1090 | ++i; |
1195 | 1091 | ||
1196 | 1092 | ||
1197 | tVFont = | 1093 | tVFont = |
1198 | addWidFont(i18n("Today"),i18n("JournalView:"), | 1094 | addWidFont(i18n("Today"),i18n("JournalView:"), |
1199 | &(KOPrefs::instance()->mJornalViewFont),topFrame); | 1095 | &(KOPrefs::instance()->mJornalViewFont),topFrame); |
1200 | topLayout->addWidget(tVFont->label(),i,0); | 1096 | topLayout->addWidget(tVFont->label(),i,0); |
1201 | topLayout->addWidget(tVFont->preview(),i,1); | 1097 | topLayout->addWidget(tVFont->preview(),i,1); |
1202 | topLayout->addWidget(tVFont->button(),i,2); | 1098 | topLayout->addWidget(tVFont->button(),i,2); |
1203 | ++i; | 1099 | ++i; |
1204 | 1100 | ||
1205 | 1101 | ||
1206 | 1102 | ||
1207 | 1103 | ||
1208 | topLayout->setColStretch(1,1); | 1104 | topLayout->setColStretch(1,1); |
1209 | topLayout->setRowStretch(4,1); | 1105 | topLayout->setRowStretch(4,1); |
1210 | 1106 | ||
1211 | 1107 | ||
1212 | 1108 | ||
1213 | 1109 | ||
1214 | } | 1110 | } |
1215 | 1111 | ||
1216 | void KOPrefsDialog::setupColorsTab() | 1112 | void KOPrefsDialog::setupColorsTab() |
1217 | { | 1113 | { |
1218 | QFrame *topFrame = addPage(i18n("Colors"),0,0); | 1114 | QFrame *topFrame = addPage(i18n("Colors"),0,0); |
1219 | // DesktopIcon("colorize",KIcon::SizeMedium)); | 1115 | // DesktopIcon("colorize",KIcon::SizeMedium)); |
1220 | 1116 | ||
1221 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); | 1117 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); |
1222 | // topLayout->setSpacing(mSpacingHint); | 1118 | // topLayout->setSpacing(mSpacingHint); |
1223 | // topLayout->setMargin(mMarginHint); | 1119 | // topLayout->setMargin(mMarginHint); |
1224 | 1120 | ||
1225 | topLayout->setSpacing(2); | 1121 | topLayout->setSpacing(2); |
1226 | topLayout->setMargin(3); | 1122 | topLayout->setMargin(3); |
1227 | 1123 | ||
1228 | int ii = 1; | 1124 | int ii = 1; |
1229 | QGroupBox *categoryGroup ; | 1125 | QGroupBox *categoryGroup ; |
1230 | 1126 | ||
1231 | categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), | 1127 | categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), |
1232 | topFrame); | 1128 | topFrame); |
1233 | topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); | 1129 | topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); |
1234 | 1130 | ||
1235 | mCategoryCombo = new QComboBox(categoryGroup); | 1131 | mCategoryCombo = new QComboBox(categoryGroup); |
1236 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); | 1132 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); |
1237 | connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); | 1133 | connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); |
1238 | 1134 | ||
1239 | mCategoryButton = new KColorButton(categoryGroup); | 1135 | mCategoryButton = new KColorButton(categoryGroup); |
1240 | connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); | 1136 | connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); |
1241 | updateCategoryColor(); | 1137 | updateCategoryColor(); |
1242 | 1138 | ||
1243 | 1139 | ||
1244 | // Holiday Color | 1140 | // Holiday Color |
1245 | 1141 | ||
1246 | KPrefsDialogWidColor *holidayColor = | 1142 | KPrefsDialogWidColor *holidayColor = |
1247 | addWidColor(i18n("Holiday color:"), | 1143 | addWidColor(i18n("Holiday color:"), |
1248 | &(KOPrefs::instance()->mHolidayColor),topFrame); | 1144 | &(KOPrefs::instance()->mHolidayColor),topFrame); |
1249 | topLayout->addWidget(holidayColor->label(),ii,0); | 1145 | topLayout->addWidget(holidayColor->label(),ii,0); |
1250 | topLayout->addWidget(holidayColor->button(),ii++,1); | 1146 | topLayout->addWidget(holidayColor->button(),ii++,1); |
1251 | 1147 | ||
1252 | // Highlight Color | 1148 | // Highlight Color |
1253 | KPrefsDialogWidColor *highlightColor = | 1149 | KPrefsDialogWidColor *highlightColor = |
1254 | addWidColor(i18n("Highlight color:"), | 1150 | addWidColor(i18n("Highlight color:"), |
1255 | &(KOPrefs::instance()->mHighlightColor),topFrame); | 1151 | &(KOPrefs::instance()->mHighlightColor),topFrame); |
1256 | topLayout->addWidget(highlightColor->label(),ii,0); | 1152 | topLayout->addWidget(highlightColor->label(),ii,0); |
1257 | topLayout->addWidget(highlightColor->button(),ii++,1); | 1153 | topLayout->addWidget(highlightColor->button(),ii++,1); |
1258 | 1154 | ||
1259 | // Event color | 1155 | // Event color |
1260 | KPrefsDialogWidColor *eventColor = | 1156 | KPrefsDialogWidColor *eventColor = |
1261 | addWidColor(i18n("Default event color:"), | 1157 | addWidColor(i18n("Default event color:"), |
1262 | &(KOPrefs::instance()->mEventColor),topFrame); | 1158 | &(KOPrefs::instance()->mEventColor),topFrame); |
1263 | topLayout->addWidget(eventColor->label(),ii,0); | 1159 | topLayout->addWidget(eventColor->label(),ii,0); |
1264 | topLayout->addWidget(eventColor->button(),ii++,1); | 1160 | topLayout->addWidget(eventColor->button(),ii++,1); |
1265 | eventColor = | 1161 | eventColor = |
1266 | addWidColor(i18n("Default todo done color:"), | 1162 | addWidColor(i18n("Default todo done color:"), |
1267 | &(KOPrefs::instance()->mTodoDoneColor),topFrame); | 1163 | &(KOPrefs::instance()->mTodoDoneColor),topFrame); |
1268 | topLayout->addWidget(eventColor->label(),ii,0); | 1164 | topLayout->addWidget(eventColor->label(),ii,0); |
1269 | topLayout->addWidget(eventColor->button(),ii++,1); | 1165 | topLayout->addWidget(eventColor->button(),ii++,1); |
1270 | 1166 | ||
1271 | 1167 | ||
1272 | // agenda view background color | 1168 | // agenda view background color |
1273 | KPrefsDialogWidColor *agendaBgColor = | 1169 | KPrefsDialogWidColor *agendaBgColor = |
1274 | addWidColor(i18n("Agenda view background color:"), | 1170 | addWidColor(i18n("Agenda view background color:"), |
1275 | &(KOPrefs::instance()->mAgendaBgColor),topFrame); | 1171 | &(KOPrefs::instance()->mAgendaBgColor),topFrame); |
1276 | topLayout->addWidget(agendaBgColor->label(),ii,0); | 1172 | topLayout->addWidget(agendaBgColor->label(),ii,0); |
1277 | topLayout->addWidget(agendaBgColor->button(),ii++,1); | 1173 | topLayout->addWidget(agendaBgColor->button(),ii++,1); |
1278 | 1174 | ||
1279 | // working hours color | 1175 | // working hours color |
1280 | KPrefsDialogWidColor *workingHoursColor = | 1176 | KPrefsDialogWidColor *workingHoursColor = |
1281 | addWidColor(i18n("Working hours color:"), | 1177 | addWidColor(i18n("Working hours color:"), |
1282 | &(KOPrefs::instance()->mWorkingHoursColor),topFrame); | 1178 | &(KOPrefs::instance()->mWorkingHoursColor),topFrame); |
1283 | topLayout->addWidget(workingHoursColor->label(),ii,0); | 1179 | topLayout->addWidget(workingHoursColor->label(),ii,0); |
1284 | topLayout->addWidget(workingHoursColor->button(),ii++,1); | 1180 | topLayout->addWidget(workingHoursColor->button(),ii++,1); |
1285 | 1181 | ||
1286 | KPrefsDialogWidBool *sb = | 1182 | KPrefsDialogWidBool *sb = |
1287 | addWidBool(i18n("Use colors for application:"), | 1183 | addWidBool(i18n("Use colors for application:"), |
1288 | &(KOPrefs::instance()->mUseAppColors),topFrame); | 1184 | &(KOPrefs::instance()->mUseAppColors),topFrame); |
1289 | topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); | 1185 | topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); |
1290 | 1186 | ||
1291 | ii++; | 1187 | ii++; |
1292 | KPrefsDialogWidColor * workingHoursColor1 = | 1188 | KPrefsDialogWidColor * workingHoursColor1 = |
1293 | addWidColor(i18n("Buttons, menus, etc.:"), | 1189 | addWidColor(i18n("Buttons, menus, etc.:"), |
1294 | &(KOPrefs::instance()->mAppColor1),topFrame); | 1190 | &(KOPrefs::instance()->mAppColor1),topFrame); |
1295 | topLayout->addWidget(workingHoursColor1->label(),ii,0); | 1191 | topLayout->addWidget(workingHoursColor1->label(),ii,0); |
1296 | topLayout->addWidget(workingHoursColor1->button(),ii++,1); | 1192 | topLayout->addWidget(workingHoursColor1->button(),ii++,1); |
1297 | 1193 | ||
1298 | KPrefsDialogWidColor * workingHoursColor2 = | 1194 | KPrefsDialogWidColor * workingHoursColor2 = |
1299 | addWidColor(i18n("Frames, labels, etc.:"), | 1195 | addWidColor(i18n("Frames, labels, etc.:"), |
1300 | &(KOPrefs::instance()->mAppColor2),topFrame); | 1196 | &(KOPrefs::instance()->mAppColor2),topFrame); |
1301 | topLayout->addWidget(workingHoursColor2->label(),ii,0); | 1197 | topLayout->addWidget(workingHoursColor2->label(),ii,0); |
1302 | topLayout->addWidget(workingHoursColor2->button(),ii++,1); | 1198 | topLayout->addWidget(workingHoursColor2->button(),ii++,1); |
1303 | 1199 | ||
1304 | 1200 | ||
1305 | 1201 | ||
1306 | } | 1202 | } |
1307 | 1203 | ||
1308 | void KOPrefsDialog::setCategoryColor() | 1204 | void KOPrefsDialog::setCategoryColor() |
1309 | { | 1205 | { |
1310 | mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); | 1206 | mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); |
1311 | } | 1207 | } |
1312 | 1208 | ||
1313 | void KOPrefsDialog::updateCategoryColor() | 1209 | void KOPrefsDialog::updateCategoryColor() |
1314 | { | 1210 | { |
1315 | QString cat = mCategoryCombo->currentText(); | 1211 | QString cat = mCategoryCombo->currentText(); |
1316 | QColor *color = mCategoryDict.find(cat); | 1212 | QColor *color = mCategoryDict.find(cat); |
1317 | if (!color) { | 1213 | if (!color) { |
1318 | color = KOPrefs::instance()->categoryColor(cat); | 1214 | color = KOPrefs::instance()->categoryColor(cat); |
1319 | } | 1215 | } |
1320 | if (color) { | 1216 | if (color) { |
1321 | mCategoryButton->setColor(*color); | 1217 | mCategoryButton->setColor(*color); |
1322 | } | 1218 | } |
1323 | } | 1219 | } |
1324 | 1220 | ||
1325 | void KOPrefsDialog::setupPrinterTab() | 1221 | void KOPrefsDialog::setupPrinterTab() |
1326 | { | 1222 | { |
1327 | mPrinterTab = addPage(i18n("Printing"),0, | 1223 | mPrinterTab = addPage(i18n("Printing"),0, |
1328 | DesktopIcon("fileprint",KIcon::SizeMedium)); | 1224 | DesktopIcon("fileprint",KIcon::SizeMedium)); |
1329 | 1225 | ||
1330 | QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); | 1226 | QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); |
1331 | topLayout->setSpacing(mSpacingHint); | 1227 | topLayout->setSpacing(mSpacingHint); |
1332 | topLayout->setMargin(mMarginHint); | 1228 | topLayout->setMargin(mMarginHint); |
1333 | 1229 | ||
1334 | topLayout->setRowStretch(4,1); | 1230 | topLayout->setRowStretch(4,1); |
1335 | } | 1231 | } |
1336 | 1232 | ||
1337 | void KOPrefsDialog::setupGroupSchedulingTab() | 1233 | void KOPrefsDialog::setupGroupSchedulingTab() |
1338 | { | 1234 | { |
1339 | #if 0 | 1235 | #if 0 |
1340 | QFrame *topFrame = addPage(i18n("Group Scheduling"),0, | 1236 | QFrame *topFrame = addPage(i18n("Group Scheduling"),0, |
1341 | DesktopIcon("personal",KIcon::SizeMedium)); | 1237 | DesktopIcon("personal",KIcon::SizeMedium)); |
1342 | 1238 | ||
1343 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); | 1239 | QGridLayout *topLayout = new QGridLayout(topFrame,6,2); |
1344 | topLayout->setSpacing(mSpacingHint); | 1240 | topLayout->setSpacing(mSpacingHint); |
1345 | topLayout->setMargin(mMarginHint); | 1241 | topLayout->setMargin(mMarginHint); |
1346 | 1242 | ||
1347 | #if 0 | 1243 | #if 0 |
1348 | KPrefsDialogWidRadios *schedulerGroup = | 1244 | KPrefsDialogWidRadios *schedulerGroup = |
1349 | addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), | 1245 | addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), |
1350 | topFrame); | 1246 | topFrame); |
1351 | schedulerGroup->addRadio("Dummy"); // Only for debugging | 1247 | schedulerGroup->addRadio("Dummy"); // Only for debugging |
1352 | schedulerGroup->addRadio(i18n("Mail client")); | 1248 | schedulerGroup->addRadio(i18n("Mail client")); |
1353 | 1249 | ||
1354 | topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); | 1250 | topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); |
1355 | #endif | 1251 | #endif |
1356 | 1252 | ||
1357 | KPrefsDialogWidRadios *sendGroup = | 1253 | KPrefsDialogWidRadios *sendGroup = |
1358 | addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), | 1254 | addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), |
1359 | topFrame); | 1255 | topFrame); |
1360 | sendGroup->addRadio(i18n("Send to outbox")); | 1256 | sendGroup->addRadio(i18n("Send to outbox")); |
1361 | sendGroup->addRadio(i18n("Send directly")); | 1257 | sendGroup->addRadio(i18n("Send directly")); |
1362 | 1258 | ||
1363 | topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); | 1259 | topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); |
1364 | 1260 | ||
1365 | topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); | 1261 | topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); |
1366 | mAMails = new QListView(topFrame); | 1262 | mAMails = new QListView(topFrame); |
1367 | mAMails->addColumn(i18n("Email"),300); | 1263 | mAMails->addColumn(i18n("Email"),300); |
1368 | topLayout->addMultiCellWidget(mAMails,3,3,0,1); | 1264 | topLayout->addMultiCellWidget(mAMails,3,3,0,1); |
1369 | 1265 | ||
1370 | topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); | 1266 | topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); |
1371 | aEmailsEdit = new QLineEdit(topFrame); | 1267 | aEmailsEdit = new QLineEdit(topFrame); |
1372 | aEmailsEdit->setEnabled(false); | 1268 | aEmailsEdit->setEnabled(false); |
1373 | topLayout->addWidget(aEmailsEdit,4,1); | 1269 | topLayout->addWidget(aEmailsEdit,4,1); |
1374 | 1270 | ||
1375 | QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); | 1271 | QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); |
1376 | topLayout->addWidget(add,5,0); | 1272 | topLayout->addWidget(add,5,0); |
1377 | QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); | 1273 | QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); |
1378 | topLayout->addWidget(del,5,1); | 1274 | topLayout->addWidget(del,5,1); |
1379 | 1275 | ||
1380 | //topLayout->setRowStretch(2,1); | 1276 | //topLayout->setRowStretch(2,1); |
1381 | connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); | 1277 | connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); |
1382 | connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); | 1278 | connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); |
1383 | connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); | 1279 | connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); |
1384 | connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); | 1280 | connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); |
1385 | #endif | 1281 | #endif |
1386 | } | 1282 | } |
1387 | 1283 | ||
1388 | void KOPrefsDialog::setupGroupAutomationTab() | 1284 | void KOPrefsDialog::setupGroupAutomationTab() |
1389 | { | 1285 | { |
1390 | return; | 1286 | return; |
1391 | QFrame *topFrame = addPage(i18n("Group Automation"),0, | 1287 | QFrame *topFrame = addPage(i18n("Group Automation"),0, |
1392 | DesktopIcon("personal",KIcon::SizeMedium)); | 1288 | DesktopIcon("personal",KIcon::SizeMedium)); |
1393 | 1289 | ||
1394 | QGridLayout *topLayout = new QGridLayout(topFrame,5,1); | 1290 | QGridLayout *topLayout = new QGridLayout(topFrame,5,1); |
1395 | topLayout->setSpacing(mSpacingHint); | 1291 | topLayout->setSpacing(mSpacingHint); |
1396 | topLayout->setMargin(mMarginHint); | 1292 | topLayout->setMargin(mMarginHint); |
1397 | 1293 | ||
1398 | KPrefsDialogWidRadios *autoRefreshGroup = | 1294 | KPrefsDialogWidRadios *autoRefreshGroup = |
1399 | addWidRadios(i18n("Auto Send Refresh"), | 1295 | addWidRadios(i18n("Auto Send Refresh"), |
1400 | &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); | 1296 | &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); |
1401 | autoRefreshGroup->addRadio(i18n("Never")); | 1297 | autoRefreshGroup->addRadio(i18n("Never")); |
1402 | autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); | 1298 | autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); |
1403 | //autoRefreshGroup->addRadio(i18n("selected emails")); | 1299 | //autoRefreshGroup->addRadio(i18n("selected emails")); |
1404 | topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); | 1300 | topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); |
1405 | 1301 | ||
1406 | KPrefsDialogWidRadios *autoInsertGroup = | 1302 | KPrefsDialogWidRadios *autoInsertGroup = |
1407 | addWidRadios(i18n("Auto Insert IMIP Replies"), | 1303 | addWidRadios(i18n("Auto Insert IMIP Replies"), |
1408 | &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); | 1304 | &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); |
1409 | autoInsertGroup->addRadio(i18n("Never")); | 1305 | autoInsertGroup->addRadio(i18n("Never")); |
1410 | autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); | 1306 | autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); |
1411 | //autoInsertGroup->addRadio(i18n("selected emails")); | 1307 | //autoInsertGroup->addRadio(i18n("selected emails")); |
1412 | topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); | 1308 | topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); |
1413 | 1309 | ||
1414 | KPrefsDialogWidRadios *autoRequestGroup = | 1310 | KPrefsDialogWidRadios *autoRequestGroup = |
1415 | addWidRadios(i18n("Auto Insert IMIP Requests"), | 1311 | addWidRadios(i18n("Auto Insert IMIP Requests"), |
1416 | &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); | 1312 | &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); |
1417 | autoRequestGroup->addRadio(i18n("Never")); | 1313 | autoRequestGroup->addRadio(i18n("Never")); |
1418 | autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); | 1314 | autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); |
1419 | //autoInsertGroup->addRadio(i18n("selected emails")); | 1315 | //autoInsertGroup->addRadio(i18n("selected emails")); |
1420 | topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); | 1316 | topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); |
1421 | 1317 | ||
1422 | KPrefsDialogWidRadios *autoFreeBusyGroup = | 1318 | KPrefsDialogWidRadios *autoFreeBusyGroup = |
1423 | addWidRadios(i18n("Auto Send FreeBusy Information"), | 1319 | addWidRadios(i18n("Auto Send FreeBusy Information"), |
1424 | &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); | 1320 | &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); |
1425 | autoFreeBusyGroup->addRadio(i18n("Never")); | 1321 | autoFreeBusyGroup->addRadio(i18n("Never")); |
1426 | autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); | 1322 | autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); |
1427 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); | 1323 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); |
1428 | topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); | 1324 | topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); |
1429 | 1325 | ||
1430 | KPrefsDialogWidRadios *autoFreeBusyReplyGroup = | 1326 | KPrefsDialogWidRadios *autoFreeBusyReplyGroup = |
1431 | addWidRadios(i18n("Auto Save FreeBusy Replies"), | 1327 | addWidRadios(i18n("Auto Save FreeBusy Replies"), |
1432 | &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); | 1328 | &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); |
1433 | autoFreeBusyReplyGroup->addRadio(i18n("Never")); | 1329 | autoFreeBusyReplyGroup->addRadio(i18n("Never")); |
1434 | autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); | 1330 | autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); |
1435 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); | 1331 | //autoFreeBusyGroup->addRadio(i18n("selected emails")); |
1436 | topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); | 1332 | topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); |
1437 | } | 1333 | } |
1438 | 1334 | ||
1439 | void KOPrefsDialog::showPrinterTab() | 1335 | void KOPrefsDialog::showPrinterTab() |
1440 | { | 1336 | { |
1441 | showPage(pageIndex(mPrinterTab)); | 1337 | showPage(pageIndex(mPrinterTab)); |
1442 | } | 1338 | } |
1443 | 1339 | ||
1444 | 1340 | ||
1445 | void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, | 1341 | void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, |
1446 | const QStringList *tags) | 1342 | const QStringList *tags) |
1447 | { | 1343 | { |
1448 | if (tags) { | 1344 | if (tags) { |
1449 | int i = tags->findIndex(text); | 1345 | int i = tags->findIndex(text); |
1450 | if (i > 0) combo->setCurrentItem(i); | 1346 | if (i > 0) combo->setCurrentItem(i); |
1451 | } else { | 1347 | } else { |
1452 | for(int i=0;i<combo->count();++i) { | 1348 | for(int i=0;i<combo->count();++i) { |
1453 | if (combo->text(i) == text) { | 1349 | if (combo->text(i) == text) { |
1454 | combo->setCurrentItem(i); | 1350 | combo->setCurrentItem(i); |
1455 | break; | 1351 | break; |
1456 | } | 1352 | } |
1457 | } | 1353 | } |
1458 | } | 1354 | } |
1459 | } | 1355 | } |
1460 | 1356 | ||
1461 | void KOPrefsDialog::usrReadConfig() | 1357 | void KOPrefsDialog::usrReadConfig() |
1462 | { | 1358 | { |
1463 | if ( kdelibcfg ) | 1359 | |
1464 | kdelibcfg->readConfig(); | ||
1465 | else { | ||
1466 | mNameEdit->setText(KOPrefs::instance()->fullName()); | 1360 | mNameEdit->setText(KOPrefs::instance()->fullName()); |
1467 | mEmailEdit->setText(KOPrefs::instance()->email()); | 1361 | mEmailEdit->setText(KOPrefs::instance()->email()); |
1468 | 1362 | ||
1469 | mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); | 1363 | mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); |
1470 | // QDate current ( 2001, 1,1); | 1364 | |
1471 | //mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); | ||
1472 | //mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); | ||
1473 | //setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId)); | ||
1474 | //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); | ||
1475 | mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); | 1365 | mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); |
1476 | mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); | 1366 | mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); |
1477 | mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); | 1367 | mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); |
1478 | // if (KOPrefs::instance()->mAllDaySize > 47 ) | ||
1479 | // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2; | ||
1480 | //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize); | ||
1481 | 1368 | ||
1482 | mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); | 1369 | mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); |
1483 | mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); | 1370 | mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); |
1484 | mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); | 1371 | mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); |
1485 | // mAMails->clear(); | 1372 | // mAMails->clear(); |
1486 | // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); | 1373 | // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); |
1487 | // it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { | 1374 | // it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { |
1488 | // QListViewItem *item = new QListViewItem(mAMails); | 1375 | // QListViewItem *item = new QListViewItem(mAMails); |
1489 | // item->setText(0,*it); | 1376 | // item->setText(0,*it); |
1490 | // mAMails->insertItem(item); | 1377 | // mAMails->insertItem(item); |
1491 | // } | 1378 | // } |
1492 | 1379 | ||
1493 | // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP); | ||
1494 | //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser); | ||
1495 | //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd); | ||
1496 | //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile); | ||
1497 | |||
1498 | //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); | 1380 | //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); |
1499 | mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); | 1381 | mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); |
1500 | //QString dummy = KOPrefs::instance()->mUserDateFormatLong; | ||
1501 | //mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); | ||
1502 | //dummy = KOPrefs::instance()->mUserDateFormatShort; | ||
1503 | //mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); | ||
1504 | updateCategories(); | 1382 | updateCategories(); |
1505 | mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); | 1383 | mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); |
1506 | mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); | 1384 | mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); |
1507 | mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); | 1385 | mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); |
1508 | mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); | 1386 | mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); |
1509 | } | 1387 | |
1510 | } | 1388 | } |
1511 | 1389 | ||
1512 | 1390 | ||
1513 | void KOPrefsDialog::usrWriteConfig() | 1391 | void KOPrefsDialog::usrWriteConfig() |
1514 | { | 1392 | { |
1515 | if ( kdelibcfg ) | 1393 | |
1516 | kdelibcfg->writeConfig(); | 1394 | |
1517 | else { | ||
1518 | // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text(); | ||
1519 | //KOPrefs::instance()->mRemoteUser = mRemoteUser->text(); | ||
1520 | //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text(); | ||
1521 | //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); | ||
1522 | //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); | ||
1523 | KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); | 1395 | KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); |
1524 | |||
1525 | //KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); | ||
1526 | //KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); | ||
1527 | KOPrefs::instance()->setFullName(mNameEdit->text()); | 1396 | KOPrefs::instance()->setFullName(mNameEdit->text()); |
1528 | KOPrefs::instance()->setEmail(mEmailEdit->text()); | 1397 | KOPrefs::instance()->setEmail(mEmailEdit->text()); |
1529 | 1398 | ||
1530 | KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); | 1399 | KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); |
1531 | |||
1532 | // KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); | ||
1533 | //QDate date; | ||
1534 | //date = mStartDateSavingEdit->date(); | ||
1535 | //int sub = 0; | ||
1536 | //if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | ||
1537 | // sub = 1; | ||
1538 | // KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; | ||
1539 | // date = mEndDateSavingEdit->date(); | ||
1540 | // if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) | ||
1541 | // sub = 1; | ||
1542 | // else | ||
1543 | // sub = 0; | ||
1544 | // KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; | ||
1545 | // // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); | ||
1546 | |||
1547 | KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); | 1400 | KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); |
1548 | KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); | 1401 | KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); |
1549 | KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); | 1402 | KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); |
1550 | 1403 | ||
1551 | //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); | ||
1552 | |||
1553 | QDictIterator<QColor> it(mCategoryDict); | 1404 | QDictIterator<QColor> it(mCategoryDict); |
1554 | while (it.current()) { | 1405 | while (it.current()) { |
1555 | KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); | 1406 | KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); |
1556 | ++it; | 1407 | ++it; |
1557 | } | 1408 | } |
1558 | 1409 | ||
1559 | KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); | 1410 | KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); |
1560 | KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); | 1411 | KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); |
1561 | KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); | 1412 | KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); |
1562 | 1413 | ||
1563 | KOPrefs::instance()->mAdditionalMails.clear(); | 1414 | KOPrefs::instance()->mAdditionalMails.clear(); |
1564 | // QListViewItem *item; | 1415 | // QListViewItem *item; |
1565 | // item = mAMails->firstChild(); | 1416 | // item = mAMails->firstChild(); |
1566 | // while (item) | 1417 | // while (item) |
1567 | // { | 1418 | // { |
1568 | // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); | 1419 | // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); |
1569 | // item = item->nextSibling(); | 1420 | // item = item->nextSibling(); |
1570 | // } | 1421 | // } |
1571 | KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); | 1422 | KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); |
1572 | KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; | 1423 | KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; |
1573 | KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; | 1424 | KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; |
1574 | KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; | 1425 | KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; |
1575 | } | 1426 | |
1576 | } | 1427 | } |
1577 | 1428 | ||
1578 | void KOPrefsDialog::updateCategories() | 1429 | void KOPrefsDialog::updateCategories() |
1579 | { | 1430 | { |
1580 | mCategoryCombo->clear(); | 1431 | mCategoryCombo->clear(); |
1581 | mCategoryDict.clear(); | 1432 | mCategoryDict.clear(); |
1582 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); | 1433 | mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); |
1583 | updateCategoryColor(); | 1434 | updateCategoryColor(); |
1584 | } | 1435 | } |
1585 | 1436 | ||
1586 | void KOPrefsDialog::warningGroupScheduling() | ||
1587 | { | ||
1588 | warningExperimental(mEnableGroupScheduling->checkBox()->isChecked()); | ||
1589 | } | ||
1590 | |||
1591 | void KOPrefsDialog::warningProjectView() | ||
1592 | { | ||
1593 | warningExperimental(mEnableProjectView->checkBox()->isChecked()); | ||
1594 | } | ||
1595 | |||
1596 | void KOPrefsDialog::warningExperimental(bool on) | ||
1597 | { | ||
1598 | if (on) { | ||
1599 | KMessageBox::information(this,i18n("This is an experimental feature. " | ||
1600 | "It may not work, it may do nothing useful and it may cause data loss. " | ||
1601 | "Use with care.\n" | ||
1602 | "You have to restart KOrganizer for this setting to take effect.")); | ||
1603 | } else { | ||
1604 | KMessageBox::information(this, | ||
1605 | i18n("You have to restart KOrganizer for this setting to take effect.")); | ||
1606 | } | ||
1607 | } | ||
1608 | |||
1609 | void KOPrefsDialog::toggleEmailSettings(bool on) | 1437 | void KOPrefsDialog::toggleEmailSettings(bool on) |
1610 | { | 1438 | { |
1611 | if (on) { | 1439 | if (on) { |
1612 | mEmailEdit->setEnabled(false); | 1440 | mEmailEdit->setEnabled(false); |
1613 | mNameEdit->setEnabled(false); | 1441 | mNameEdit->setEnabled(false); |
1614 | mEmailLabel->setEnabled(false); | 1442 | mEmailLabel->setEnabled(false); |
1615 | mNameLabel->setEnabled(false); | 1443 | mNameLabel->setEnabled(false); |
1616 | 1444 | ||
1617 | KEMailSettings settings; | 1445 | KEMailSettings settings; |
1618 | mNameEdit->setText(settings.getSetting(KEMailSettings::RealName)); | 1446 | mNameEdit->setText(settings.getSetting(KEMailSettings::RealName)); |
1619 | mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress)); | 1447 | mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress)); |
1620 | } else { | 1448 | } else { |
1621 | mEmailEdit->setEnabled(true); | 1449 | mEmailEdit->setEnabled(true); |
1622 | mNameEdit->setEnabled(true); | 1450 | mNameEdit->setEnabled(true); |
1623 | mEmailLabel->setEnabled(true); | 1451 | mEmailLabel->setEnabled(true); |
1624 | mNameLabel->setEnabled(true); | 1452 | mNameLabel->setEnabled(true); |
1625 | } | 1453 | } |
1626 | } | 1454 | } |
1627 | 1455 | ||
1628 | void KOPrefsDialog::addItem() | 1456 | void KOPrefsDialog::addItem() |
1629 | { | 1457 | { |
1630 | // aEmailsEdit->setEnabled(true); | 1458 | // aEmailsEdit->setEnabled(true); |
1631 | // QListViewItem *item = new QListViewItem(mAMails); | 1459 | // QListViewItem *item = new QListViewItem(mAMails); |
1632 | // mAMails->insertItem(item); | 1460 | // mAMails->insertItem(item); |
1633 | // mAMails->setSelected(item,true); | 1461 | // mAMails->setSelected(item,true); |
1634 | // aEmailsEdit->setText(i18n("(EmptyEmail)")); | 1462 | // aEmailsEdit->setText(i18n("(EmptyEmail)")); |
1635 | } | 1463 | } |
1636 | 1464 | ||
1637 | void KOPrefsDialog::removeItem() | 1465 | void KOPrefsDialog::removeItem() |
1638 | { | 1466 | { |
1639 | // QListViewItem *item; | 1467 | // QListViewItem *item; |
1640 | // item = mAMails->selectedItem(); | 1468 | // item = mAMails->selectedItem(); |
1641 | // if (!item) return; | 1469 | // if (!item) return; |
1642 | // mAMails->takeItem(item); | 1470 | // mAMails->takeItem(item); |
1643 | // item = mAMails->selectedItem(); | 1471 | // item = mAMails->selectedItem(); |
1644 | // if (!item) { | 1472 | // if (!item) { |
1645 | // aEmailsEdit->setText(""); | 1473 | // aEmailsEdit->setText(""); |
1646 | // aEmailsEdit->setEnabled(false); | 1474 | // aEmailsEdit->setEnabled(false); |
1647 | // } | 1475 | // } |
1648 | // if (mAMails->childCount() == 0) { | 1476 | // if (mAMails->childCount() == 0) { |
1649 | // aEmailsEdit->setEnabled(false); | 1477 | // aEmailsEdit->setEnabled(false); |
1650 | // } | 1478 | // } |
1651 | } | 1479 | } |
1652 | 1480 | ||
1653 | void KOPrefsDialog::updateItem() | 1481 | void KOPrefsDialog::updateItem() |
1654 | { | 1482 | { |
1655 | // QListViewItem *item; | 1483 | // QListViewItem *item; |
1656 | // item = mAMails->selectedItem(); | 1484 | // item = mAMails->selectedItem(); |
1657 | // if (!item) return; | 1485 | // if (!item) return; |
1658 | // item->setText(0,aEmailsEdit->text()); | 1486 | // item->setText(0,aEmailsEdit->text()); |
1659 | } | 1487 | } |
1660 | 1488 | ||
1661 | void KOPrefsDialog::updateInput() | 1489 | void KOPrefsDialog::updateInput() |
1662 | { | 1490 | { |
1663 | // QListViewItem *item; | 1491 | // QListViewItem *item; |
1664 | // item = mAMails->selectedItem(); | 1492 | // item = mAMails->selectedItem(); |
1665 | // if (!item) return; | 1493 | // if (!item) return; |
1666 | // aEmailsEdit->setEnabled(true); | 1494 | // aEmailsEdit->setEnabled(true); |
1667 | // aEmailsEdit->setText(item->text(0)); | 1495 | // aEmailsEdit->setText(item->text(0)); |
1668 | } | 1496 | } |
1669 | void KOPrefsDialog::updateTimezoneOffset( int index ) | ||
1670 | { | ||
1671 | /* | ||
1672 | qDebug("updateTimezoneOffset %d ", index); | ||
1673 | if ( index < 24 ) { | ||
1674 | mTimezoneOffsetSpin->setEnabled ( false ); | ||
1675 | mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 ); | ||
1676 | |||
1677 | |||
1678 | } else { | ||
1679 | if ( index == 24 ) { | ||
1680 | mTimezoneOffsetSpin->setEnabled ( true ); | ||
1681 | mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); | ||
1682 | |||
1683 | } else { | ||
1684 | mTimezoneOffsetSpin->setEnabled ( false ); | ||
1685 | mTimezoneOffsetSpin->setValue( 0 ); | ||
1686 | } | ||
1687 | } | ||
1688 | */ | ||
1689 | } | ||
1690 | |||
1691 | void KOPrefsDialog::setupTimeZoneTab() | ||
1692 | { | ||
1693 | #if 0 | ||
1694 | QFrame *topFrame = addPage(i18n("Time Zone"),0,0); | ||
1695 | // DesktopIcon("clock",KIcon::SizeMedium)); | ||
1696 | |||
1697 | QGridLayout *topLayout = new QGridLayout(topFrame,5,2); | ||
1698 | topLayout->setSpacing(mSpacingHint); | ||
1699 | topLayout->setMargin(mMarginHint); | ||
1700 | |||
1701 | QHBox *timeZoneBox = new QHBox( topFrame ); | ||
1702 | topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); | ||
1703 | |||
1704 | new QLabel( i18n("Timezone:"), timeZoneBox ); | ||
1705 | mTimeZoneCombo = new QComboBox( timeZoneBox ); | ||
1706 | if ( QApplication::desktop()->width() < 300 ) { | ||
1707 | mTimeZoneCombo->setMaximumWidth(150); | ||
1708 | } | ||
1709 | |||
1710 | QStringList list; | ||
1711 | list = KGlobal::locale()->timeZoneList(); | ||
1712 | mTimeZoneCombo->insertStringList(list); | ||
1713 | |||
1714 | // find the currently set time zone and select it | ||
1715 | QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId; | ||
1716 | int nCurrentlySet = 11; | ||
1717 | for (int i = 0; i < mTimeZoneCombo->count(); i++) | ||
1718 | { | ||
1719 | if (mTimeZoneCombo->text(i) == sCurrentlySet) | ||
1720 | { | ||
1721 | nCurrentlySet = i; | ||
1722 | break; | ||
1723 | } | ||
1724 | } | ||
1725 | mTimeZoneCombo->setCurrentItem(nCurrentlySet); | ||
1726 | int iii = 1; | ||
1727 | KPrefsDialogWidBool *sb = | ||
1728 | addWidBool(i18n("Timezone has daylight saving"), | ||
1729 | &(KOPrefs::instance()->mUseDaylightsaving),topFrame); | ||
1730 | topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); | ||
1731 | ++iii; | ||
1732 | QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); | ||
1733 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | ||
1734 | ++iii; | ||
1735 | lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); | ||
1736 | topLayout->addMultiCellWidget(lab, iii,iii,0,1); | ||
1737 | ++iii; | ||
1738 | lab = new QLabel( i18n("Daylight start:"), topFrame ); | ||
1739 | topLayout->addWidget(lab, iii,0); | ||
1740 | mStartDateSavingEdit = new KDateEdit(topFrame); | ||
1741 | topLayout->addWidget(mStartDateSavingEdit, iii,1); | ||
1742 | ++iii; | ||
1743 | |||
1744 | lab = new QLabel( i18n("Daylight end:"), topFrame ); | ||
1745 | topLayout->addWidget(lab, iii,0); | ||
1746 | mEndDateSavingEdit = new KDateEdit(topFrame); | ||
1747 | topLayout->addWidget(mEndDateSavingEdit, iii,1); | ||
1748 | ++iii; | ||
1749 | QDate current ( 2001, 1,1); | ||
1750 | mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); | ||
1751 | mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); | ||
1752 | #endif | ||
1753 | |||
1754 | } | ||
1755 | 1497 | ||
diff --git a/korganizer/koprefsdialog.h b/korganizer/koprefsdialog.h index 6892028..80d6545 100644 --- a/korganizer/koprefsdialog.h +++ b/korganizer/koprefsdialog.h | |||
@@ -1,166 +1,154 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@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 | #ifndef _KOPREFSDIALOG_H | 23 | #ifndef _KOPREFSDIALOG_H |
24 | #define _KOPREFSDIALOG_H | 24 | #define _KOPREFSDIALOG_H |
25 | 25 | ||
26 | #include <qframe.h> | 26 | #include <qframe.h> |
27 | #include <qdict.h> | 27 | #include <qdict.h> |
28 | #include <qcolor.h> | 28 | #include <qcolor.h> |
29 | #include <qlistview.h> | 29 | #include <qlistview.h> |
30 | 30 | ||
31 | #include <kdialogbase.h> | 31 | #include <kdialogbase.h> |
32 | 32 | ||
33 | #include <libkdepim/kprefsdialog.h> | 33 | #include <libkdepim/kprefsdialog.h> |
34 | #include <libkdepim/kdateedit.h> | 34 | #include <libkdepim/kdateedit.h> |
35 | #include <kcmconfigs/kdepimconfigwidget.h> | 35 | #include <kcmconfigs/kdepimconfigwidget.h> |
36 | 36 | ||
37 | class KColorButton; | 37 | class KColorButton; |
38 | class QSpinBox; | 38 | class QSpinBox; |
39 | class QSlider; | 39 | class QSlider; |
40 | class KURLRequester; | 40 | class KURLRequester; |
41 | class QComboBox; | 41 | class QComboBox; |
42 | class QLineEdit; | 42 | class QLineEdit; |
43 | class QStringList; | 43 | class QStringList; |
44 | 44 | ||
45 | /** Dialog to change the korganizer configuration. | 45 | /** Dialog to change the korganizer configuration. |
46 | */ | 46 | */ |
47 | class KOPrefsDialog : public KPrefsDialog | 47 | class KOPrefsDialog : public KPrefsDialog |
48 | { | 48 | { |
49 | Q_OBJECT | 49 | Q_OBJECT |
50 | public: | 50 | public: |
51 | /** Initialize dialog and pages */ | 51 | /** Initialize dialog and pages */ |
52 | KOPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false); | 52 | KOPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false); |
53 | ~KOPrefsDialog(); | 53 | ~KOPrefsDialog(); |
54 | 54 | ||
55 | public slots: | 55 | public slots: |
56 | void showPrinterTab(); | 56 | void showPrinterTab(); |
57 | 57 | ||
58 | /** Update controls for categories */ | 58 | /** Update controls for categories */ |
59 | void updateCategories(); | 59 | void updateCategories(); |
60 | void showSyncPage(); | ||
61 | protected slots: | 60 | protected slots: |
62 | void selectSoundFile(); | 61 | void selectSoundFile(); |
63 | void setCategoryColor(); | 62 | void setCategoryColor(); |
64 | void updateCategoryColor(); | 63 | void updateCategoryColor(); |
65 | void updateTimezoneOffset( int ); | ||
66 | |||
67 | |||
68 | void warningExperimental(bool on); | ||
69 | void warningGroupScheduling(); | ||
70 | void warningProjectView(); | ||
71 | |||
72 | void toggleEmailSettings(bool); | 64 | void toggleEmailSettings(bool); |
73 | 65 | ||
74 | //additional emails | 66 | //additional emails |
75 | void addItem(); | 67 | void addItem(); |
76 | void removeItem(); | 68 | void removeItem(); |
77 | void updateItem(); | 69 | void updateItem(); |
78 | void updateInput(); | 70 | void updateInput(); |
79 | 71 | ||
80 | protected: | 72 | protected: |
81 | void usrReadConfig(); | 73 | void usrReadConfig(); |
82 | void usrWriteConfig(); | 74 | void usrWriteConfig(); |
83 | void setupGlobalTab(); | 75 | void setupGlobalTab(); |
84 | 76 | ||
85 | void setupMainTab(); | 77 | void setupMainTab(); |
86 | void setupTimeTab(); | 78 | void setupTimeTab(); |
87 | void setupTimeZoneTab(); | ||
88 | void setupLocaleTab(); | 79 | void setupLocaleTab(); |
89 | void setupLocaleDateTab(); | 80 | void setupLocaleDateTab(); |
90 | void setupFontsTab(); | 81 | void setupFontsTab(); |
91 | void setupColorsTab(); | 82 | void setupColorsTab(); |
92 | void setupViewsTab(); | 83 | void setupViewsTab(); |
93 | void setupDisplayTab(); | 84 | void setupDisplayTab(); |
94 | void setupPrinterTab(); | 85 | void setupPrinterTab(); |
95 | void setupGroupSchedulingTab(); | 86 | void setupGroupSchedulingTab(); |
96 | void setupGroupAutomationTab(); | 87 | void setupGroupAutomationTab(); |
97 | void setupSyncTab(); | ||
98 | void setupSyncAlgTab(); | ||
99 | 88 | ||
100 | void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0); | 89 | void setCombo(QComboBox *combo,const QString & text, const QStringList *tags = 0); |
101 | 90 | ||
102 | 91 | ||
103 | private: | 92 | private: |
104 | KDEPIMConfigWidget* kdelibcfg; | ||
105 | KPrefsDialogWidBool *mEnableGroupScheduling; | 93 | KPrefsDialogWidBool *mEnableGroupScheduling; |
106 | KPrefsDialogWidBool *mEnableProjectView; | 94 | KPrefsDialogWidBool *mEnableProjectView; |
107 | 95 | ||
108 | QFrame *mPrinterTab; | 96 | QFrame *mPrinterTab; |
109 | 97 | ||
110 | QLineEdit *nameEdit; | 98 | QLineEdit *nameEdit; |
111 | QLineEdit *emailEdit; | 99 | QLineEdit *emailEdit; |
112 | 100 | ||
113 | QComboBox *timeCombo; | 101 | QComboBox *timeCombo; |
114 | QComboBox *tzCombo; | 102 | QComboBox *tzCombo; |
115 | 103 | ||
116 | // widgets holding preferences data | 104 | // widgets holding preferences data |
117 | QLineEdit *mNameEdit; | 105 | QLineEdit *mNameEdit; |
118 | QLineEdit *mEmailEdit; | 106 | QLineEdit *mEmailEdit; |
119 | QLabel *mNameLabel; | 107 | QLabel *mNameLabel; |
120 | QLabel *mEmailLabel; | 108 | QLabel *mEmailLabel; |
121 | QLineEdit *mAdditionalEdit; | 109 | QLineEdit *mAdditionalEdit; |
122 | QSpinBox *mAutoSaveIntervalSpin; | 110 | QSpinBox *mAutoSaveIntervalSpin; |
123 | QSpinBox *mPrioSpin; | 111 | QSpinBox *mPrioSpin; |
124 | // QListView *mAMails; | 112 | // QListView *mAMails; |
125 | QLineEdit *aEmailsEdit; | 113 | QLineEdit *aEmailsEdit; |
126 | 114 | ||
127 | QComboBox *mTimeZoneCombo; | 115 | QComboBox *mTimeZoneCombo; |
128 | QStringList tzonenames; | 116 | QStringList tzonenames; |
129 | QSpinBox *mStartTimeSpin; | 117 | QSpinBox *mStartTimeSpin; |
130 | QSpinBox *mDefaultDurationSpin; | 118 | QSpinBox *mDefaultDurationSpin; |
131 | QComboBox *mAlarmTimeCombo; | 119 | QComboBox *mAlarmTimeCombo; |
132 | 120 | ||
133 | QComboBox *mCategoryCombo; | 121 | QComboBox *mCategoryCombo; |
134 | KColorButton *mCategoryButton; | 122 | KColorButton *mCategoryButton; |
135 | QDict<QColor> mCategoryDict; | 123 | QDict<QColor> mCategoryDict; |
136 | 124 | ||
137 | QSlider *mHourSizeSlider; | 125 | QSlider *mHourSizeSlider; |
138 | 126 | ||
139 | QSpinBox *mNextXDaysSpin; | 127 | QSpinBox *mNextXDaysSpin; |
140 | QSpinBox *mWhatsNextSpin; | 128 | QSpinBox *mWhatsNextSpin; |
141 | 129 | ||
142 | QLineEdit * mRemoteIPEdit; | 130 | QLineEdit * mRemoteIPEdit; |
143 | QLineEdit * mRemoteUser; | 131 | QLineEdit * mRemoteUser; |
144 | QLineEdit * mRemotePassWd; | 132 | QLineEdit * mRemotePassWd; |
145 | QLineEdit * mRemoteFile; | 133 | QLineEdit * mRemoteFile; |
146 | QLineEdit * mLocalTempFile; | 134 | QLineEdit * mLocalTempFile; |
147 | QWidget* mSetupSyncAlgTab; | 135 | QWidget* mSetupSyncAlgTab; |
148 | QLineEdit * mUserDateFormatLong; | 136 | QLineEdit * mUserDateFormatLong; |
149 | QLineEdit * mUserDateFormatShort; | 137 | QLineEdit * mUserDateFormatShort; |
150 | 138 | ||
151 | QSpinBox *mTimezoneOffsetSpin; | 139 | QSpinBox *mTimezoneOffsetSpin; |
152 | QSpinBox *mDaylightsavingStart; | 140 | QSpinBox *mDaylightsavingStart; |
153 | QSpinBox *mDaylightsavingEnd; | 141 | QSpinBox *mDaylightsavingEnd; |
154 | KDateEdit* mStartDateSavingEdit; | 142 | KDateEdit* mStartDateSavingEdit; |
155 | KDateEdit* mEndDateSavingEdit; | 143 | KDateEdit* mEndDateSavingEdit; |
156 | QSpinBox * mAlarmPlayBeeps; | 144 | QSpinBox * mAlarmPlayBeeps; |
157 | QSpinBox * mAlarmSuspendTime; | 145 | QSpinBox * mAlarmSuspendTime; |
158 | QSpinBox * mAlarmSuspendCount; | 146 | QSpinBox * mAlarmSuspendCount; |
159 | QSpinBox * mAlarmBeepInterval; | 147 | QSpinBox * mAlarmBeepInterval; |
160 | 148 | ||
161 | QLineEdit * mDefaultAlarmFile; | 149 | QLineEdit * mDefaultAlarmFile; |
162 | int mSpacingHint; | 150 | int mSpacingHint; |
163 | int mMarginHint; | 151 | int mMarginHint; |
164 | }; | 152 | }; |
165 | 153 | ||
166 | #endif | 154 | #endif |
diff --git a/libkdepim/kprefsdialog.cpp b/libkdepim/kprefsdialog.cpp index b6ae775..6dc741d 100644 --- a/libkdepim/kprefsdialog.cpp +++ b/libkdepim/kprefsdialog.cpp | |||
@@ -1,410 +1,440 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@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 | // $Id$ | 24 | // $Id$ |
25 | 25 | ||
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qgroupbox.h> | 28 | #include <qgroupbox.h> |
29 | #include <qbuttongroup.h> | 29 | #include <qbuttongroup.h> |
30 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
31 | #include <qfont.h> | 31 | #include <qfont.h> |
32 | #include <qslider.h> | 32 | #include <qslider.h> |
33 | #include <qfile.h> | 33 | #include <qfile.h> |
34 | #include <qtextstream.h> | 34 | #include <qtextstream.h> |
35 | #include <qvbox.h> | 35 | #include <qvbox.h> |
36 | #include <qhbox.h> | 36 | #include <qhbox.h> |
37 | #include <qspinbox.h> | 37 | #include <qspinbox.h> |
38 | #include <qdatetime.h> | 38 | #include <qdatetime.h> |
39 | #include <qframe.h> | 39 | #include <qframe.h> |
40 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
41 | #include <qcheckbox.h> | 41 | #include <qcheckbox.h> |
42 | #include <qradiobutton.h> | 42 | #include <qradiobutton.h> |
43 | #include <qpushbutton.h> | 43 | #include <qpushbutton.h> |
44 | #include <qapplication.h> | 44 | #include <qapplication.h> |
45 | 45 | ||
46 | #include <kcolorbutton.h> | 46 | #include <kcolorbutton.h> |
47 | #include <kdebug.h> | 47 | #include <kdebug.h> |
48 | #include <klocale.h> | 48 | #include <klocale.h> |
49 | #include <kglobal.h> | 49 | #include <kglobal.h> |
50 | #include <kglobalsettings.h> | ||
50 | #include <kfontdialog.h> | 51 | #include <kfontdialog.h> |
51 | #include <kmessagebox.h> | 52 | #include <kmessagebox.h> |
52 | #include <kcolordialog.h> | 53 | #include <kcolordialog.h> |
53 | #include <kiconloader.h> | 54 | #include <kiconloader.h> |
54 | 55 | ||
55 | #include "kprefs.h" | 56 | #include "kprefs.h" |
57 | #include "kpimglobalprefs.h" | ||
56 | 58 | ||
57 | #include "kprefsdialog.h" | 59 | #include "kprefsdialog.h" |
58 | //#include "kprefsdialog.moc" | 60 | //#include "kprefsdialog.moc" |
59 | 61 | ||
60 | KPrefsDialogWidBool::KPrefsDialogWidBool(const QString &text,bool *reference, | 62 | KPrefsDialogWidBool::KPrefsDialogWidBool(const QString &text,bool *reference, |
61 | QWidget *parent) | 63 | QWidget *parent) |
62 | { | 64 | { |
63 | mReference = reference; | 65 | mReference = reference; |
64 | 66 | ||
65 | mCheck = new QCheckBox(text,parent); | 67 | mCheck = new QCheckBox(text,parent); |
66 | } | 68 | } |
67 | 69 | ||
68 | void KPrefsDialogWidBool::readConfig() | 70 | void KPrefsDialogWidBool::readConfig() |
69 | { | 71 | { |
70 | mCheck->setChecked(*mReference); | 72 | mCheck->setChecked(*mReference); |
71 | } | 73 | } |
72 | 74 | ||
73 | void KPrefsDialogWidBool::writeConfig() | 75 | void KPrefsDialogWidBool::writeConfig() |
74 | { | 76 | { |
75 | *mReference = mCheck->isChecked(); | 77 | *mReference = mCheck->isChecked(); |
76 | } | 78 | } |
77 | 79 | ||
78 | QCheckBox *KPrefsDialogWidBool::checkBox() | 80 | QCheckBox *KPrefsDialogWidBool::checkBox() |
79 | { | 81 | { |
80 | return mCheck; | 82 | return mCheck; |
81 | } | 83 | } |
82 | 84 | ||
83 | 85 | ||
84 | KPrefsDialogWidColor::KPrefsDialogWidColor(const QString &text,QColor *reference, | 86 | KPrefsDialogWidColor::KPrefsDialogWidColor(const QString &text,QColor *reference, |
85 | QWidget *parent) | 87 | QWidget *parent) |
86 | { | 88 | { |
87 | mReference = reference; | 89 | mReference = reference; |
88 | 90 | ||
89 | mButton = new KColorButton(parent); | 91 | mButton = new KColorButton(parent); |
90 | mLabel = new QLabel(mButton, text, parent); | 92 | mLabel = new QLabel(mButton, text, parent); |
91 | mButton->setColor( *mReference ); | 93 | mButton->setColor( *mReference ); |
92 | mButton->setColor( Qt::red ); | 94 | mButton->setColor( Qt::red ); |
93 | 95 | ||
94 | } | 96 | } |
95 | 97 | ||
96 | KPrefsDialogWidColor::~KPrefsDialogWidColor() | 98 | KPrefsDialogWidColor::~KPrefsDialogWidColor() |
97 | { | 99 | { |
98 | // kdDebug(5300) << "KPrefsDialogWidColor::~KPrefsDialogWidColor()" << endl; | 100 | // kdDebug(5300) << "KPrefsDialogWidColor::~KPrefsDialogWidColor()" << endl; |
99 | } | 101 | } |
100 | 102 | ||
101 | void KPrefsDialogWidColor::readConfig() | 103 | void KPrefsDialogWidColor::readConfig() |
102 | { | 104 | { |
103 | mButton->setColor(*mReference); | 105 | mButton->setColor(*mReference); |
104 | } | 106 | } |
105 | 107 | ||
106 | void KPrefsDialogWidColor::writeConfig() | 108 | void KPrefsDialogWidColor::writeConfig() |
107 | { | 109 | { |
108 | *mReference = mButton->color(); | 110 | *mReference = mButton->color(); |
109 | } | 111 | } |
110 | 112 | ||
111 | QLabel *KPrefsDialogWidColor::label() | 113 | QLabel *KPrefsDialogWidColor::label() |
112 | { | 114 | { |
113 | return mLabel; | 115 | return mLabel; |
114 | } | 116 | } |
115 | 117 | ||
116 | KColorButton *KPrefsDialogWidColor::button() | 118 | KColorButton *KPrefsDialogWidColor::button() |
117 | { | 119 | { |
118 | return mButton; | 120 | return mButton; |
119 | } | 121 | } |
120 | 122 | ||
121 | KPrefsDialogWidFont::KPrefsDialogWidFont(const QString &sampleText,const QString &labelText, | 123 | KPrefsDialogWidFont::KPrefsDialogWidFont(const QString &sampleText,const QString &labelText, |
122 | QFont *reference,QWidget *parent) | 124 | QFont *reference,QWidget *parent) |
123 | { | 125 | { |
124 | mReference = reference; | 126 | mReference = reference; |
125 | 127 | ||
126 | mLabel = new QLabel(labelText, parent); | 128 | mLabel = new QLabel(labelText, parent); |
127 | 129 | ||
128 | mPreview = new QLabel(sampleText,parent); | 130 | mPreview = new QLabel(sampleText,parent); |
129 | mPreview->setFrameStyle(QFrame::Panel|QFrame::Sunken); | 131 | mPreview->setFrameStyle(QFrame::Panel|QFrame::Sunken); |
130 | 132 | ||
131 | mButton = new QPushButton(i18n("Choose..."), parent); | 133 | mButton = new QPushButton(i18n("Choose..."), parent); |
132 | connect(mButton,SIGNAL(clicked()),SLOT(selectFont())); | 134 | connect(mButton,SIGNAL(clicked()),SLOT(selectFont())); |
133 | mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 ); | 135 | mPreview->setMaximumHeight( QApplication::desktop()->height() / 12 ); |
134 | mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 ); | 136 | mPreview->setMaximumWidth( (QApplication::desktop()->width() / 2)-10 ); |
135 | } | 137 | } |
136 | 138 | ||
137 | KPrefsDialogWidFont::~KPrefsDialogWidFont() | 139 | KPrefsDialogWidFont::~KPrefsDialogWidFont() |
138 | { | 140 | { |
139 | } | 141 | } |
140 | 142 | ||
141 | void KPrefsDialogWidFont::readConfig() | 143 | void KPrefsDialogWidFont::readConfig() |
142 | { | 144 | { |
143 | mPreview->setFont(*mReference); | 145 | mPreview->setFont(*mReference); |
144 | } | 146 | } |
145 | 147 | ||
146 | void KPrefsDialogWidFont::writeConfig() | 148 | void KPrefsDialogWidFont::writeConfig() |
147 | { | 149 | { |
148 | *mReference = mPreview->font(); | 150 | *mReference = mPreview->font(); |
149 | } | 151 | } |
150 | 152 | ||
151 | QLabel *KPrefsDialogWidFont::label() | 153 | QLabel *KPrefsDialogWidFont::label() |
152 | { | 154 | { |
153 | return mLabel; | 155 | return mLabel; |
154 | } | 156 | } |
155 | 157 | ||
156 | QLabel *KPrefsDialogWidFont::preview() | 158 | QLabel *KPrefsDialogWidFont::preview() |
157 | { | 159 | { |
158 | return mPreview; | 160 | return mPreview; |
159 | } | 161 | } |
160 | 162 | ||
161 | QPushButton *KPrefsDialogWidFont::button() | 163 | QPushButton *KPrefsDialogWidFont::button() |
162 | { | 164 | { |
163 | return mButton; | 165 | return mButton; |
164 | } | 166 | } |
165 | 167 | ||
166 | void KPrefsDialogWidFont::selectFont() | 168 | void KPrefsDialogWidFont::selectFont() |
167 | { | 169 | { |
168 | QFont myFont(mPreview->font()); | 170 | QFont myFont(mPreview->font()); |
169 | bool ok; | 171 | bool ok; |
170 | myFont = KFontDialog::getFont(myFont, ok); | 172 | myFont = KFontDialog::getFont(myFont, ok); |
171 | if ( ok ) { | 173 | if ( ok ) { |
172 | mPreview->setFont(myFont); | 174 | mPreview->setFont(myFont); |
173 | } | 175 | } |
174 | } | 176 | } |
175 | 177 | ||
176 | 178 | ||
177 | KPrefsDialogWidTime::KPrefsDialogWidTime(const QString &text,int *reference, | 179 | KPrefsDialogWidTime::KPrefsDialogWidTime(const QString &text,int *reference, |
178 | QWidget *parent) | 180 | QWidget *parent) |
179 | { | 181 | { |
180 | mReference = reference; | 182 | mReference = reference; |
181 | 183 | ||
182 | mLabel = new QLabel(text,parent); | 184 | mLabel = new QLabel(text,parent); |
183 | mSpin = new QSpinBox(0,23,1,parent); | 185 | mSpin = new QSpinBox(0,23,1,parent); |
184 | mSpin->setSuffix(":00"); | 186 | mSpin->setSuffix(":00"); |
185 | } | 187 | } |
186 | 188 | ||
187 | void KPrefsDialogWidTime::readConfig() | 189 | void KPrefsDialogWidTime::readConfig() |
188 | { | 190 | { |
189 | mSpin->setValue(*mReference); | 191 | mSpin->setValue(*mReference); |
190 | } | 192 | } |
191 | 193 | ||
192 | void KPrefsDialogWidTime::writeConfig() | 194 | void KPrefsDialogWidTime::writeConfig() |
193 | { | 195 | { |
194 | *mReference = mSpin->value(); | 196 | *mReference = mSpin->value(); |
195 | } | 197 | } |
196 | 198 | ||
197 | QLabel *KPrefsDialogWidTime::label() | 199 | QLabel *KPrefsDialogWidTime::label() |
198 | { | 200 | { |
199 | return mLabel; | 201 | return mLabel; |
200 | } | 202 | } |
201 | 203 | ||
202 | QSpinBox *KPrefsDialogWidTime::spinBox() | 204 | QSpinBox *KPrefsDialogWidTime::spinBox() |
203 | { | 205 | { |
204 | return mSpin; | 206 | return mSpin; |
205 | } | 207 | } |
206 | 208 | ||
207 | 209 | ||
208 | KPrefsDialogWidRadios::KPrefsDialogWidRadios(const QString &text,int *reference, | 210 | KPrefsDialogWidRadios::KPrefsDialogWidRadios(const QString &text,int *reference, |
209 | QWidget *parent) | 211 | QWidget *parent) |
210 | { | 212 | { |
211 | mReference = reference; | 213 | mReference = reference; |
212 | 214 | ||
213 | mBox = new QButtonGroup(1,Qt::Horizontal,text,parent); | 215 | mBox = new QButtonGroup(1,Qt::Horizontal,text,parent); |
214 | } | 216 | } |
215 | 217 | ||
216 | KPrefsDialogWidRadios::~KPrefsDialogWidRadios() | 218 | KPrefsDialogWidRadios::~KPrefsDialogWidRadios() |
217 | { | 219 | { |
218 | } | 220 | } |
219 | 221 | ||
220 | void KPrefsDialogWidRadios::addRadio(const QString &text) | 222 | void KPrefsDialogWidRadios::addRadio(const QString &text) |
221 | { | 223 | { |
222 | new QRadioButton(text,mBox); | 224 | new QRadioButton(text,mBox); |
223 | } | 225 | } |
224 | 226 | ||
225 | QButtonGroup *KPrefsDialogWidRadios::groupBox() | 227 | QButtonGroup *KPrefsDialogWidRadios::groupBox() |
226 | { | 228 | { |
227 | return mBox; | 229 | return mBox; |
228 | } | 230 | } |
229 | 231 | ||
230 | void KPrefsDialogWidRadios::readConfig() | 232 | void KPrefsDialogWidRadios::readConfig() |
231 | { | 233 | { |
232 | mBox->setButton(*mReference); | 234 | mBox->setButton(*mReference); |
233 | } | 235 | } |
234 | 236 | ||
235 | void KPrefsDialogWidRadios::writeConfig() | 237 | void KPrefsDialogWidRadios::writeConfig() |
236 | { | 238 | { |
237 | *mReference = mBox->id(mBox->selected()); | 239 | *mReference = mBox->id(mBox->selected()); |
238 | } | 240 | } |
239 | 241 | ||
240 | 242 | ||
241 | KPrefsDialogWidString::KPrefsDialogWidString(const QString &text,QString *reference, | 243 | KPrefsDialogWidString::KPrefsDialogWidString(const QString &text,QString *reference, |
242 | QWidget *parent, QLineEdit::EchoMode echomode) | 244 | QWidget *parent, QLineEdit::EchoMode echomode) |
243 | { | 245 | { |
244 | mReference = reference; | 246 | mReference = reference; |
245 | 247 | ||
246 | mLabel = new QLabel(text,parent); | 248 | mLabel = new QLabel(text,parent); |
247 | mEdit = new QLineEdit(parent); | 249 | mEdit = new QLineEdit(parent); |
248 | mEdit->setEchoMode( echomode ); | 250 | mEdit->setEchoMode( echomode ); |
249 | } | 251 | } |
250 | 252 | ||
251 | KPrefsDialogWidString::~KPrefsDialogWidString() | 253 | KPrefsDialogWidString::~KPrefsDialogWidString() |
252 | { | 254 | { |
253 | } | 255 | } |
254 | 256 | ||
255 | void KPrefsDialogWidString::readConfig() | 257 | void KPrefsDialogWidString::readConfig() |
256 | { | 258 | { |
257 | mEdit->setText(*mReference); | 259 | mEdit->setText(*mReference); |
258 | } | 260 | } |
259 | 261 | ||
260 | void KPrefsDialogWidString::writeConfig() | 262 | void KPrefsDialogWidString::writeConfig() |
261 | { | 263 | { |
262 | *mReference = mEdit->text(); | 264 | *mReference = mEdit->text(); |
263 | } | 265 | } |
264 | 266 | ||
265 | QLabel *KPrefsDialogWidString::label() | 267 | QLabel *KPrefsDialogWidString::label() |
266 | { | 268 | { |
267 | return mLabel; | 269 | return mLabel; |
268 | } | 270 | } |
269 | 271 | ||
270 | QLineEdit *KPrefsDialogWidString::lineEdit() | 272 | QLineEdit *KPrefsDialogWidString::lineEdit() |
271 | { | 273 | { |
272 | return mEdit; | 274 | return mEdit; |
273 | } | 275 | } |
274 | 276 | ||
275 | 277 | ||
276 | KPrefsDialog::KPrefsDialog(KPrefs *prefs,QWidget *parent,char *name,bool modal) : | 278 | KPrefsDialog::KPrefsDialog(KPrefs *prefs,QWidget *parent,char *name,bool modal) : |
277 | KDialogBase(IconList,i18n("Preferences"),Ok|Cancel|Default,Ok,parent, | 279 | KDialogBase(IconList,i18n("Preferences"),Ok|Cancel|Default,Ok,parent, |
278 | name,modal,true) | 280 | name,modal,true) |
279 | { | 281 | { |
280 | mPrefs = prefs; | 282 | mPrefs = prefs; |
281 | 283 | ||
282 | // This seems to cause a crash on exit. Investigate later. | 284 | // This seems to cause a crash on exit. Investigate later. |
283 | mPrefsWids.setAutoDelete(true); | 285 | mPrefsWids.setAutoDelete(true); |
284 | 286 | ||
285 | connect(this,SIGNAL(defaultClicked()),SLOT(slotDefault())); | 287 | connect(this,SIGNAL(defaultClicked()),SLOT(slotDefault())); |
286 | //connect(this,SIGNAL(cancelClicked()),SLOT(slotDefault())); | 288 | //connect(this,SIGNAL(cancelClicked()),SLOT(slotDefault())); |
287 | //connect(this,SIGNAL(cancelClicked()),SLOT(reject())); | 289 | //connect(this,SIGNAL(cancelClicked()),SLOT(reject())); |
288 | } | 290 | } |
289 | 291 | ||
290 | KPrefsDialog::~KPrefsDialog() | 292 | KPrefsDialog::~KPrefsDialog() |
291 | { | 293 | { |
292 | } | 294 | } |
293 | 295 | ||
294 | void KPrefsDialog::addWid(KPrefsDialogWid *wid) | 296 | void KPrefsDialog::addWid(KPrefsDialogWid *wid) |
295 | { | 297 | { |
296 | mPrefsWids.append(wid); | 298 | mPrefsWids.append(wid); |
297 | } | 299 | } |
298 | 300 | ||
299 | KPrefsDialogWidBool *KPrefsDialog::addWidBool(const QString &text,bool *reference,QWidget *parent) | 301 | KPrefsDialogWidBool *KPrefsDialog::addWidBool(const QString &text,bool *reference,QWidget *parent) |
300 | { | 302 | { |
301 | KPrefsDialogWidBool *w = new KPrefsDialogWidBool(text,reference,parent); | 303 | KPrefsDialogWidBool *w = new KPrefsDialogWidBool(text,reference,parent); |
302 | addWid(w); | 304 | addWid(w); |
303 | return w; | 305 | return w; |
304 | } | 306 | } |
305 | 307 | ||
306 | KPrefsDialogWidTime *KPrefsDialog::addWidTime(const QString &text,int *reference,QWidget *parent) | 308 | KPrefsDialogWidTime *KPrefsDialog::addWidTime(const QString &text,int *reference,QWidget *parent) |
307 | { | 309 | { |
308 | KPrefsDialogWidTime *w = new KPrefsDialogWidTime(text,reference,parent); | 310 | KPrefsDialogWidTime *w = new KPrefsDialogWidTime(text,reference,parent); |
309 | addWid(w); | 311 | addWid(w); |
310 | return w; | 312 | return w; |
311 | } | 313 | } |
312 | 314 | ||
313 | KPrefsDialogWidColor *KPrefsDialog::addWidColor(const QString &text,QColor *reference,QWidget *parent) | 315 | KPrefsDialogWidColor *KPrefsDialog::addWidColor(const QString &text,QColor *reference,QWidget *parent) |
314 | { | 316 | { |
315 | KPrefsDialogWidColor *w = new KPrefsDialogWidColor(text,reference,parent); | 317 | KPrefsDialogWidColor *w = new KPrefsDialogWidColor(text,reference,parent); |
316 | addWid(w); | 318 | addWid(w); |
317 | return w; | 319 | return w; |
318 | } | 320 | } |
319 | 321 | ||
320 | KPrefsDialogWidRadios *KPrefsDialog::addWidRadios(const QString &text,int *reference,QWidget *parent) | 322 | KPrefsDialogWidRadios *KPrefsDialog::addWidRadios(const QString &text,int *reference,QWidget *parent) |
321 | { | 323 | { |
322 | KPrefsDialogWidRadios *w = new KPrefsDialogWidRadios(text,reference,parent); | 324 | KPrefsDialogWidRadios *w = new KPrefsDialogWidRadios(text,reference,parent); |
323 | addWid(w); | 325 | addWid(w); |
324 | return w; | 326 | return w; |
325 | } | 327 | } |
326 | 328 | ||
327 | KPrefsDialogWidString *KPrefsDialog::addWidString(const QString &text,QString *reference,QWidget *parent) | 329 | KPrefsDialogWidString *KPrefsDialog::addWidString(const QString &text,QString *reference,QWidget *parent) |
328 | { | 330 | { |
329 | KPrefsDialogWidString *w = new KPrefsDialogWidString(text,reference,parent); | 331 | KPrefsDialogWidString *w = new KPrefsDialogWidString(text,reference,parent); |
330 | addWid(w); | 332 | addWid(w); |
331 | return w; | 333 | return w; |
332 | } | 334 | } |
333 | 335 | ||
334 | KPrefsDialogWidString *KPrefsDialog::addWidPassword(const QString &text,QString *reference,QWidget *parent) | 336 | KPrefsDialogWidString *KPrefsDialog::addWidPassword(const QString &text,QString *reference,QWidget *parent) |
335 | { | 337 | { |
336 | KPrefsDialogWidString *w = new KPrefsDialogWidString(text,reference,parent,QLineEdit::Password); | 338 | KPrefsDialogWidString *w = new KPrefsDialogWidString(text,reference,parent,QLineEdit::Password); |
337 | addWid(w); | 339 | addWid(w); |
338 | return w; | 340 | return w; |
339 | } | 341 | } |
340 | 342 | ||
341 | KPrefsDialogWidFont *KPrefsDialog::addWidFont(const QString &sampleText,const QString &buttonText, | 343 | KPrefsDialogWidFont *KPrefsDialog::addWidFont(const QString &sampleText,const QString &buttonText, |
342 | QFont *reference,QWidget *parent) | 344 | QFont *reference,QWidget *parent) |
343 | { | 345 | { |
344 | KPrefsDialogWidFont *w = new KPrefsDialogWidFont(sampleText,buttonText,reference,parent); | 346 | KPrefsDialogWidFont *w = new KPrefsDialogWidFont(sampleText,buttonText,reference,parent); |
345 | addWid(w); | 347 | addWid(w); |
346 | return w; | 348 | return w; |
347 | } | 349 | } |
348 | 350 | ||
349 | void KPrefsDialog::setDefaults() | 351 | void KPrefsDialog::setDefaults() |
350 | { | 352 | { |
351 | mPrefs->setDefaults(); | 353 | mPrefs->setDefaults(); |
352 | 354 | ||
353 | readConfig(); | 355 | readConfig(); |
354 | } | 356 | } |
355 | 357 | ||
356 | void KPrefsDialog::readConfig() | 358 | void KPrefsDialog::readConfig() |
357 | { | 359 | { |
358 | // kdDebug(5300) << "KPrefsDialog::readConfig()" << endl; | 360 | // kdDebug(5300) << "KPrefsDialog::readConfig()" << endl; |
359 | 361 | ||
360 | KPrefsDialogWid *wid; | 362 | KPrefsDialogWid *wid; |
361 | for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { | 363 | for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { |
362 | wid->readConfig(); | 364 | wid->readConfig(); |
363 | } | 365 | } |
364 | 366 | ||
365 | usrReadConfig(); | 367 | usrReadConfig(); |
366 | } | 368 | } |
367 | 369 | ||
368 | void KPrefsDialog::writeConfig() | 370 | void KPrefsDialog::writeConfig() |
369 | { | 371 | { |
370 | // kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl; | 372 | // kdDebug(5300) << "KPrefsDialog::writeConfig()" << endl; |
371 | 373 | ||
372 | KPrefsDialogWid *wid; | 374 | KPrefsDialogWid *wid; |
373 | for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { | 375 | for(wid = mPrefsWids.first();wid;wid=mPrefsWids.next()) { |
374 | wid->writeConfig(); | 376 | wid->writeConfig(); |
375 | } | 377 | } |
376 | 378 | ||
377 | usrWriteConfig(); | 379 | usrWriteConfig(); |
378 | 380 | ||
379 | // kdDebug(5300) << "KPrefsDialog::writeConfig() now writing..." << endl; | 381 | // kdDebug(5300) << "KPrefsDialog::writeConfig() now writing..." << endl; |
380 | 382 | ||
381 | mPrefs->writeConfig(); | 383 | mPrefs->writeConfig(); |
382 | 384 | ||
383 | // kdDebug(5300) << "KPrefsDialog::writeConfig() done" << endl; | 385 | // kdDebug(5300) << "KPrefsDialog::writeConfig() done" << endl; |
384 | } | 386 | } |
385 | 387 | ||
386 | 388 | ||
387 | void KPrefsDialog::slotApply() | 389 | void KPrefsDialog::slotApply() |
388 | { | 390 | { |
389 | writeConfig(); | 391 | writeConfig(); |
390 | emit configChanged(); | 392 | emit configChanged(); |
391 | } | 393 | } |
392 | 394 | ||
393 | void KPrefsDialog::slotOk() | 395 | void KPrefsDialog::slotOk() |
394 | { | 396 | { |
395 | slotApply(); | 397 | slotApply(); |
396 | QDialog::accept(); | 398 | QDialog::accept(); |
397 | } | 399 | } |
398 | void KPrefsDialog::accept() | 400 | void KPrefsDialog::accept() |
399 | { | 401 | { |
400 | slotOk(); | 402 | slotOk(); |
401 | } | 403 | } |
402 | 404 | ||
403 | void KPrefsDialog::slotDefault() | 405 | void KPrefsDialog::slotDefault() |
404 | { | 406 | { |
405 | if (KMessageBox::warningContinueCancel(this, | 407 | if (KMessageBox::warningContinueCancel(this, |
406 | i18n("You are about to set all\npreferences to default values.\nAll " | 408 | i18n("You are about to set all\npreferences to default values.\nAll " |
407 | "custom modifications will be lost."),i18n("Setting Default Preferences"), | 409 | "custom modifications will be lost."),i18n("Setting Default Preferences"), |
408 | i18n("Continue")) | 410 | i18n("Continue")) |
409 | == KMessageBox::Continue) setDefaults(); | 411 | == KMessageBox::Continue) setDefaults(); |
410 | } | 412 | } |
413 | |||
414 | KPimPrefsGlobalDialog::KPimPrefsGlobalDialog(QWidget *parent,char *name,bool modal): KPrefsDialog( KPimGlobalPrefs::instance() ,parent, name, modal ) | ||
415 | { | ||
416 | setFont( KGlobalSettings::generalMaxFont() ); | ||
417 | kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), this, "KPrefsGlobalDialog" ); | ||
418 | setMainWidget( kdelibcfg ); | ||
419 | setCaption( i18n("KDE-Pim Global Settings")); | ||
420 | kdelibcfg->readConfig(); | ||
421 | #ifndef DESKTOP_VERSION | ||
422 | if ( QApplication::desktop()->height() <= 480 ) | ||
423 | hideButtons(); | ||
424 | showMaximized(); | ||
425 | #endif | ||
426 | } | ||
427 | void KPimPrefsGlobalDialog::showTZconfig() | ||
428 | { | ||
429 | kdelibcfg->showTimeZoneTab() ; | ||
430 | } | ||
431 | void KPimPrefsGlobalDialog::usrReadConfig() | ||
432 | { | ||
433 | kdelibcfg->readConfig(); | ||
434 | } | ||
435 | |||
436 | void KPimPrefsGlobalDialog::usrWriteConfig() | ||
437 | { | ||
438 | kdelibcfg->writeConfig(); | ||
439 | } | ||
440 | |||
diff --git a/libkdepim/kprefsdialog.h b/libkdepim/kprefsdialog.h index efcb86a..52ec809 100644 --- a/libkdepim/kprefsdialog.h +++ b/libkdepim/kprefsdialog.h | |||
@@ -1,445 +1,471 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@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 | #ifndef _KPREFSDIALOG_H | 23 | #ifndef _KPREFSDIALOG_H |
24 | #define _KPREFSDIALOG_H | 24 | #define _KPREFSDIALOG_H |
25 | // $Id$ | 25 | // $Id$ |
26 | 26 | ||
27 | #include <qptrlist.h> | 27 | #include <qptrlist.h> |
28 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
29 | 29 | ||
30 | #include <kdialogbase.h> | 30 | #include <kdialogbase.h> |
31 | 31 | ||
32 | class KPrefs; | 32 | class KPrefs; |
33 | class KPrefsDialog; | 33 | class KPrefsDialog; |
34 | 34 | ||
35 | class KColorButton; | 35 | class KColorButton; |
36 | class QCheckBox; | 36 | class QCheckBox; |
37 | class QLabel; | 37 | class QLabel; |
38 | class QSpinBox; | 38 | class QSpinBox; |
39 | class QButtonGroup; | 39 | class QButtonGroup; |
40 | 40 | ||
41 | /** | 41 | /** |
42 | @short Base class for widgets used by @ref KPrefsDialog. | 42 | @short Base class for widgets used by @ref KPrefsDialog. |
43 | @author Cornelius Schumacher | 43 | @author Cornelius Schumacher |
44 | @see KPrefsDialog | 44 | @see KPrefsDialog |
45 | 45 | ||
46 | This class provides the interface for the preferences widgets used by | 46 | This class provides the interface for the preferences widgets used by |
47 | KPrefsDialog. | 47 | KPrefsDialog. |
48 | */ | 48 | */ |
49 | class KPrefsDialogWid : public QObject | 49 | class KPrefsDialogWid : public QObject |
50 | { | 50 | { |
51 | public: | 51 | public: |
52 | /** | 52 | /** |
53 | This function is called to read value of the setting from the | 53 | This function is called to read value of the setting from the |
54 | stored configuration and display it in the widget. | 54 | stored configuration and display it in the widget. |
55 | */ | 55 | */ |
56 | virtual void readConfig() = 0; | 56 | virtual void readConfig() = 0; |
57 | /** | 57 | /** |
58 | This function is called to write the current setting of the widget to the | 58 | This function is called to write the current setting of the widget to the |
59 | stored configuration. | 59 | stored configuration. |
60 | */ | 60 | */ |
61 | virtual void writeConfig() = 0; | 61 | virtual void writeConfig() = 0; |
62 | }; | 62 | }; |
63 | 63 | ||
64 | /** | 64 | /** |
65 | @short Widget for bool settings in @ref KPrefsDialog. | 65 | @short Widget for bool settings in @ref KPrefsDialog. |
66 | 66 | ||
67 | This class provides a widget for configuring bool values. It is meant to be | 67 | This class provides a widget for configuring bool values. It is meant to be |
68 | used by KPrefsDialog. The user is responsible for the layout management. | 68 | used by KPrefsDialog. The user is responsible for the layout management. |
69 | */ | 69 | */ |
70 | class KPrefsDialogWidBool : public KPrefsDialogWid | 70 | class KPrefsDialogWidBool : public KPrefsDialogWid |
71 | { | 71 | { |
72 | public: | 72 | public: |
73 | /** | 73 | /** |
74 | Create a bool widget consisting of a QCheckbox. | 74 | Create a bool widget consisting of a QCheckbox. |
75 | 75 | ||
76 | @param text Text of QCheckBox. | 76 | @param text Text of QCheckBox. |
77 | @param reference Pointer to variable read and written by this widget. | 77 | @param reference Pointer to variable read and written by this widget. |
78 | @param parent Parent widget. | 78 | @param parent Parent widget. |
79 | */ | 79 | */ |
80 | KPrefsDialogWidBool(const QString &text,bool *reference,QWidget *parent); | 80 | KPrefsDialogWidBool(const QString &text,bool *reference,QWidget *parent); |
81 | 81 | ||
82 | /** | 82 | /** |
83 | Return the QCheckbox used by this widget. | 83 | Return the QCheckbox used by this widget. |
84 | */ | 84 | */ |
85 | QCheckBox *checkBox(); | 85 | QCheckBox *checkBox(); |
86 | 86 | ||
87 | void readConfig(); | 87 | void readConfig(); |
88 | void writeConfig(); | 88 | void writeConfig(); |
89 | 89 | ||
90 | private: | 90 | private: |
91 | bool *mReference; | 91 | bool *mReference; |
92 | 92 | ||
93 | QCheckBox *mCheck; | 93 | QCheckBox *mCheck; |
94 | }; | 94 | }; |
95 | 95 | ||
96 | /** | 96 | /** |
97 | @short Widget for time settings in @ref KPrefsDialog. | 97 | @short Widget for time settings in @ref KPrefsDialog. |
98 | 98 | ||
99 | This class provides a widget for configuring time values. It is meant to be | 99 | This class provides a widget for configuring time values. It is meant to be |
100 | used by KPrefsDialog. The user is responsible for the layout management. | 100 | used by KPrefsDialog. The user is responsible for the layout management. |
101 | */ | 101 | */ |
102 | class KPrefsDialogWidTime : public KPrefsDialogWid | 102 | class KPrefsDialogWidTime : public KPrefsDialogWid |
103 | { | 103 | { |
104 | public: | 104 | public: |
105 | /** | 105 | /** |
106 | Create a time widget consisting of a label and a spinbox. | 106 | Create a time widget consisting of a label and a spinbox. |
107 | 107 | ||
108 | @param text Text of Label. | 108 | @param text Text of Label. |
109 | @param reference Pointer to variable read and written by this widget. | 109 | @param reference Pointer to variable read and written by this widget. |
110 | @param parent Parent widget. | 110 | @param parent Parent widget. |
111 | */ | 111 | */ |
112 | KPrefsDialogWidTime(const QString &text,int *reference,QWidget *parent); | 112 | KPrefsDialogWidTime(const QString &text,int *reference,QWidget *parent); |
113 | 113 | ||
114 | /** | 114 | /** |
115 | Return QLabel used by this widget. | 115 | Return QLabel used by this widget. |
116 | */ | 116 | */ |
117 | QLabel *label(); | 117 | QLabel *label(); |
118 | /** | 118 | /** |
119 | Return QSpinBox used by this widget. | 119 | Return QSpinBox used by this widget. |
120 | */ | 120 | */ |
121 | QSpinBox *spinBox(); | 121 | QSpinBox *spinBox(); |
122 | 122 | ||
123 | void readConfig(); | 123 | void readConfig(); |
124 | void writeConfig(); | 124 | void writeConfig(); |
125 | 125 | ||
126 | private: | 126 | private: |
127 | int *mReference; | 127 | int *mReference; |
128 | 128 | ||
129 | QLabel *mLabel; | 129 | QLabel *mLabel; |
130 | QSpinBox *mSpin; | 130 | QSpinBox *mSpin; |
131 | }; | 131 | }; |
132 | 132 | ||
133 | /** | 133 | /** |
134 | @short Widget for color settings in @ref KPrefsDialog. | 134 | @short Widget for color settings in @ref KPrefsDialog. |
135 | 135 | ||
136 | This class provides a widget for configuring color values. It is meant to be | 136 | This class provides a widget for configuring color values. It is meant to be |
137 | used by KPrefsDialog. The user is responsible for the layout management. | 137 | used by KPrefsDialog. The user is responsible for the layout management. |
138 | */ | 138 | */ |
139 | class KPrefsDialogWidColor : public KPrefsDialogWid | 139 | class KPrefsDialogWidColor : public KPrefsDialogWid |
140 | { | 140 | { |
141 | public: | 141 | public: |
142 | /** | 142 | /** |
143 | Create a color widget consisting of a test field and a button for opening | 143 | Create a color widget consisting of a test field and a button for opening |
144 | a color dialog. | 144 | a color dialog. |
145 | 145 | ||
146 | @param text Text of button. | 146 | @param text Text of button. |
147 | @param reference Pointer to variable read and written by this widget. | 147 | @param reference Pointer to variable read and written by this widget. |
148 | @param parent Parent widget. | 148 | @param parent Parent widget. |
149 | */ | 149 | */ |
150 | KPrefsDialogWidColor(const QString &text,QColor *reference,QWidget *parent); | 150 | KPrefsDialogWidColor(const QString &text,QColor *reference,QWidget *parent); |
151 | /** | 151 | /** |
152 | Destruct color setting widget. | 152 | Destruct color setting widget. |
153 | */ | 153 | */ |
154 | ~KPrefsDialogWidColor(); | 154 | ~KPrefsDialogWidColor(); |
155 | 155 | ||
156 | /** | 156 | /** |
157 | Return QLabel for the button | 157 | Return QLabel for the button |
158 | */ | 158 | */ |
159 | QLabel *label(); | 159 | QLabel *label(); |
160 | /** | 160 | /** |
161 | Return button opening the color dialog. | 161 | Return button opening the color dialog. |
162 | */ | 162 | */ |
163 | KColorButton *button(); | 163 | KColorButton *button(); |
164 | 164 | ||
165 | void readConfig(); | 165 | void readConfig(); |
166 | void writeConfig(); | 166 | void writeConfig(); |
167 | 167 | ||
168 | private: | 168 | private: |
169 | QColor *mReference; | 169 | QColor *mReference; |
170 | 170 | ||
171 | QLabel *mLabel; | 171 | QLabel *mLabel; |
172 | KColorButton *mButton; | 172 | KColorButton *mButton; |
173 | }; | 173 | }; |
174 | 174 | ||
175 | /** | 175 | /** |
176 | @short Widget for font settings in @ref KPrefsDialog. | 176 | @short Widget for font settings in @ref KPrefsDialog. |
177 | 177 | ||
178 | This class provides a widget for configuring font values. It is meant to be | 178 | This class provides a widget for configuring font values. It is meant to be |
179 | used by KPrefsDialog. The user is responsible for the layout management. | 179 | used by KPrefsDialog. The user is responsible for the layout management. |
180 | */ | 180 | */ |
181 | class KPrefsDialogWidFont : public KPrefsDialogWid | 181 | class KPrefsDialogWidFont : public KPrefsDialogWid |
182 | { | 182 | { |
183 | Q_OBJECT | 183 | Q_OBJECT |
184 | public: | 184 | public: |
185 | /** | 185 | /** |
186 | Create a font widget consisting of a test field and a button for opening | 186 | Create a font widget consisting of a test field and a button for opening |
187 | a font dialog. | 187 | a font dialog. |
188 | 188 | ||
189 | @param label Text of label. | 189 | @param label Text of label. |
190 | @param reference Pointer to variable read and written by this widget. | 190 | @param reference Pointer to variable read and written by this widget. |
191 | @param parent Parent widget. | 191 | @param parent Parent widget. |
192 | */ | 192 | */ |
193 | KPrefsDialogWidFont(const QString &sampleText,const QString &labelText, | 193 | KPrefsDialogWidFont(const QString &sampleText,const QString &labelText, |
194 | QFont *reference,QWidget *parent); | 194 | QFont *reference,QWidget *parent); |
195 | /** | 195 | /** |
196 | Destruct font setting widget. | 196 | Destruct font setting widget. |
197 | */ | 197 | */ |
198 | ~KPrefsDialogWidFont(); | 198 | ~KPrefsDialogWidFont(); |
199 | 199 | ||
200 | /** | 200 | /** |
201 | Return label. | 201 | Return label. |
202 | */ | 202 | */ |
203 | QLabel *label(); | 203 | QLabel *label(); |
204 | /** | 204 | /** |
205 | Return QFrame used as preview field. | 205 | Return QFrame used as preview field. |
206 | */ | 206 | */ |
207 | QLabel *preview(); | 207 | QLabel *preview(); |
208 | /** | 208 | /** |
209 | Return button opening the font dialog. | 209 | Return button opening the font dialog. |
210 | */ | 210 | */ |
211 | QPushButton *button(); | 211 | QPushButton *button(); |
212 | 212 | ||
213 | void readConfig(); | 213 | void readConfig(); |
214 | void writeConfig(); | 214 | void writeConfig(); |
215 | 215 | ||
216 | protected slots: | 216 | protected slots: |
217 | void selectFont(); | 217 | void selectFont(); |
218 | 218 | ||
219 | private: | 219 | private: |
220 | QFont *mReference; | 220 | QFont *mReference; |
221 | 221 | ||
222 | QLabel *mLabel; | 222 | QLabel *mLabel; |
223 | QLabel *mPreview; | 223 | QLabel *mPreview; |
224 | QPushButton *mButton; | 224 | QPushButton *mButton; |
225 | }; | 225 | }; |
226 | 226 | ||
227 | /** | 227 | /** |
228 | @short Widget for settings represented by a group of radio buttons in | 228 | @short Widget for settings represented by a group of radio buttons in |
229 | @ref KPrefsDialog. | 229 | @ref KPrefsDialog. |
230 | 230 | ||
231 | This class provides a widget for configuring selections. It is meant to be | 231 | This class provides a widget for configuring selections. It is meant to be |
232 | used by KPrefsDialog. The user is responsible for the layout management. The | 232 | used by KPrefsDialog. The user is responsible for the layout management. The |
233 | setting is interpreted as an int value, corresponding to the position of the | 233 | setting is interpreted as an int value, corresponding to the position of the |
234 | radio button. The position of the button is defined by the sequence of @ref | 234 | radio button. The position of the button is defined by the sequence of @ref |
235 | addRadio() calls, starting with 0. | 235 | addRadio() calls, starting with 0. |
236 | */ | 236 | */ |
237 | class KPrefsDialogWidRadios : public KPrefsDialogWid | 237 | class KPrefsDialogWidRadios : public KPrefsDialogWid |
238 | { | 238 | { |
239 | public: | 239 | public: |
240 | /** | 240 | /** |
241 | Create a widget for selection of an option. It consists of a box with | 241 | Create a widget for selection of an option. It consists of a box with |
242 | several radio buttons. | 242 | several radio buttons. |
243 | 243 | ||
244 | @param text Text of main box. | 244 | @param text Text of main box. |
245 | @param reference Pointer to variable read and written by this widget. | 245 | @param reference Pointer to variable read and written by this widget. |
246 | @param parent Parent widget. | 246 | @param parent Parent widget. |
247 | */ | 247 | */ |
248 | KPrefsDialogWidRadios(const QString &text,int *reference,QWidget *parent); | 248 | KPrefsDialogWidRadios(const QString &text,int *reference,QWidget *parent); |
249 | virtual ~KPrefsDialogWidRadios(); | 249 | virtual ~KPrefsDialogWidRadios(); |
250 | 250 | ||
251 | /** | 251 | /** |
252 | Add a radio button. | 252 | Add a radio button. |
253 | 253 | ||
254 | @param text Text of the button. | 254 | @param text Text of the button. |
255 | */ | 255 | */ |
256 | void addRadio(const QString &text); | 256 | void addRadio(const QString &text); |
257 | 257 | ||
258 | /** | 258 | /** |
259 | Return the box widget used by this widget. | 259 | Return the box widget used by this widget. |
260 | */ | 260 | */ |
261 | QButtonGroup *groupBox(); | 261 | QButtonGroup *groupBox(); |
262 | 262 | ||
263 | void readConfig(); | 263 | void readConfig(); |
264 | void writeConfig(); | 264 | void writeConfig(); |
265 | 265 | ||
266 | private: | 266 | private: |
267 | int *mReference; | 267 | int *mReference; |
268 | 268 | ||
269 | QButtonGroup *mBox; | 269 | QButtonGroup *mBox; |
270 | }; | 270 | }; |
271 | 271 | ||
272 | 272 | ||
273 | /** | 273 | /** |
274 | @short Widget for string settings in @ref KPrefsDialog. | 274 | @short Widget for string settings in @ref KPrefsDialog. |
275 | 275 | ||
276 | This class provides a widget for configuring string values. It is meant to be | 276 | This class provides a widget for configuring string values. It is meant to be |
277 | used by KPrefsDialog. The user is responsible for the layout management. | 277 | used by KPrefsDialog. The user is responsible for the layout management. |
278 | */ | 278 | */ |
279 | class KPrefsDialogWidString : public KPrefsDialogWid | 279 | class KPrefsDialogWidString : public KPrefsDialogWid |
280 | { | 280 | { |
281 | public: | 281 | public: |
282 | /** | 282 | /** |
283 | Create a string widget consisting of a test label and a line edit. | 283 | Create a string widget consisting of a test label and a line edit. |
284 | 284 | ||
285 | @param text Text of label. | 285 | @param text Text of label. |
286 | @param reference Pointer to variable read and written by this widget. | 286 | @param reference Pointer to variable read and written by this widget. |
287 | @param parent Parent widget. | 287 | @param parent Parent widget. |
288 | */ | 288 | */ |
289 | KPrefsDialogWidString(const QString &text,QString *reference,QWidget *parent,QLineEdit::EchoMode echomode=QLineEdit::Normal); | 289 | KPrefsDialogWidString(const QString &text,QString *reference,QWidget *parent,QLineEdit::EchoMode echomode=QLineEdit::Normal); |
290 | /** | 290 | /** |
291 | Destructor. | 291 | Destructor. |
292 | */ | 292 | */ |
293 | virtual ~KPrefsDialogWidString(); | 293 | virtual ~KPrefsDialogWidString(); |
294 | 294 | ||
295 | /** | 295 | /** |
296 | Return label used by this widget. | 296 | Return label used by this widget. |
297 | */ | 297 | */ |
298 | QLabel *label(); | 298 | QLabel *label(); |
299 | /** | 299 | /** |
300 | Return QLineEdit used by this widget. | 300 | Return QLineEdit used by this widget. |
301 | */ | 301 | */ |
302 | QLineEdit *lineEdit(); | 302 | QLineEdit *lineEdit(); |
303 | 303 | ||
304 | void readConfig(); | 304 | void readConfig(); |
305 | void writeConfig(); | 305 | void writeConfig(); |
306 | 306 | ||
307 | private: | 307 | private: |
308 | QString *mReference; | 308 | QString *mReference; |
309 | 309 | ||
310 | QLabel *mLabel; | 310 | QLabel *mLabel; |
311 | QLineEdit *mEdit; | 311 | QLineEdit *mEdit; |
312 | }; | 312 | }; |
313 | 313 | ||
314 | 314 | ||
315 | /** | 315 | /** |
316 | @short Base class for a preferences dialog. | 316 | @short Base class for a preferences dialog. |
317 | 317 | ||
318 | This class provides the framework for a preferences dialog. You have to | 318 | This class provides the framework for a preferences dialog. You have to |
319 | subclass it and add the code to create the actual configuration widgets and | 319 | subclass it and add the code to create the actual configuration widgets and |
320 | do the layout management. | 320 | do the layout management. |
321 | 321 | ||
322 | KPrefsDialog provides functions to add subclasses of @ref KPrefsDialogWid. For | 322 | KPrefsDialog provides functions to add subclasses of @ref KPrefsDialogWid. For |
323 | these widgets the reading, writing and setting to default values is handled | 323 | these widgets the reading, writing and setting to default values is handled |
324 | automatically. Custom widgets have to be handled in the functions @ref | 324 | automatically. Custom widgets have to be handled in the functions @ref |
325 | usrReadConfig() and @ref usrWriteConfig(). | 325 | usrReadConfig() and @ref usrWriteConfig(). |
326 | */ | 326 | */ |
327 | class KPrefsDialog : public KDialogBase | 327 | class KPrefsDialog : public KDialogBase |
328 | { | 328 | { |
329 | Q_OBJECT | 329 | Q_OBJECT |
330 | public: | 330 | public: |
331 | /** | 331 | /** |
332 | Create a KPrefsDialog for a KPrefs object. | 332 | Create a KPrefsDialog for a KPrefs object. |
333 | 333 | ||
334 | @param prefs KPrefs object used to access te configuration. | 334 | @param prefs KPrefs object used to access te configuration. |
335 | @param parent Parent widget. | 335 | @param parent Parent widget. |
336 | @param name Widget name. | 336 | @param name Widget name. |
337 | @param modal true, if dialog has to be modal, false for non-modal. | 337 | @param modal true, if dialog has to be modal, false for non-modal. |
338 | */ | 338 | */ |
339 | KPrefsDialog(KPrefs *prefs,QWidget *parent=0,char *name=0,bool modal=false); | 339 | KPrefsDialog(KPrefs *prefs,QWidget *parent=0,char *name=0,bool modal=false); |
340 | /** | 340 | /** |
341 | Destructor. | 341 | Destructor. |
342 | */ | 342 | */ |
343 | virtual ~KPrefsDialog(); | 343 | virtual ~KPrefsDialog(); |
344 | 344 | ||
345 | /** | 345 | /** |
346 | Register a custom KPrefsDialogWid object. | 346 | Register a custom KPrefsDialogWid object. |
347 | */ | 347 | */ |
348 | void addWid(KPrefsDialogWid *); | 348 | void addWid(KPrefsDialogWid *); |
349 | /** | 349 | /** |
350 | Register a @ref KPrefsDialogWidBool object. | 350 | Register a @ref KPrefsDialogWidBool object. |
351 | 351 | ||
352 | @param text Text of bool widget. | 352 | @param text Text of bool widget. |
353 | @param reference Reference to variable storing the setting. | 353 | @param reference Reference to variable storing the setting. |
354 | @param parent Parent widget. | 354 | @param parent Parent widget. |
355 | */ | 355 | */ |
356 | KPrefsDialogWidBool *addWidBool(const QString &text,bool *reference,QWidget *parent); | 356 | KPrefsDialogWidBool *addWidBool(const QString &text,bool *reference,QWidget *parent); |
357 | /** | 357 | /** |
358 | Register a @ref KPrefsDialogWidTime object. | 358 | Register a @ref KPrefsDialogWidTime object. |
359 | 359 | ||
360 | @param text Text of time widget. | 360 | @param text Text of time widget. |
361 | @param reference Reference to variable storing the setting. | 361 | @param reference Reference to variable storing the setting. |
362 | @param parent Parent widget. | 362 | @param parent Parent widget. |
363 | */ | 363 | */ |
364 | KPrefsDialogWidTime *addWidTime(const QString &text,int *reference,QWidget *parent); | 364 | KPrefsDialogWidTime *addWidTime(const QString &text,int *reference,QWidget *parent); |
365 | /** | 365 | /** |
366 | Register a @ref KPrefsDialogWidColor object. | 366 | Register a @ref KPrefsDialogWidColor object. |
367 | 367 | ||
368 | @param text Text of color widget. | 368 | @param text Text of color widget. |
369 | @param reference Reference to variable storing the setting. | 369 | @param reference Reference to variable storing the setting. |
370 | @param parent Parent widget. | 370 | @param parent Parent widget. |
371 | */ | 371 | */ |
372 | KPrefsDialogWidColor *addWidColor(const QString &text,QColor *reference,QWidget *parent); | 372 | KPrefsDialogWidColor *addWidColor(const QString &text,QColor *reference,QWidget *parent); |
373 | /** | 373 | /** |
374 | Register a @ref KPrefsDialogWidRadios object. | 374 | Register a @ref KPrefsDialogWidRadios object. |
375 | 375 | ||
376 | @param text Text of radio button box widget. | 376 | @param text Text of radio button box widget. |
377 | @param reference Reference to variable storing the setting. | 377 | @param reference Reference to variable storing the setting. |
378 | @param parent Parent widget. | 378 | @param parent Parent widget. |
379 | */ | 379 | */ |
380 | KPrefsDialogWidRadios *addWidRadios(const QString &text,int *reference,QWidget *parent); | 380 | KPrefsDialogWidRadios *addWidRadios(const QString &text,int *reference,QWidget *parent); |
381 | /** | 381 | /** |
382 | Register a @ref KPrefsDialogWidString object. | 382 | Register a @ref KPrefsDialogWidString object. |
383 | 383 | ||
384 | @param text Text of string widget. | 384 | @param text Text of string widget. |
385 | @param reference Reference to variable storing the setting. | 385 | @param reference Reference to variable storing the setting. |
386 | @param parent Parent widget. | 386 | @param parent Parent widget. |
387 | */ | 387 | */ |
388 | KPrefsDialogWidString *addWidString(const QString &text,QString *reference,QWidget *parent); | 388 | KPrefsDialogWidString *addWidString(const QString &text,QString *reference,QWidget *parent); |
389 | /** | 389 | /** |
390 | Register a password @ref KPrefsDialogWidString object, with echomode set to QLineEdit::Password. | 390 | Register a password @ref KPrefsDialogWidString object, with echomode set to QLineEdit::Password. |
391 | 391 | ||
392 | @param text Text of string widget. | 392 | @param text Text of string widget. |
393 | @param reference Reference to variable storing the setting. | 393 | @param reference Reference to variable storing the setting. |
394 | @param parent Parent widget. | 394 | @param parent Parent widget. |
395 | */ | 395 | */ |
396 | KPrefsDialogWidString *addWidPassword (const QString &text,QString *reference,QWidget *parent); | 396 | KPrefsDialogWidString *addWidPassword (const QString &text,QString *reference,QWidget *parent); |
397 | /** | 397 | /** |
398 | Register a @ref KPrefsDialogWidFont object. | 398 | Register a @ref KPrefsDialogWidFont object. |
399 | 399 | ||
400 | @param sampleText Sample text of font widget. | 400 | @param sampleText Sample text of font widget. |
401 | @param buttonText Button text of font widget. | 401 | @param buttonText Button text of font widget. |
402 | @param reference Reference to variable storing the setting. | 402 | @param reference Reference to variable storing the setting. |
403 | @param parent Parent widget. | 403 | @param parent Parent widget. |
404 | */ | 404 | */ |
405 | KPrefsDialogWidFont *addWidFont(const QString &sampleText,const QString &buttonText, | 405 | KPrefsDialogWidFont *addWidFont(const QString &sampleText,const QString &buttonText, |
406 | QFont *reference,QWidget *parent); | 406 | QFont *reference,QWidget *parent); |
407 | 407 | ||
408 | public slots: | 408 | public slots: |
409 | /** Set all widgets to default values. */ | 409 | /** Set all widgets to default values. */ |
410 | void setDefaults(); | 410 | void setDefaults(); |
411 | 411 | ||
412 | /** Read preferences from config file. */ | 412 | /** Read preferences from config file. */ |
413 | void readConfig(); | 413 | void readConfig(); |
414 | 414 | ||
415 | /** Write preferences to config file. */ | 415 | /** Write preferences to config file. */ |
416 | void writeConfig(); | 416 | void writeConfig(); |
417 | 417 | ||
418 | signals: | 418 | signals: |
419 | /** Emitted when the a changed configuration has been stored. */ | 419 | /** Emitted when the a changed configuration has been stored. */ |
420 | void configChanged(); | 420 | void configChanged(); |
421 | 421 | ||
422 | protected slots: | 422 | protected slots: |
423 | /** Apply changes to preferences */ | 423 | /** Apply changes to preferences */ |
424 | void slotApply(); | 424 | void slotApply(); |
425 | 425 | ||
426 | void accept(); | 426 | void accept(); |
427 | /** Accept changes to preferences and close dialog */ | 427 | /** Accept changes to preferences and close dialog */ |
428 | void slotOk(); | 428 | void slotOk(); |
429 | 429 | ||
430 | /** Set preferences to default values */ | 430 | /** Set preferences to default values */ |
431 | void slotDefault(); | 431 | void slotDefault(); |
432 | 432 | ||
433 | protected: | 433 | protected: |
434 | /** Implement this to read custom configuration widgets. */ | 434 | /** Implement this to read custom configuration widgets. */ |
435 | virtual void usrReadConfig() {} | 435 | virtual void usrReadConfig() {} |
436 | /** Implement this to write custom configuration widgets. */ | 436 | /** Implement this to write custom configuration widgets. */ |
437 | virtual void usrWriteConfig() {} | 437 | virtual void usrWriteConfig() {} |
438 | 438 | ||
439 | private: | 439 | private: |
440 | KPrefs *mPrefs; | 440 | KPrefs *mPrefs; |
441 | 441 | ||
442 | QPtrList<KPrefsDialogWid> mPrefsWids; | 442 | QPtrList<KPrefsDialogWid> mPrefsWids; |
443 | }; | 443 | }; |
444 | 444 | ||
445 | |||
446 | #include "kcmconfigs/kdepimconfigwidget.h" | ||
447 | class KPimPrefsGlobalDialog : public KPrefsDialog | ||
448 | { | ||
449 | Q_OBJECT | ||
450 | public: | ||
451 | KPimPrefsGlobalDialog(QWidget *parent=0,char *name=0,bool modal=true); | ||
452 | /** | ||
453 | Destructor. | ||
454 | */ | ||
455 | void showTZconfig(); | ||
456 | |||
457 | public slots: | ||
458 | |||
459 | signals: | ||
460 | protected slots: | ||
461 | |||
462 | protected: | ||
463 | void usrReadConfig(); | ||
464 | virtual void usrWriteConfig() ; | ||
465 | |||
466 | private: | ||
467 | KDEPIMConfigWidget* kdelibcfg; | ||
468 | |||
469 | }; | ||
470 | |||
445 | #endif | 471 | #endif |