summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-25 15:12:21 (UTC)
committer zautrix <zautrix>2005-01-25 15:12:21 (UTC)
commitfe4e6e85abc2ec90cc80108fc7434899b6e13048 (patch) (unidiff)
tree9a3cf83ecf8796d0020076e4e8e275d193fb2584
parent165d969ce6ac38c5e3d7b5c629af0b00d0fff017 (diff)
downloadkdepimpi-fe4e6e85abc2ec90cc80108fc7434899b6e13048.zip
kdepimpi-fe4e6e85abc2ec90cc80108fc7434899b6e13048.tar.gz
kdepimpi-fe4e6e85abc2ec90cc80108fc7434899b6e13048.tar.bz2
small fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp11
-rw-r--r--kaddressbook/kaddressbook.pro31
-rw-r--r--kaddressbook/mainembedded.cpp30
-rw-r--r--kdepim-desktop.pro2
-rw-r--r--korganizer/koprefsdialog.cpp2
-rw-r--r--korganizer/korganizer.pro32
-rw-r--r--korganizer/main.cpp29
-rw-r--r--korganizer/mainwindow.cpp8
8 files changed, 72 insertions, 73 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 505cbf4..590cc82 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,3320 +1,3321 @@
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/*s 24/*s
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (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 99
100 100
101//#include <qlabel.h> 101//#include <qlabel.h>
102 102
103 103
104#ifndef DESKTOP_VERSION 104#ifndef DESKTOP_VERSION
105#include <qpe/ir.h> 105#include <qpe/ir.h>
106#include <qpe/qpemenubar.h> 106#include <qpe/qpemenubar.h>
107#include <qtopia/qcopenvelope_qws.h> 107#include <qtopia/qcopenvelope_qws.h>
108#else 108#else
109 109
110#include <qmenubar.h> 110#include <qmenubar.h>
111#endif 111#endif
112 112
113#endif // KAB_EMBEDDED 113#endif // KAB_EMBEDDED
114#include "kcmconfigs/kcmkabconfig.h" 114#include "kcmconfigs/kcmkabconfig.h"
115#include "kcmconfigs/kcmkdepimconfig.h" 115#include "kcmconfigs/kcmkdepimconfig.h"
116#include "kpimglobalprefs.h" 116#include "kpimglobalprefs.h"
117#include "externalapphandler.h" 117#include "externalapphandler.h"
118#include "xxportselectdialog.h" 118#include "xxportselectdialog.h"
119 119
120 120
121#include <kresources/selectdialog.h> 121#include <kresources/selectdialog.h>
122#include <kmessagebox.h> 122#include <kmessagebox.h>
123 123
124#include <picture.h> 124#include <picture.h>
125#include <resource.h> 125#include <resource.h>
126 126
127//US#include <qsplitter.h> 127//US#include <qsplitter.h>
128#include <qmap.h> 128#include <qmap.h>
129#include <qdir.h> 129#include <qdir.h>
130#include <qfile.h> 130#include <qfile.h>
131#include <qvbox.h> 131#include <qvbox.h>
132#include <qlayout.h> 132#include <qlayout.h>
133#include <qclipboard.h> 133#include <qclipboard.h>
134#include <qtextstream.h> 134#include <qtextstream.h>
135#include <qradiobutton.h> 135#include <qradiobutton.h>
136#include <qbuttongroup.h> 136#include <qbuttongroup.h>
137 137
138#include <libkdepim/categoryselectdialog.h> 138#include <libkdepim/categoryselectdialog.h>
139#include <libkdepim/categoryeditdialog.h> 139#include <libkdepim/categoryeditdialog.h>
140#include <kabc/vcardconverter.h> 140#include <kabc/vcardconverter.h>
141 141
142 142
143#include "addresseeutil.h" 143#include "addresseeutil.h"
144#include "undocmds.h" 144#include "undocmds.h"
145#include "addresseeeditordialog.h" 145#include "addresseeeditordialog.h"
146#include "viewmanager.h" 146#include "viewmanager.h"
147#include "details/detailsviewcontainer.h" 147#include "details/detailsviewcontainer.h"
148#include "kabprefs.h" 148#include "kabprefs.h"
149#include "xxportmanager.h" 149#include "xxportmanager.h"
150#include "incsearchwidget.h" 150#include "incsearchwidget.h"
151#include "jumpbuttonbar.h" 151#include "jumpbuttonbar.h"
152#include "extensionmanager.h" 152#include "extensionmanager.h"
153#include "addresseeconfig.h" 153#include "addresseeconfig.h"
154#include "nameeditdialog.h" 154#include "nameeditdialog.h"
155#include <kcmultidialog.h> 155#include <kcmultidialog.h>
156 156
157#ifdef _WIN32_ 157#ifdef _WIN32_
158 158#ifdef _OL_IMPORT_
159#include "kaimportoldialog.h" 159#include "kaimportoldialog.h"
160#endif
160#else 161#else
161#include <unistd.h> 162#include <unistd.h>
162#endif 163#endif
163// sync includes 164// sync includes
164#include <libkdepim/ksyncprofile.h> 165#include <libkdepim/ksyncprofile.h>
165#include <libkdepim/ksyncprefsdialog.h> 166#include <libkdepim/ksyncprefsdialog.h>
166 167
167 168
168class KABCatPrefs : public QDialog 169class KABCatPrefs : public QDialog
169{ 170{
170 public: 171 public:
171 KABCatPrefs( QWidget *parent=0, const char *name=0 ) : 172 KABCatPrefs( QWidget *parent=0, const char *name=0 ) :
172 QDialog( parent, name, true ) 173 QDialog( parent, name, true )
173 { 174 {
174 setCaption( i18n("Manage new Categories") ); 175 setCaption( i18n("Manage new Categories") );
175 QVBoxLayout* lay = new QVBoxLayout( this ); 176 QVBoxLayout* lay = new QVBoxLayout( this );
176 lay->setSpacing( 3 ); 177 lay->setSpacing( 3 );
177 lay->setMargin( 3 ); 178 lay->setMargin( 3 );
178 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 ); 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 );
179 lay->addWidget( lab ); 180 lay->addWidget( lab );
180 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 181 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
181 lay->addWidget( format ); 182 lay->addWidget( format );
182 format->setExclusive ( true ) ; 183 format->setExclusive ( true ) ;
183 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 184 addCatBut = new QRadioButton(i18n("Add to category list"), format );
184 new QRadioButton(i18n("Remove from addressees"), format ); 185 new QRadioButton(i18n("Remove from addressees"), format );
185 addCatBut->setChecked( true ); 186 addCatBut->setChecked( true );
186 QPushButton * ok = new QPushButton( i18n("OK"), this ); 187 QPushButton * ok = new QPushButton( i18n("OK"), this );
187 lay->addWidget( ok ); 188 lay->addWidget( ok );
188 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 189 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
189 lay->addWidget( cancel ); 190 lay->addWidget( cancel );
190 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 191 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
191 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 192 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
192 resize( 200, 200 ); 193 resize( 200, 200 );
193 } 194 }
194 195
195 bool addCat() { return addCatBut->isChecked(); } 196 bool addCat() { return addCatBut->isChecked(); }
196private: 197private:
197 QRadioButton* addCatBut; 198 QRadioButton* addCatBut;
198}; 199};
199 200
200class KABFormatPrefs : public QDialog 201class KABFormatPrefs : public QDialog
201{ 202{
202 public: 203 public:
203 KABFormatPrefs( QWidget *parent=0, const char *name=0 ) : 204 KABFormatPrefs( QWidget *parent=0, const char *name=0 ) :
204 QDialog( parent, name, true ) 205 QDialog( parent, name, true )
205 { 206 {
206 setCaption( i18n("Set formatted name") ); 207 setCaption( i18n("Set formatted name") );
207 QVBoxLayout* lay = new QVBoxLayout( this ); 208 QVBoxLayout* lay = new QVBoxLayout( this );
208 lay->setSpacing( 3 ); 209 lay->setSpacing( 3 );
209 lay->setMargin( 3 ); 210 lay->setMargin( 3 );
210 QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this ); 211 QLabel * lab = new QLabel( i18n("You can set the formatted name\nfor a list of contacts in one go."), this );
211 lay->addWidget( lab ); 212 lay->addWidget( lab );
212 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); 213 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this );
213 lay->addWidget( format ); 214 lay->addWidget( format );
214 format->setExclusive ( true ) ; 215 format->setExclusive ( true ) ;
215 simple = new QRadioButton(i18n("Simple: James Bond"), format ); 216 simple = new QRadioButton(i18n("Simple: James Bond"), format );
216 full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); 217 full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format );
217 reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); 218 reverse = new QRadioButton(i18n("Reverse: Bond, James"), format );
218 company = new QRadioButton(i18n("Organization: MI6"), format ); 219 company = new QRadioButton(i18n("Organization: MI6"), format );
219 simple->setChecked( true ); 220 simple->setChecked( true );
220 setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); 221 setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this);
221 lay->addWidget( setCompany ); 222 lay->addWidget( setCompany );
222 QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); 223 QPushButton * ok = new QPushButton( i18n("Select contact list"), this );
223 lay->addWidget( ok ); 224 lay->addWidget( ok );
224 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 225 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
225 lay->addWidget( cancel ); 226 lay->addWidget( cancel );
226 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 227 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
227 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 228 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
228 //resize( 200, 200 ); 229 //resize( 200, 200 );
229 230
230 } 231 }
231public: 232public:
232 QRadioButton* simple, *full, *reverse, *company; 233 QRadioButton* simple, *full, *reverse, *company;
233 QCheckBox* setCompany; 234 QCheckBox* setCompany;
234}; 235};
235 236
236 237
237 238
238class KAex2phonePrefs : public QDialog 239class KAex2phonePrefs : public QDialog
239{ 240{
240 public: 241 public:
241 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 242 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
242 QDialog( parent, name, true ) 243 QDialog( parent, name, true )
243 { 244 {
244 setCaption( i18n("Export to phone options") ); 245 setCaption( i18n("Export to phone options") );
245 QVBoxLayout* lay = new QVBoxLayout( this ); 246 QVBoxLayout* lay = new QVBoxLayout( this );
246 lay->setSpacing( 3 ); 247 lay->setSpacing( 3 );
247 lay->setMargin( 3 ); 248 lay->setMargin( 3 );
248 QLabel *lab; 249 QLabel *lab;
249 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 250 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
250 lab->setAlignment (AlignHCenter ); 251 lab->setAlignment (AlignHCenter );
251 QHBox* temphb; 252 QHBox* temphb;
252 temphb = new QHBox( this ); 253 temphb = new QHBox( this );
253 new QLabel( i18n("I/O device: "), temphb ); 254 new QLabel( i18n("I/O device: "), temphb );
254 mPhoneDevice = new QLineEdit( temphb); 255 mPhoneDevice = new QLineEdit( temphb);
255 lay->addWidget( temphb ); 256 lay->addWidget( temphb );
256 temphb = new QHBox( this ); 257 temphb = new QHBox( this );
257 new QLabel( i18n("Connection: "), temphb ); 258 new QLabel( i18n("Connection: "), temphb );
258 mPhoneConnection = new QLineEdit( temphb); 259 mPhoneConnection = new QLineEdit( temphb);
259 lay->addWidget( temphb ); 260 lay->addWidget( temphb );
260 temphb = new QHBox( this ); 261 temphb = new QHBox( this );
261 new QLabel( i18n("Model(opt.): "), temphb ); 262 new QLabel( i18n("Model(opt.): "), temphb );
262 mPhoneModel = new QLineEdit( temphb); 263 mPhoneModel = new QLineEdit( temphb);
263 lay->addWidget( temphb ); 264 lay->addWidget( temphb );
264 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); 265 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
265 // lay->addWidget( mWriteToSim ); 266 // lay->addWidget( mWriteToSim );
266 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); 267 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
267 lab->setAlignment (AlignHCenter); 268 lab->setAlignment (AlignHCenter);
268 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 269 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
269 lay->addWidget( ok ); 270 lay->addWidget( ok );
270 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 271 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
271 lay->addWidget( cancel ); 272 lay->addWidget( cancel );
272 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 273 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
273 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 274 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
274 resize( 220, 240 ); 275 resize( 220, 240 );
275 276
276 } 277 }
277 278
278public: 279public:
279 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 280 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
280 QCheckBox* mWriteToSim; 281 QCheckBox* mWriteToSim;
281}; 282};
282 283
283 284
284bool pasteWithNewUid = true; 285bool pasteWithNewUid = true;
285 286
286#ifdef KAB_EMBEDDED 287#ifdef KAB_EMBEDDED
287KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 288KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
288 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 289 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
289 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 290 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
290 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 291 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
291#else //KAB_EMBEDDED 292#else //KAB_EMBEDDED
292KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 293KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
293 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 294 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
294 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 295 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
295 mReadWrite( readWrite ), mModified( false ) 296 mReadWrite( readWrite ), mModified( false )
296#endif //KAB_EMBEDDED 297#endif //KAB_EMBEDDED
297{ 298{
298 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 299 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
299 // syncManager->setBlockSave(false); 300 // syncManager->setBlockSave(false);
300 mMiniSplitter = 0; 301 mMiniSplitter = 0;
301 mExtensionBarSplitter = 0; 302 mExtensionBarSplitter = 0;
302 mIsPart = !parent->inherits( "KAddressBookMain" ); 303 mIsPart = !parent->inherits( "KAddressBookMain" );
303 mAddressBook = KABC::StdAddressBook::self(); 304 mAddressBook = KABC::StdAddressBook::self();
304 KABC::StdAddressBook::setAutomaticSave( false ); 305 KABC::StdAddressBook::setAutomaticSave( false );
305 306
306#ifndef KAB_EMBEDDED 307#ifndef KAB_EMBEDDED
307 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 308 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
308#endif //KAB_EMBEDDED 309#endif //KAB_EMBEDDED
309 310
310 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 311 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
311 SLOT( addressBookChanged() ) ); 312 SLOT( addressBookChanged() ) );
312 313
313#if 0 314#if 0
314 // LP moved to addressbook init method 315 // LP moved to addressbook init method
315 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 316 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
316 "X-Department", "KADDRESSBOOK" ); 317 "X-Department", "KADDRESSBOOK" );
317 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 318 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
318 "X-Profession", "KADDRESSBOOK" ); 319 "X-Profession", "KADDRESSBOOK" );
319 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 320 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
320 "X-AssistantsName", "KADDRESSBOOK" ); 321 "X-AssistantsName", "KADDRESSBOOK" );
321 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 322 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
322 "X-ManagersName", "KADDRESSBOOK" ); 323 "X-ManagersName", "KADDRESSBOOK" );
323 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 324 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
324 "X-SpousesName", "KADDRESSBOOK" ); 325 "X-SpousesName", "KADDRESSBOOK" );
325 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 326 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
326 "X-Office", "KADDRESSBOOK" ); 327 "X-Office", "KADDRESSBOOK" );
327 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 328 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
328 "X-IMAddress", "KADDRESSBOOK" ); 329 "X-IMAddress", "KADDRESSBOOK" );
329 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 330 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
330 "X-Anniversary", "KADDRESSBOOK" ); 331 "X-Anniversary", "KADDRESSBOOK" );
331 332
332 //US added this field to become compatible with Opie/qtopia addressbook 333 //US added this field to become compatible with Opie/qtopia addressbook
333 // values can be "female" or "male" or "". An empty field represents undefined. 334 // values can be "female" or "male" or "". An empty field represents undefined.
334 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 335 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
335 "X-Gender", "KADDRESSBOOK" ); 336 "X-Gender", "KADDRESSBOOK" );
336 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 337 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
337 "X-Children", "KADDRESSBOOK" ); 338 "X-Children", "KADDRESSBOOK" );
338 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 339 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
339 "X-FreeBusyUrl", "KADDRESSBOOK" ); 340 "X-FreeBusyUrl", "KADDRESSBOOK" );
340#endif 341#endif
341 initGUI(); 342 initGUI();
342 343
343 mIncSearchWidget->setFocus(); 344 mIncSearchWidget->setFocus();
344 345
345 346
346 connect( mViewManager, SIGNAL( selected( const QString& ) ), 347 connect( mViewManager, SIGNAL( selected( const QString& ) ),
347 SLOT( setContactSelected( const QString& ) ) ); 348 SLOT( setContactSelected( const QString& ) ) );
348 connect( mViewManager, SIGNAL( executed( const QString& ) ), 349 connect( mViewManager, SIGNAL( executed( const QString& ) ),
349 SLOT( executeContact( const QString& ) ) ); 350 SLOT( executeContact( const QString& ) ) );
350 351
351 connect( mViewManager, SIGNAL( deleteRequest( ) ), 352 connect( mViewManager, SIGNAL( deleteRequest( ) ),
352 SLOT( deleteContacts( ) ) ); 353 SLOT( deleteContacts( ) ) );
353 connect( mViewManager, SIGNAL( modified() ), 354 connect( mViewManager, SIGNAL( modified() ),
354 SLOT( setModified() ) ); 355 SLOT( setModified() ) );
355 356
356 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 357 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
357 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 358 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
358 359
359 connect( mXXPortManager, SIGNAL( modified() ), 360 connect( mXXPortManager, SIGNAL( modified() ),
360 SLOT( setModified() ) ); 361 SLOT( setModified() ) );
361 362
362 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 363 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
363 SLOT( incrementalSearch( const QString& ) ) ); 364 SLOT( incrementalSearch( const QString& ) ) );
364 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 365 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
365 mJumpButtonBar, SLOT( recreateButtons() ) ); 366 mJumpButtonBar, SLOT( recreateButtons() ) );
366 367
367 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 368 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
368 SLOT( sendMail( const QString& ) ) ); 369 SLOT( sendMail( const QString& ) ) );
369 370
370 371
371 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 372 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
372 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&))); 373 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&)));
373 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 374 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
374 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); 375 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle()));
375 376
376 377
377#ifndef KAB_EMBEDDED 378#ifndef KAB_EMBEDDED
378 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 379 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
379 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 380 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
380 381
381 connect( mDetails, SIGNAL( browse( const QString& ) ), 382 connect( mDetails, SIGNAL( browse( const QString& ) ),
382 SLOT( browse( const QString& ) ) ); 383 SLOT( browse( const QString& ) ) );
383 384
384 385
385 mAddressBookService = new KAddressBookService( this ); 386 mAddressBookService = new KAddressBookService( this );
386 387
387#endif //KAB_EMBEDDED 388#endif //KAB_EMBEDDED
388 389
389 mMessageTimer = new QTimer( this ); 390 mMessageTimer = new QTimer( this );
390 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); 391 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
391 mEditorDialog = 0; 392 mEditorDialog = 0;
392 createAddresseeEditorDialog( this ); 393 createAddresseeEditorDialog( this );
393 setModified( false ); 394 setModified( false );
394 mBRdisabled = false; 395 mBRdisabled = false;
395#ifndef DESKTOP_VERSION 396#ifndef DESKTOP_VERSION
396 infrared = 0; 397 infrared = 0;
397#endif 398#endif
398 //toggleBeamReceive( ); 399 //toggleBeamReceive( );
399 //mMainWindow->toolBar()->show(); 400 //mMainWindow->toolBar()->show();
400 // we have a toolbar repainting error on the Zaurus when starting KA/Pi 401 // we have a toolbar repainting error on the Zaurus when starting KA/Pi
401 QTimer::singleShot( 10, this , SLOT ( updateToolBar())); 402 QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
402} 403}
403 404
404void KABCore::updateToolBar() 405void KABCore::updateToolBar()
405{ 406{
406 static int iii = 0; 407 static int iii = 0;
407 ++iii; 408 ++iii;
408 mMainWindow->toolBar()->repaintMe(); 409 mMainWindow->toolBar()->repaintMe();
409 if ( iii < 3 ) 410 if ( iii < 3 )
410 QTimer::singleShot( 10, this , SLOT ( updateToolBar())); 411 QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
411} 412}
412KABCore::~KABCore() 413KABCore::~KABCore()
413{ 414{
414 // save(); 415 // save();
415 //saveSettings(); 416 //saveSettings();
416 //KABPrefs::instance()->writeConfig(); 417 //KABPrefs::instance()->writeConfig();
417 delete AddresseeConfig::instance(); 418 delete AddresseeConfig::instance();
418 mAddressBook = 0; 419 mAddressBook = 0;
419 KABC::StdAddressBook::close(); 420 KABC::StdAddressBook::close();
420 421
421 delete syncManager; 422 delete syncManager;
422#ifndef DESKTOP_VERSION 423#ifndef DESKTOP_VERSION
423 if ( infrared ) 424 if ( infrared )
424 delete infrared; 425 delete infrared;
425#endif 426#endif
426} 427}
427void KABCore::receive( const QCString& cmsg, const QByteArray& data ) 428void KABCore::receive( const QCString& cmsg, const QByteArray& data )
428{ 429{
429 qDebug("KA: QCOP message received: %s ", cmsg.data() ); 430 qDebug("KA: QCOP message received: %s ", cmsg.data() );
430 if ( cmsg == "setDocument(QString)" ) { 431 if ( cmsg == "setDocument(QString)" ) {
431 QDataStream stream( data, IO_ReadOnly ); 432 QDataStream stream( data, IO_ReadOnly );
432 QString fileName; 433 QString fileName;
433 stream >> fileName; 434 stream >> fileName;
434 recieve( fileName ); 435 recieve( fileName );
435 return; 436 return;
436 } 437 }
437} 438}
438void KABCore::toggleBeamReceive( ) 439void KABCore::toggleBeamReceive( )
439{ 440{
440 if ( mBRdisabled ) 441 if ( mBRdisabled )
441 return; 442 return;
442#ifndef DESKTOP_VERSION 443#ifndef DESKTOP_VERSION
443 if ( infrared ) { 444 if ( infrared ) {
444 qDebug("AB disable BeamReceive "); 445 qDebug("AB disable BeamReceive ");
445 delete infrared; 446 delete infrared;
446 infrared = 0; 447 infrared = 0;
447 mActionBR->setChecked(false); 448 mActionBR->setChecked(false);
448 return; 449 return;
449 } 450 }
450 qDebug("AB enable BeamReceive "); 451 qDebug("AB enable BeamReceive ");
451 mActionBR->setChecked(true); 452 mActionBR->setChecked(true);
452 453
453 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; 454 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
454 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); 455 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
455#endif 456#endif
456} 457}
457 458
458 459
459void KABCore::disableBR(bool b) 460void KABCore::disableBR(bool b)
460{ 461{
461#ifndef DESKTOP_VERSION 462#ifndef DESKTOP_VERSION
462 if ( b ) { 463 if ( b ) {
463 if ( infrared ) { 464 if ( infrared ) {
464 toggleBeamReceive( ); 465 toggleBeamReceive( );
465 } 466 }
466 mBRdisabled = true; 467 mBRdisabled = true;
467 } else { 468 } else {
468 if ( mBRdisabled ) { 469 if ( mBRdisabled ) {
469 mBRdisabled = false; 470 mBRdisabled = false;
470 //toggleBeamReceive( ); 471 //toggleBeamReceive( );
471 } 472 }
472 } 473 }
473#endif 474#endif
474 475
475} 476}
476void KABCore::recieve( QString fn ) 477void KABCore::recieve( QString fn )
477{ 478{
478 //qDebug("KABCore::recieve "); 479 //qDebug("KABCore::recieve ");
479 int count = mAddressBook->importFromFile( fn, true ); 480 int count = mAddressBook->importFromFile( fn, true );
480 if ( count ) 481 if ( count )
481 setModified( true ); 482 setModified( true );
482 mViewManager->refreshView(); 483 mViewManager->refreshView();
483 message(i18n("%1 contact(s) received!").arg( count )); 484 message(i18n("%1 contact(s) received!").arg( count ));
484 topLevelWidget()->showMaximized(); 485 topLevelWidget()->showMaximized();
485 topLevelWidget()->raise(); 486 topLevelWidget()->raise();
486} 487}
487void KABCore::restoreSettings() 488void KABCore::restoreSettings()
488{ 489{
489 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 490 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
490 491
491 bool state; 492 bool state;
492 493
493 if (mMultipleViewsAtOnce) 494 if (mMultipleViewsAtOnce)
494 state = KABPrefs::instance()->mDetailsPageVisible; 495 state = KABPrefs::instance()->mDetailsPageVisible;
495 else 496 else
496 state = false; 497 state = false;
497 498
498 mActionDetails->setChecked( state ); 499 mActionDetails->setChecked( state );
499 setDetailsVisible( state ); 500 setDetailsVisible( state );
500 501
501 state = KABPrefs::instance()->mJumpButtonBarVisible; 502 state = KABPrefs::instance()->mJumpButtonBarVisible;
502 503
503 mActionJumpBar->setChecked( state ); 504 mActionJumpBar->setChecked( state );
504 setJumpButtonBarVisible( state ); 505 setJumpButtonBarVisible( state );
505/*US 506/*US
506 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 507 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
507 if ( splitterSize.count() == 0 ) { 508 if ( splitterSize.count() == 0 ) {
508 splitterSize.append( width() / 2 ); 509 splitterSize.append( width() / 2 );
509 splitterSize.append( width() / 2 ); 510 splitterSize.append( width() / 2 );
510 } 511 }
511 mMiniSplitter->setSizes( splitterSize ); 512 mMiniSplitter->setSizes( splitterSize );
512 if ( mExtensionBarSplitter ) { 513 if ( mExtensionBarSplitter ) {
513 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 514 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
514 if ( splitterSize.count() == 0 ) { 515 if ( splitterSize.count() == 0 ) {
515 splitterSize.append( width() / 2 ); 516 splitterSize.append( width() / 2 );
516 splitterSize.append( width() / 2 ); 517 splitterSize.append( width() / 2 );
517 } 518 }
518 mExtensionBarSplitter->setSizes( splitterSize ); 519 mExtensionBarSplitter->setSizes( splitterSize );
519 520
520 } 521 }
521*/ 522*/
522 mViewManager->restoreSettings(); 523 mViewManager->restoreSettings();
523 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 524 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
524 mExtensionManager->restoreSettings(); 525 mExtensionManager->restoreSettings();
525#ifdef DESKTOP_VERSION 526#ifdef DESKTOP_VERSION
526 int wid = width(); 527 int wid = width();
527 if ( wid < 10 ) 528 if ( wid < 10 )
528 wid = 400; 529 wid = 400;
529#else 530#else
530 int wid = QApplication::desktop()->width(); 531 int wid = QApplication::desktop()->width();
531 if ( wid < 640 ) 532 if ( wid < 640 )
532 wid = QApplication::desktop()->height(); 533 wid = QApplication::desktop()->height();
533#endif 534#endif
534 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 535 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
535 if ( true /*splitterSize.count() == 0*/ ) { 536 if ( true /*splitterSize.count() == 0*/ ) {
536 splitterSize.append( wid / 2 ); 537 splitterSize.append( wid / 2 );
537 splitterSize.append( wid / 2 ); 538 splitterSize.append( wid / 2 );
538 } 539 }
539 mMiniSplitter->setSizes( splitterSize ); 540 mMiniSplitter->setSizes( splitterSize );
540 if ( mExtensionBarSplitter ) { 541 if ( mExtensionBarSplitter ) {
541 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 542 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
542 if ( true /*splitterSize.count() == 0*/ ) { 543 if ( true /*splitterSize.count() == 0*/ ) {
543 splitterSize.append( wid / 2 ); 544 splitterSize.append( wid / 2 );
544 splitterSize.append( wid / 2 ); 545 splitterSize.append( wid / 2 );
545 } 546 }
546 mExtensionBarSplitter->setSizes( splitterSize ); 547 mExtensionBarSplitter->setSizes( splitterSize );
547 548
548 } 549 }
549 550
550 551
551} 552}
552 553
553void KABCore::saveSettings() 554void KABCore::saveSettings()
554{ 555{
555 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 556 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
556 if ( mExtensionBarSplitter ) 557 if ( mExtensionBarSplitter )
557 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 558 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
558 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 559 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
559 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 560 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
560#ifndef KAB_EMBEDDED 561#ifndef KAB_EMBEDDED
561 562
562 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 563 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
563 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 564 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
564#endif //KAB_EMBEDDED 565#endif //KAB_EMBEDDED
565 mExtensionManager->saveSettings(); 566 mExtensionManager->saveSettings();
566 mViewManager->saveSettings(); 567 mViewManager->saveSettings();
567 568
568 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 569 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
569 KABPrefs::instance()->writeConfig(); 570 KABPrefs::instance()->writeConfig();
570 qDebug("KABCore::saveSettings() "); 571 qDebug("KABCore::saveSettings() ");
571} 572}
572 573
573KABC::AddressBook *KABCore::addressBook() const 574KABC::AddressBook *KABCore::addressBook() const
574{ 575{
575 return mAddressBook; 576 return mAddressBook;
576} 577}
577 578
578KConfig *KABCore::config() 579KConfig *KABCore::config()
579{ 580{
580#ifndef KAB_EMBEDDED 581#ifndef KAB_EMBEDDED
581 return KABPrefs::instance()->config(); 582 return KABPrefs::instance()->config();
582#else //KAB_EMBEDDED 583#else //KAB_EMBEDDED
583 return KABPrefs::instance()->getConfig(); 584 return KABPrefs::instance()->getConfig();
584#endif //KAB_EMBEDDED 585#endif //KAB_EMBEDDED
585} 586}
586 587
587KActionCollection *KABCore::actionCollection() const 588KActionCollection *KABCore::actionCollection() const
588{ 589{
589 return mGUIClient->actionCollection(); 590 return mGUIClient->actionCollection();
590} 591}
591 592
592KABC::Field *KABCore::currentSearchField() const 593KABC::Field *KABCore::currentSearchField() const
593{ 594{
594 if (mIncSearchWidget) 595 if (mIncSearchWidget)
595 return mIncSearchWidget->currentField(); 596 return mIncSearchWidget->currentField();
596 else 597 else
597 return 0; 598 return 0;
598} 599}
599 600
600QStringList KABCore::selectedUIDs() const 601QStringList KABCore::selectedUIDs() const
601{ 602{
602 return mViewManager->selectedUids(); 603 return mViewManager->selectedUids();
603} 604}
604 605
605KABC::Resource *KABCore::requestResource( QWidget *parent ) 606KABC::Resource *KABCore::requestResource( QWidget *parent )
606{ 607{
607 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 608 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
608 609
609 QPtrList<KRES::Resource> kresResources; 610 QPtrList<KRES::Resource> kresResources;
610 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 611 QPtrListIterator<KABC::Resource> resIt( kabcResources );
611 KABC::Resource *resource; 612 KABC::Resource *resource;
612 while ( ( resource = resIt.current() ) != 0 ) { 613 while ( ( resource = resIt.current() ) != 0 ) {
613 ++resIt; 614 ++resIt;
614 if ( !resource->readOnly() ) { 615 if ( !resource->readOnly() ) {
615 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 616 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
616 if ( res ) 617 if ( res )
617 kresResources.append( res ); 618 kresResources.append( res );
618 } 619 }
619 } 620 }
620 621
621 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 622 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
622 return static_cast<KABC::Resource*>( res ); 623 return static_cast<KABC::Resource*>( res );
623} 624}
624 625
625#ifndef KAB_EMBEDDED 626#ifndef KAB_EMBEDDED
626KAboutData *KABCore::createAboutData() 627KAboutData *KABCore::createAboutData()
627#else //KAB_EMBEDDED 628#else //KAB_EMBEDDED
628void KABCore::createAboutData() 629void KABCore::createAboutData()
629#endif //KAB_EMBEDDED 630#endif //KAB_EMBEDDED
630{ 631{
631#ifndef KAB_EMBEDDED 632#ifndef KAB_EMBEDDED
632 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 633 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
633 "3.1", I18N_NOOP( "The KDE Address Book" ), 634 "3.1", I18N_NOOP( "The KDE Address Book" ),
634 KAboutData::License_GPL_V2, 635 KAboutData::License_GPL_V2,
635 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 636 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
636 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 637 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
637 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 638 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
638 about->addAuthor( "Cornelius Schumacher", 639 about->addAuthor( "Cornelius Schumacher",
639 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 640 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
640 "schumacher@kde.org" ); 641 "schumacher@kde.org" );
641 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 642 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
642 "mpilone@slac.com" ); 643 "mpilone@slac.com" );
643 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 644 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
644 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 645 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
645 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 646 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
646 "michel@klaralvdalens-datakonsult.se" ); 647 "michel@klaralvdalens-datakonsult.se" );
647 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 648 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
648 "hansen@kde.org" ); 649 "hansen@kde.org" );
649 650
650 return about; 651 return about;
651#endif //KAB_EMBEDDED 652#endif //KAB_EMBEDDED
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 Lutz Rogowski\n" 667 "(c) 2004 Lutz Rogowski\n"
667 "(c) 1997-2003, The KDE PIM Team\n" 668 "(c) 1997-2003, The KDE PIM Team\n"
668 "Tobias Koenig Current maintainer\ntokoe@kde.org\n" 669 "Tobias Koenig Current maintainer\ntokoe@kde.org\n"
669 "Don Sanders Original author\n" 670 "Don Sanders Original author\n"
670 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" 671 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n"
671 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" 672 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\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" "michel@klaralvdalens-datakonsult.se\n" 675 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
675 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" 676 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n"
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
682void KABCore::setContactSelected( const QString &uid ) 683void 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
725void KABCore::sendMail() 726void KABCore::sendMail()
726{ 727{
727 sendMail( mViewManager->selectedEmails().join( ", " ) ); 728 sendMail( mViewManager->selectedEmails().join( ", " ) );
728} 729}
729 730
730void KABCore::sendMail( const QString& emaillist ) 731void 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
741void KABCore::mailVCard() 742void 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
748void KABCore::mailVCard( const QStringList& uids ) 749void 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*/
804void KABCore::beamMySelf() 805void 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}
819void KABCore::updateMainWindow() 820void KABCore::updateMainWindow()
820{ 821{
821 822
822 mMainWindow->showMaximized(); 823 mMainWindow->showMaximized();
823 mMainWindow->update(); 824 mMainWindow->update();
824} 825}
825void KABCore::resizeEvent(QResizeEvent* e ) 826void KABCore::resizeEvent(QResizeEvent* e )
826{ 827{
827 if ( !mMiniSplitter ) 828 if ( !mMiniSplitter )
828 return; 829 return;
829 //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); 830 //qDebug("KABCore::resizeEvent(QResizeEvent* e ) ");
830 if ( QApplication::desktop()->width() >= 480 ) { 831 if ( QApplication::desktop()->width() >= 480 ) {
831 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 832 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480
832 if ( mMiniSplitter->orientation() == Qt::Vertical ) { 833 if ( mMiniSplitter->orientation() == Qt::Vertical ) {
833 mMiniSplitter->setOrientation( Qt::Horizontal); 834 mMiniSplitter->setOrientation( Qt::Horizontal);
834 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 835 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
835 if ( QApplication::desktop()->width() <= 640 ) { 836 if ( QApplication::desktop()->width() <= 640 ) {
836 //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); 837 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
837 mViewManager->getFilterAction()->setComboWidth( 150 ); 838 mViewManager->getFilterAction()->setComboWidth( 150 );
838 QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); 839 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
839 } 840 }
840 } 841 }
841 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 842 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640
842 if ( mMiniSplitter->orientation() == Qt::Horizontal ) { 843 if ( mMiniSplitter->orientation() == Qt::Horizontal ) {
843 mMiniSplitter->setOrientation( Qt::Vertical ); 844 mMiniSplitter->setOrientation( Qt::Vertical );
844 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 845 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
845 if ( QApplication::desktop()->width() <= 640 ) { 846 if ( QApplication::desktop()->width() <= 640 ) {
846 //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); 847 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
847 mMainWindow->showMinimized(); 848 mMainWindow->showMinimized();
848 mViewManager->getFilterAction()->setComboWidth( 0 ); 849 mViewManager->getFilterAction()->setComboWidth( 0 );
849 QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); 850 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
850 } 851 }
851 } 852 }
852 } 853 }
853 } 854 }
854 855
855} 856}
856void KABCore::export2phone() 857void KABCore::export2phone()
857{ 858{
858 859
859 QStringList uids; 860 QStringList uids;
860 XXPortSelectDialog dlg( this, false, this ); 861 XXPortSelectDialog dlg( this, false, this );
861 if ( dlg.exec() ) 862 if ( dlg.exec() )
862 uids = dlg.uids(); 863 uids = dlg.uids();
863 else 864 else
864 return; 865 return;
865 if ( uids.isEmpty() ) 866 if ( uids.isEmpty() )
866 return; 867 return;
867 // qDebug("count %d ", uids.count()); 868 // qDebug("count %d ", uids.count());
868 869
869 KAex2phonePrefs ex2phone; 870 KAex2phonePrefs ex2phone;
870 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 871 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
871 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 872 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
872 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 873 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
873 874
874 if ( !ex2phone.exec() ) { 875 if ( !ex2phone.exec() ) {
875 return; 876 return;
876 } 877 }
877 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 878 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
878 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 879 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
879 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 880 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
880 881
881 882
882 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 883 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
883 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 884 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
884 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 885 KPimGlobalPrefs::instance()->mEx2PhoneModel );
885 886
886 QString fileName = getPhoneFile(); 887 QString fileName = getPhoneFile();
887 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) 888 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
888 return; 889 return;
889 890
890 message(i18n("Exporting to phone...")); 891 message(i18n("Exporting to phone..."));
891 QTimer::singleShot( 1, this , SLOT ( writeToPhone())); 892 QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
892 893
893} 894}
894QString KABCore::getPhoneFile() 895QString KABCore::getPhoneFile()
895{ 896{
896#ifdef DESKTOP_VERSION 897#ifdef DESKTOP_VERSION
897 return locateLocal("tmp", "phonefile.vcf"); 898 return locateLocal("tmp", "phonefile.vcf");
898#else 899#else
899 return "/tmp/phonefile.vcf"; 900 return "/tmp/phonefile.vcf";
900#endif 901#endif
901 902
902} 903}
903void KABCore::writeToPhone( ) 904void KABCore::writeToPhone( )
904{ 905{
905 if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) 906 if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
906 message(i18n("Export to phone finished!")); 907 message(i18n("Export to phone finished!"));
907 else 908 else
908 qDebug(i18n("Error exporting to phone")); 909 qDebug(i18n("Error exporting to phone"));
909} 910}
910void KABCore::beamVCard() 911void KABCore::beamVCard()
911{ 912{
912 QStringList uids; 913 QStringList uids;
913 XXPortSelectDialog dlg( this, false, this ); 914 XXPortSelectDialog dlg( this, false, this );
914 if ( dlg.exec() ) 915 if ( dlg.exec() )
915 uids = dlg.uids(); 916 uids = dlg.uids();
916 else 917 else
917 return; 918 return;
918 if ( uids.isEmpty() ) 919 if ( uids.isEmpty() )
919 return; 920 return;
920 beamVCard( uids ); 921 beamVCard( uids );
921} 922}
922 923
923 924
924void KABCore::beamVCard(const QStringList& uids) 925void KABCore::beamVCard(const QStringList& uids)
925{ 926{
926 927
927 // LR: we should use the /tmp dir on the Zaurus, 928 // LR: we should use the /tmp dir on the Zaurus,
928 // because: /tmp = RAM, (HOME)/kdepim = flash memory 929 // because: /tmp = RAM, (HOME)/kdepim = flash memory
929 930
930#ifdef DESKTOP_VERSION 931#ifdef DESKTOP_VERSION
931 QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); 932 QString fileName = locateLocal("tmp", "kapibeamfile.vcf");
932#else 933#else
933 QString fileName = "/tmp/kapibeamfile.vcf"; 934 QString fileName = "/tmp/kapibeamfile.vcf";
934#endif 935#endif
935 936
936 KABC::VCardConverter converter; 937 KABC::VCardConverter converter;
937 QString description; 938 QString description;
938 QString datastream; 939 QString datastream;
939 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 940 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
940 KABC::Addressee a = mAddressBook->findByUid( *it ); 941 KABC::Addressee a = mAddressBook->findByUid( *it );
941 942
942 if ( a.isEmpty() ) 943 if ( a.isEmpty() )
943 continue; 944 continue;
944 945
945 if (description.isEmpty()) 946 if (description.isEmpty())
946 description = a.formattedName(); 947 description = a.formattedName();
947 948
948 QString vcard; 949 QString vcard;
949 converter.addresseeToVCard( a, vcard ); 950 converter.addresseeToVCard( a, vcard );
950 int start = 0; 951 int start = 0;
951 int next; 952 int next;
952 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 953 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
953 int semi = vcard.find(";", next); 954 int semi = vcard.find(";", next);
954 int dopp = vcard.find(":", next); 955 int dopp = vcard.find(":", next);
955 int sep; 956 int sep;
956 if ( semi < dopp && semi >= 0 ) 957 if ( semi < dopp && semi >= 0 )
957 sep = semi ; 958 sep = semi ;
958 else 959 else
959 sep = dopp; 960 sep = dopp;
960 datastream +=vcard.mid( start, next - start); 961 datastream +=vcard.mid( start, next - start);
961 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 962 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
962 start = sep; 963 start = sep;
963 } 964 }
964 datastream += vcard.mid( start,vcard.length() ); 965 datastream += vcard.mid( start,vcard.length() );
965 } 966 }
966#ifndef DESKTOP_VERSION 967#ifndef DESKTOP_VERSION
967 QFile outFile(fileName); 968 QFile outFile(fileName);
968 if ( outFile.open(IO_WriteOnly) ) { 969 if ( outFile.open(IO_WriteOnly) ) {
969 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 970 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
970 QTextStream t( &outFile ); // use a text stream 971 QTextStream t( &outFile ); // use a text stream
971 //t.setEncoding( QTextStream::UnicodeUTF8 ); 972 //t.setEncoding( QTextStream::UnicodeUTF8 );
972 t.setEncoding( QTextStream::Latin1 ); 973 t.setEncoding( QTextStream::Latin1 );
973 t <<datastream.latin1(); 974 t <<datastream.latin1();
974 outFile.close(); 975 outFile.close();
975 Ir *ir = new Ir( this ); 976 Ir *ir = new Ir( this );
976 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 977 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
977 ir->send( fileName, description, "text/x-vCard" ); 978 ir->send( fileName, description, "text/x-vCard" );
978 } else { 979 } else {
979 qDebug("Error open temp beam file "); 980 qDebug("Error open temp beam file ");
980 return; 981 return;
981 } 982 }
982#endif 983#endif
983 984
984} 985}
985 986
986void KABCore::beamDone( Ir *ir ) 987void KABCore::beamDone( Ir *ir )
987{ 988{
988#ifndef DESKTOP_VERSION 989#ifndef DESKTOP_VERSION
989 delete ir; 990 delete ir;
990#endif 991#endif
991 topLevelWidget()->raise(); 992 topLevelWidget()->raise();
992 message( i18n("Beaming finished!") ); 993 message( i18n("Beaming finished!") );
993} 994}
994 995
995 996
996void KABCore::browse( const QString& url ) 997void KABCore::browse( const QString& url )
997{ 998{
998#ifndef KAB_EMBEDDED 999#ifndef KAB_EMBEDDED
999 kapp->invokeBrowser( url ); 1000 kapp->invokeBrowser( url );
1000#else //KAB_EMBEDDED 1001#else //KAB_EMBEDDED
1001 qDebug("KABCore::browse must be fixed"); 1002 qDebug("KABCore::browse must be fixed");
1002#endif //KAB_EMBEDDED 1003#endif //KAB_EMBEDDED
1003} 1004}
1004 1005
1005void KABCore::selectAllContacts() 1006void KABCore::selectAllContacts()
1006{ 1007{
1007 mViewManager->setSelected( QString::null, true ); 1008 mViewManager->setSelected( QString::null, true );
1008} 1009}
1009 1010
1010void KABCore::deleteContacts() 1011void KABCore::deleteContacts()
1011{ 1012{
1012 QStringList uidList = mViewManager->selectedUids(); 1013 QStringList uidList = mViewManager->selectedUids();
1013 deleteContacts( uidList ); 1014 deleteContacts( uidList );
1014} 1015}
1015 1016
1016void KABCore::deleteContacts( const QStringList &uids ) 1017void KABCore::deleteContacts( const QStringList &uids )
1017{ 1018{
1018 if ( uids.count() > 0 ) { 1019 if ( uids.count() > 0 ) {
1019 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 1020 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
1020 UndoStack::instance()->push( command ); 1021 UndoStack::instance()->push( command );
1021 RedoStack::instance()->clear(); 1022 RedoStack::instance()->clear();
1022 1023
1023 // now if we deleted anything, refresh 1024 // now if we deleted anything, refresh
1024 setContactSelected( QString::null ); 1025 setContactSelected( QString::null );
1025 setModified( true ); 1026 setModified( true );
1026 } 1027 }
1027} 1028}
1028 1029
1029void KABCore::copyContacts() 1030void KABCore::copyContacts()
1030{ 1031{
1031 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1032 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1032 1033
1033 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 1034 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
1034 1035
1035 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 1036 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
1036 1037
1037 QClipboard *cb = QApplication::clipboard(); 1038 QClipboard *cb = QApplication::clipboard();
1038 cb->setText( clipText ); 1039 cb->setText( clipText );
1039} 1040}
1040 1041
1041void KABCore::cutContacts() 1042void KABCore::cutContacts()
1042{ 1043{
1043 QStringList uidList = mViewManager->selectedUids(); 1044 QStringList uidList = mViewManager->selectedUids();
1044 1045
1045//US if ( uidList.size() > 0 ) { 1046//US if ( uidList.size() > 0 ) {
1046 if ( uidList.count() > 0 ) { 1047 if ( uidList.count() > 0 ) {
1047 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 1048 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
1048 UndoStack::instance()->push( command ); 1049 UndoStack::instance()->push( command );
1049 RedoStack::instance()->clear(); 1050 RedoStack::instance()->clear();
1050 1051
1051 setModified( true ); 1052 setModified( true );
1052 } 1053 }
1053} 1054}
1054 1055
1055void KABCore::pasteContacts() 1056void KABCore::pasteContacts()
1056{ 1057{
1057 QClipboard *cb = QApplication::clipboard(); 1058 QClipboard *cb = QApplication::clipboard();
1058 1059
1059 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 1060 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
1060 1061
1061 pasteContacts( list ); 1062 pasteContacts( list );
1062} 1063}
1063 1064
1064void KABCore::pasteContacts( KABC::Addressee::List &list ) 1065void KABCore::pasteContacts( KABC::Addressee::List &list )
1065{ 1066{
1066 KABC::Resource *resource = requestResource( this ); 1067 KABC::Resource *resource = requestResource( this );
1067 KABC::Addressee::List::Iterator it; 1068 KABC::Addressee::List::Iterator it;
1068 for ( it = list.begin(); it != list.end(); ++it ) 1069 for ( it = list.begin(); it != list.end(); ++it )
1069 (*it).setResource( resource ); 1070 (*it).setResource( resource );
1070 1071
1071 PwPasteCommand *command = new PwPasteCommand( this, list ); 1072 PwPasteCommand *command = new PwPasteCommand( this, list );
1072 UndoStack::instance()->push( command ); 1073 UndoStack::instance()->push( command );
1073 RedoStack::instance()->clear(); 1074 RedoStack::instance()->clear();
1074 1075
1075 setModified( true ); 1076 setModified( true );
1076} 1077}
1077 1078
1078void KABCore::setWhoAmI() 1079void KABCore::setWhoAmI()
1079{ 1080{
1080 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1081 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1081 1082
1082 if ( addrList.count() > 1 ) { 1083 if ( addrList.count() > 1 ) {
1083 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 1084 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
1084 return; 1085 return;
1085 } 1086 }
1086 1087
1087 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 1088 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
1088 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 1089 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
1089 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 1090 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
1090} 1091}
1091void KABCore::editCategories() 1092void KABCore::editCategories()
1092{ 1093{
1093 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true ); 1094 KPIM::CategoryEditDialog dlg ( KABPrefs::instance(), this, "", true );
1094 dlg.exec(); 1095 dlg.exec();
1095} 1096}
1096void KABCore::setCategories() 1097void KABCore::setCategories()
1097{ 1098{
1098 1099
1099 QStringList uids; 1100 QStringList uids;
1100 XXPortSelectDialog dlgx( this, false, this ); 1101 XXPortSelectDialog dlgx( this, false, this );
1101 if ( dlgx.exec() ) 1102 if ( dlgx.exec() )
1102 uids = dlgx.uids(); 1103 uids = dlgx.uids();
1103 else 1104 else
1104 return; 1105 return;
1105 if ( uids.isEmpty() ) 1106 if ( uids.isEmpty() )
1106 return; 1107 return;
1107 // qDebug("count %d ", uids.count()); 1108 // qDebug("count %d ", uids.count());
1108 1109
1109 1110
1110 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 1111 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
1111 if ( !dlg.exec() ) { 1112 if ( !dlg.exec() ) {
1112 message( i18n("Setting categories cancelled") ); 1113 message( i18n("Setting categories cancelled") );
1113 return; 1114 return;
1114 } 1115 }
1115 bool merge = false; 1116 bool merge = false;
1116 QString msg = i18n( "Merge with existing categories?" ); 1117 QString msg = i18n( "Merge with existing categories?" );
1117 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 1118 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
1118 merge = true; 1119 merge = true;
1119 1120
1120 message( i18n("Setting categories ... please wait!") ); 1121 message( i18n("Setting categories ... please wait!") );
1121 QStringList categories = dlg.selectedCategories(); 1122 QStringList categories = dlg.selectedCategories();
1122 1123
1123 //QStringList uids = mViewManager->selectedUids(); 1124 //QStringList uids = mViewManager->selectedUids();
1124 QStringList::Iterator it; 1125 QStringList::Iterator it;
1125 for ( it = uids.begin(); it != uids.end(); ++it ) { 1126 for ( it = uids.begin(); it != uids.end(); ++it ) {
1126 KABC::Addressee addr = mAddressBook->findByUid( *it ); 1127 KABC::Addressee addr = mAddressBook->findByUid( *it );
1127 if ( !addr.isEmpty() ) { 1128 if ( !addr.isEmpty() ) {
1128 if ( !merge ) 1129 if ( !merge )
1129 addr.setCategories( categories ); 1130 addr.setCategories( categories );
1130 else { 1131 else {
1131 QStringList addrCategories = addr.categories(); 1132 QStringList addrCategories = addr.categories();
1132 QStringList::Iterator catIt; 1133 QStringList::Iterator catIt;
1133 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 1134 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
1134 if ( !addrCategories.contains( *catIt ) ) 1135 if ( !addrCategories.contains( *catIt ) )
1135 addrCategories.append( *catIt ); 1136 addrCategories.append( *catIt );
1136 } 1137 }
1137 addr.setCategories( addrCategories ); 1138 addr.setCategories( addrCategories );
1138 } 1139 }
1139 mAddressBook->insertAddressee( addr ); 1140 mAddressBook->insertAddressee( addr );
1140 } 1141 }
1141 } 1142 }
1142 1143
1143 if ( uids.count() > 0 ) 1144 if ( uids.count() > 0 )
1144 setModified( true ); 1145 setModified( true );
1145 message( i18n("Setting categories completed!") ); 1146 message( i18n("Setting categories completed!") );
1146} 1147}
1147 1148
1148void KABCore::setSearchFields( const KABC::Field::List &fields ) 1149void KABCore::setSearchFields( const KABC::Field::List &fields )
1149{ 1150{
1150 mIncSearchWidget->setFields( fields ); 1151 mIncSearchWidget->setFields( fields );
1151} 1152}
1152 1153
1153void KABCore::incrementalSearch( const QString& text ) 1154void KABCore::incrementalSearch( const QString& text )
1154{ 1155{
1155 mViewManager->doSearch( text, mIncSearchWidget->currentField() ); 1156 mViewManager->doSearch( text, mIncSearchWidget->currentField() );
1156} 1157}
1157 1158
1158void KABCore::setModified() 1159void KABCore::setModified()
1159{ 1160{
1160 setModified( true ); 1161 setModified( true );
1161} 1162}
1162 1163
1163void KABCore::setModifiedWOrefresh() 1164void KABCore::setModifiedWOrefresh()
1164{ 1165{
1165 // qDebug("KABCore::setModifiedWOrefresh() "); 1166 // qDebug("KABCore::setModifiedWOrefresh() ");
1166 mModified = true; 1167 mModified = true;
1167 mActionSave->setEnabled( mModified ); 1168 mActionSave->setEnabled( mModified );
1168 1169
1169 1170
1170} 1171}
1171void KABCore::setModified( bool modified ) 1172void KABCore::setModified( bool modified )
1172{ 1173{
1173 mModified = modified; 1174 mModified = modified;
1174 mActionSave->setEnabled( mModified ); 1175 mActionSave->setEnabled( mModified );
1175 1176
1176 if ( modified ) 1177 if ( modified )
1177 mJumpButtonBar->recreateButtons(); 1178 mJumpButtonBar->recreateButtons();
1178 1179
1179 mViewManager->refreshView(); 1180 mViewManager->refreshView();
1180 1181
1181} 1182}
1182 1183
1183bool KABCore::modified() const 1184bool KABCore::modified() const
1184{ 1185{
1185 return mModified; 1186 return mModified;
1186} 1187}
1187 1188
1188void KABCore::contactModified( const KABC::Addressee &addr ) 1189void KABCore::contactModified( const KABC::Addressee &addr )
1189{ 1190{
1190 addrModified( addr ); 1191 addrModified( addr );
1191#if 0 // debug only 1192#if 0 // debug only
1192 KABC::Addressee ad = addr; 1193 KABC::Addressee ad = addr;
1193 ad.computeCsum( "123"); 1194 ad.computeCsum( "123");
1194#endif 1195#endif
1195} 1196}
1196 1197
1197void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails ) 1198void KABCore::addrModified( const KABC::Addressee &addr ,bool updateDetails )
1198{ 1199{
1199 1200
1200 Command *command = 0; 1201 Command *command = 0;
1201 QString uid; 1202 QString uid;
1202 1203
1203 // check if it exists already 1204 // check if it exists already
1204 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 1205 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
1205 if ( origAddr.isEmpty() ) 1206 if ( origAddr.isEmpty() )
1206 command = new PwNewCommand( mAddressBook, addr ); 1207 command = new PwNewCommand( mAddressBook, addr );
1207 else { 1208 else {
1208 command = new PwEditCommand( mAddressBook, origAddr, addr ); 1209 command = new PwEditCommand( mAddressBook, origAddr, addr );
1209 uid = addr.uid(); 1210 uid = addr.uid();
1210 } 1211 }
1211 1212
1212 UndoStack::instance()->push( command ); 1213 UndoStack::instance()->push( command );
1213 RedoStack::instance()->clear(); 1214 RedoStack::instance()->clear();
1214 if ( updateDetails ) 1215 if ( updateDetails )
1215 mDetails->setAddressee( addr ); 1216 mDetails->setAddressee( addr );
1216 setModified( true ); 1217 setModified( true );
1217} 1218}
1218 1219
1219void KABCore::newContact() 1220void KABCore::newContact()
1220{ 1221{
1221 1222
1222 1223
1223 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 1224 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
1224 1225
1225 QPtrList<KRES::Resource> kresResources; 1226 QPtrList<KRES::Resource> kresResources;
1226 QPtrListIterator<KABC::Resource> it( kabcResources ); 1227 QPtrListIterator<KABC::Resource> it( kabcResources );
1227 KABC::Resource *resource; 1228 KABC::Resource *resource;
1228 while ( ( resource = it.current() ) != 0 ) { 1229 while ( ( resource = it.current() ) != 0 ) {
1229 ++it; 1230 ++it;
1230 if ( !resource->readOnly() ) { 1231 if ( !resource->readOnly() ) {
1231 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 1232 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
1232 if ( res ) 1233 if ( res )
1233 kresResources.append( res ); 1234 kresResources.append( res );
1234 } 1235 }
1235 } 1236 }
1236 1237
1237 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 1238 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
1238 resource = static_cast<KABC::Resource*>( res ); 1239 resource = static_cast<KABC::Resource*>( res );
1239 1240
1240 if ( resource ) { 1241 if ( resource ) {
1241 KABC::Addressee addr; 1242 KABC::Addressee addr;
1242 addr.setResource( resource ); 1243 addr.setResource( resource );
1243 mEditorDialog->setAddressee( addr ); 1244 mEditorDialog->setAddressee( addr );
1244 KApplication::execDialog ( mEditorDialog ); 1245 KApplication::execDialog ( mEditorDialog );
1245 1246
1246 } else 1247 } else
1247 return; 1248 return;
1248 1249
1249 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 1250 // mEditorDict.insert( dialog->addressee().uid(), dialog );
1250 1251
1251 1252
1252} 1253}
1253 1254
1254void KABCore::addEmail( QString aStr ) 1255void KABCore::addEmail( QString aStr )
1255{ 1256{
1256#ifndef KAB_EMBEDDED 1257#ifndef KAB_EMBEDDED
1257 QString fullName, email; 1258 QString fullName, email;
1258 1259
1259 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 1260 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
1260 1261
1261 // Try to lookup the addressee matching the email address 1262 // Try to lookup the addressee matching the email address
1262 bool found = false; 1263 bool found = false;
1263 QStringList emailList; 1264 QStringList emailList;
1264 KABC::AddressBook::Iterator it; 1265 KABC::AddressBook::Iterator it;
1265 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 1266 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
1266 emailList = (*it).emails(); 1267 emailList = (*it).emails();
1267 if ( emailList.contains( email ) > 0 ) { 1268 if ( emailList.contains( email ) > 0 ) {
1268 found = true; 1269 found = true;
1269 (*it).setNameFromString( fullName ); 1270 (*it).setNameFromString( fullName );
1270 editContact( (*it).uid() ); 1271 editContact( (*it).uid() );
1271 } 1272 }
1272 } 1273 }
1273 1274
1274 if ( !found ) { 1275 if ( !found ) {
1275 KABC::Addressee addr; 1276 KABC::Addressee addr;
1276 addr.setNameFromString( fullName ); 1277 addr.setNameFromString( fullName );
1277 addr.insertEmail( email, true ); 1278 addr.insertEmail( email, true );
1278 1279
1279 mAddressBook->insertAddressee( addr ); 1280 mAddressBook->insertAddressee( addr );
1280 mViewManager->refreshView( addr.uid() ); 1281 mViewManager->refreshView( addr.uid() );
1281 editContact( addr.uid() ); 1282 editContact( addr.uid() );
1282 } 1283 }
1283#else //KAB_EMBEDDED 1284#else //KAB_EMBEDDED
1284 qDebug("KABCore::addEmail finsih method"); 1285 qDebug("KABCore::addEmail finsih method");
1285#endif //KAB_EMBEDDED 1286#endif //KAB_EMBEDDED
1286} 1287}
1287 1288
1288void KABCore::importVCard( const KURL &url, bool showPreview ) 1289void KABCore::importVCard( const KURL &url, bool showPreview )
1289{ 1290{
1290 mXXPortManager->importVCard( url, showPreview ); 1291 mXXPortManager->importVCard( url, showPreview );
1291} 1292}
1292void KABCore::importFromOL() 1293void KABCore::importFromOL()
1293{ 1294{
1294#ifdef _WIN32_ 1295#ifdef _OL_IMPORT_
1295 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 1296 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
1296 idgl->exec(); 1297 idgl->exec();
1297 KABC::Addressee::List list = idgl->getAddressList(); 1298 KABC::Addressee::List list = idgl->getAddressList();
1298 if ( list.count() > 0 ) { 1299 if ( list.count() > 0 ) {
1299 KABC::Addressee::List listNew; 1300 KABC::Addressee::List listNew;
1300 KABC::Addressee::List listExisting; 1301 KABC::Addressee::List listExisting;
1301 KABC::Addressee::List::Iterator it; 1302 KABC::Addressee::List::Iterator it;
1302 KABC::AddressBook::Iterator iter; 1303 KABC::AddressBook::Iterator iter;
1303 for ( it = list.begin(); it != list.end(); ++it ) { 1304 for ( it = list.begin(); it != list.end(); ++it ) {
1304 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1305 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
1305 listNew.append( (*it) ); 1306 listNew.append( (*it) );
1306 else 1307 else
1307 listExisting.append( (*it) ); 1308 listExisting.append( (*it) );
1308 } 1309 }
1309 if ( listExisting.count() > 0 ) 1310 if ( listExisting.count() > 0 )
1310 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1311 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1311 if ( listNew.count() > 0 ) { 1312 if ( listNew.count() > 0 ) {
1312 pasteWithNewUid = false; 1313 pasteWithNewUid = false;
1313 pasteContacts( listNew ); 1314 pasteContacts( listNew );
1314 pasteWithNewUid = true; 1315 pasteWithNewUid = true;
1315 } 1316 }
1316 } 1317 }
1317 delete idgl; 1318 delete idgl;
1318#endif 1319#endif
1319} 1320}
1320 1321
1321void KABCore::importVCard( const QString &vCard, bool showPreview ) 1322void KABCore::importVCard( const QString &vCard, bool showPreview )
1322{ 1323{
1323 mXXPortManager->importVCard( vCard, showPreview ); 1324 mXXPortManager->importVCard( vCard, showPreview );
1324} 1325}
1325 1326
1326//US added a second method without defaultparameter 1327//US added a second method without defaultparameter
1327void KABCore::editContact2() { 1328void KABCore::editContact2() {
1328 editContact( QString::null ); 1329 editContact( QString::null );
1329} 1330}
1330 1331
1331void KABCore::editContact( const QString &uid ) 1332void KABCore::editContact( const QString &uid )
1332{ 1333{
1333 1334
1334 if ( mExtensionManager->isQuickEditVisible() ) 1335 if ( mExtensionManager->isQuickEditVisible() )
1335 return; 1336 return;
1336 1337
1337 // First, locate the contact entry 1338 // First, locate the contact entry
1338 QString localUID = uid; 1339 QString localUID = uid;
1339 if ( localUID.isNull() ) { 1340 if ( localUID.isNull() ) {
1340 QStringList uidList = mViewManager->selectedUids(); 1341 QStringList uidList = mViewManager->selectedUids();
1341 if ( uidList.count() > 0 ) 1342 if ( uidList.count() > 0 )
1342 localUID = *( uidList.at( 0 ) ); 1343 localUID = *( uidList.at( 0 ) );
1343 } 1344 }
1344 1345
1345 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1346 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1346 if ( !addr.isEmpty() ) { 1347 if ( !addr.isEmpty() ) {
1347 mEditorDialog->setAddressee( addr ); 1348 mEditorDialog->setAddressee( addr );
1348 KApplication::execDialog ( mEditorDialog ); 1349 KApplication::execDialog ( mEditorDialog );
1349 } 1350 }
1350} 1351}
1351 1352
1352/** 1353/**
1353 Shows or edits the detail view for the given uid. If the uid is QString::null, 1354 Shows or edits the detail view for the given uid. If the uid is QString::null,
1354 the method will try to find a selected addressee in the view. 1355 the method will try to find a selected addressee in the view.
1355 */ 1356 */
1356void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) 1357void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1357{ 1358{
1358 if ( mMultipleViewsAtOnce ) 1359 if ( mMultipleViewsAtOnce )
1359 { 1360 {
1360 editContact( uid ); 1361 editContact( uid );
1361 } 1362 }
1362 else 1363 else
1363 { 1364 {
1364 setDetailsVisible( true ); 1365 setDetailsVisible( true );
1365 mActionDetails->setChecked(true); 1366 mActionDetails->setChecked(true);
1366 } 1367 }
1367 1368
1368} 1369}
1369 1370
1370void KABCore::save() 1371void KABCore::save()
1371{ 1372{
1372 if (syncManager->blockSave()) 1373 if (syncManager->blockSave())
1373 return; 1374 return;
1374 if ( !mModified ) 1375 if ( !mModified )
1375 return; 1376 return;
1376 1377
1377 syncManager->setBlockSave(true); 1378 syncManager->setBlockSave(true);
1378 QString text = i18n( "There was an error while attempting to save\n the " 1379 QString text = i18n( "There was an error while attempting to save\n the "
1379 "address book. Please check that some \nother application is " 1380 "address book. Please check that some \nother application is "
1380 "not using it. " ); 1381 "not using it. " );
1381 message(i18n("Saving ... please wait! "), false); 1382 message(i18n("Saving ... please wait! "), false);
1382 //qApp->processEvents(); 1383 //qApp->processEvents();
1383#ifndef KAB_EMBEDDED 1384#ifndef KAB_EMBEDDED
1384 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1385 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1385 if ( !b || !b->save() ) { 1386 if ( !b || !b->save() ) {
1386 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1387 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1387 } 1388 }
1388#else //KAB_EMBEDDED 1389#else //KAB_EMBEDDED
1389 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1390 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1390 if ( !b || !b->save() ) { 1391 if ( !b || !b->save() ) {
1391 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1392 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1392 } 1393 }
1393#endif //KAB_EMBEDDED 1394#endif //KAB_EMBEDDED
1394 1395
1395 message(i18n("Addressbook saved!")); 1396 message(i18n("Addressbook saved!"));
1396 setModified( false ); 1397 setModified( false );
1397 syncManager->setBlockSave(false); 1398 syncManager->setBlockSave(false);
1398} 1399}
1399 1400
1400 1401
1401void KABCore::undo() 1402void KABCore::undo()
1402{ 1403{
1403 UndoStack::instance()->undo(); 1404 UndoStack::instance()->undo();
1404 1405
1405 // Refresh the view 1406 // Refresh the view
1406 mViewManager->refreshView(); 1407 mViewManager->refreshView();
1407} 1408}
1408 1409
1409void KABCore::redo() 1410void KABCore::redo()
1410{ 1411{
1411 RedoStack::instance()->redo(); 1412 RedoStack::instance()->redo();
1412 1413
1413 // Refresh the view 1414 // Refresh the view
1414 mViewManager->refreshView(); 1415 mViewManager->refreshView();
1415} 1416}
1416 1417
1417void KABCore::setJumpButtonBarVisible( bool visible ) 1418void KABCore::setJumpButtonBarVisible( bool visible )
1418{ 1419{
1419 if (mMultipleViewsAtOnce) 1420 if (mMultipleViewsAtOnce)
1420 { 1421 {
1421 if ( visible ) 1422 if ( visible )
1422 mJumpButtonBar->show(); 1423 mJumpButtonBar->show();
1423 else 1424 else
1424 mJumpButtonBar->hide(); 1425 mJumpButtonBar->hide();
1425 } 1426 }
1426 else 1427 else
1427 { 1428 {
1428 // show the jumpbar only if "the details are hidden" == "viewmanager are shown" 1429 // show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1429 if (mViewManager->isVisible()) 1430 if (mViewManager->isVisible())
1430 { 1431 {
1431 if ( visible ) 1432 if ( visible )
1432 mJumpButtonBar->show(); 1433 mJumpButtonBar->show();
1433 else 1434 else
1434 mJumpButtonBar->hide(); 1435 mJumpButtonBar->hide();
1435 } 1436 }
1436 else 1437 else
1437 { 1438 {
1438 mJumpButtonBar->hide(); 1439 mJumpButtonBar->hide();
1439 } 1440 }
1440 } 1441 }
1441} 1442}
1442 1443
1443 1444
1444void KABCore::setDetailsToState() 1445void KABCore::setDetailsToState()
1445{ 1446{
1446 setDetailsVisible( mActionDetails->isChecked() ); 1447 setDetailsVisible( mActionDetails->isChecked() );
1447} 1448}
1448void KABCore::setDetailsToggle() 1449void KABCore::setDetailsToggle()
1449{ 1450{
1450 mActionDetails->setChecked( !mActionDetails->isChecked() ); 1451 mActionDetails->setChecked( !mActionDetails->isChecked() );
1451 setDetailsToState(); 1452 setDetailsToState();
1452} 1453}
1453 1454
1454 1455
1455 1456
1456void KABCore::setDetailsVisible( bool visible ) 1457void KABCore::setDetailsVisible( bool visible )
1457{ 1458{
1458 if (visible && mDetails->isHidden()) 1459 if (visible && mDetails->isHidden())
1459 { 1460 {
1460 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1461 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1461 if ( addrList.count() > 0 ) 1462 if ( addrList.count() > 0 )
1462 mDetails->setAddressee( addrList[ 0 ] ); 1463 mDetails->setAddressee( addrList[ 0 ] );
1463 } 1464 }
1464 1465
1465 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between 1466 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between
1466 // the listview and the detailview. We do that by changing the splitbar size. 1467 // the listview and the detailview. We do that by changing the splitbar size.
1467 if (mMultipleViewsAtOnce) 1468 if (mMultipleViewsAtOnce)
1468 { 1469 {
1469 if ( visible ) 1470 if ( visible )
1470 mDetails->show(); 1471 mDetails->show();
1471 else 1472 else
1472 mDetails->hide(); 1473 mDetails->hide();
1473 } 1474 }
1474 else 1475 else
1475 { 1476 {
1476 if ( visible ) { 1477 if ( visible ) {
1477 mViewManager->hide(); 1478 mViewManager->hide();
1478 mDetails->show(); 1479 mDetails->show();
1479 mIncSearchWidget->setFocus(); 1480 mIncSearchWidget->setFocus();
1480 } 1481 }
1481 else { 1482 else {
1482 mViewManager->show(); 1483 mViewManager->show();
1483 mDetails->hide(); 1484 mDetails->hide();
1484 mViewManager->setFocusAV(); 1485 mViewManager->setFocusAV();
1485 } 1486 }
1486 setJumpButtonBarVisible( !visible ); 1487 setJumpButtonBarVisible( !visible );
1487 } 1488 }
1488 1489
1489} 1490}
1490 1491
1491void KABCore::extensionChanged( int id ) 1492void KABCore::extensionChanged( int id )
1492{ 1493{
1493 //change the details view only for non desktop systems 1494 //change the details view only for non desktop systems
1494#ifndef DESKTOP_VERSION 1495#ifndef DESKTOP_VERSION
1495 1496
1496 if (id == 0) 1497 if (id == 0)
1497 { 1498 {
1498 //the user disabled the extension. 1499 //the user disabled the extension.
1499 1500
1500 if (mMultipleViewsAtOnce) 1501 if (mMultipleViewsAtOnce)
1501 { // enable detailsview again 1502 { // enable detailsview again
1502 setDetailsVisible( true ); 1503 setDetailsVisible( true );
1503 mActionDetails->setChecked( true ); 1504 mActionDetails->setChecked( true );
1504 } 1505 }
1505 else 1506 else
1506 { //go back to the listview 1507 { //go back to the listview
1507 setDetailsVisible( false ); 1508 setDetailsVisible( false );
1508 mActionDetails->setChecked( false ); 1509 mActionDetails->setChecked( false );
1509 mActionDetails->setEnabled(true); 1510 mActionDetails->setEnabled(true);
1510 } 1511 }
1511 1512
1512 } 1513 }
1513 else 1514 else
1514 { 1515 {
1515 //the user enabled the extension. 1516 //the user enabled the extension.
1516 setDetailsVisible( false ); 1517 setDetailsVisible( false );
1517 mActionDetails->setChecked( false ); 1518 mActionDetails->setChecked( false );
1518 1519
1519 if (!mMultipleViewsAtOnce) 1520 if (!mMultipleViewsAtOnce)
1520 { 1521 {
1521 mActionDetails->setEnabled(false); 1522 mActionDetails->setEnabled(false);
1522 } 1523 }
1523 1524
1524 mExtensionManager->setSelectionChanged(); 1525 mExtensionManager->setSelectionChanged();
1525 1526
1526 } 1527 }
1527 1528
1528#endif// DESKTOP_VERSION 1529#endif// DESKTOP_VERSION
1529 1530
1530} 1531}
1531 1532
1532 1533
1533void KABCore::extensionModified( const KABC::Addressee::List &list ) 1534void KABCore::extensionModified( const KABC::Addressee::List &list )
1534{ 1535{
1535 1536
1536 if ( list.count() != 0 ) { 1537 if ( list.count() != 0 ) {
1537 KABC::Addressee::List::ConstIterator it; 1538 KABC::Addressee::List::ConstIterator it;
1538 for ( it = list.begin(); it != list.end(); ++it ) 1539 for ( it = list.begin(); it != list.end(); ++it )
1539 mAddressBook->insertAddressee( *it ); 1540 mAddressBook->insertAddressee( *it );
1540 if ( list.count() > 1 ) 1541 if ( list.count() > 1 )
1541 setModified(); 1542 setModified();
1542 else 1543 else
1543 setModifiedWOrefresh(); 1544 setModifiedWOrefresh();
1544 } 1545 }
1545 if ( list.count() == 0 ) 1546 if ( list.count() == 0 )
1546 mViewManager->refreshView(); 1547 mViewManager->refreshView();
1547 else 1548 else
1548 mViewManager->refreshView( list[ 0 ].uid() ); 1549 mViewManager->refreshView( list[ 0 ].uid() );
1549 1550
1550 1551
1551 1552
1552} 1553}
1553 1554
1554QString KABCore::getNameByPhone( const QString &phone ) 1555QString KABCore::getNameByPhone( const QString &phone )
1555{ 1556{
1556#ifndef KAB_EMBEDDED 1557#ifndef KAB_EMBEDDED
1557 QRegExp r( "[/*/-/ ]" ); 1558 QRegExp r( "[/*/-/ ]" );
1558 QString localPhone( phone ); 1559 QString localPhone( phone );
1559 1560
1560 bool found = false; 1561 bool found = false;
1561 QString ownerName = ""; 1562 QString ownerName = "";
1562 KABC::AddressBook::Iterator iter; 1563 KABC::AddressBook::Iterator iter;
1563 KABC::PhoneNumber::List::Iterator phoneIter; 1564 KABC::PhoneNumber::List::Iterator phoneIter;
1564 KABC::PhoneNumber::List phoneList; 1565 KABC::PhoneNumber::List phoneList;
1565 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 1566 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
1566 phoneList = (*iter).phoneNumbers(); 1567 phoneList = (*iter).phoneNumbers();
1567 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 1568 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
1568 ++phoneIter) { 1569 ++phoneIter) {
1569 // Get rid of separator chars so just the numbers are compared. 1570 // Get rid of separator chars so just the numbers are compared.
1570 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 1571 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
1571 ownerName = (*iter).formattedName(); 1572 ownerName = (*iter).formattedName();
1572 found = true; 1573 found = true;
1573 } 1574 }
1574 } 1575 }
1575 } 1576 }
1576 1577
1577 return ownerName; 1578 return ownerName;
1578#else //KAB_EMBEDDED 1579#else //KAB_EMBEDDED
1579 qDebug("KABCore::getNameByPhone finsih method"); 1580 qDebug("KABCore::getNameByPhone finsih method");
1580 return ""; 1581 return "";
1581#endif //KAB_EMBEDDED 1582#endif //KAB_EMBEDDED
1582 1583
1583} 1584}
1584 1585
1585void KABCore::openConfigDialog() 1586void KABCore::openConfigDialog()
1586{ 1587{
1587 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); 1588 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
1588 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); 1589 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
1589 ConfigureDialog->addModule(kabcfg ); 1590 ConfigureDialog->addModule(kabcfg );
1590 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); 1591 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" );
1591 ConfigureDialog->addModule(kdelibcfg ); 1592 ConfigureDialog->addModule(kdelibcfg );
1592 1593
1593 connect( ConfigureDialog, SIGNAL( applyClicked() ), 1594 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1594 this, SLOT( configurationChanged() ) ); 1595 this, SLOT( configurationChanged() ) );
1595 connect( ConfigureDialog, SIGNAL( okClicked() ), 1596 connect( ConfigureDialog, SIGNAL( okClicked() ),
1596 this, SLOT( configurationChanged() ) ); 1597 this, SLOT( configurationChanged() ) );
1597 saveSettings(); 1598 saveSettings();
1598#ifndef DESKTOP_VERSION 1599#ifndef DESKTOP_VERSION
1599 ConfigureDialog->showMaximized(); 1600 ConfigureDialog->showMaximized();
1600#endif 1601#endif
1601 if ( ConfigureDialog->exec() ) 1602 if ( ConfigureDialog->exec() )
1602 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); 1603 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") );
1603 delete ConfigureDialog; 1604 delete ConfigureDialog;
1604} 1605}
1605 1606
1606void KABCore::openLDAPDialog() 1607void KABCore::openLDAPDialog()
1607{ 1608{
1608#ifndef KAB_EMBEDDED 1609#ifndef KAB_EMBEDDED
1609 if ( !mLdapSearchDialog ) { 1610 if ( !mLdapSearchDialog ) {
1610 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1611 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1611 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1612 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1612 SLOT( refreshView() ) ); 1613 SLOT( refreshView() ) );
1613 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1614 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1614 SLOT( setModified() ) ); 1615 SLOT( setModified() ) );
1615 } else 1616 } else
1616 mLdapSearchDialog->restoreSettings(); 1617 mLdapSearchDialog->restoreSettings();
1617 1618
1618 if ( mLdapSearchDialog->isOK() ) 1619 if ( mLdapSearchDialog->isOK() )
1619 mLdapSearchDialog->exec(); 1620 mLdapSearchDialog->exec();
1620#else //KAB_EMBEDDED 1621#else //KAB_EMBEDDED
1621 qDebug("KABCore::openLDAPDialog() finsih method"); 1622 qDebug("KABCore::openLDAPDialog() finsih method");
1622#endif //KAB_EMBEDDED 1623#endif //KAB_EMBEDDED
1623} 1624}
1624 1625
1625void KABCore::print() 1626void KABCore::print()
1626{ 1627{
1627#ifndef KAB_EMBEDDED 1628#ifndef KAB_EMBEDDED
1628 KPrinter printer; 1629 KPrinter printer;
1629 if ( !printer.setup( this ) ) 1630 if ( !printer.setup( this ) )
1630 return; 1631 return;
1631 1632
1632 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1633 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1633 mViewManager->selectedUids(), this ); 1634 mViewManager->selectedUids(), this );
1634 1635
1635 wizard.exec(); 1636 wizard.exec();
1636#else //KAB_EMBEDDED 1637#else //KAB_EMBEDDED
1637 qDebug("KABCore::print() finsih method"); 1638 qDebug("KABCore::print() finsih method");
1638#endif //KAB_EMBEDDED 1639#endif //KAB_EMBEDDED
1639 1640
1640} 1641}
1641 1642
1642 1643
1643void KABCore::addGUIClient( KXMLGUIClient *client ) 1644void KABCore::addGUIClient( KXMLGUIClient *client )
1644{ 1645{
1645 if ( mGUIClient ) 1646 if ( mGUIClient )
1646 mGUIClient->insertChildClient( client ); 1647 mGUIClient->insertChildClient( client );
1647 else 1648 else
1648 KMessageBox::error( this, "no KXMLGUICLient"); 1649 KMessageBox::error( this, "no KXMLGUICLient");
1649} 1650}
1650 1651
1651 1652
1652void KABCore::configurationChanged() 1653void KABCore::configurationChanged()
1653{ 1654{
1654 mExtensionManager->reconfigure(); 1655 mExtensionManager->reconfigure();
1655} 1656}
1656 1657
1657void KABCore::addressBookChanged() 1658void KABCore::addressBookChanged()
1658{ 1659{
1659/*US 1660/*US
1660 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1661 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1661 while ( it.current() ) { 1662 while ( it.current() ) {
1662 if ( it.current()->dirty() ) { 1663 if ( it.current()->dirty() ) {
1663 QString text = i18n( "Data has been changed externally. Unsaved " 1664 QString text = i18n( "Data has been changed externally. Unsaved "
1664 "changes will be lost." ); 1665 "changes will be lost." );
1665 KMessageBox::information( this, text ); 1666 KMessageBox::information( this, text );
1666 } 1667 }
1667 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1668 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1668 ++it; 1669 ++it;
1669 } 1670 }
1670*/ 1671*/
1671 if (mEditorDialog) 1672 if (mEditorDialog)
1672 { 1673 {
1673 if (mEditorDialog->dirty()) 1674 if (mEditorDialog->dirty())
1674 { 1675 {
1675 QString text = i18n( "Data has been changed externally. Unsaved " 1676 QString text = i18n( "Data has been changed externally. Unsaved "
1676 "changes will be lost." ); 1677 "changes will be lost." );
1677 KMessageBox::information( this, text ); 1678 KMessageBox::information( this, text );
1678 } 1679 }
1679 QString currentuid = mEditorDialog->addressee().uid(); 1680 QString currentuid = mEditorDialog->addressee().uid();
1680 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); 1681 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
1681 } 1682 }
1682 mViewManager->refreshView(); 1683 mViewManager->refreshView();
1683 1684
1684 1685
1685} 1686}
1686 1687
1687AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1688AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1688 const char *name ) 1689 const char *name )
1689{ 1690{
1690 1691
1691 if ( mEditorDialog == 0 ) { 1692 if ( mEditorDialog == 0 ) {
1692 mEditorDialog = new AddresseeEditorDialog( this, parent, 1693 mEditorDialog = new AddresseeEditorDialog( this, parent,
1693 name ? name : "editorDialog" ); 1694 name ? name : "editorDialog" );
1694 1695
1695 1696
1696 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1697 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1697 SLOT( contactModified( const KABC::Addressee& ) ) ); 1698 SLOT( contactModified( const KABC::Addressee& ) ) );
1698 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), 1699 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1699 // SLOT( slotEditorDestroyed( const QString& ) ) ; 1700 // SLOT( slotEditorDestroyed( const QString& ) ) ;
1700 } 1701 }
1701 1702
1702 return mEditorDialog; 1703 return mEditorDialog;
1703} 1704}
1704 1705
1705void KABCore::slotEditorDestroyed( const QString &uid ) 1706void KABCore::slotEditorDestroyed( const QString &uid )
1706{ 1707{
1707 //mEditorDict.remove( uid ); 1708 //mEditorDict.remove( uid );
1708} 1709}
1709 1710
1710void KABCore::initGUI() 1711void KABCore::initGUI()
1711{ 1712{
1712#ifndef KAB_EMBEDDED 1713#ifndef KAB_EMBEDDED
1713 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1714 QHBoxLayout *topLayout = new QHBoxLayout( this );
1714 topLayout->setSpacing( KDialogBase::spacingHint() ); 1715 topLayout->setSpacing( KDialogBase::spacingHint() );
1715 1716
1716 mExtensionBarSplitter = new QSplitter( this ); 1717 mExtensionBarSplitter = new QSplitter( this );
1717 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1718 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1718 1719
1719 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1720 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1720 1721
1721 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1722 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1722 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1723 mIncSearchWidget = new IncSearchWidget( viewSpace );
1723 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1724 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1724 SLOT( incrementalSearch( const QString& ) ) ); 1725 SLOT( incrementalSearch( const QString& ) ) );
1725 1726
1726 mViewManager = new ViewManager( this, viewSpace ); 1727 mViewManager = new ViewManager( this, viewSpace );
1727 viewSpace->setStretchFactor( mViewManager, 1 ); 1728 viewSpace->setStretchFactor( mViewManager, 1 );
1728 1729
1729 mDetails = new ViewContainer( mDetailsSplitter ); 1730 mDetails = new ViewContainer( mDetailsSplitter );
1730 1731
1731 mJumpButtonBar = new JumpButtonBar( this, this ); 1732 mJumpButtonBar = new JumpButtonBar( this, this );
1732 1733
1733 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1734 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1734 1735
1735 topLayout->addWidget( mExtensionBarSplitter ); 1736 topLayout->addWidget( mExtensionBarSplitter );
1736 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1737 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1737 topLayout->addWidget( mJumpButtonBar ); 1738 topLayout->addWidget( mJumpButtonBar );
1738 topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1739 topLayout->setStretchFactor( mJumpButtonBar, 1 );
1739 1740
1740 mXXPortManager = new XXPortManager( this, this ); 1741 mXXPortManager = new XXPortManager( this, this );
1741 1742
1742#else //KAB_EMBEDDED 1743#else //KAB_EMBEDDED
1743 //US initialize viewMenu before settingup viewmanager. 1744 //US initialize viewMenu before settingup viewmanager.
1744 // Viewmanager needs this menu to plugin submenues. 1745 // Viewmanager needs this menu to plugin submenues.
1745 viewMenu = new QPopupMenu( this ); 1746 viewMenu = new QPopupMenu( this );
1746 settingsMenu = new QPopupMenu( this ); 1747 settingsMenu = new QPopupMenu( this );
1747 //filterMenu = new QPopupMenu( this ); 1748 //filterMenu = new QPopupMenu( this );
1748 ImportMenu = new QPopupMenu( this ); 1749 ImportMenu = new QPopupMenu( this );
1749 ExportMenu = new QPopupMenu( this ); 1750 ExportMenu = new QPopupMenu( this );
1750 syncMenu = new QPopupMenu( this ); 1751 syncMenu = new QPopupMenu( this );
1751 changeMenu= new QPopupMenu( this ); 1752 changeMenu= new QPopupMenu( this );
1752 beamMenu= new QPopupMenu( this ); 1753 beamMenu= new QPopupMenu( this );
1753 1754
1754//US since we have no splitter for the embedded system, setup 1755//US since we have no splitter for the embedded system, setup
1755// a layout with two frames. One left and one right. 1756// a layout with two frames. One left and one right.
1756 1757
1757 QBoxLayout *topLayout; 1758 QBoxLayout *topLayout;
1758 1759
1759 // = new QHBoxLayout( this ); 1760 // = new QHBoxLayout( this );
1760// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1761// QBoxLayout *topLayout = (QBoxLayout*)layout();
1761 1762
1762// QWidget *mainBox = new QWidget( this ); 1763// QWidget *mainBox = new QWidget( this );
1763// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1764// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1764 1765
1765#ifdef DESKTOP_VERSION 1766#ifdef DESKTOP_VERSION
1766 topLayout = new QHBoxLayout( this ); 1767 topLayout = new QHBoxLayout( this );
1767 1768
1768 1769
1769 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1770 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1770 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1771 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1771 1772
1772 topLayout->addWidget(mMiniSplitter ); 1773 topLayout->addWidget(mMiniSplitter );
1773 1774
1774 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1775 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1775 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1776 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1776 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1777 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1777 mDetails = new ViewContainer( mMiniSplitter ); 1778 mDetails = new ViewContainer( mMiniSplitter );
1778 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1779 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1779#else 1780#else
1780 if ( QApplication::desktop()->width() > 480 ) { 1781 if ( QApplication::desktop()->width() > 480 ) {
1781 topLayout = new QHBoxLayout( this ); 1782 topLayout = new QHBoxLayout( this );
1782 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1783 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1783 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1784 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1784 } else { 1785 } else {
1785 1786
1786 topLayout = new QHBoxLayout( this ); 1787 topLayout = new QHBoxLayout( this );
1787 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1788 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1788 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1789 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1789 } 1790 }
1790 1791
1791 topLayout->addWidget(mMiniSplitter ); 1792 topLayout->addWidget(mMiniSplitter );
1792 mViewManager = new ViewManager( this, mMiniSplitter ); 1793 mViewManager = new ViewManager( this, mMiniSplitter );
1793 mDetails = new ViewContainer( mMiniSplitter ); 1794 mDetails = new ViewContainer( mMiniSplitter );
1794 1795
1795 1796
1796 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1797 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1797#endif 1798#endif
1798 //eh->hide(); 1799 //eh->hide();
1799 // topLayout->addWidget(mExtensionManager ); 1800 // topLayout->addWidget(mExtensionManager );
1800 1801
1801 1802
1802/*US 1803/*US
1803#ifndef KAB_NOSPLITTER 1804#ifndef KAB_NOSPLITTER
1804 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1805 QHBoxLayout *topLayout = new QHBoxLayout( this );
1805//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1806//US topLayout->setSpacing( KDialogBase::spacingHint() );
1806 topLayout->setSpacing( 10 ); 1807 topLayout->setSpacing( 10 );
1807 1808
1808 mDetailsSplitter = new QSplitter( this ); 1809 mDetailsSplitter = new QSplitter( this );
1809 1810
1810 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1811 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1811 1812
1812 mViewManager = new ViewManager( this, viewSpace ); 1813 mViewManager = new ViewManager( this, viewSpace );
1813 viewSpace->setStretchFactor( mViewManager, 1 ); 1814 viewSpace->setStretchFactor( mViewManager, 1 );
1814 1815
1815 mDetails = new ViewContainer( mDetailsSplitter ); 1816 mDetails = new ViewContainer( mDetailsSplitter );
1816 1817
1817 topLayout->addWidget( mDetailsSplitter ); 1818 topLayout->addWidget( mDetailsSplitter );
1818 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1819 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1819#else //KAB_NOSPLITTER 1820#else //KAB_NOSPLITTER
1820 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1821 QHBoxLayout *topLayout = new QHBoxLayout( this );
1821//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1822//US topLayout->setSpacing( KDialogBase::spacingHint() );
1822 topLayout->setSpacing( 10 ); 1823 topLayout->setSpacing( 10 );
1823 1824
1824// mDetailsSplitter = new QSplitter( this ); 1825// mDetailsSplitter = new QSplitter( this );
1825 1826
1826 QVBox *viewSpace = new QVBox( this ); 1827 QVBox *viewSpace = new QVBox( this );
1827 1828
1828 mViewManager = new ViewManager( this, viewSpace ); 1829 mViewManager = new ViewManager( this, viewSpace );
1829 viewSpace->setStretchFactor( mViewManager, 1 ); 1830 viewSpace->setStretchFactor( mViewManager, 1 );
1830 1831
1831 mDetails = new ViewContainer( this ); 1832 mDetails = new ViewContainer( this );
1832 1833
1833 topLayout->addWidget( viewSpace ); 1834 topLayout->addWidget( viewSpace );
1834// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1835// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1835 topLayout->addWidget( mDetails ); 1836 topLayout->addWidget( mDetails );
1836#endif //KAB_NOSPLITTER 1837#endif //KAB_NOSPLITTER
1837*/ 1838*/
1838 1839
1839 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 1840 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
1840 syncManager->setBlockSave(false); 1841 syncManager->setBlockSave(false);
1841 1842
1842 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 1843 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
1843 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 1844 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
1844 QString sync_file = sentSyncFile(); 1845 QString sync_file = sentSyncFile();
1845 //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1()); 1846 //qDebug("KABCore::initGUI()::setting tmp sync file to:%s ",sync_file.latin1());
1846 syncManager->setDefaultFileName( sync_file ); 1847 syncManager->setDefaultFileName( sync_file );
1847 //connect(syncManager , SIGNAL( ), this, SLOT( ) ); 1848 //connect(syncManager , SIGNAL( ), this, SLOT( ) );
1848 1849
1849#endif //KAB_EMBEDDED 1850#endif //KAB_EMBEDDED
1850 initActions(); 1851 initActions();
1851 1852
1852#ifdef KAB_EMBEDDED 1853#ifdef KAB_EMBEDDED
1853 addActionsManually(); 1854 addActionsManually();
1854 //US make sure the export and import menues are initialized before creating the xxPortManager. 1855 //US make sure the export and import menues are initialized before creating the xxPortManager.
1855 mXXPortManager = new XXPortManager( this, this ); 1856 mXXPortManager = new XXPortManager( this, this );
1856 1857
1857 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1858 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1858 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1859 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1859 // mActionQuit->plug ( mMainWindow->toolBar()); 1860 // mActionQuit->plug ( mMainWindow->toolBar());
1860 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1861 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1861 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1862 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1862 // mIncSearchWidget->hide(); 1863 // mIncSearchWidget->hide();
1863 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1864 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1864 SLOT( incrementalSearch( const QString& ) ) ); 1865 SLOT( incrementalSearch( const QString& ) ) );
1865 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); 1866 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) );
1866 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); 1867 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) );
1867 1868
1868 mJumpButtonBar = new JumpButtonBar( this, this ); 1869 mJumpButtonBar = new JumpButtonBar( this, this );
1869 1870
1870 topLayout->addWidget( mJumpButtonBar ); 1871 topLayout->addWidget( mJumpButtonBar );
1871//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1872//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1872 1873
1873// mMainWindow->getIconToolBar()->raise(); 1874// mMainWindow->getIconToolBar()->raise();
1874 1875
1875#endif //KAB_EMBEDDED 1876#endif //KAB_EMBEDDED
1876 1877
1877} 1878}
1878void KABCore::initActions() 1879void KABCore::initActions()
1879{ 1880{
1880//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1881//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1881 1882
1882#ifndef KAB_EMBEDDED 1883#ifndef KAB_EMBEDDED
1883 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1884 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1884 SLOT( clipboardDataChanged() ) ); 1885 SLOT( clipboardDataChanged() ) );
1885#endif //KAB_EMBEDDED 1886#endif //KAB_EMBEDDED
1886 1887
1887 // file menu 1888 // file menu
1888 1889
1889 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1890 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1890 //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1891 //mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1891 mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager, 1892 mActionPrint = new KAction( i18n( "&Print View" ), "fileprint", CTRL + Key_P, mViewManager,
1892 SLOT( printView() ), actionCollection(), "kaddressbook_print" ); 1893 SLOT( printView() ), actionCollection(), "kaddressbook_print" );
1893 1894
1894 1895
1895 mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails, 1896 mActionPrintDetails = new KAction( i18n( "&Print Details" ), "fileprint", 0, mDetails,
1896 SLOT( printView() ), actionCollection(), "kaddressbook_print2" ); 1897 SLOT( printView() ), actionCollection(), "kaddressbook_print2" );
1897 1898
1898 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1899 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1899 SLOT( save() ), actionCollection(), "file_sync" ); 1900 SLOT( save() ), actionCollection(), "file_sync" );
1900 1901
1901 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1902 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1902 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1903 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1903 1904
1904 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1905 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1905 this, SLOT( mailVCard() ), 1906 this, SLOT( mailVCard() ),
1906 actionCollection(), "file_mail_vcard"); 1907 actionCollection(), "file_mail_vcard");
1907 1908
1908 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this, 1909 mActionExport2phone = new KAction( i18n( "Export to phone" ), "ex2phone", 0, this,
1909 SLOT( export2phone() ), actionCollection(), 1910 SLOT( export2phone() ), actionCollection(),
1910 "kaddressbook_ex2phone" ); 1911 "kaddressbook_ex2phone" );
1911 1912
1912 mActionBeamVCard = 0; 1913 mActionBeamVCard = 0;
1913 mActionBeam = 0; 1914 mActionBeam = 0;
1914 1915
1915#ifndef DESKTOP_VERSION 1916#ifndef DESKTOP_VERSION
1916 if ( Ir::supported() ) { 1917 if ( Ir::supported() ) {
1917 mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this, 1918 mActionBeamVCard = new KAction( i18n( "Beam v&Card(s)..." ), "beam", 0, this,
1918 SLOT( beamVCard() ), actionCollection(), 1919 SLOT( beamVCard() ), actionCollection(),
1919 "kaddressbook_beam_vcard" ); 1920 "kaddressbook_beam_vcard" );
1920 1921
1921 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1922 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1922 SLOT( beamMySelf() ), actionCollection(), 1923 SLOT( beamMySelf() ), actionCollection(),
1923 "kaddressbook_beam_myself" ); 1924 "kaddressbook_beam_myself" );
1924 } 1925 }
1925#endif 1926#endif
1926 1927
1927 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1928 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1928 this, SLOT( editContact2() ), 1929 this, SLOT( editContact2() ),
1929 actionCollection(), "file_properties" ); 1930 actionCollection(), "file_properties" );
1930 1931
1931#ifdef KAB_EMBEDDED 1932#ifdef KAB_EMBEDDED
1932 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1933 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1933 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1934 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1934 mMainWindow, SLOT( exit() ), 1935 mMainWindow, SLOT( exit() ),
1935 actionCollection(), "quit" ); 1936 actionCollection(), "quit" );
1936#endif //KAB_EMBEDDED 1937#endif //KAB_EMBEDDED
1937 1938
1938 // edit menu 1939 // edit menu
1939 if ( mIsPart ) { 1940 if ( mIsPart ) {
1940 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1941 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1941 SLOT( copyContacts() ), actionCollection(), 1942 SLOT( copyContacts() ), actionCollection(),
1942 "kaddressbook_copy" ); 1943 "kaddressbook_copy" );
1943 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1944 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1944 SLOT( cutContacts() ), actionCollection(), 1945 SLOT( cutContacts() ), actionCollection(),
1945 "kaddressbook_cut" ); 1946 "kaddressbook_cut" );
1946 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1947 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1947 SLOT( pasteContacts() ), actionCollection(), 1948 SLOT( pasteContacts() ), actionCollection(),
1948 "kaddressbook_paste" ); 1949 "kaddressbook_paste" );
1949 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1950 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1950 SLOT( selectAllContacts() ), actionCollection(), 1951 SLOT( selectAllContacts() ), actionCollection(),
1951 "kaddressbook_select_all" ); 1952 "kaddressbook_select_all" );
1952 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1953 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1953 SLOT( undo() ), actionCollection(), 1954 SLOT( undo() ), actionCollection(),
1954 "kaddressbook_undo" ); 1955 "kaddressbook_undo" );
1955 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1956 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1956 this, SLOT( redo() ), actionCollection(), 1957 this, SLOT( redo() ), actionCollection(),
1957 "kaddressbook_redo" ); 1958 "kaddressbook_redo" );
1958 } else { 1959 } else {
1959 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1960 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1960 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1961 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1961 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1962 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1962 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1963 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1963 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1964 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1964 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1965 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1965 } 1966 }
1966 1967
1967 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1968 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1968 Key_Delete, this, SLOT( deleteContacts() ), 1969 Key_Delete, this, SLOT( deleteContacts() ),
1969 actionCollection(), "edit_delete" ); 1970 actionCollection(), "edit_delete" );
1970 1971
1971 mActionUndo->setEnabled( false ); 1972 mActionUndo->setEnabled( false );
1972 mActionRedo->setEnabled( false ); 1973 mActionRedo->setEnabled( false );
1973 1974
1974 // settings menu 1975 // settings menu
1975#ifdef KAB_EMBEDDED 1976#ifdef KAB_EMBEDDED
1976//US special menuentry to configure the addressbook resources. On KDE 1977//US special menuentry to configure the addressbook resources. On KDE
1977// you do that through the control center !!! 1978// you do that through the control center !!!
1978 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1979 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1979 SLOT( configureResources() ), actionCollection(), 1980 SLOT( configureResources() ), actionCollection(),
1980 "kaddressbook_configure_resources" ); 1981 "kaddressbook_configure_resources" );
1981#endif //KAB_EMBEDDED 1982#endif //KAB_EMBEDDED
1982 1983
1983 if ( mIsPart ) { 1984 if ( mIsPart ) {
1984 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1985 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1985 SLOT( openConfigDialog() ), actionCollection(), 1986 SLOT( openConfigDialog() ), actionCollection(),
1986 "kaddressbook_configure" ); 1987 "kaddressbook_configure" );
1987 1988
1988 //US not implemented yet 1989 //US not implemented yet
1989 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1990 //mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1990 // this, SLOT( configureKeyBindings() ), actionCollection(), 1991 // this, SLOT( configureKeyBindings() ), actionCollection(),
1991 // "kaddressbook_configure_shortcuts" ); 1992 // "kaddressbook_configure_shortcuts" );
1992#ifdef KAB_EMBEDDED 1993#ifdef KAB_EMBEDDED
1993 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1994 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1994 mActionConfigureToolbars->setEnabled( false ); 1995 mActionConfigureToolbars->setEnabled( false );
1995#endif //KAB_EMBEDDED 1996#endif //KAB_EMBEDDED
1996 1997
1997 } else { 1998 } else {
1998 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1999 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1999 2000
2000 //US not implemented yet 2001 //US not implemented yet
2001 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 2002 //mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
2002 } 2003 }
2003 2004
2004 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 2005 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
2005 actionCollection(), "options_show_jump_bar" ); 2006 actionCollection(), "options_show_jump_bar" );
2006 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 2007 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
2007 2008
2008 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, 2009 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
2009 actionCollection(), "options_show_details" ); 2010 actionCollection(), "options_show_details" );
2010 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 2011 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
2011 2012
2012 2013
2013 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this, 2014 mActionBR = new KToggleAction( i18n( "Beam receive enabled" ), "beam", 0, this,
2014 SLOT( toggleBeamReceive() ), actionCollection(), 2015 SLOT( toggleBeamReceive() ), actionCollection(),
2015 "kaddressbook_beam_rec" ); 2016 "kaddressbook_beam_rec" );
2016 2017
2017 2018
2018 // misc 2019 // misc
2019 // only enable LDAP lookup if we can handle the protocol 2020 // only enable LDAP lookup if we can handle the protocol
2020#ifndef KAB_EMBEDDED 2021#ifndef KAB_EMBEDDED
2021 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 2022 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
2022 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 2023 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
2023 this, SLOT( openLDAPDialog() ), actionCollection(), 2024 this, SLOT( openLDAPDialog() ), actionCollection(),
2024 "ldap_lookup" ); 2025 "ldap_lookup" );
2025 } 2026 }
2026#else //KAB_EMBEDDED 2027#else //KAB_EMBEDDED
2027 //qDebug("KABCore::initActions() LDAP has to be implemented"); 2028 //qDebug("KABCore::initActions() LDAP has to be implemented");
2028#endif //KAB_EMBEDDED 2029#endif //KAB_EMBEDDED
2029 2030
2030 2031
2031 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 2032 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
2032 SLOT( setWhoAmI() ), actionCollection(), 2033 SLOT( setWhoAmI() ), actionCollection(),
2033 "set_personal" ); 2034 "set_personal" );
2034 2035
2035 2036
2036 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 2037 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
2037 SLOT( setCategories() ), actionCollection(), 2038 SLOT( setCategories() ), actionCollection(),
2038 "edit_set_categories" ); 2039 "edit_set_categories" );
2039 mActionEditCategories = new KAction( i18n( "Edit Categories" ), 0, this, 2040 mActionEditCategories = new KAction( i18n( "Edit Categories" ), 0, this,
2040 SLOT( editCategories() ), actionCollection(), 2041 SLOT( editCategories() ), actionCollection(),
2041 "edit__categories" ); 2042 "edit__categories" );
2042 2043
2043 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 2044 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
2044 SLOT( removeVoice() ), actionCollection(), 2045 SLOT( removeVoice() ), actionCollection(),
2045 "remove_voice" ); 2046 "remove_voice" );
2046 mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this, 2047 mActionSetFormattedName = new KAction( i18n( "Set formatted name..." ), 0, this,
2047 SLOT( setFormattedName() ), actionCollection(), 2048 SLOT( setFormattedName() ), actionCollection(),
2048 "set_formatted" ); 2049 "set_formatted" );
2049 2050
2050 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this, 2051 mActionManageCategories= new KAction( i18n( "Manage new categories..." ), 0, this,
2051 SLOT( manageCategories() ), actionCollection(), 2052 SLOT( manageCategories() ), actionCollection(),
2052 "remove_voice" ); 2053 "remove_voice" );
2053 2054
2054 2055
2055 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, 2056 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
2056 SLOT( importFromOL() ), actionCollection(), 2057 SLOT( importFromOL() ), actionCollection(),
2057 "import_OL" ); 2058 "import_OL" );
2058#ifdef KAB_EMBEDDED 2059#ifdef KAB_EMBEDDED
2059 mActionLicence = new KAction( i18n( "Licence" ), 0, 2060 mActionLicence = new KAction( i18n( "Licence" ), 0,
2060 this, SLOT( showLicence() ), actionCollection(), 2061 this, SLOT( showLicence() ), actionCollection(),
2061 "licence_about_data" ); 2062 "licence_about_data" );
2062 mActionFaq = new KAction( i18n( "Faq" ), 0, 2063 mActionFaq = new KAction( i18n( "Faq" ), 0,
2063 this, SLOT( faq() ), actionCollection(), 2064 this, SLOT( faq() ), actionCollection(),
2064 "faq_about_data" ); 2065 "faq_about_data" );
2065 mActionWN = new KAction( i18n( "What's New?" ), 0, 2066 mActionWN = new KAction( i18n( "What's New?" ), 0,
2066 this, SLOT( whatsnew() ), actionCollection(), 2067 this, SLOT( whatsnew() ), actionCollection(),
2067 "wn" ); 2068 "wn" );
2068 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, 2069 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
2069 this, SLOT( synchowto() ), actionCollection(), 2070 this, SLOT( synchowto() ), actionCollection(),
2070 "sync" ); 2071 "sync" );
2071 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0, 2072 mActionKdeSyncHowto = new KAction( i18n( "Kde Sync HowTo" ), 0,
2072 this, SLOT( kdesynchowto() ), actionCollection(), 2073 this, SLOT( kdesynchowto() ), actionCollection(),
2073 "kdesync" ); 2074 "kdesync" );
2074 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0, 2075 mActionMultiSyncHowto = new KAction( i18n( "Multi Sync HowTo" ), 0,
2075 this, SLOT( multisynchowto() ), actionCollection(), 2076 this, SLOT( multisynchowto() ), actionCollection(),
2076 "multisync" ); 2077 "multisync" );
2077 2078
2078 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 2079 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
2079 this, SLOT( createAboutData() ), actionCollection(), 2080 this, SLOT( createAboutData() ), actionCollection(),
2080 "kaddressbook_about_data" ); 2081 "kaddressbook_about_data" );
2081#endif //KAB_EMBEDDED 2082#endif //KAB_EMBEDDED
2082 2083
2083 clipboardDataChanged(); 2084 clipboardDataChanged();
2084 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 2085 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
2085 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 2086 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
2086} 2087}
2087 2088
2088//US we need this function, to plug all actions into the correct menues. 2089//US we need this function, to plug all actions into the correct menues.
2089// KDE uses a XML format to plug the actions, but we work her without this overhead. 2090// KDE uses a XML format to plug the actions, but we work her without this overhead.
2090void KABCore::addActionsManually() 2091void KABCore::addActionsManually()
2091{ 2092{
2092//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 2093//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
2093 2094
2094#ifdef KAB_EMBEDDED 2095#ifdef KAB_EMBEDDED
2095 QPopupMenu *fileMenu = new QPopupMenu( this ); 2096 QPopupMenu *fileMenu = new QPopupMenu( this );
2096 QPopupMenu *editMenu = new QPopupMenu( this ); 2097 QPopupMenu *editMenu = new QPopupMenu( this );
2097 QPopupMenu *helpMenu = new QPopupMenu( this ); 2098 QPopupMenu *helpMenu = new QPopupMenu( this );
2098 2099
2099 KToolBar* tb = mMainWindow->toolBar(); 2100 KToolBar* tb = mMainWindow->toolBar();
2100 2101
2101#ifndef DESKTOP_VERSION 2102#ifndef DESKTOP_VERSION
2102 if ( KABPrefs::instance()->mFullMenuBarVisible ) { 2103 if ( KABPrefs::instance()->mFullMenuBarVisible ) {
2103#endif 2104#endif
2104 QMenuBar* mb = mMainWindow->menuBar(); 2105 QMenuBar* mb = mMainWindow->menuBar();
2105 2106
2106 //US setup menubar. 2107 //US setup menubar.
2107 //Disable the following block if you do not want to have a menubar. 2108 //Disable the following block if you do not want to have a menubar.
2108 mb->insertItem( i18n("&File"), fileMenu ); 2109 mb->insertItem( i18n("&File"), fileMenu );
2109 mb->insertItem( i18n("&Edit"), editMenu ); 2110 mb->insertItem( i18n("&Edit"), editMenu );
2110 mb->insertItem( i18n("&View"), viewMenu ); 2111 mb->insertItem( i18n("&View"), viewMenu );
2111 mb->insertItem( i18n("&Settings"), settingsMenu ); 2112 mb->insertItem( i18n("&Settings"), settingsMenu );
2112 mb->insertItem( i18n("Synchronize"), syncMenu ); 2113 mb->insertItem( i18n("Synchronize"), syncMenu );
2113 //mb->insertItem( i18n("&Change"), changeMenu ); 2114 //mb->insertItem( i18n("&Change"), changeMenu );
2114 mb->insertItem( i18n("&Help"), helpMenu ); 2115 mb->insertItem( i18n("&Help"), helpMenu );
2115 mIncSearchWidget = new IncSearchWidget( tb ); 2116 mIncSearchWidget = new IncSearchWidget( tb );
2116 // tb->insertWidget(-1, 0, mIncSearchWidget); 2117 // tb->insertWidget(-1, 0, mIncSearchWidget);
2117#ifndef DESKTOP_VERSION 2118#ifndef DESKTOP_VERSION
2118 } else { 2119 } else {
2119 //US setup toolbar 2120 //US setup toolbar
2120 QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); 2121 QPEMenuBar *menuBarTB = new QPEMenuBar( tb );
2121 QPopupMenu *popupBarTB = new QPopupMenu( this ); 2122 QPopupMenu *popupBarTB = new QPopupMenu( this );
2122 menuBarTB->insertItem( "ME", popupBarTB); 2123 menuBarTB->insertItem( "ME", popupBarTB);
2123 tb->insertWidget(-1, 0, menuBarTB); 2124 tb->insertWidget(-1, 0, menuBarTB);
2124 mIncSearchWidget = new IncSearchWidget( tb ); 2125 mIncSearchWidget = new IncSearchWidget( tb );
2125 2126
2126 tb->enableMoving(false); 2127 tb->enableMoving(false);
2127 popupBarTB->insertItem( i18n("&File"), fileMenu ); 2128 popupBarTB->insertItem( i18n("&File"), fileMenu );
2128 popupBarTB->insertItem( i18n("&Edit"), editMenu ); 2129 popupBarTB->insertItem( i18n("&Edit"), editMenu );
2129 popupBarTB->insertItem( i18n("&View"), viewMenu ); 2130 popupBarTB->insertItem( i18n("&View"), viewMenu );
2130 popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); 2131 popupBarTB->insertItem( i18n("&Settings"), settingsMenu );
2131 popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); 2132 popupBarTB->insertItem( i18n("Synchronize"), syncMenu );
2132 mViewManager->getFilterAction()->plug ( popupBarTB); 2133 mViewManager->getFilterAction()->plug ( popupBarTB);
2133 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); 2134 //popupBarTB->insertItem( i18n("&Change selected"), changeMenu );
2134 popupBarTB->insertItem( i18n("&Help"), helpMenu ); 2135 popupBarTB->insertItem( i18n("&Help"), helpMenu );
2135 if (QApplication::desktop()->width() > 320 ) { 2136 if (QApplication::desktop()->width() > 320 ) {
2136 // mViewManager->getFilterAction()->plug ( tb); 2137 // mViewManager->getFilterAction()->plug ( tb);
2137 } 2138 }
2138 } 2139 }
2139#endif 2140#endif
2140 // mActionQuit->plug ( mMainWindow->toolBar()); 2141 // mActionQuit->plug ( mMainWindow->toolBar());
2141 2142
2142 2143
2143 2144
2144 //US Now connect the actions with the menue entries. 2145 //US Now connect the actions with the menue entries.
2145#ifdef DESKTOP_VERSION 2146#ifdef DESKTOP_VERSION
2146 mActionPrint->plug( fileMenu ); 2147 mActionPrint->plug( fileMenu );
2147 mActionPrintDetails->plug( fileMenu ); 2148 mActionPrintDetails->plug( fileMenu );
2148 fileMenu->insertSeparator(); 2149 fileMenu->insertSeparator();
2149#endif 2150#endif
2150 mActionMail->plug( fileMenu ); 2151 mActionMail->plug( fileMenu );
2151 fileMenu->insertSeparator(); 2152 fileMenu->insertSeparator();
2152 2153
2153 mActionNewContact->plug( fileMenu ); 2154 mActionNewContact->plug( fileMenu );
2154 mActionNewContact->plug( tb ); 2155 mActionNewContact->plug( tb );
2155 2156
2156 mActionEditAddressee->plug( fileMenu ); 2157 mActionEditAddressee->plug( fileMenu );
2157 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || 2158 // if ((KGlobal::getDesktopSize() > KGlobal::Small ) ||
2158 // (!KABPrefs::instance()->mMultipleViewsAtOnce )) 2159 // (!KABPrefs::instance()->mMultipleViewsAtOnce ))
2159 mActionEditAddressee->plug( tb ); 2160 mActionEditAddressee->plug( tb );
2160 2161
2161 fileMenu->insertSeparator(); 2162 fileMenu->insertSeparator();
2162 mActionSave->plug( fileMenu ); 2163 mActionSave->plug( fileMenu );
2163 fileMenu->insertItem( "&Import", ImportMenu ); 2164 fileMenu->insertItem( "&Import", ImportMenu );
2164 fileMenu->insertItem( "&Export", ExportMenu ); 2165 fileMenu->insertItem( "&Export", ExportMenu );
2165 fileMenu->insertItem( i18n("&Change"), changeMenu ); 2166 fileMenu->insertItem( i18n("&Change"), changeMenu );
2166#ifndef DESKTOP_VERSION 2167#ifndef DESKTOP_VERSION
2167 if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); 2168 if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu );
2168#endif 2169#endif
2169#if 0 2170#if 0
2170 // PENDING fix MailVCard 2171 // PENDING fix MailVCard
2171 fileMenu->insertSeparator(); 2172 fileMenu->insertSeparator();
2172 mActionMailVCard->plug( fileMenu ); 2173 mActionMailVCard->plug( fileMenu );
2173#endif 2174#endif
2174#ifndef DESKTOP_VERSION 2175#ifndef DESKTOP_VERSION
2175 if ( Ir::supported() ) mActionBR->plug( beamMenu ); 2176 if ( Ir::supported() ) mActionBR->plug( beamMenu );
2176 if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); 2177 if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu );
2177 if ( Ir::supported() ) mActionBeam->plug( beamMenu ); 2178 if ( Ir::supported() ) mActionBeam->plug( beamMenu );
2178#endif 2179#endif
2179 fileMenu->insertSeparator(); 2180 fileMenu->insertSeparator();
2180 mActionQuit->plug( fileMenu ); 2181 mActionQuit->plug( fileMenu );
2181#ifdef _WIN32_ 2182#ifdef _OL_IMPORT_
2182 mActionImportOL->plug( ImportMenu ); 2183 mActionImportOL->plug( ImportMenu );
2183#endif 2184#endif
2184 // edit menu 2185 // edit menu
2185 mActionUndo->plug( editMenu ); 2186 mActionUndo->plug( editMenu );
2186 mActionRedo->plug( editMenu ); 2187 mActionRedo->plug( editMenu );
2187 editMenu->insertSeparator(); 2188 editMenu->insertSeparator();
2188 mActionCut->plug( editMenu ); 2189 mActionCut->plug( editMenu );
2189 mActionCopy->plug( editMenu ); 2190 mActionCopy->plug( editMenu );
2190 mActionPaste->plug( editMenu ); 2191 mActionPaste->plug( editMenu );
2191 mActionDelete->plug( editMenu ); 2192 mActionDelete->plug( editMenu );
2192 editMenu->insertSeparator(); 2193 editMenu->insertSeparator();
2193 mActionSelectAll->plug( editMenu ); 2194 mActionSelectAll->plug( editMenu );
2194 2195
2195 mActionSetFormattedName->plug( changeMenu ); 2196 mActionSetFormattedName->plug( changeMenu );
2196 mActionRemoveVoice->plug( changeMenu ); 2197 mActionRemoveVoice->plug( changeMenu );
2197 // settings menu 2198 // settings menu
2198//US special menuentry to configure the addressbook resources. On KDE 2199//US special menuentry to configure the addressbook resources. On KDE
2199// you do that through the control center !!! 2200// you do that through the control center !!!
2200 mActionConfigResources->plug( settingsMenu ); 2201 mActionConfigResources->plug( settingsMenu );
2201 settingsMenu->insertSeparator(); 2202 settingsMenu->insertSeparator();
2202 2203
2203 mActionConfigKAddressbook->plug( settingsMenu ); 2204 mActionConfigKAddressbook->plug( settingsMenu );
2204 2205
2205 if ( mIsPart ) { 2206 if ( mIsPart ) {
2206 //US not implemented yet 2207 //US not implemented yet
2207 //mActionConfigShortcuts->plug( settingsMenu ); 2208 //mActionConfigShortcuts->plug( settingsMenu );
2208 //mActionConfigureToolbars->plug( settingsMenu ); 2209 //mActionConfigureToolbars->plug( settingsMenu );
2209 2210
2210 } else { 2211 } else {
2211 //US not implemented yet 2212 //US not implemented yet
2212 //mActionKeyBindings->plug( settingsMenu ); 2213 //mActionKeyBindings->plug( settingsMenu );
2213 } 2214 }
2214 2215
2215 settingsMenu->insertSeparator(); 2216 settingsMenu->insertSeparator();
2216 2217
2217 mActionJumpBar->plug( settingsMenu ); 2218 mActionJumpBar->plug( settingsMenu );
2218 mActionDetails->plug( settingsMenu ); 2219 mActionDetails->plug( settingsMenu );
2219 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2220 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
2220 mActionDetails->plug( tb ); 2221 mActionDetails->plug( tb );
2221 settingsMenu->insertSeparator(); 2222 settingsMenu->insertSeparator();
2222#ifndef DESKTOP_VERSION 2223#ifndef DESKTOP_VERSION
2223 if ( Ir::supported() ) mActionBR->plug(settingsMenu ); 2224 if ( Ir::supported() ) mActionBR->plug(settingsMenu );
2224#endif
2225 settingsMenu->insertSeparator(); 2225 settingsMenu->insertSeparator();
2226#endif
2226 2227
2227 mActionWhoAmI->plug( settingsMenu ); 2228 mActionWhoAmI->plug( settingsMenu );
2228 mActionEditCategories->plug( settingsMenu ); 2229 mActionEditCategories->plug( settingsMenu );
2229 mActionEditCategories->plug( changeMenu ); 2230 mActionEditCategories->plug( changeMenu );
2230 mActionCategories->plug( changeMenu ); 2231 mActionCategories->plug( changeMenu );
2231 mActionManageCategories->plug( changeMenu ); 2232 mActionManageCategories->plug( changeMenu );
2232 2233
2233 mActionCategories->plug( settingsMenu ); 2234 mActionCategories->plug( settingsMenu );
2234 mActionManageCategories->plug( settingsMenu ); 2235 mActionManageCategories->plug( settingsMenu );
2235 2236
2236 2237
2237 mActionWN->plug( helpMenu ); 2238 mActionWN->plug( helpMenu );
2238 mActionSyncHowto->plug( helpMenu ); 2239 mActionSyncHowto->plug( helpMenu );
2239 mActionKdeSyncHowto->plug( helpMenu ); 2240 mActionKdeSyncHowto->plug( helpMenu );
2240 mActionMultiSyncHowto->plug( helpMenu ); 2241 mActionMultiSyncHowto->plug( helpMenu );
2241 mActionFaq->plug( helpMenu ); 2242 mActionFaq->plug( helpMenu );
2242 mActionLicence->plug( helpMenu ); 2243 mActionLicence->plug( helpMenu );
2243 mActionAboutKAddressbook->plug( helpMenu ); 2244 mActionAboutKAddressbook->plug( helpMenu );
2244 2245
2245 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2246 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2246 2247
2247 mActionSave->plug( tb ); 2248 mActionSave->plug( tb );
2248 mViewManager->getFilterAction()->plug ( tb); 2249 mViewManager->getFilterAction()->plug ( tb);
2249 //LR hide filteraction on started in 480x640 2250 //LR hide filteraction on started in 480x640
2250 if (QApplication::desktop()->width() == 480 ) { 2251 if (QApplication::desktop()->width() == 480 ) {
2251 mViewManager->getFilterAction()->setComboWidth( 0 ); 2252 mViewManager->getFilterAction()->setComboWidth( 0 );
2252 } 2253 }
2253 mActionUndo->plug( tb ); 2254 mActionUndo->plug( tb );
2254 mActionDelete->plug( tb ); 2255 mActionDelete->plug( tb );
2255 mActionRedo->plug( tb ); 2256 mActionRedo->plug( tb );
2256 } else { 2257 } else {
2257 mActionSave->plug( tb ); 2258 mActionSave->plug( tb );
2258 tb->enableMoving(false); 2259 tb->enableMoving(false);
2259 } 2260 }
2260 //mActionQuit->plug ( tb ); 2261 //mActionQuit->plug ( tb );
2261 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2262 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2262 2263
2263 //US link the searchwidget first to this. 2264 //US link the searchwidget first to this.
2264 // The real linkage to the toolbar happens later. 2265 // The real linkage to the toolbar happens later.
2265//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2266//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2266//US tb->insertItem( mIncSearchWidget ); 2267//US tb->insertItem( mIncSearchWidget );
2267/*US 2268/*US
2268 mIncSearchWidget = new IncSearchWidget( tb ); 2269 mIncSearchWidget = new IncSearchWidget( tb );
2269 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2270 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2270 SLOT( incrementalSearch( const QString& ) ) ); 2271 SLOT( incrementalSearch( const QString& ) ) );
2271 2272
2272 mJumpButtonBar = new JumpButtonBar( this, this ); 2273 mJumpButtonBar = new JumpButtonBar( this, this );
2273 2274
2274//US topLayout->addWidget( mJumpButtonBar ); 2275//US topLayout->addWidget( mJumpButtonBar );
2275 this->layout()->add( mJumpButtonBar ); 2276 this->layout()->add( mJumpButtonBar );
2276*/ 2277*/
2277 2278
2278#endif //KAB_EMBEDDED 2279#endif //KAB_EMBEDDED
2279 2280
2280 mActionExport2phone->plug( ExportMenu ); 2281 mActionExport2phone->plug( ExportMenu );
2281 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2282 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2282 syncManager->fillSyncMenu(); 2283 syncManager->fillSyncMenu();
2283 2284
2284} 2285}
2285void KABCore::showLicence() 2286void KABCore::showLicence()
2286{ 2287{
2287 KApplication::showLicence(); 2288 KApplication::showLicence();
2288} 2289}
2289 2290
2290void KABCore::manageCategories( ) 2291void KABCore::manageCategories( )
2291{ 2292{
2292 KABCatPrefs* cp = new KABCatPrefs(); 2293 KABCatPrefs* cp = new KABCatPrefs();
2293 cp->show(); 2294 cp->show();
2294 int w =cp->sizeHint().width() ; 2295 int w =cp->sizeHint().width() ;
2295 int h = cp->sizeHint().height() ; 2296 int h = cp->sizeHint().height() ;
2296 int dw = QApplication::desktop()->width(); 2297 int dw = QApplication::desktop()->width();
2297 int dh = QApplication::desktop()->height(); 2298 int dh = QApplication::desktop()->height();
2298 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2299 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2299 if ( !cp->exec() ) { 2300 if ( !cp->exec() ) {
2300 delete cp; 2301 delete cp;
2301 return; 2302 return;
2302 } 2303 }
2303 int count = 0; 2304 int count = 0;
2304 int cc = 0; 2305 int cc = 0;
2305 message( i18n("Please wait, processing categories...")); 2306 message( i18n("Please wait, processing categories..."));
2306 if ( cp->addCat() ) { 2307 if ( cp->addCat() ) {
2307 KABC::AddressBook::Iterator it; 2308 KABC::AddressBook::Iterator it;
2308 QStringList catList = KABPrefs::instance()->mCustomCategories; 2309 QStringList catList = KABPrefs::instance()->mCustomCategories;
2309 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2310 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2310 ++cc; 2311 ++cc;
2311 if ( cc %10 == 0) 2312 if ( cc %10 == 0)
2312 message(i18n("Processing contact #%1").arg(cc)); 2313 message(i18n("Processing contact #%1").arg(cc));
2313 QStringList catIncList = (*it).categories(); 2314 QStringList catIncList = (*it).categories();
2314 int i; 2315 int i;
2315 for( i = 0; i< catIncList.count(); ++i ) { 2316 for( i = 0; i< catIncList.count(); ++i ) {
2316 if ( !catList.contains (catIncList[i])) { 2317 if ( !catList.contains (catIncList[i])) {
2317 catList.append( catIncList[i] ); 2318 catList.append( catIncList[i] );
2318 //qDebug("add cat %s ", catIncList[i].latin1()); 2319 //qDebug("add cat %s ", catIncList[i].latin1());
2319 ++count; 2320 ++count;
2320 } 2321 }
2321 } 2322 }
2322 } 2323 }
2323 catList.sort(); 2324 catList.sort();
2324 KABPrefs::instance()->mCustomCategories = catList; 2325 KABPrefs::instance()->mCustomCategories = catList;
2325 KABPrefs::instance()->writeConfig(); 2326 KABPrefs::instance()->writeConfig();
2326 message(QString::number( count )+ i18n(" categories added to list! ")); 2327 message(QString::number( count )+ i18n(" categories added to list! "));
2327 } else { 2328 } else {
2328 QStringList catList = KABPrefs::instance()->mCustomCategories; 2329 QStringList catList = KABPrefs::instance()->mCustomCategories;
2329 QStringList catIncList; 2330 QStringList catIncList;
2330 QStringList newCatList; 2331 QStringList newCatList;
2331 KABC::AddressBook::Iterator it; 2332 KABC::AddressBook::Iterator it;
2332 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2333 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2333 ++cc; 2334 ++cc;
2334 if ( cc %10 == 0) 2335 if ( cc %10 == 0)
2335 message(i18n("Processing contact #%1").arg(cc)); 2336 message(i18n("Processing contact #%1").arg(cc));
2336 QStringList catIncList = (*it).categories(); 2337 QStringList catIncList = (*it).categories();
2337 int i; 2338 int i;
2338 if ( catIncList.count() ) { 2339 if ( catIncList.count() ) {
2339 newCatList.clear(); 2340 newCatList.clear();
2340 for( i = 0; i< catIncList.count(); ++i ) { 2341 for( i = 0; i< catIncList.count(); ++i ) {
2341 if ( catList.contains (catIncList[i])) { 2342 if ( catList.contains (catIncList[i])) {
2342 newCatList.append( catIncList[i] ); 2343 newCatList.append( catIncList[i] );
2343 } 2344 }
2344 } 2345 }
2345 newCatList.sort(); 2346 newCatList.sort();
2346 (*it).setCategories( newCatList ); 2347 (*it).setCategories( newCatList );
2347 mAddressBook->insertAddressee( (*it) ); 2348 mAddressBook->insertAddressee( (*it) );
2348 } 2349 }
2349 } 2350 }
2350 setModified( true ); 2351 setModified( true );
2351 mViewManager->refreshView(); 2352 mViewManager->refreshView();
2352 message( i18n("Removing categories done!")); 2353 message( i18n("Removing categories done!"));
2353 } 2354 }
2354 delete cp; 2355 delete cp;
2355} 2356}
2356void KABCore::removeVoice() 2357void KABCore::removeVoice()
2357{ 2358{
2358 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 ) 2359 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 )
2359 return; 2360 return;
2360 XXPortSelectDialog dlg( this, false, this ); 2361 XXPortSelectDialog dlg( this, false, this );
2361 if ( !dlg.exec() ) 2362 if ( !dlg.exec() )
2362 return; 2363 return;
2363 mAddressBook->setUntagged(); 2364 mAddressBook->setUntagged();
2364 dlg.tagSelected(); 2365 dlg.tagSelected();
2365 message(i18n("Removing voice..."), false ); 2366 message(i18n("Removing voice..."), false );
2366 KABC::AddressBook::Iterator it; 2367 KABC::AddressBook::Iterator it;
2367 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2368 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2368 if ( (*it).tagged() ) { 2369 if ( (*it).tagged() ) {
2369 (*it).removeVoice(); 2370 (*it).removeVoice();
2370 } 2371 }
2371 } 2372 }
2372 message(i18n("Refreshing view...") ); 2373 message(i18n("Refreshing view...") );
2373 qApp->processEvents(); 2374 qApp->processEvents();
2374 mViewManager->refreshView( "" ); 2375 mViewManager->refreshView( "" );
2375 Addressee add; 2376 Addressee add;
2376 mDetails->setAddressee( add ); 2377 mDetails->setAddressee( add );
2377 message(i18n("Remove voice completed!") ); 2378 message(i18n("Remove voice completed!") );
2378 2379
2379 2380
2380 2381
2381} 2382}
2382 2383
2383void KABCore::setFormattedName() 2384void KABCore::setFormattedName()
2384{ 2385{
2385 KABFormatPrefs setpref; 2386 KABFormatPrefs setpref;
2386 if ( !setpref.exec() ) { 2387 if ( !setpref.exec() ) {
2387 return; 2388 return;
2388 } 2389 }
2389 XXPortSelectDialog dlg( this, false, this ); 2390 XXPortSelectDialog dlg( this, false, this );
2390 if ( !dlg.exec() ) 2391 if ( !dlg.exec() )
2391 return; 2392 return;
2392 mAddressBook->setUntagged(); 2393 mAddressBook->setUntagged();
2393 dlg.tagSelected(); 2394 dlg.tagSelected();
2394 int count = 0; 2395 int count = 0;
2395 KABC::AddressBook::Iterator it; 2396 KABC::AddressBook::Iterator it;
2396 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2397 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2397 if ( (*it).tagged() ) { 2398 if ( (*it).tagged() ) {
2398 ++count; 2399 ++count;
2399 if ( count %10 == 0 ) 2400 if ( count %10 == 0 )
2400 message(i18n("Changing contact #%1").arg( count ) ); 2401 message(i18n("Changing contact #%1").arg( count ) );
2401 qApp->processEvents(); 2402 qApp->processEvents();
2402 QString fName; 2403 QString fName;
2403 if ( setpref.simple->isChecked() ) 2404 if ( setpref.simple->isChecked() )
2404 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); 2405 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName );
2405 else if ( setpref.full->isChecked() ) 2406 else if ( setpref.full->isChecked() )
2406 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); 2407 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName );
2407 else if ( setpref.reverse->isChecked() ) 2408 else if ( setpref.reverse->isChecked() )
2408 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); 2409 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName );
2409 else 2410 else
2410 fName = (*it).organization(); 2411 fName = (*it).organization();
2411 if ( setpref.setCompany->isChecked() ) 2412 if ( setpref.setCompany->isChecked() )
2412 if ( fName.isEmpty() || fName =="," ) 2413 if ( fName.isEmpty() || fName =="," )
2413 fName = (*it).organization(); 2414 fName = (*it).organization();
2414 (*it).setFormattedName( fName ); 2415 (*it).setFormattedName( fName );
2415 } 2416 }
2416 } 2417 }
2417 message(i18n("Refreshing view...") ); 2418 message(i18n("Refreshing view...") );
2418 qApp->processEvents(); 2419 qApp->processEvents();
2419 mViewManager->refreshView( "" ); 2420 mViewManager->refreshView( "" );
2420 Addressee add; 2421 Addressee add;
2421 mDetails->setAddressee( add ); 2422 mDetails->setAddressee( add );
2422 message(i18n("Setting formatted name completed!") ); 2423 message(i18n("Setting formatted name completed!") );
2423} 2424}
2424 2425
2425void KABCore::clipboardDataChanged() 2426void KABCore::clipboardDataChanged()
2426{ 2427{
2427 2428
2428 if ( mReadWrite ) 2429 if ( mReadWrite )
2429 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2430 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2430 2431
2431} 2432}
2432 2433
2433void KABCore::updateActionMenu() 2434void KABCore::updateActionMenu()
2434{ 2435{
2435 UndoStack *undo = UndoStack::instance(); 2436 UndoStack *undo = UndoStack::instance();
2436 RedoStack *redo = RedoStack::instance(); 2437 RedoStack *redo = RedoStack::instance();
2437 2438
2438 if ( undo->isEmpty() ) 2439 if ( undo->isEmpty() )
2439 mActionUndo->setText( i18n( "Undo" ) ); 2440 mActionUndo->setText( i18n( "Undo" ) );
2440 else 2441 else
2441 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2442 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2442 2443
2443 mActionUndo->setEnabled( !undo->isEmpty() ); 2444 mActionUndo->setEnabled( !undo->isEmpty() );
2444 2445
2445 if ( !redo->top() ) 2446 if ( !redo->top() )
2446 mActionRedo->setText( i18n( "Redo" ) ); 2447 mActionRedo->setText( i18n( "Redo" ) );
2447 else 2448 else
2448 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2449 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2449 2450
2450 mActionRedo->setEnabled( !redo->isEmpty() ); 2451 mActionRedo->setEnabled( !redo->isEmpty() );
2451} 2452}
2452 2453
2453void KABCore::configureKeyBindings() 2454void KABCore::configureKeyBindings()
2454{ 2455{
2455#ifndef KAB_EMBEDDED 2456#ifndef KAB_EMBEDDED
2456 KKeyDialog::configure( actionCollection(), true ); 2457 KKeyDialog::configure( actionCollection(), true );
2457#else //KAB_EMBEDDED 2458#else //KAB_EMBEDDED
2458 qDebug("KABCore::configureKeyBindings() not implemented"); 2459 qDebug("KABCore::configureKeyBindings() not implemented");
2459#endif //KAB_EMBEDDED 2460#endif //KAB_EMBEDDED
2460} 2461}
2461 2462
2462#ifdef KAB_EMBEDDED 2463#ifdef KAB_EMBEDDED
2463void KABCore::configureResources() 2464void KABCore::configureResources()
2464{ 2465{
2465 KRES::KCMKResources dlg( this, "" , 0 ); 2466 KRES::KCMKResources dlg( this, "" , 0 );
2466 2467
2467 if ( !dlg.exec() ) 2468 if ( !dlg.exec() )
2468 return; 2469 return;
2469 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2470 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2470} 2471}
2471#endif //KAB_EMBEDDED 2472#endif //KAB_EMBEDDED
2472 2473
2473 2474
2474/* this method will be called through the QCop interface from Ko/Pi to select addresses 2475/* this method will be called through the QCop interface from Ko/Pi to select addresses
2475 * for the attendees list of an event. 2476 * for the attendees list of an event.
2476 */ 2477 */
2477void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2478void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2478{ 2479{
2479 QStringList nameList; 2480 QStringList nameList;
2480 QStringList emailList; 2481 QStringList emailList;
2481 QStringList uidList; 2482 QStringList uidList;
2482 2483
2483 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2484 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2484 uint i=0; 2485 uint i=0;
2485 for (i=0; i < list.count(); i++) 2486 for (i=0; i < list.count(); i++)
2486 { 2487 {
2487 nameList.append(list[i].realName()); 2488 nameList.append(list[i].realName());
2488 emailList.append(list[i].preferredEmail()); 2489 emailList.append(list[i].preferredEmail());
2489 uidList.append(list[i].uid()); 2490 uidList.append(list[i].uid());
2490 } 2491 }
2491 2492
2492 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2493 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
2493 2494
2494} 2495}
2495 2496
2496/* this method will be called through the QCop interface from Ko/Pi to select birthdays 2497/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2497 * to put them into the calendar. 2498 * to put them into the calendar.
2498 */ 2499 */
2499void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) 2500void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2500{ 2501{
2501 // qDebug("KABCore::requestForBirthdayList"); 2502 // qDebug("KABCore::requestForBirthdayList");
2502 QStringList birthdayList; 2503 QStringList birthdayList;
2503 QStringList anniversaryList; 2504 QStringList anniversaryList;
2504 QStringList realNameList; 2505 QStringList realNameList;
2505 QStringList preferredEmailList; 2506 QStringList preferredEmailList;
2506 QStringList assembledNameList; 2507 QStringList assembledNameList;
2507 QStringList uidList; 2508 QStringList uidList;
2508 2509
2509 KABC::AddressBook::Iterator it; 2510 KABC::AddressBook::Iterator it;
2510 2511
2511 int count = 0; 2512 int count = 0;
2512 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2513 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2513 ++count; 2514 ++count;
2514 } 2515 }
2515 QProgressBar bar(count,0 ); 2516 QProgressBar bar(count,0 );
2516 int w = 300; 2517 int w = 300;
2517 if ( QApplication::desktop()->width() < 320 ) 2518 if ( QApplication::desktop()->width() < 320 )
2518 w = 220; 2519 w = 220;
2519 int h = bar.sizeHint().height() ; 2520 int h = bar.sizeHint().height() ;
2520 int dw = QApplication::desktop()->width(); 2521 int dw = QApplication::desktop()->width();
2521 int dh = QApplication::desktop()->height(); 2522 int dh = QApplication::desktop()->height();
2522 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2523 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2523 bar.show(); 2524 bar.show();
2524 bar.setCaption (i18n("Collecting birthdays - close to abort!") ); 2525 bar.setCaption (i18n("Collecting birthdays - close to abort!") );
2525 qApp->processEvents(); 2526 qApp->processEvents();
2526 2527
2527 QDate bday; 2528 QDate bday;
2528 QString anni; 2529 QString anni;
2529 QString formattedbday; 2530 QString formattedbday;
2530 2531
2531 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) 2532 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
2532 { 2533 {
2533 if ( ! bar.isVisible() ) 2534 if ( ! bar.isVisible() )
2534 return; 2535 return;
2535 bar.setProgress( count++ ); 2536 bar.setProgress( count++ );
2536 qApp->processEvents(); 2537 qApp->processEvents();
2537 bday = (*it).birthday().date(); 2538 bday = (*it).birthday().date();
2538 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); 2539 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
2539 2540
2540 if ( bday.isValid() || !anni.isEmpty()) 2541 if ( bday.isValid() || !anni.isEmpty())
2541 { 2542 {
2542 if (bday.isValid()) 2543 if (bday.isValid())
2543 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); 2544 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
2544 else 2545 else
2545 formattedbday = "NOTVALID"; 2546 formattedbday = "NOTVALID";
2546 if (anni.isEmpty()) 2547 if (anni.isEmpty())
2547 anni = "INVALID"; 2548 anni = "INVALID";
2548 2549
2549 birthdayList.append(formattedbday); 2550 birthdayList.append(formattedbday);
2550 anniversaryList.append(anni); //should be ISODate 2551 anniversaryList.append(anni); //should be ISODate
2551 realNameList.append((*it).realName()); 2552 realNameList.append((*it).realName());
2552 preferredEmailList.append((*it).preferredEmail()); 2553 preferredEmailList.append((*it).preferredEmail());
2553 assembledNameList.append((*it).assembledName()); 2554 assembledNameList.append((*it).assembledName());
2554 uidList.append((*it).uid()); 2555 uidList.append((*it).uid());
2555 2556
2556 //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() ); 2557 //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() );
2557 } 2558 }
2558 } 2559 }
2559 2560
2560 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); 2561 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
2561 2562
2562} 2563}
2563 2564
2564/* this method will be called through the QCop interface from other apps to show details of a contact. 2565/* this method will be called through the QCop interface from other apps to show details of a contact.
2565 */ 2566 */
2566void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2567void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2567{ 2568{
2568 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2569 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2569 2570
2570 QString foundUid = QString::null; 2571 QString foundUid = QString::null;
2571 if ( ! uid.isEmpty() ) { 2572 if ( ! uid.isEmpty() ) {
2572 Addressee adrr = mAddressBook->findByUid( uid ); 2573 Addressee adrr = mAddressBook->findByUid( uid );
2573 if ( !adrr.isEmpty() ) { 2574 if ( !adrr.isEmpty() ) {
2574 foundUid = uid; 2575 foundUid = uid;
2575 } 2576 }
2576 if ( email == "sendbacklist" ) { 2577 if ( email == "sendbacklist" ) {
2577 //qDebug("ssssssssssssssssssssssend "); 2578 //qDebug("ssssssssssssssssssssssend ");
2578 QStringList nameList; 2579 QStringList nameList;
2579 QStringList emailList; 2580 QStringList emailList;
2580 QStringList uidList; 2581 QStringList uidList;
2581 nameList.append(adrr.realName()); 2582 nameList.append(adrr.realName());
2582 emailList = adrr.emails(); 2583 emailList = adrr.emails();
2583 uidList.append( adrr.preferredEmail()); 2584 uidList.append( adrr.preferredEmail());
2584 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 2585 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2585 return; 2586 return;
2586 } 2587 }
2587 2588
2588 } 2589 }
2589 2590
2590 if ( email == "sendbacklist" ) 2591 if ( email == "sendbacklist" )
2591 return; 2592 return;
2592 if (foundUid.isEmpty()) 2593 if (foundUid.isEmpty())
2593 { 2594 {
2594 //find the uid of the person first 2595 //find the uid of the person first
2595 Addressee::List namelist; 2596 Addressee::List namelist;
2596 Addressee::List emaillist; 2597 Addressee::List emaillist;
2597 2598
2598 if (!name.isEmpty()) 2599 if (!name.isEmpty())
2599 namelist = mAddressBook->findByName( name ); 2600 namelist = mAddressBook->findByName( name );
2600 2601
2601 if (!email.isEmpty()) 2602 if (!email.isEmpty())
2602 emaillist = mAddressBook->findByEmail( email ); 2603 emaillist = mAddressBook->findByEmail( email );
2603 //qDebug("count %d %d ", namelist.count(),emaillist.count() ); 2604 //qDebug("count %d %d ", namelist.count(),emaillist.count() );
2604 //check if we have a match in Namelist and Emaillist 2605 //check if we have a match in Namelist and Emaillist
2605 if ((namelist.count() == 0) && (emaillist.count() > 0)) { 2606 if ((namelist.count() == 0) && (emaillist.count() > 0)) {
2606 foundUid = emaillist[0].uid(); 2607 foundUid = emaillist[0].uid();
2607 } 2608 }
2608 else if ((namelist.count() > 0) && (emaillist.count() == 0)) 2609 else if ((namelist.count() > 0) && (emaillist.count() == 0))
2609 foundUid = namelist[0].uid(); 2610 foundUid = namelist[0].uid();
2610 else 2611 else
2611 { 2612 {
2612 for (int i = 0; i < namelist.count(); i++) 2613 for (int i = 0; i < namelist.count(); i++)
2613 { 2614 {
2614 for (int j = 0; j < emaillist.count(); j++) 2615 for (int j = 0; j < emaillist.count(); j++)
2615 { 2616 {
2616 if (namelist[i] == emaillist[j]) 2617 if (namelist[i] == emaillist[j])
2617 { 2618 {
2618 foundUid = namelist[i].uid(); 2619 foundUid = namelist[i].uid();
2619 } 2620 }
2620 } 2621 }
2621 } 2622 }
2622 } 2623 }
2623 } 2624 }
2624 else 2625 else
2625 { 2626 {
2626 foundUid = uid; 2627 foundUid = uid;
2627 } 2628 }
2628 2629
2629 if (!foundUid.isEmpty()) 2630 if (!foundUid.isEmpty())
2630 { 2631 {
2631 2632
2632 // raise Ka/Pi if it is in the background 2633 // raise Ka/Pi if it is in the background
2633#ifndef DESKTOP_VERSION 2634#ifndef DESKTOP_VERSION
2634#ifndef KORG_NODCOP 2635#ifndef KORG_NODCOP
2635 //QCopEnvelope e("QPE/Application/kapi", "raise()"); 2636 //QCopEnvelope e("QPE/Application/kapi", "raise()");
2636#endif 2637#endif
2637#endif 2638#endif
2638 2639
2639 mMainWindow->showMaximized(); 2640 mMainWindow->showMaximized();
2640 mMainWindow-> raise(); 2641 mMainWindow-> raise();
2641 2642
2642 mViewManager->setSelected( "", false); 2643 mViewManager->setSelected( "", false);
2643 mViewManager->refreshView( "" ); 2644 mViewManager->refreshView( "" );
2644 mViewManager->setSelected( foundUid, true ); 2645 mViewManager->setSelected( foundUid, true );
2645 mViewManager->refreshView( foundUid ); 2646 mViewManager->refreshView( foundUid );
2646 2647
2647 if ( !mMultipleViewsAtOnce ) 2648 if ( !mMultipleViewsAtOnce )
2648 { 2649 {
2649 setDetailsVisible( true ); 2650 setDetailsVisible( true );
2650 mActionDetails->setChecked(true); 2651 mActionDetails->setChecked(true);
2651 } 2652 }
2652 } 2653 }
2653} 2654}
2654 2655
2655void KABCore::whatsnew() 2656void KABCore::whatsnew()
2656{ 2657{
2657 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 2658 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
2658} 2659}
2659void KABCore::synchowto() 2660void KABCore::synchowto()
2660{ 2661{
2661 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 2662 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
2662} 2663}
2663void KABCore::kdesynchowto() 2664void KABCore::kdesynchowto()
2664{ 2665{
2665 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 2666 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
2666} 2667}
2667void KABCore::multisynchowto() 2668void KABCore::multisynchowto()
2668{ 2669{
2669 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 2670 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
2670} 2671}
2671void KABCore::faq() 2672void KABCore::faq()
2672{ 2673{
2673 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); 2674 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" );
2674} 2675}
2675 2676
2676#include <libkcal/syncdefines.h> 2677#include <libkcal/syncdefines.h>
2677 2678
2678KABC::Addressee KABCore::getLastSyncAddressee() 2679KABC::Addressee KABCore::getLastSyncAddressee()
2679{ 2680{
2680 Addressee lse; 2681 Addressee lse;
2681 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2682 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2682 2683
2683 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 2684 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
2684 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2685 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
2685 if (lse.isEmpty()) { 2686 if (lse.isEmpty()) {
2686 qDebug("Creating new last-syncAddressee "); 2687 qDebug("Creating new last-syncAddressee ");
2687 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2688 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice );
2688 QString sum = ""; 2689 QString sum = "";
2689 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 2690 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
2690 sum = "E: "; 2691 sum = "E: ";
2691 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); 2692 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event"));
2692 lse.setRevision( mLastAddressbookSync ); 2693 lse.setRevision( mLastAddressbookSync );
2693 lse.setCategories( i18n("SyncEvent") ); 2694 lse.setCategories( i18n("SyncEvent") );
2694 mAddressBook->insertAddressee( lse ); 2695 mAddressBook->insertAddressee( lse );
2695 } 2696 }
2696 return lse; 2697 return lse;
2697} 2698}
2698int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) 2699int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full )
2699{ 2700{
2700 2701
2701 //void setZaurusId(int id); 2702 //void setZaurusId(int id);
2702 // int zaurusId() const; 2703 // int zaurusId() const;
2703 // void setZaurusUid(int id); 2704 // void setZaurusUid(int id);
2704 // int zaurusUid() const; 2705 // int zaurusUid() const;
2705 // void setZaurusStat(int id); 2706 // void setZaurusStat(int id);
2706 // int zaurusStat() const; 2707 // int zaurusStat() const;
2707 // 0 equal 2708 // 0 equal
2708 // 1 take local 2709 // 1 take local
2709 // 2 take remote 2710 // 2 take remote
2710 // 3 cancel 2711 // 3 cancel
2711 QDateTime lastSync = mLastAddressbookSync; 2712 QDateTime lastSync = mLastAddressbookSync;
2712 QDateTime localMod = local->revision(); 2713 QDateTime localMod = local->revision();
2713 QDateTime remoteMod = remote->revision(); 2714 QDateTime remoteMod = remote->revision();
2714 2715
2715 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2716 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2716 2717
2717 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2718 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2718 bool remCh, locCh; 2719 bool remCh, locCh;
2719 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 2720 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
2720 if ( remCh ) 2721 if ( remCh )
2721 qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 2722 qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
2722 locCh = ( localMod > mLastAddressbookSync ); 2723 locCh = ( localMod > mLastAddressbookSync );
2723 //qDebug("cahnged rem %d loc %d",remCh, locCh ); 2724 //qDebug("cahnged rem %d loc %d",remCh, locCh );
2724 if ( !remCh && ! locCh ) { 2725 if ( !remCh && ! locCh ) {
2725 //qDebug("both not changed "); 2726 //qDebug("both not changed ");
2726 lastSync = localMod.addDays(1); 2727 lastSync = localMod.addDays(1);
2727 if ( mode <= SYNC_PREF_ASK ) 2728 if ( mode <= SYNC_PREF_ASK )
2728 return 0; 2729 return 0;
2729 } else { 2730 } else {
2730 if ( locCh ) { 2731 if ( locCh ) {
2731 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); 2732 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1());
2732 lastSync = localMod.addDays( -1 ); 2733 lastSync = localMod.addDays( -1 );
2733 if ( !remCh ) 2734 if ( !remCh )
2734 remoteMod =( lastSync.addDays( -1 ) ); 2735 remoteMod =( lastSync.addDays( -1 ) );
2735 } else { 2736 } else {
2736 //qDebug(" not loc changed "); 2737 //qDebug(" not loc changed ");
2737 lastSync = localMod.addDays( 1 ); 2738 lastSync = localMod.addDays( 1 );
2738 if ( remCh ) { 2739 if ( remCh ) {
2739 //qDebug("rem changed "); 2740 //qDebug("rem changed ");
2740 remoteMod =( lastSync.addDays( 1 ) ); 2741 remoteMod =( lastSync.addDays( 1 ) );
2741 } 2742 }
2742 2743
2743 } 2744 }
2744 } 2745 }
2745 full = true; 2746 full = true;
2746 if ( mode < SYNC_PREF_ASK ) 2747 if ( mode < SYNC_PREF_ASK )
2747 mode = SYNC_PREF_ASK; 2748 mode = SYNC_PREF_ASK;
2748 } else { 2749 } else {
2749 if ( localMod == remoteMod ) 2750 if ( localMod == remoteMod )
2750 return 0; 2751 return 0;
2751 2752
2752 } 2753 }
2753 //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec()); 2754 //qDebug("%s %s --- %d %d", localMod.toString().latin1() , remoteMod.toString().latin1(), localMod.time().msec(), remoteMod.time().msec());
2754 //qDebug("lastsync %s ", lastSync.toString().latin1() ); 2755 //qDebug("lastsync %s ", lastSync.toString().latin1() );
2755 //full = true; //debug only 2756 //full = true; //debug only
2756 if ( full ) { 2757 if ( full ) {
2757 bool equ = ( (*local) == (*remote) ); 2758 bool equ = ( (*local) == (*remote) );
2758 if ( equ ) { 2759 if ( equ ) {
2759 //qDebug("equal "); 2760 //qDebug("equal ");
2760 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2761 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2761 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 2762 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
2762 } 2763 }
2763 if ( mode < SYNC_PREF_FORCE_LOCAL ) 2764 if ( mode < SYNC_PREF_FORCE_LOCAL )
2764 return 0; 2765 return 0;
2765 2766
2766 }//else //debug only 2767 }//else //debug only
2767 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 2768 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
2768 } 2769 }
2769 int result; 2770 int result;
2770 bool localIsNew; 2771 bool localIsNew;
2771 //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() ); 2772 //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() );
2772 2773
2773 if ( full && mode < SYNC_PREF_NEWEST ) 2774 if ( full && mode < SYNC_PREF_NEWEST )
2774 mode = SYNC_PREF_ASK; 2775 mode = SYNC_PREF_ASK;
2775 2776
2776 switch( mode ) { 2777 switch( mode ) {
2777 case SYNC_PREF_LOCAL: 2778 case SYNC_PREF_LOCAL:
2778 if ( lastSync > remoteMod ) 2779 if ( lastSync > remoteMod )
2779 return 1; 2780 return 1;
2780 if ( lastSync > localMod ) 2781 if ( lastSync > localMod )
2781 return 2; 2782 return 2;
2782 return 1; 2783 return 1;
2783 break; 2784 break;
2784 case SYNC_PREF_REMOTE: 2785 case SYNC_PREF_REMOTE:
2785 if ( lastSync > remoteMod ) 2786 if ( lastSync > remoteMod )
2786 return 1; 2787 return 1;
2787 if ( lastSync > localMod ) 2788 if ( lastSync > localMod )
2788 return 2; 2789 return 2;
2789 return 2; 2790 return 2;
2790 break; 2791 break;
2791 case SYNC_PREF_NEWEST: 2792 case SYNC_PREF_NEWEST:
2792 if ( localMod > remoteMod ) 2793 if ( localMod > remoteMod )
2793 return 1; 2794 return 1;
2794 else 2795 else
2795 return 2; 2796 return 2;
2796 break; 2797 break;
2797 case SYNC_PREF_ASK: 2798 case SYNC_PREF_ASK:
2798 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 2799 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
2799 if ( lastSync > remoteMod ) 2800 if ( lastSync > remoteMod )
2800 return 1; 2801 return 1;
2801 if ( lastSync > localMod ) { 2802 if ( lastSync > localMod ) {
2802 return 2; 2803 return 2;
2803 } 2804 }
2804 localIsNew = localMod >= remoteMod; 2805 localIsNew = localMod >= remoteMod;
2805 //qDebug("conflict! ************************************** "); 2806 //qDebug("conflict! ************************************** ");
2806 { 2807 {
2807 KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this ); 2808 KABC::AddresseeChooser acd ( *local,*remote, localIsNew , this );
2808 result = acd.executeD(localIsNew); 2809 result = acd.executeD(localIsNew);
2809 return result; 2810 return result;
2810 } 2811 }
2811 break; 2812 break;
2812 case SYNC_PREF_FORCE_LOCAL: 2813 case SYNC_PREF_FORCE_LOCAL:
2813 return 1; 2814 return 1;
2814 break; 2815 break;
2815 case SYNC_PREF_FORCE_REMOTE: 2816 case SYNC_PREF_FORCE_REMOTE:
2816 return 2; 2817 return 2;
2817 break; 2818 break;
2818 2819
2819 default: 2820 default:
2820 // SYNC_PREF_TAKE_BOTH not implemented 2821 // SYNC_PREF_TAKE_BOTH not implemented
2821 break; 2822 break;
2822 } 2823 }
2823 return 0; 2824 return 0;
2824} 2825}
2825 2826
2826 2827
2827bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) 2828bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode)
2828{ 2829{
2829 bool syncOK = true; 2830 bool syncOK = true;
2830 int addedAddressee = 0; 2831 int addedAddressee = 0;
2831 int addedAddresseeR = 0; 2832 int addedAddresseeR = 0;
2832 int deletedAddresseeR = 0; 2833 int deletedAddresseeR = 0;
2833 int deletedAddresseeL = 0; 2834 int deletedAddresseeL = 0;
2834 int changedLocal = 0; 2835 int changedLocal = 0;
2835 int changedRemote = 0; 2836 int changedRemote = 0;
2836 int filteredIN = 0; 2837 int filteredIN = 0;
2837 int filteredOUT = 0; 2838 int filteredOUT = 0;
2838 2839
2839 QString mCurrentSyncName = syncManager->getCurrentSyncName(); 2840 QString mCurrentSyncName = syncManager->getCurrentSyncName();
2840 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2841 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2841 2842
2842 //QPtrList<Addressee> el = local->rawAddressees(); 2843 //QPtrList<Addressee> el = local->rawAddressees();
2843 Addressee addresseeR; 2844 Addressee addresseeR;
2844 QString uid; 2845 QString uid;
2845 int take; 2846 int take;
2846 Addressee addresseeL; 2847 Addressee addresseeL;
2847 Addressee addresseeRSync; 2848 Addressee addresseeRSync;
2848 Addressee addresseeLSync; 2849 Addressee addresseeLSync;
2849 // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees(); 2850 // KABC::Addressee::List addresseeRSyncSharp = remote->getExternLastSyncAddressees();
2850 //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees(); 2851 //KABC::Addressee::List addresseeLSyncSharp = local->getExternLastSyncAddressees();
2851 bool fullDateRange = false; 2852 bool fullDateRange = false;
2852 local->resetTempSyncStat(); 2853 local->resetTempSyncStat();
2853 mLastAddressbookSync = QDateTime::currentDateTime(); 2854 mLastAddressbookSync = QDateTime::currentDateTime();
2854 if ( syncManager->syncWithDesktop() ) { 2855 if ( syncManager->syncWithDesktop() ) {
2855 // remote->removeSyncInfo( QString());//remove all info 2856 // remote->removeSyncInfo( QString());//remove all info
2856 if ( KSyncManager::mRequestedSyncEvent.isValid() ) { 2857 if ( KSyncManager::mRequestedSyncEvent.isValid() ) {
2857 mLastAddressbookSync = KSyncManager::mRequestedSyncEvent; 2858 mLastAddressbookSync = KSyncManager::mRequestedSyncEvent;
2858 qDebug("using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() ); 2859 qDebug("using extern time for calendar sync: %s ", mLastAddressbookSync.toString().latin1() );
2859 } else { 2860 } else {
2860 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime "); 2861 qDebug("KSyncManager::mRequestedSyncEvent has invalid datatime ");
2861 } 2862 }
2862 } 2863 }
2863 QDateTime modifiedCalendar = mLastAddressbookSync; 2864 QDateTime modifiedCalendar = mLastAddressbookSync;
2864 addresseeLSync = getLastSyncAddressee(); 2865 addresseeLSync = getLastSyncAddressee();
2865 qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1()); 2866 qDebug("Last Sync %s ", addresseeLSync.revision().toString().latin1());
2866 addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName ); 2867 addresseeR = remote->findByUid("last-syncAddressee-"+mCurrentSyncName );
2867 if ( !addresseeR.isEmpty() ) { 2868 if ( !addresseeR.isEmpty() ) {
2868 addresseeRSync = addresseeR; 2869 addresseeRSync = addresseeR;
2869 remote->removeAddressee(addresseeR ); 2870 remote->removeAddressee(addresseeR );
2870 2871
2871 } else { 2872 } else {
2872 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2873 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2873 addresseeRSync = addresseeLSync ; 2874 addresseeRSync = addresseeLSync ;
2874 } else { 2875 } else {
2875 //qDebug("FULLDATE 1"); 2876 //qDebug("FULLDATE 1");
2876 fullDateRange = true; 2877 fullDateRange = true;
2877 Addressee newAdd; 2878 Addressee newAdd;
2878 addresseeRSync = newAdd; 2879 addresseeRSync = newAdd;
2879 addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee")); 2880 addresseeRSync.setFamilyName(mCurrentSyncName + i18n(" - sync addressee"));
2880 addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName ); 2881 addresseeRSync.setUid("last-syncAddressee-"+mCurrentSyncName );
2881 addresseeRSync.setRevision( mLastAddressbookSync ); 2882 addresseeRSync.setRevision( mLastAddressbookSync );
2882 addresseeRSync.setCategories( i18n("SyncAddressee") ); 2883 addresseeRSync.setCategories( i18n("SyncAddressee") );
2883 } 2884 }
2884 } 2885 }
2885 if ( addresseeLSync.revision() == mLastAddressbookSync ) { 2886 if ( addresseeLSync.revision() == mLastAddressbookSync ) {
2886 // qDebug("FULLDATE 2"); 2887 // qDebug("FULLDATE 2");
2887 fullDateRange = true; 2888 fullDateRange = true;
2888 } 2889 }
2889 if ( ! fullDateRange ) { 2890 if ( ! fullDateRange ) {
2890 if ( addresseeLSync.revision() != addresseeRSync.revision() ) { 2891 if ( addresseeLSync.revision() != addresseeRSync.revision() ) {
2891 2892
2892 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); 2893 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() );
2893 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); 2894 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec());
2894 fullDateRange = true; 2895 fullDateRange = true;
2895 //qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); 2896 //qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() );
2896 } 2897 }
2897 } 2898 }
2898 // fullDateRange = true; // debug only! 2899 // fullDateRange = true; // debug only!
2899 if ( fullDateRange ) 2900 if ( fullDateRange )
2900 mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); 2901 mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365);
2901 else 2902 else
2902 mLastAddressbookSync = addresseeLSync.revision(); 2903 mLastAddressbookSync = addresseeLSync.revision();
2903 // for resyncing if own file has changed 2904 // for resyncing if own file has changed
2904 // PENDING fixme later when implemented 2905 // PENDING fixme later when implemented
2905#if 0 2906#if 0
2906 if ( mCurrentSyncDevice == "deleteaftersync" ) { 2907 if ( mCurrentSyncDevice == "deleteaftersync" ) {
2907 mLastAddressbookSync = loadedFileVersion; 2908 mLastAddressbookSync = loadedFileVersion;
2908 qDebug("setting mLastAddressbookSync "); 2909 qDebug("setting mLastAddressbookSync ");
2909 } 2910 }
2910#endif 2911#endif
2911 2912
2912 2913
2913 // ********** setting filters **************** 2914 // ********** setting filters ****************
2914 Filter filterIN = mViewManager->getFilterByName( syncManager->mFilterInAB ); 2915 Filter filterIN = mViewManager->getFilterByName( syncManager->mFilterInAB );
2915 Filter filterOUT = mViewManager->getFilterByName( syncManager->mFilterOutAB ); 2916 Filter filterOUT = mViewManager->getFilterByName( syncManager->mFilterOutAB );
2916 2917
2917 //qDebug("*************************** "); 2918 //qDebug("*************************** ");
2918 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); 2919 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() );
2919 QStringList er = remote->uidList(); 2920 QStringList er = remote->uidList();
2920 Addressee inR ;//= er.first(); 2921 Addressee inR ;//= er.first();
2921 Addressee inL; 2922 Addressee inL;
2922 2923
2923 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count()); 2924 syncManager->showProgressBar(0, i18n("Syncing - close to abort!"), er.count());
2924 2925
2925 int modulo = (er.count()/10)+1; 2926 int modulo = (er.count()/10)+1;
2926 int incCounter = 0; 2927 int incCounter = 0;
2927 while ( incCounter < er.count()) { 2928 while ( incCounter < er.count()) {
2928 if (syncManager->isProgressBarCanceled()) 2929 if (syncManager->isProgressBarCanceled())
2929 return false; 2930 return false;
2930 if ( incCounter % modulo == 0 ) 2931 if ( incCounter % modulo == 0 )
2931 syncManager->showProgressBar(incCounter); 2932 syncManager->showProgressBar(incCounter);
2932 2933
2933 uid = er[ incCounter ]; 2934 uid = er[ incCounter ];
2934 bool skipIncidence = false; 2935 bool skipIncidence = false;
2935 if ( uid.left(19) == QString("last-syncAddressee-") ) 2936 if ( uid.left(19) == QString("last-syncAddressee-") )
2936 skipIncidence = true; 2937 skipIncidence = true;
2937 QString idS,OidS; 2938 QString idS,OidS;
2938 qApp->processEvents(); 2939 qApp->processEvents();
2939 if ( !skipIncidence ) { 2940 if ( !skipIncidence ) {
2940 inL = local->findByUid( uid ); 2941 inL = local->findByUid( uid );
2941 inR = remote->findByUid( uid ); 2942 inR = remote->findByUid( uid );
2942 //inL.setResource( 0 ); 2943 //inL.setResource( 0 );
2943 //inR.setResource( 0 ); 2944 //inR.setResource( 0 );
2944 if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars 2945 if ( !inL.isEmpty() ) { // maybe conflict - same uid in both calendars
2945 if ( !inL.resource() || inL.resource()->includeInSync() ) { 2946 if ( !inL.resource() || inL.resource()->includeInSync() ) {
2946 if ( (take = takeAddressee( &inL, &inR, mode, fullDateRange )) ) { 2947 if ( (take = takeAddressee( &inL, &inR, mode, fullDateRange )) ) {
2947 //qDebug("take %d %s ", take, inL.summary().latin1()); 2948 //qDebug("take %d %s ", take, inL.summary().latin1());
2948 if ( take == 3 ) 2949 if ( take == 3 )
2949 return false; 2950 return false;
2950 if ( take == 1 ) {// take local ********************** 2951 if ( take == 1 ) {// take local **********************
2951 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2952 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2952 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); 2953 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
2953 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); 2954 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
2954 local->insertAddressee( inL, false ); 2955 local->insertAddressee( inL, false );
2955 idS = inR.externalUID(); 2956 idS = inR.externalUID();
2956 OidS = inR.originalExternalUID(); 2957 OidS = inR.originalExternalUID();
2957 } 2958 }
2958 else 2959 else
2959 idS = inR.IDStr(); 2960 idS = inR.IDStr();
2960 remote->removeAddressee( inR ); 2961 remote->removeAddressee( inR );
2961 inR = inL; 2962 inR = inL;
2962 inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 2963 inR.setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
2963 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2964 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2964 inR.setOriginalExternalUID( OidS ); 2965 inR.setOriginalExternalUID( OidS );
2965 inR.setExternalUID( idS ); 2966 inR.setExternalUID( idS );
2966 if ( syncManager->syncWithDesktop() ) { 2967 if ( syncManager->syncWithDesktop() ) {
2967 inR.setIDStr("changed" ); 2968 inR.setIDStr("changed" );
2968 } 2969 }
2969 //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" ); 2970 //inR.insertCustom( "KADDRESSBOOK", "X-KDESYNC","changed" );
2970 } else { 2971 } else {
2971 inR.setIDStr( idS ); 2972 inR.setIDStr( idS );
2972 } 2973 }
2973 inR.setResource( 0 ); 2974 inR.setResource( 0 );
2974 remote->insertAddressee( inR , false); 2975 remote->insertAddressee( inR , false);
2975 ++changedRemote; 2976 ++changedRemote;
2976 } else { // take == 2 take remote ********************** 2977 } else { // take == 2 take remote **********************
2977 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2978 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2978 if ( inR.revision().date().year() < 2004 ) 2979 if ( inR.revision().date().year() < 2004 )
2979 inR.setRevision( modifiedCalendar ); 2980 inR.setRevision( modifiedCalendar );
2980 } 2981 }
2981 idS = inL.IDStr(); 2982 idS = inL.IDStr();
2982 local->removeAddressee( inL ); 2983 local->removeAddressee( inL );
2983 inL = inR; 2984 inL = inR;
2984 inL.setIDStr( idS ); 2985 inL.setIDStr( idS );
2985 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2986 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2986 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); 2987 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
2987 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); 2988 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
2988 } 2989 }
2989 inL.setResource( 0 ); 2990 inL.setResource( 0 );
2990 local->insertAddressee( inL , false ); 2991 local->insertAddressee( inL , false );
2991 ++changedLocal; 2992 ++changedLocal;
2992 } 2993 }
2993 } 2994 }
2994 } 2995 }
2995 } else { // no conflict ********** add or delete remote 2996 } else { // no conflict ********** add or delete remote
2996 if ( filterIN.name().isEmpty() || filterIN.filterAddressee( inR ) ) { 2997 if ( filterIN.name().isEmpty() || filterIN.filterAddressee( inR ) ) {
2997 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2998 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2998 QString des = addresseeLSync.note(); 2999 QString des = addresseeLSync.note();
2999 if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 3000 if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
3000 inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 3001 inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE );
3001 remote->insertAddressee( inR, false ); 3002 remote->insertAddressee( inR, false );
3002 ++deletedAddresseeR; 3003 ++deletedAddresseeR;
3003 } else { 3004 } else {
3004 inR.setRevision( modifiedCalendar ); 3005 inR.setRevision( modifiedCalendar );
3005 remote->insertAddressee( inR, false ); 3006 remote->insertAddressee( inR, false );
3006 inL = inR; 3007 inL = inR;
3007 inL.setIDStr( ":" ); 3008 inL.setIDStr( ":" );
3008 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) ); 3009 inL.setCsum( mCurrentSyncDevice, inR.getCsum(mCurrentSyncDevice) );
3009 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) ); 3010 inL.setID( mCurrentSyncDevice, inR.getID(mCurrentSyncDevice) );
3010 inL.setResource( 0 ); 3011 inL.setResource( 0 );
3011 local->insertAddressee( inL , false); 3012 local->insertAddressee( inL , false);
3012 ++addedAddressee; 3013 ++addedAddressee;
3013 } 3014 }
3014 } else { 3015 } else {
3015 if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { 3016 if ( inR.revision() > mLastAddressbookSync || mode == 5 ) {
3016 inR.setRevision( modifiedCalendar ); 3017 inR.setRevision( modifiedCalendar );
3017 remote->insertAddressee( inR, false ); 3018 remote->insertAddressee( inR, false );
3018 inR.setResource( 0 ); 3019 inR.setResource( 0 );
3019 local->insertAddressee( inR, false ); 3020 local->insertAddressee( inR, false );
3020 ++addedAddressee; 3021 ++addedAddressee;
3021 } else { 3022 } else {
3022 // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); 3023 // pending checkExternSyncAddressee(addresseeRSyncSharp, inR);
3023 remote->removeAddressee( inR ); 3024 remote->removeAddressee( inR );
3024 ++deletedAddresseeR; 3025 ++deletedAddresseeR;
3025 } 3026 }
3026 } 3027 }
3027 } else { 3028 } else {
3028 ++filteredIN; 3029 ++filteredIN;
3029 } 3030 }
3030 } 3031 }
3031 } 3032 }
3032 ++incCounter; 3033 ++incCounter;
3033 } 3034 }
3034 er.clear(); 3035 er.clear();
3035 QStringList el = local->uidList(); 3036 QStringList el = local->uidList();
3036 modulo = (el.count()/10)+1; 3037 modulo = (el.count()/10)+1;
3037 3038
3038 syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); 3039 syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count());
3039 incCounter = 0; 3040 incCounter = 0;
3040 while ( incCounter < el.count()) { 3041 while ( incCounter < el.count()) {
3041 qApp->processEvents(); 3042 qApp->processEvents();
3042 if (syncManager->isProgressBarCanceled()) 3043 if (syncManager->isProgressBarCanceled())
3043 return false; 3044 return false;
3044 if ( incCounter % modulo == 0 ) 3045 if ( incCounter % modulo == 0 )
3045 syncManager->showProgressBar(incCounter); 3046 syncManager->showProgressBar(incCounter);
3046 uid = el[ incCounter ]; 3047 uid = el[ incCounter ];
3047 bool skipIncidence = false; 3048 bool skipIncidence = false;
3048 if ( uid.left(19) == QString("last-syncAddressee-") ) 3049 if ( uid.left(19) == QString("last-syncAddressee-") )
3049 skipIncidence = true; 3050 skipIncidence = true;
3050 if ( !skipIncidence ) { 3051 if ( !skipIncidence ) {
3051 inL = local->findByUid( uid ); 3052 inL = local->findByUid( uid );
3052 if ( !inL.resource() || inL.resource()->includeInSync() ) { 3053 if ( !inL.resource() || inL.resource()->includeInSync() ) {
3053 inR = remote->findByUid( uid ); 3054 inR = remote->findByUid( uid );
3054 if ( inR.isEmpty() ){ 3055 if ( inR.isEmpty() ){
3055 if ( filterOUT.name().isEmpty() || filterOUT.filterAddressee( inL ) ) { 3056 if ( filterOUT.name().isEmpty() || filterOUT.filterAddressee( inL ) ) {
3056 // no conflict ********** add or delete local 3057 // no conflict ********** add or delete local
3057 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 3058 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
3058 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 3059 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
3059 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 3060 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
3060 local->removeAddressee( inL ); 3061 local->removeAddressee( inL );
3061 ++deletedAddresseeL; 3062 ++deletedAddresseeL;
3062 } else { 3063 } else {
3063 if ( ! syncManager->mWriteBackExistingOnly ) { 3064 if ( ! syncManager->mWriteBackExistingOnly ) {
3064 inL.removeID(mCurrentSyncDevice ); 3065 inL.removeID(mCurrentSyncDevice );
3065 ++addedAddresseeR; 3066 ++addedAddresseeR;
3066 inL.setRevision( modifiedCalendar ); 3067 inL.setRevision( modifiedCalendar );
3067 local->insertAddressee( inL, false ); 3068 local->insertAddressee( inL, false );
3068 inR = inL; 3069 inR = inL;
3069 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); 3070 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL );
3070 inR.setResource( 0 ); 3071 inR.setResource( 0 );
3071 remote->insertAddressee( inR, false ); 3072 remote->insertAddressee( inR, false );
3072 } 3073 }
3073 } 3074 }
3074 } else { 3075 } else {
3075 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { 3076 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) {
3076 //qDebug("data %s ", inL.revision().toString().latin1()); 3077 //qDebug("data %s ", inL.revision().toString().latin1());
3077 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 3078 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
3078 local->removeAddressee( inL ); 3079 local->removeAddressee( inL );
3079 ++deletedAddresseeL; 3080 ++deletedAddresseeL;
3080 } else { 3081 } else {
3081 if ( ! syncManager->mWriteBackExistingOnly ) { 3082 if ( ! syncManager->mWriteBackExistingOnly ) {
3082 ++addedAddresseeR; 3083 ++addedAddresseeR;
3083 inL.setRevision( modifiedCalendar ); 3084 inL.setRevision( modifiedCalendar );
3084 local->insertAddressee( inL, false ); 3085 local->insertAddressee( inL, false );
3085 inR = inL; 3086 inR = inL;
3086 inR.setIDStr( ":" ); 3087 inR.setIDStr( ":" );
3087 inR.setResource( 0 ); 3088 inR.setResource( 0 );
3088 remote->insertAddressee( inR, false ); 3089 remote->insertAddressee( inR, false );
3089 } 3090 }
3090 } 3091 }
3091 } 3092 }
3092 } else { 3093 } else {
3093 ++filteredOUT; 3094 ++filteredOUT;
3094 } 3095 }
3095 } 3096 }
3096 } 3097 }
3097 } 3098 }
3098 ++incCounter; 3099 ++incCounter;
3099 } 3100 }
3100 el.clear(); 3101 el.clear();
3101 syncManager->hideProgressBar(); 3102 syncManager->hideProgressBar();
3102 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); 3103 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 );
3103 // get rid of micro seconds 3104 // get rid of micro seconds
3104 QTime t = mLastAddressbookSync.time(); 3105 QTime t = mLastAddressbookSync.time();
3105 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); 3106 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) );
3106 addresseeLSync.setRevision( mLastAddressbookSync ); 3107 addresseeLSync.setRevision( mLastAddressbookSync );
3107 addresseeRSync.setRevision( mLastAddressbookSync ); 3108 addresseeRSync.setRevision( mLastAddressbookSync );
3108 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; 3109 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ;
3109 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); 3110 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName );
3110 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; 3111 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ;
3111 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); 3112 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") );
3112 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; 3113 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ;
3113 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); 3114 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() );
3114 addresseeRSync.setNote( "" ) ; 3115 addresseeRSync.setNote( "" ) ;
3115 addresseeLSync.setNote( "" ); 3116 addresseeLSync.setNote( "" );
3116 3117
3117 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 3118 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
3118 remote->insertAddressee( addresseeRSync, false ); 3119 remote->insertAddressee( addresseeRSync, false );
3119 local->insertAddressee( addresseeLSync, false ); 3120 local->insertAddressee( addresseeLSync, false );
3120 QString mes; 3121 QString mes;
3121 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 ); 3122 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 );
3122 qDebug( mes ); 3123 qDebug( mes );
3123 mes = i18n("Local addressbook changed!\n") +mes; 3124 mes = i18n("Local addressbook changed!\n") +mes;
3124 if ( syncManager->mShowSyncSummary ) { 3125 if ( syncManager->mShowSyncSummary ) {
3125 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 3126 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
3126 i18n("KA/Pi Synchronization"),i18n("Write back"))) { 3127 i18n("KA/Pi Synchronization"),i18n("Write back"))) {
3127 qDebug("cancelled "); 3128 qDebug("cancelled ");
3128 return false; 3129 return false;
3129 } 3130 }
3130 } 3131 }
3131 return syncOK; 3132 return syncOK;
3132} 3133}
3133 3134
3134 3135
3135//this is a overwritten callbackmethods from the syncinterface 3136//this is a overwritten callbackmethods from the syncinterface
3136bool KABCore::sync(KSyncManager* manager, QString filename, int mode) 3137bool KABCore::sync(KSyncManager* manager, QString filename, int mode)
3137{ 3138{
3138 3139
3139 //pending prepare addresseeview for output 3140 //pending prepare addresseeview for output
3140 //pending detect, if remote file has REV field. if not switch to external sync 3141 //pending detect, if remote file has REV field. if not switch to external sync
3141 mGlobalSyncMode = SYNC_MODE_NORMAL; 3142 mGlobalSyncMode = SYNC_MODE_NORMAL;
3142 if ( manager != syncManager ) 3143 if ( manager != syncManager )
3143 qDebug("KABCore::sync:: ERROR! :: manager != syncManager "); 3144 qDebug("KABCore::sync:: ERROR! :: manager != syncManager ");
3144 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 3145 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
3145 3146
3146 AddressBook abLocal(filename,"syncContact"); 3147 AddressBook abLocal(filename,"syncContact");
3147 bool syncOK = false; 3148 bool syncOK = false;
3148 if ( abLocal.load() ) { 3149 if ( abLocal.load() ) {
3149 qDebug("Sync:AB loaded %s,sync mode %d",filename.latin1(), mode ); 3150 qDebug("Sync:AB loaded %s,sync mode %d",filename.latin1(), mode );
3150 bool external = false; 3151 bool external = false;
3151 bool isXML = false; 3152 bool isXML = false;
3152 if ( filename.right(4) == ".xml") { 3153 if ( filename.right(4) == ".xml") {
3153 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3154 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3154 isXML = true; 3155 isXML = true;
3155 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 3156 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
3156 } else { 3157 } else {
3157 external = !manager->mIsKapiFile; 3158 external = !manager->mIsKapiFile;
3158 if ( external ) { 3159 if ( external ) {
3159 qDebug("Sync:Setting vcf mode to external "); 3160 qDebug("Sync:Setting vcf mode to external ");
3160 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3161 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3161 AddressBook::Iterator it; 3162 AddressBook::Iterator it;
3162 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 3163 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
3163 (*it).setID( mCurrentSyncDevice, (*it).uid() ); 3164 (*it).setID( mCurrentSyncDevice, (*it).uid() );
3164 (*it).computeCsum( mCurrentSyncDevice ); 3165 (*it).computeCsum( mCurrentSyncDevice );
3165 } 3166 }
3166 } 3167 }
3167 } 3168 }
3168 //AddressBook::Iterator it; 3169 //AddressBook::Iterator it;
3169 //QStringList vcards; 3170 //QStringList vcards;
3170 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 3171 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
3171 // qDebug("Name %s ", (*it).familyName().latin1()); 3172 // qDebug("Name %s ", (*it).familyName().latin1());
3172 //} 3173 //}
3173 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); 3174 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode );
3174 if ( syncOK ) { 3175 if ( syncOK ) {
3175 if ( syncManager->mWriteBackFile ) 3176 if ( syncManager->mWriteBackFile )
3176 { 3177 {
3177 if ( external ) 3178 if ( external )
3178 abLocal.removeSyncAddressees( !isXML); 3179 abLocal.removeSyncAddressees( !isXML);
3179 qDebug("Sync:Saving remote AB "); 3180 qDebug("Sync:Saving remote AB ");
3180 if ( ! abLocal.saveAB()) 3181 if ( ! abLocal.saveAB())
3181 qDebug("Error writing back AB to file "); 3182 qDebug("Error writing back AB to file ");
3182 if ( external ) { 3183 if ( external ) {
3183 // afterwrite processing 3184 // afterwrite processing
3184 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML); 3185 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ,isXML);
3185 } 3186 }
3186 } 3187 }
3187 } 3188 }
3188 setModified(); 3189 setModified();
3189 3190
3190 } 3191 }
3191 abLocal.removeResources(); 3192 abLocal.removeResources();
3192 if ( syncOK ) 3193 if ( syncOK )
3193 mViewManager->refreshView(); 3194 mViewManager->refreshView();
3194 return syncOK; 3195 return syncOK;
3195 3196
3196} 3197}
3197void KABCore::removeSyncInfo( QString syncProfile) 3198void KABCore::removeSyncInfo( QString syncProfile)
3198{ 3199{
3199 qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1()); 3200 qDebug("AB:removeSyncInfo for profile %s ", syncProfile.latin1());
3200 mAddressBook->removeSyncInfo( syncProfile ); 3201 mAddressBook->removeSyncInfo( syncProfile );
3201 setModified(); 3202 setModified();
3202} 3203}
3203 3204
3204 3205
3205//this is a overwritten callbackmethods from the syncinterface 3206//this is a overwritten callbackmethods from the syncinterface
3206bool KABCore::syncExternal(KSyncManager* manager, QString resource) 3207bool KABCore::syncExternal(KSyncManager* manager, QString resource)
3207{ 3208{
3208 if ( resource == "phone" ) 3209 if ( resource == "phone" )
3209 return syncPhone(); 3210 return syncPhone();
3210 disableBR( true ); 3211 disableBR( true );
3211 if ( manager != syncManager ) 3212 if ( manager != syncManager )
3212 qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager "); 3213 qDebug("KABCore::syncExternal:: ERROR! :: manager != syncManager ");
3213 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 3214 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
3214 3215
3215 AddressBook abLocal( resource,"syncContact"); 3216 AddressBook abLocal( resource,"syncContact");
3216 bool syncOK = false; 3217 bool syncOK = false;
3217 message(i18n("Loading DTM address data..."), false); 3218 message(i18n("Loading DTM address data..."), false);
3218 if ( abLocal.load() ) { 3219 if ( abLocal.load() ) {
3219 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); 3220 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
3220 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3221 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3221 message(i18n("Sync preprocessing..."),false); 3222 message(i18n("Sync preprocessing..."),false);
3222 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false ); 3223 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, false );
3223 message(i18n("Synchronizing..."),false); 3224 message(i18n("Synchronizing..."),false);
3224 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 3225 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
3225 if ( syncOK ) { 3226 if ( syncOK ) {
3226 if ( syncManager->mWriteBackFile ) { 3227 if ( syncManager->mWriteBackFile ) {
3227 abLocal.removeSyncAddressees( false ); 3228 abLocal.removeSyncAddressees( false );
3228 message(i18n("Saving DTM address data..."),false); 3229 message(i18n("Saving DTM address data..."),false);
3229 abLocal.saveAB(); 3230 abLocal.saveAB();
3230 message(i18n("Sync postprocessing..."),false); 3231 message(i18n("Sync postprocessing..."),false);
3231 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); 3232 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
3232 } 3233 }
3233 } else 3234 } else
3234 message( i18n("Sync cancelled or failed.") ); 3235 message( i18n("Sync cancelled or failed.") );
3235 setModified(); 3236 setModified();
3236 } 3237 }
3237 abLocal.removeResources(); 3238 abLocal.removeResources();
3238 if ( syncOK ) { 3239 if ( syncOK ) {
3239 mViewManager->refreshView(); 3240 mViewManager->refreshView();
3240 message(i18n("DTM syncing finished.")); 3241 message(i18n("DTM syncing finished."));
3241 } 3242 }
3242 disableBR( false ); 3243 disableBR( false );
3243 return syncOK; 3244 return syncOK;
3244 3245
3245} 3246}
3246void KABCore::message( QString m, bool startTimer) 3247void KABCore::message( QString m, bool startTimer)
3247{ 3248{
3248 topLevelWidget()->setCaption( m ); 3249 topLevelWidget()->setCaption( m );
3249 qApp->processEvents(); 3250 qApp->processEvents();
3250 if ( startTimer ) 3251 if ( startTimer )
3251 mMessageTimer->start( 15000, true ); 3252 mMessageTimer->start( 15000, true );
3252 else 3253 else
3253 mMessageTimer->stop(); 3254 mMessageTimer->stop();
3254} 3255}
3255bool KABCore::syncPhone() 3256bool KABCore::syncPhone()
3256{ 3257{
3257 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 3258 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
3258 QString fileName = getPhoneFile(); 3259 QString fileName = getPhoneFile();
3259 if ( !PhoneAccess::readFromPhone( fileName) ) { 3260 if ( !PhoneAccess::readFromPhone( fileName) ) {
3260 message(i18n("Phone access failed!")); 3261 message(i18n("Phone access failed!"));
3261 return false; 3262 return false;
3262 } 3263 }
3263 AddressBook abLocal( fileName,"syncContact"); 3264 AddressBook abLocal( fileName,"syncContact");
3264 bool syncOK = false; 3265 bool syncOK = false;
3265 { 3266 {
3266 abLocal.importFromFile( fileName ); 3267 abLocal.importFromFile( fileName );
3267 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); 3268 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1());
3268 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 3269 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
3269 abLocal.preparePhoneSync( mCurrentSyncDevice, true ); 3270 abLocal.preparePhoneSync( mCurrentSyncDevice, true );
3270 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 3271 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
3271 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 3272 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
3272 if ( syncOK ) { 3273 if ( syncOK ) {
3273 if ( syncManager->mWriteBackFile ) { 3274 if ( syncManager->mWriteBackFile ) {
3274 abLocal.removeSyncAddressees( true ); 3275 abLocal.removeSyncAddressees( true );
3275 abLocal.saveABphone( fileName ); 3276 abLocal.saveABphone( fileName );
3276 abLocal.findNewExtIds( fileName, mCurrentSyncDevice ); 3277 abLocal.findNewExtIds( fileName, mCurrentSyncDevice );
3277 //abLocal.preparePhoneSync( mCurrentSyncDevice, false ); 3278 //abLocal.preparePhoneSync( mCurrentSyncDevice, false );
3278 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true ); 3279 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice, true );
3279 } 3280 }
3280 } 3281 }
3281 setModified(); 3282 setModified();
3282 } 3283 }
3283 abLocal.removeResources(); 3284 abLocal.removeResources();
3284 if ( syncOK ) 3285 if ( syncOK )
3285 mViewManager->refreshView(); 3286 mViewManager->refreshView();
3286 return syncOK; 3287 return syncOK;
3287} 3288}
3288void KABCore::getFile( bool success ) 3289void KABCore::getFile( bool success )
3289{ 3290{
3290 if ( ! success ) { 3291 if ( ! success ) {
3291 message( i18n("Error receiving file. Nothing changed!") ); 3292 message( i18n("Error receiving file. Nothing changed!") );
3292 return; 3293 return;
3293 } 3294 }
3294 int count = mAddressBook->importFromFile( sentSyncFile() , false, true ); 3295 int count = mAddressBook->importFromFile( sentSyncFile() , false, true );
3295 if ( count ) 3296 if ( count )
3296 setModified( true ); 3297 setModified( true );
3297 message( i18n("Pi-Sync successful!") ); 3298 message( i18n("Pi-Sync successful!") );
3298 mViewManager->refreshView(); 3299 mViewManager->refreshView();
3299} 3300}
3300void KABCore::syncFileRequest() 3301void KABCore::syncFileRequest()
3301{ 3302{
3302 if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) { 3303 if ( KABPrefs::instance()->mPassiveSyncWithDesktop ) {
3303 syncManager->slotSyncMenu( 999 ); 3304 syncManager->slotSyncMenu( 999 );
3304 } 3305 }
3305 mAddressBook->export2File( sentSyncFile() ); 3306 mAddressBook->export2File( sentSyncFile() );
3306} 3307}
3307QString KABCore::sentSyncFile() 3308QString KABCore::sentSyncFile()
3308{ 3309{
3309#ifdef DESKTOP_VERSION 3310#ifdef DESKTOP_VERSION
3310 return locateLocal( "tmp", "copysyncab.vcf" ); 3311 return locateLocal( "tmp", "copysyncab.vcf" );
3311#else 3312#else
3312 return QString( "/tmp/copysyncab.vcf" ); 3313 return QString( "/tmp/copysyncab.vcf" );
3313#endif 3314#endif
3314} 3315}
3315 3316
3316void KABCore::setCaptionBack() 3317void KABCore::setCaptionBack()
3317{ 3318{
3318 mMessageTimer->stop(); 3319 mMessageTimer->stop();
3319 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); 3320 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") );
3320} 3321}
diff --git a/kaddressbook/kaddressbook.pro b/kaddressbook/kaddressbook.pro
index fbbc026..e73de06 100644
--- a/kaddressbook/kaddressbook.pro
+++ b/kaddressbook/kaddressbook.pro
@@ -1,184 +1,177 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG = qt warn_on 2 CONFIG = qt warn_on
3 TARGET = kapi 3 TARGET = kapi
4DESTDIR= ../bin 4DESTDIR= ../bin
5 5
6include( ../variables.pri ) 6include( ../variables.pri )
7 7
8 8
9INCLUDEPATH += . ./details ./features ./xxport ../libkdepim ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../ interfaces 9INCLUDEPATH += . ./details ./features ./xxport ../libkdepim ../microkde ../microkde/kdecore ../microkde/kutils ../microkde/kio/kfile ../microkde/kio/kio ../microkde/kdeui ../microkde/kresources ../kabc ../ interfaces
10DEFINES += KAB_EMBEDDED KAB_NOSPLITTER DESKTOP_VERSION 10DEFINES += KAB_EMBEDDED KAB_NOSPLITTER DESKTOP_VERSION
11 11
12unix : { 12unix : {
13LIBS += ../bin/libmicrokdepim.so 13LIBS += ../bin/libmicrokdepim.so
14LIBS += ../bin/libmicrokde.so 14LIBS += ../bin/libmicrokde.so
15LIBS += ../bin/libmicrokabc.so 15LIBS += ../bin/libmicrokabc.so
16LIBS += ../bin/libmicrokcal.so 16LIBS += ../bin/libmicrokcal.so
17#LIBS += -lldap 17#LIBS += -lldap
18OBJECTS_DIR = obj/unix 18OBJECTS_DIR = obj/unix
19MOC_DIR = moc/unix 19MOC_DIR = moc/unix
20} 20}
21win32: { 21win32: {
22RC_FILE = winicons.rc 22RC_FILE = winicons.rc
23DEFINES += _WIN32_ 23DEFINES += _WIN32_
24LIBS += ../bin/microkdepim.lib 24LIBS += ../bin/microkdepim.lib
25LIBS += ../bin/microkcal.lib 25LIBS += ../bin/microkcal.lib
26LIBS += ../bin/microkde.lib 26LIBS += ../bin/microkde.lib
27LIBS += ../bin/microkabc.lib 27LIBS += ../bin/microkabc.lib
28QMAKE_LINK += /NODEFAULTLIB:LIBC 28QMAKE_LINK += /NODEFAULTLIB:LIBC
29OBJECTS_DIR = obj/win 29OBJECTS_DIR = obj/win
30MOC_DIR = moc/win 30MOC_DIR = moc/win
31#olimport section
32#blabla: {
33
31LIBS += mfc71u.lib 34LIBS += mfc71u.lib
35DEFINES += _OL_IMPORT_
36HEADERS = ../outport/msoutl9.h \
37 kaimportoldialog.h
38SOURCES = ../outport/msoutl9.cpp \
39 kaimportoldialog.cpp
40#}
41#olimport section end
32} 42}
33 43
34
35
36
37
38
39
40
41INTERFACES = \ 44INTERFACES = \
42# filteredit_base.ui \ 45# filteredit_base.ui \
43# kofilterview_base.ui \ 46# kofilterview_base.ui \
44 47
45HEADERS = \ 48HEADERS += \
46features/mergewidget.h \ 49features/mergewidget.h \
47features/distributionlistwidget.h \ 50features/distributionlistwidget.h \
48kcmconfigs/addresseewidget.h \ 51kcmconfigs/addresseewidget.h \
49kcmconfigs/extensionconfigdialog.h \ 52kcmconfigs/extensionconfigdialog.h \
50kcmconfigs/kcmkabconfig.h \ 53kcmconfigs/kcmkabconfig.h \
51kcmconfigs/kabconfigwidget.h \ 54kcmconfigs/kabconfigwidget.h \
52addresseeeditordialog.h \ 55addresseeeditordialog.h \
53addresseeeditorwidget.h \ 56addresseeeditorwidget.h \
54addresseditwidget.h \ 57addresseditwidget.h \
55addresseeconfig.h \ 58addresseeconfig.h \
56addresseeutil.h \ 59addresseeutil.h \
57emaileditwidget.h \ 60emaileditwidget.h \
58filtereditdialog.h \ 61filtereditdialog.h \
59kaddressbookmain.h \ 62kaddressbookmain.h \
60kabprefs.h \ 63kabprefs.h \
61kabcore.h \ 64kabcore.h \
62viewmanager.h \ 65viewmanager.h \
63extensionmanager.h \ 66extensionmanager.h \
64extensionwidget.h \ 67extensionwidget.h \
65kaddressbookview.h \ 68kaddressbookview.h \
66geowidget.h \ 69geowidget.h \
67imagewidget.h \ 70imagewidget.h \
68incsearchwidget.h \ 71incsearchwidget.h \
69jumpbuttonbar.h \ 72jumpbuttonbar.h \
70phoneeditwidget.h \ 73phoneeditwidget.h \
71secrecywidget.h \ 74secrecywidget.h \
72keywidget.h \ 75keywidget.h \
73nameeditdialog.h \ 76nameeditdialog.h \
74filter.h \ 77filter.h \
75addviewdialog.h \ 78addviewdialog.h \
76configurewidget.h \ 79configurewidget.h \
77viewconfigurewidget.h \ 80viewconfigurewidget.h \
78viewconfigurefieldspage.h \ 81viewconfigurefieldspage.h \
79viewconfigurefilterpage.h \ 82viewconfigurefilterpage.h \
80typecombo.h \ 83typecombo.h \
81undo.h \ 84undo.h \
82undocmds.h \ 85undocmds.h \
83xxportmanager.h \ 86xxportmanager.h \
84xxportobject.h \ 87xxportobject.h \
85xxportselectdialog.h \ 88xxportselectdialog.h \
86details/detailsviewcontainer.h \ 89details/detailsviewcontainer.h \
87details/look_basic.h \ 90details/look_basic.h \
88details/look_html.h \ 91details/look_html.h \
89views/kaddressbookiconview.h \ 92views/kaddressbookiconview.h \
90views/kaddressbooktableview.h \ 93views/kaddressbooktableview.h \
91views/kaddressbookcardview.h \ 94views/kaddressbookcardview.h \
92views/configuretableviewdialog.h \ 95views/configuretableviewdialog.h \
93views/configurecardviewdialog.h \ 96views/configurecardviewdialog.h \
94views/cardview.h \ 97views/cardview.h \
95views/colorlistbox.h \ 98views/colorlistbox.h \
96views/contactlistview.h \ 99views/contactlistview.h \
97xxport/vcard_xxport.h \ 100xxport/vcard_xxport.h \
98xxport/kde2_xxport.h \ 101xxport/kde2_xxport.h \
99xxport/csv_xxport.h \ 102xxport/csv_xxport.h \
100xxport/csvimportdialog.h \ 103xxport/csvimportdialog.h \
101xxport/opie_xxport.h \ 104xxport/opie_xxport.h \
102xxport/qtopia_xxport.h \ 105xxport/qtopia_xxport.h \
103xxport/sharpdtm_xxport.h \ 106xxport/sharpdtm_xxport.h \
104#details/look_details.h \ 107#details/look_details.h \
105#mainwindoiw.h \ 108#mainwindoiw.h \
106# alarmclient.h \ 109# alarmclient.h \
107# calendarview.h \ 110# calendarview.h \
108# customlistviewitem.h \ 111# customlistviewitem.h \
109# datenavigator.h 112# datenavigator.h
110 113
111SOURCES = \ 114SOURCES += \
112addresseeeditordialog.cpp \ 115addresseeeditordialog.cpp \
113addresseeeditorwidget.cpp \ 116addresseeeditorwidget.cpp \
114addresseditwidget.cpp \ 117addresseditwidget.cpp \
115addresseeconfig.cpp \ 118addresseeconfig.cpp \
116addresseeutil.cpp \ 119addresseeutil.cpp \
117extensionmanager.cpp \ 120extensionmanager.cpp \
118features/mergewidget.cpp \ 121features/mergewidget.cpp \
119features/distributionlistwidget.cpp \ 122features/distributionlistwidget.cpp \
120kcmconfigs/addresseewidget.cpp \ 123kcmconfigs/addresseewidget.cpp \
121kcmconfigs/extensionconfigdialog.cpp \ 124kcmconfigs/extensionconfigdialog.cpp \
122kcmconfigs/kcmkabconfig.cpp \ 125kcmconfigs/kcmkabconfig.cpp \
123kcmconfigs/kabconfigwidget.cpp \ 126kcmconfigs/kabconfigwidget.cpp \
124emaileditwidget.cpp \ 127emaileditwidget.cpp \
125filtereditdialog.cpp \ 128filtereditdialog.cpp \
126mainembedded.cpp \ 129mainembedded.cpp \
127kaddressbookmain.cpp \ 130kaddressbookmain.cpp \
128kabcore.cpp \ 131kabcore.cpp \
129kabprefs.cpp \ 132kabprefs.cpp \
130viewmanager.cpp \ 133viewmanager.cpp \
131kaddressbookview.cpp \ 134kaddressbookview.cpp \
132extensionwidget.cpp \ 135extensionwidget.cpp \
133geowidget.cpp \ 136geowidget.cpp \
134imagewidget.cpp \ 137imagewidget.cpp \
135incsearchwidget.cpp \ 138incsearchwidget.cpp \
136jumpbuttonbar.cpp \ 139jumpbuttonbar.cpp \
137phoneeditwidget.cpp \ 140phoneeditwidget.cpp \
138secrecywidget.cpp \ 141secrecywidget.cpp \
139keywidget.cpp \ 142keywidget.cpp \
140nameeditdialog.cpp \ 143nameeditdialog.cpp \
141filter.cpp \ 144filter.cpp \
142addviewdialog.cpp \ 145addviewdialog.cpp \
143configurewidget.cpp \ 146configurewidget.cpp \
144viewconfigurewidget.cpp \ 147viewconfigurewidget.cpp \
145viewconfigurefieldspage.cpp \ 148viewconfigurefieldspage.cpp \
146viewconfigurefilterpage.cpp \ 149viewconfigurefilterpage.cpp \
147undo.cpp \ 150undo.cpp \
148undocmds.cpp \ 151undocmds.cpp \
149xxportmanager.cpp \ 152xxportmanager.cpp \
150xxportobject.cpp \ 153xxportobject.cpp \
151xxportselectdialog.cpp \ 154xxportselectdialog.cpp \
152details/detailsviewcontainer.cpp \ 155details/detailsviewcontainer.cpp \
153details/look_basic.cpp \ 156details/look_basic.cpp \
154details/look_html.cpp \ 157details/look_html.cpp \
155views/kaddressbookiconview.cpp \ 158views/kaddressbookiconview.cpp \
156views/kaddressbooktableview.cpp \ 159views/kaddressbooktableview.cpp \
157views/kaddressbookcardview.cpp \ 160views/kaddressbookcardview.cpp \
158views/configuretableviewdialog.cpp \ 161views/configuretableviewdialog.cpp \
159views/configurecardviewdialog.cpp \ 162views/configurecardviewdialog.cpp \
160views/cardview.cpp \ 163views/cardview.cpp \
161views/contactlistview.cpp \ 164views/contactlistview.cpp \
162views/colorlistbox.cpp \ 165views/colorlistbox.cpp \
163xxport/vcard_xxport.cpp \ 166xxport/vcard_xxport.cpp \
164xxport/kde2_xxport.cpp \ 167xxport/kde2_xxport.cpp \
165xxport/csv_xxport.cpp \ 168xxport/csv_xxport.cpp \
166xxport/csvimportdialog.cpp \ 169xxport/csvimportdialog.cpp \
167xxport/opie_xxport.cpp \ 170xxport/opie_xxport.cpp \
168xxport/qtopia_xxport.cpp \ 171xxport/qtopia_xxport.cpp \
169xxport/sharpdtm_xxport.cpp \ 172xxport/sharpdtm_xxport.cpp \
170#details/look_details.cpp \ 173#details/look_details.cpp \
171#mainwindow.cpp \ 174#mainwindow.cpp \
172# calendarview.cpp \ 175# calendarview.cpp \
173# timespanview.cpp 176# timespanview.cpp
174 177
175
176
177win32: {
178HEADERS += ../outport/msoutl9.h \
179 kaimportoldialog.h
180
181SOURCES += ../outport/msoutl9.cpp \
182 kaimportoldialog.cpp
183}
184
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index 1e03dba..d9968f3 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -1,100 +1,102 @@
1#ifndef DESKTOP_VERSION 1#ifndef DESKTOP_VERSION
2#include <qpe/qpeapplication.h> 2#include <qpe/qpeapplication.h>
3#include <qcopchannel_qws.h> 3#include <qcopchannel_qws.h>
4#include <stdlib.h> 4#include <stdlib.h>
5#else 5#else
6#include <qapplication.h> 6#include <qapplication.h>
7#include <qwindowsstyle.h> 7#include <qwindowsstyle.h>
8#include <qplatinumstyle.h> 8#include <qplatinumstyle.h>
9#include <qmainwindow.h> 9#include <qmainwindow.h>
10#include <qmessagebox.h>
11#include <stdlib.h>
10#endif 12#endif
11 13
12#include <qtextcodec.h> 14#include <qtextcodec.h>
13#include <kstandarddirs.h> 15#include <kstandarddirs.h>
14#include <qregexp.h> 16#include <qregexp.h>
15#include <kglobal.h> 17#include <kglobal.h>
16#include <stdio.h> 18#include <stdio.h>
17#include <qdir.h> 19#include <qdir.h>
18#include "kabprefs.h" 20#include "kabprefs.h"
19#include "kaddressbookmain.h" 21#include "kaddressbookmain.h"
20#include "externalapphandler.h" 22#include "externalapphandler.h"
21#include <libkdepim/kpimglobalprefs.h> 23#include <libkdepim/kpimglobalprefs.h>
22void dumpMissing(); 24void dumpMissing();
23int main( int argc, char **argv ) 25int main( int argc, char **argv )
24{ 26{
25#ifndef DESKTOP_VERSION 27#ifndef DESKTOP_VERSION
26 QPEApplication a( argc, argv ); 28 QPEApplication a( argc, argv );
27 a.setKeepRunning (); 29 a.setKeepRunning ();
28#else 30#else
29 QApplication a( argc, argv ); 31 QApplication a( argc, argv );
30 QApplication::setStyle( new QPlatinumStyle ()); 32 QApplication::setStyle( new QPlatinumStyle ());
31 QString hdir = QDir::homeDirPath(); 33#ifdef _WIN32_
32 // there is a bug when creating dirs for WIN 98 34 QString hdir ( getenv( "HOME") );
33 // it is difficult to fix, because we have no WIN 98 runnung 35 if ( hdir.isEmpty() ) {
34 // such that we try it to create the dirs at startup here 36 QString hd ("C:/" );
35 if ( hdir == "C:\\" ) { // win 98 or ME 37 //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd );
36 QDir app_dir; 38 if ( QDir::homeDirPath().lower() == hd.lower() ) {
37 if ( !app_dir.exists("C:\\kdepim") ) 39 _putenv( "HOME=C:");
38 app_dir.mkdir ("C:\\kdepim"); 40 //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) );
39 if ( !app_dir.exists("C:\\kdepim\\apps") ) 41 }
40 app_dir.mkdir ("C:\\kdepim\\apps"); 42 } else {
41 if ( !app_dir.exists("C:\\kdepim\\config") ) 43 QDir app_dir;
42 app_dir.mkdir ("C:\\kdepim\\config"); 44 if ( !app_dir.exists(hdir) )
43 if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") ) 45 app_dir.mkdir (hdir);
44 app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook");
45 } 46 }
46#endif 47#endif
48#endif
47 49
48 bool exitHelp = false; 50 bool exitHelp = false;
49 if ( argc > 1 ) { 51 if ( argc > 1 ) {
50 QString command = argv[1]; 52 QString command = argv[1];
51 if ( command == "-help" ){ 53 if ( command == "-help" ){
52 printf("KA/E command line commands:\n"); 54 printf("KA/E command line commands:\n");
53 printf(" no command: Start KA/E in usual way\n"); 55 printf(" no command: Start KA/E in usual way\n");
54 printf(" -help: This output\n"); 56 printf(" -help: This output\n");
55 printf(" KA/E is exiting now. Bye!\n"); 57 printf(" KA/E is exiting now. Bye!\n");
56 exitHelp = true; 58 exitHelp = true;
57 } 59 }
58 } 60 }
59 if ( ! exitHelp ) { 61 if ( ! exitHelp ) {
60 62
61 KGlobal::setAppName( "kaddressbook" ); 63 KGlobal::setAppName( "kaddressbook" );
62#ifndef DESKTOP_VERSION 64#ifndef DESKTOP_VERSION
63 if ( QApplication::desktop()->width() > 320 ) 65 if ( QApplication::desktop()->width() > 320 )
64 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); 66 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/");
65 else 67 else
66 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); 68 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/");
67#else 69#else
68 QString fileName ; 70 QString fileName ;
69 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; 71 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/";
70 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 72 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
71 QApplication::addLibraryPath ( qApp->applicationDirPath () ); 73 QApplication::addLibraryPath ( qApp->applicationDirPath () );
72 74
73#endif 75#endif
74 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); 76 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook")));
75 // init language 77 // init language
76 KPimGlobalPrefs::instance()->setGlobalConfig(); 78 KPimGlobalPrefs::instance()->setGlobalConfig();
77 KAddressBookMain m ; 79 KAddressBookMain m ;
78//US MainWindow m; 80//US MainWindow m;
79#ifndef DESKTOP_VERSION 81#ifndef DESKTOP_VERSION
80 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 82 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
81#endif 83#endif
82 84
83 85
84#ifndef DESKTOP_VERSION 86#ifndef DESKTOP_VERSION
85 a.showMainWidget( &m ); 87 a.showMainWidget( &m );
86 88
87#else 89#else
88 a.setMainWidget( &m ); 90 a.setMainWidget( &m );
89 m.resize (640, 480 ); 91 m.resize (640, 480 );
90 m.show(); 92 m.show();
91#endif 93#endif
92 a.exec(); 94 a.exec();
93 95
94 dumpMissing(); 96 dumpMissing();
95 97
96 KPimGlobalPrefs::instance()->writeConfig(); 98 KPimGlobalPrefs::instance()->writeConfig();
97 } 99 }
98 qDebug("KA: Bye! "); 100 qDebug("KA: Bye! ");
99} 101}
100 102
diff --git a/kdepim-desktop.pro b/kdepim-desktop.pro
index b0d60b7..da3a966 100644
--- a/kdepim-desktop.pro
+++ b/kdepim-desktop.pro
@@ -1,8 +1,8 @@
1 1
2 2
3TEMPLATE = subdirs 3TEMPLATE = subdirs
4SUBDIRS = libical libkcal kabc libkdepim microkde korganizer kaddressbook kabc/plugins/file kabc/plugins/dir kabc/plugins/file kabc/plugins/qtopia gammu/emb/common gammu/emb/gammu 4SUBDIRS = libical libkcal kabc libkdepim microkde korganizer kaddressbook kabc/plugins/file kabc/plugins/dir kabc/plugins/qtopia gammu/emb/common gammu/emb/gammu
5unix:{ 5unix:{
6SUBDIRS += kmicromail/libetpan kmicromail/libmailwrapper kmicromail pwmanager/libcrypt/cipher pwmanager/libcrypt/error pwmanager/libcrypt/mpi pwmanager/libcrypt/zlib pwmanager/pwmanager 6SUBDIRS += kmicromail/libetpan kmicromail/libmailwrapper kmicromail pwmanager/libcrypt/cipher pwmanager/libcrypt/error pwmanager/libcrypt/mpi pwmanager/libcrypt/zlib pwmanager/pwmanager
7} 7}
8 8
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index 8aa24ee..ea73fd0 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -1,1659 +1,1661 @@
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 56
57#include <kurlrequester.h> 57#include <kurlrequester.h>
58#include <klineedit.h> 58#include <klineedit.h>
59 59
60#if defined(USE_SOLARIS) 60#if defined(USE_SOLARIS)
61#include <sys/param.h> 61#include <sys/param.h>
62 62
63#define ZONEINFODIR "/usr/share/lib/zoneinfo" 63#define ZONEINFODIR "/usr/share/lib/zoneinfo"
64#define INITFILE "/etc/default/init" 64#define INITFILE "/etc/default/init"
65#endif 65#endif
66 66
67#include "koprefs.h" 67#include "koprefs.h"
68 68
69#include "koprefsdialog.h" 69#include "koprefsdialog.h"
70#include "kpimglobalprefs.h" 70#include "kpimglobalprefs.h"
71 71
72 72
73KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : 73KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) :
74 KPrefsDialog(KOPrefs::instance(),parent,name,true) 74 KPrefsDialog(KOPrefs::instance(),parent,name,true)
75{ 75{
76 76
77 setCaption( i18n("Preferences - some settings need a restart (nr)")); 77 setCaption( i18n("Preferences - some settings need a restart (nr)"));
78 mCategoryDict.setAutoDelete(true); 78 mCategoryDict.setAutoDelete(true);
79 79
80 KGlobal::locale()->insertCatalogue("timezones"); 80 KGlobal::locale()->insertCatalogue("timezones");
81 81
82 setupGlobalTab(); 82 setupGlobalTab();
83 setupMainTab(); 83 setupMainTab();
84 // setupLocaleTab(); 84 // setupLocaleTab();
85 //setupTimeZoneTab(); 85 //setupTimeZoneTab();
86 setupTimeTab(); 86 setupTimeTab();
87 //setupLocaleDateTab(); 87 //setupLocaleDateTab();
88 setupFontsTab(); 88 setupFontsTab();
89 setupColorsTab(); 89 setupColorsTab();
90 setupViewsTab(); 90 setupViewsTab();
91 //setupSyncTab(); 91 //setupSyncTab();
92 //setupSyncAlgTab(); 92 //setupSyncAlgTab();
93 //setupPrinterTab(); 93 //setupPrinterTab();
94 //setupGroupSchedulingTab(); 94 //setupGroupSchedulingTab();
95 //setupGroupAutomationTab(); 95 //setupGroupAutomationTab();
96 96
97#ifndef DESKTOP_VERSION
97 if ( QApplication::desktop()->height() == 480 ) 98 if ( QApplication::desktop()->height() == 480 )
98 hideButtons(); 99 hideButtons();
100#endif
99} 101}
100 102
101 103
102KOPrefsDialog::~KOPrefsDialog() 104KOPrefsDialog::~KOPrefsDialog()
103{ 105{
104} 106}
105void KOPrefsDialog::setupGlobalTab() 107void KOPrefsDialog::setupGlobalTab()
106{ 108{
107 QFrame *topFrame = addPage(i18n("Global"),0,0); 109 QFrame *topFrame = addPage(i18n("Global"),0,0);
108 kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" ); 110 kdelibcfg = new KDEPIMConfigWidget( KPimGlobalPrefs::instance(), topFrame, "KCMKdeLibConfig" );
109 QVBoxLayout *topLayout = new QVBoxLayout(topFrame); 111 QVBoxLayout *topLayout = new QVBoxLayout(topFrame);
110 topLayout->addWidget( kdelibcfg ); 112 topLayout->addWidget( kdelibcfg );
111 113
112 114
113} 115}
114void KOPrefsDialog::setupLocaleDateTab() 116void KOPrefsDialog::setupLocaleDateTab()
115{ 117{
116#if 0 118#if 0
117QFrame *topFrame = addPage(i18n("Date Format"),0,0); 119QFrame *topFrame = addPage(i18n("Date Format"),0,0);
118 QGridLayout *topLayout = new QGridLayout(topFrame,3,2); 120 QGridLayout *topLayout = new QGridLayout(topFrame,3,2);
119 topLayout->setSpacing(spacingHint()); 121 topLayout->setSpacing(spacingHint());
120 topLayout->setMargin(marginHint()); 122 topLayout->setMargin(marginHint());
121 int iii = 0; 123 int iii = 0;
122 124
123 125
124 KPrefsDialogWidRadios *syncPrefsGroup = 126 KPrefsDialogWidRadios *syncPrefsGroup =
125 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame); 127 addWidRadios(i18n("Date Format:"),&(KOPrefs::instance()->mPreferredDate),topFrame);
126 QString format; 128 QString format;
127 if ( QApplication::desktop()->width() < 480 ) 129 if ( QApplication::desktop()->width() < 480 )
128 format = "(%d.%m.%Y)"; 130 format = "(%d.%m.%Y)";
129 else 131 else
130 format = "(%d.%m.%Y|%A %d %B %Y)"; 132 format = "(%d.%m.%Y|%A %d %B %Y)";
131 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format)); 133 syncPrefsGroup->addRadio(i18n("24.03.2004 "+format));
132 if ( QApplication::desktop()->width() < 480 ) 134 if ( QApplication::desktop()->width() < 480 )
133 format = "(%m.%d.%Y)"; 135 format = "(%m.%d.%Y)";
134 else 136 else
135 format = "(%m.%d.%Y|%A %B %d %Y)"; 137 format = "(%m.%d.%Y|%A %B %d %Y)";
136 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format)); 138 syncPrefsGroup->addRadio(i18n("03.24.2004 "+format));
137 if ( QApplication::desktop()->width() < 480 ) 139 if ( QApplication::desktop()->width() < 480 )
138 format = "(%Y-%m-%d)"; 140 format = "(%Y-%m-%d)";
139 else 141 else
140 format = "(%Y-%m-%d|%A %Y %B %d)"; 142 format = "(%Y-%m-%d|%A %Y %B %d)";
141 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format)); 143 syncPrefsGroup->addRadio(i18n("2004-03-24 "+format));
142 syncPrefsGroup->addRadio(i18n("User defined")); 144 syncPrefsGroup->addRadio(i18n("User defined"));
143 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 145 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
144 ++iii; 146 ++iii;
145 ++iii; 147 ++iii;
146 QLabel * lab; 148 QLabel * lab;
147 mUserDateFormatLong = new QLineEdit(topFrame); 149 mUserDateFormatLong = new QLineEdit(topFrame);
148 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame); 150 lab = new QLabel(mUserDateFormatLong, i18n("User long date:"), topFrame);
149 topLayout->addWidget(lab ,iii,0); 151 topLayout->addWidget(lab ,iii,0);
150 topLayout->addWidget(mUserDateFormatLong,iii,1); 152 topLayout->addWidget(mUserDateFormatLong,iii,1);
151 ++iii; 153 ++iii;
152 mUserDateFormatShort = new QLineEdit(topFrame); 154 mUserDateFormatShort = new QLineEdit(topFrame);
153 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame); 155 lab = new QLabel(mUserDateFormatShort, i18n("User short date:"), topFrame);
154 topLayout->addWidget(lab ,iii,0); 156 topLayout->addWidget(lab ,iii,0);
155 topLayout->addWidget(mUserDateFormatShort,iii,1); 157 topLayout->addWidget(mUserDateFormatShort,iii,1);
156 ++iii; 158 ++iii;
157 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);
158 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 160 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
159 ++iii; 161 ++iii;
160 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);
161 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 163 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
162 ++iii; 164 ++iii;
163 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);
164 topLayout->addMultiCellWidget(lab ,iii,iii,0,1); 166 topLayout->addMultiCellWidget(lab ,iii,iii,0,1);
165 ++iii; 167 ++iii;
166#endif 168#endif
167 169
168} 170}
169 171
170void KOPrefsDialog::setupLocaleTab() 172void KOPrefsDialog::setupLocaleTab()
171{ 173{
172#if 0 174#if 0
173 QFrame *topFrame = addPage(i18n("Locale"),0,0); 175 QFrame *topFrame = addPage(i18n("Locale"),0,0);
174 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 176 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
175 topLayout->setSpacing(spacingHint()); 177 topLayout->setSpacing(spacingHint());
176 topLayout->setMargin(marginHint()); 178 topLayout->setMargin(marginHint());
177 int iii = 0; 179 int iii = 0;
178 KPrefsDialogWidRadios *syncPrefsGroup = 180 KPrefsDialogWidRadios *syncPrefsGroup =
179 addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame); 181 addWidRadios(i18n("Language:(needs restart)"),&(KOPrefs::instance()->mPreferredLanguage),topFrame);
180 syncPrefsGroup->addRadio(i18n("English")); 182 syncPrefsGroup->addRadio(i18n("English"));
181 syncPrefsGroup->addRadio(i18n("German")); 183 syncPrefsGroup->addRadio(i18n("German"));
182 syncPrefsGroup->addRadio(i18n("French")); 184 syncPrefsGroup->addRadio(i18n("French"));
183 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)")); 185 syncPrefsGroup->addRadio(i18n("User defined (usertranslation.txt)"));
184 if ( QApplication::desktop()->width() < 300 ) 186 if ( QApplication::desktop()->width() < 300 )
185 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 187 ;// syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
186 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 188 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
187 ++iii; 189 ++iii;
188 190
189 syncPrefsGroup = 191 syncPrefsGroup =
190 addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame); 192 addWidRadios(i18n("Time Format(nr):"),&(KOPrefs::instance()->mPreferredTime),topFrame);
191 if ( QApplication::desktop()->width() > 300 ) 193 if ( QApplication::desktop()->width() > 300 )
192 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 194 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
193 syncPrefsGroup->addRadio(i18n("24:00")); 195 syncPrefsGroup->addRadio(i18n("24:00"));
194 syncPrefsGroup->addRadio(i18n("12:00am")); 196 syncPrefsGroup->addRadio(i18n("12:00am"));
195 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical); 197 syncPrefsGroup->groupBox()-> setOrientation (Qt::Vertical);
196 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 198 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
197 ++iii; 199 ++iii;
198 KPrefsDialogWidBool *sb; 200 KPrefsDialogWidBool *sb;
199 if ( QApplication::desktop()->width() < 300 ) { 201 if ( QApplication::desktop()->width() < 300 ) {
200 sb = 202 sb =
201 addWidBool(i18n("Week starts on Sunday"), 203 addWidBool(i18n("Week starts on Sunday"),
202 &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame); 204 &(KOPrefs::instance()->mWeekStartsOnSunday),topFrame);
203 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 205 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
204 ++iii; 206 ++iii;
205 sb = 207 sb =
206 addWidBool(i18n("Use short date in (WN/E) view"), 208 addWidBool(i18n("Use short date in (WN/E) view"),
207 &(KOPrefs::instance()->mShortDateInViewer),topFrame); 209 &(KOPrefs::instance()->mShortDateInViewer),topFrame);
208 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 210 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
209 } 211 }
210 else { 212 else {
211 QWidget * hb = new QWidget( topFrame ); 213 QWidget * hb = new QWidget( topFrame );
212 QHBoxLayout *hbLayout = new QHBoxLayout(hb); 214 QHBoxLayout *hbLayout = new QHBoxLayout(hb);
213 sb = 215 sb =
214 addWidBool(i18n("Week starts on Sunday"), 216 addWidBool(i18n("Week starts on Sunday"),
215 &(KOPrefs::instance()->mWeekStartsOnSunday),hb); 217 &(KOPrefs::instance()->mWeekStartsOnSunday),hb);
216 hbLayout->addWidget(sb->checkBox() ); 218 hbLayout->addWidget(sb->checkBox() );
217 sb = 219 sb =
218 addWidBool(i18n("Use short date in (WN/E) view"), 220 addWidBool(i18n("Use short date in (WN/E) view"),
219 &(KOPrefs::instance()->mShortDateInViewer),hb); 221 &(KOPrefs::instance()->mShortDateInViewer),hb);
220 hbLayout->addWidget(sb->checkBox() ); 222 hbLayout->addWidget(sb->checkBox() );
221 topLayout->addMultiCellWidget(hb, iii,iii,0,1); 223 topLayout->addMultiCellWidget(hb, iii,iii,0,1);
222 224
223 } 225 }
224 // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION 226 // KPrefsDialogWidBool *sb; //#ifndef DESKTOP_VERSION
225#if 0 227#if 0
226 ++iii; 228 ++iii;
227 sb = 229 sb =
228 addWidBool(i18n("Quick load/save (w/o Unicode)"), 230 addWidBool(i18n("Quick load/save (w/o Unicode)"),
229 &(KOPrefs::instance()->mUseQuicksave),topFrame); 231 &(KOPrefs::instance()->mUseQuicksave),topFrame);
230 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 232 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
231#endif 233#endif
232#endif 234#endif
233} 235}
234void KOPrefsDialog::showSyncPage() 236void KOPrefsDialog::showSyncPage()
235{ 237{
236 showPage ( 0 ) ; 238 showPage ( 0 ) ;
237 kdelibcfg->showTimeZoneTab() ; 239 kdelibcfg->showTimeZoneTab() ;
238 240
239} 241}
240void KOPrefsDialog::setupSyncAlgTab() 242void KOPrefsDialog::setupSyncAlgTab()
241{ 243{
242#if 0 244#if 0
243 QLabel * lab; 245 QLabel * lab;
244 QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0); 246 QFrame *topFrame = addPage(i18n("Sync Prefs"),0,0);
245 mSetupSyncAlgTab = topFrame; 247 mSetupSyncAlgTab = topFrame;
246 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 248 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
247 topLayout->setSpacing(spacingHint()); 249 topLayout->setSpacing(spacingHint());
248 topLayout->setMargin(marginHint()); 250 topLayout->setMargin(marginHint());
249 int iii = 0; 251 int iii = 0;
250 252
251 KPrefsDialogWidBool *sb = 253 KPrefsDialogWidBool *sb =
252 addWidBool(i18n("Ask for preferences before syncing"), 254 addWidBool(i18n("Ask for preferences before syncing"),
253 &(KOPrefs::instance()->mAskForPreferences),topFrame); 255 &(KOPrefs::instance()->mAskForPreferences),topFrame);
254 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 256 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
255 257
256 ++iii; 258 ++iii;
257 259
258 KPrefsDialogWidRadios *syncPrefsGroup = 260 KPrefsDialogWidRadios *syncPrefsGroup =
259 addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs), 261 addWidRadios(i18n("Sync preferences:"),&(KOPrefs::instance()->mSyncAlgoPrefs),
260 topFrame); 262 topFrame);
261 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 263 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
262 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 264 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
263 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 265 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
264 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 266 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
265 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 267 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
266 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 268 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
267 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1); 269 topLayout->addMultiCellWidget( syncPrefsGroup->groupBox(),iii,iii,0,1);
268 ++iii; 270 ++iii;
269 sb = 271 sb =
270 addWidBool(i18n("Show summary after syncing"), 272 addWidBool(i18n("Show summary after syncing"),
271 &(KOPrefs::instance()->mShowSyncSummary),topFrame); 273 &(KOPrefs::instance()->mShowSyncSummary),topFrame);
272 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 274 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
273 275
274 ++iii; 276 ++iii;
275#endif 277#endif
276 278
277 279
278 280
279} 281}
280 282
281 283
282void KOPrefsDialog::setupSyncTab() 284void KOPrefsDialog::setupSyncTab()
283{ 285{
284#if 0 286#if 0
285 QLabel * lab; 287 QLabel * lab;
286 QFrame *topFrame = addPage(i18n("Sync Network"),0,0); 288 QFrame *topFrame = addPage(i18n("Sync Network"),0,0);
287 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 289 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
288 topLayout->setSpacing(spacingHint()); 290 topLayout->setSpacing(spacingHint());
289 topLayout->setMargin(marginHint()); 291 topLayout->setMargin(marginHint());
290 lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame); 292 lab = new QLabel(i18n("Remote syncing (via ssh/scp)\nnetwork settings "), topFrame);
291 int iii = 0; 293 int iii = 0;
292 topLayout->addMultiCellWidget(lab , iii,iii,0,1); 294 topLayout->addMultiCellWidget(lab , iii,iii,0,1);
293 ++iii; 295 ++iii;
294 296
295 mRemoteIPEdit = new QLineEdit(topFrame); 297 mRemoteIPEdit = new QLineEdit(topFrame);
296 lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame); 298 lab = new QLabel(mRemoteIPEdit, i18n("Remote IP:"), topFrame);
297 topLayout->addWidget(lab ,iii,0); 299 topLayout->addWidget(lab ,iii,0);
298 topLayout->addWidget(mRemoteIPEdit,iii,1); 300 topLayout->addWidget(mRemoteIPEdit,iii,1);
299 ++iii; 301 ++iii;
300 mRemoteUser = new QLineEdit(topFrame); 302 mRemoteUser = new QLineEdit(topFrame);
301 lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame); 303 lab = new QLabel(mRemoteUser, i18n("Remote user:"), topFrame);
302 topLayout->addWidget(lab ,iii,0); 304 topLayout->addWidget(lab ,iii,0);
303 topLayout->addWidget(mRemoteUser, iii,1); 305 topLayout->addWidget(mRemoteUser, iii,1);
304 ++iii; 306 ++iii;
305 307
306 mRemoteFile = new QLineEdit(topFrame); 308 mRemoteFile = new QLineEdit(topFrame);
307 lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame); 309 lab = new QLabel(mRemoteFile, i18n("Remote file:"), topFrame);
308 topLayout->addWidget(lab ,iii,0); 310 topLayout->addWidget(lab ,iii,0);
309 topLayout->addWidget(mRemoteFile,iii,1); 311 topLayout->addWidget(mRemoteFile,iii,1);
310 ++iii; 312 ++iii;
311 313
312 mLocalTempFile = new QLineEdit(topFrame); 314 mLocalTempFile = new QLineEdit(topFrame);
313 lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame); 315 lab = new QLabel(mLocalTempFile, i18n("Local temp file:"), topFrame);
314 topLayout->addWidget(lab ,iii,0); 316 topLayout->addWidget(lab ,iii,0);
315 topLayout->addWidget(mLocalTempFile,iii,1); 317 topLayout->addWidget(mLocalTempFile,iii,1);
316 ++iii; 318 ++iii;
317 319
318 KPrefsDialogWidBool *wb = 320 KPrefsDialogWidBool *wb =
319 addWidBool(i18n("Write back synced file"), 321 addWidBool(i18n("Write back synced file"),
320 &(KOPrefs::instance()->mWriteBackFile),topFrame); 322 &(KOPrefs::instance()->mWriteBackFile),topFrame);
321 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); 323 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1);
322 ++iii; 324 ++iii;
323 wb = 325 wb =
324 addWidBool(i18n("Write back existing entries only"), 326 addWidBool(i18n("Write back existing entries only"),
325 &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame); 327 &(KOPrefs::instance()->mWriteBackExistingOnly),topFrame);
326 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1); 328 topLayout->addMultiCellWidget(wb->checkBox(), iii,iii,0,1);
327 ++iii; 329 ++iii;
328 330
329#endif 331#endif
330} 332}
331 333
332void KOPrefsDialog::setupMainTab() 334void KOPrefsDialog::setupMainTab()
333{ 335{
334 QFrame *topFrame = addPage(i18n("General"),0,0); 336 QFrame *topFrame = addPage(i18n("General"),0,0);
335 // DesktopIcon("identity",KIcon::SizeMedium)); 337 // DesktopIcon("identity",KIcon::SizeMedium));
336 338
337 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 339 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
338 topLayout->setSpacing(spacingHint()); 340 topLayout->setSpacing(spacingHint());
339 topLayout->setMargin(marginHint()); 341 topLayout->setMargin(marginHint());
340 342
341 // KPrefsDialogWidBool *emailControlCenter = 343 // KPrefsDialogWidBool *emailControlCenter =
342// addWidBool(i18n("&Use email settings from Control Center"), 344// addWidBool(i18n("&Use email settings from Control Center"),
343// &(KOPrefs::instance()->mEmailControlCenter),topFrame); 345// &(KOPrefs::instance()->mEmailControlCenter),topFrame);
344// topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1); 346// topLayout->addMultiCellWidget(emailControlCenter->checkBox(),0,0,0,1);
345 // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)), 347 // connect(emailControlCenter->checkBox(),SIGNAL(toggled(bool)),
346 // SLOT(toggleEmailSettings(bool))); 348 // SLOT(toggleEmailSettings(bool)));
347 349
348 mNameEdit = new QLineEdit(topFrame); 350 mNameEdit = new QLineEdit(topFrame);
349 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame); 351 mNameLabel = new QLabel(mNameEdit, i18n("Full &name:"), topFrame);
350 topLayout->addWidget(mNameLabel,0,0); 352 topLayout->addWidget(mNameLabel,0,0);
351 topLayout->addWidget(mNameEdit,0,1); 353 topLayout->addWidget(mNameEdit,0,1);
352 354
353 mEmailEdit = new QLineEdit(topFrame); 355 mEmailEdit = new QLineEdit(topFrame);
354 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame); 356 mEmailLabel = new QLabel(mEmailEdit, i18n("E&mail address:"),topFrame);
355 topLayout->addWidget(mEmailLabel,1,0); 357 topLayout->addWidget(mEmailLabel,1,0);
356 topLayout->addWidget(mEmailEdit,1,1); 358 topLayout->addWidget(mEmailEdit,1,1);
357 KPrefsDialogWidBool *wb; 359 KPrefsDialogWidBool *wb;
358 QHBox *dummy; 360 QHBox *dummy;
359 if ( QApplication::desktop()->width() > 480 ) { 361 if ( QApplication::desktop()->width() > 480 ) {
360 dummy = new QHBox(topFrame); 362 dummy = new QHBox(topFrame);
361 } else { 363 } else {
362 dummy = new QVBox(topFrame); 364 dummy = new QVBox(topFrame);
363 } 365 }
364 366
365 topLayout->addMultiCellWidget(dummy, 2,2,0,1); 367 topLayout->addMultiCellWidget(dummy, 2,2,0,1);
366 addWidBool(i18n("Full menu bar(nr)"), 368 addWidBool(i18n("Full menu bar(nr)"),
367 &(KOPrefs::instance()->mShowFullMenu),dummy); 369 &(KOPrefs::instance()->mShowFullMenu),dummy);
368 370
369 371
370 addWidBool(i18n("Mini icons in toolbar(nr)"), 372 addWidBool(i18n("Mini icons in toolbar(nr)"),
371 &(KOPrefs::instance()->mToolBarMiniIcons),dummy); 373 &(KOPrefs::instance()->mToolBarMiniIcons),dummy);
372 374
373 375
374 dummy = new QHBox(topFrame); 376 dummy = new QHBox(topFrame);
375 new QLabel(i18n("Days in What's Next:"),dummy); 377 new QLabel(i18n("Days in What's Next:"),dummy);
376 mWhatsNextSpin = new QSpinBox(1,14,1,dummy); 378 mWhatsNextSpin = new QSpinBox(1,14,1,dummy);
377 379
378 topLayout->addMultiCellWidget(dummy,3,3,0,1); 380 topLayout->addMultiCellWidget(dummy,3,3,0,1);
379 381
380 382
381 383
382 dummy = new QHBox(topFrame); 384 dummy = new QHBox(topFrame);
383 new QLabel(i18n("Days in Next-X-Days:"),dummy); 385 new QLabel(i18n("Days in Next-X-Days:"),dummy);
384 mNextXDaysSpin = new QSpinBox(2,14,1,dummy); 386 mNextXDaysSpin = new QSpinBox(2,14,1,dummy);
385 387
386 topLayout->addMultiCellWidget(dummy,4,4,0,1); 388 topLayout->addMultiCellWidget(dummy,4,4,0,1);
387 389
388 QHBox *prioBox = new QHBox(topFrame); 390 QHBox *prioBox = new QHBox(topFrame);
389 // intervalBox->setSpacing(spacingHint()); 391 // intervalBox->setSpacing(spacingHint());
390 topLayout->addMultiCellWidget(prioBox,5,5,0,1); 392 topLayout->addMultiCellWidget(prioBox,5,5,0,1);
391 QString messa = i18n("Show topmost todo prios in What's Next:"); 393 QString messa = i18n("Show topmost todo prios in What's Next:");
392 394
393 if ( QApplication::desktop()->width() < 300 ) 395 if ( QApplication::desktop()->width() < 300 )
394 messa = i18n("Show topmost todo prios in What's N.:"); 396 messa = i18n("Show topmost todo prios in What's N.:");
395 QLabel *prioLabel = new QLabel(messa, prioBox); 397 QLabel *prioLabel = new QLabel(messa, prioBox);
396 mPrioSpin = new QSpinBox(0,5,1,prioBox); 398 mPrioSpin = new QSpinBox(0,5,1,prioBox);
397 if ( QApplication::desktop()->width() < 300 ) 399 if ( QApplication::desktop()->width() < 300 )
398 mPrioSpin->setFixedWidth( 40 ); 400 mPrioSpin->setFixedWidth( 40 );
399 401
400 // KPrefsDialogWidBool *bcc = 402 // KPrefsDialogWidBool *bcc =
401// addWidBool(i18n("Send copy to owner when mailing events"), 403// addWidBool(i18n("Send copy to owner when mailing events"),
402// &(KOPrefs::instance()->mBcc),topFrame); 404// &(KOPrefs::instance()->mBcc),topFrame);
403// topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1); 405// topLayout->addMultiCellWidget(bcc->checkBox(),4,4,0,1);
404 406
405 407
406 // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame); 408 // QGroupBox *autoSaveGroup = new QGroupBox(1,Horizontal,i18n("Auto-Save"), topFrame);
407 //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1); 409 //topLayout->addMultiCellWidget(autoSaveGroup,6,6,0,1);
408 410
409 // addWidBool(i18n("Enable automatic saving of calendar"), 411 // addWidBool(i18n("Enable automatic saving of calendar"),
410 // &(KOPrefs::instance()->mAutoSave),autoSaveGroup); 412 // &(KOPrefs::instance()->mAutoSave),autoSaveGroup);
411 413
412 QHBox *intervalBox = new QHBox(topFrame); 414 QHBox *intervalBox = new QHBox(topFrame);
413 // intervalBox->setSpacing(spacingHint()); 415 // intervalBox->setSpacing(spacingHint());
414 topLayout->addMultiCellWidget(intervalBox,6,6,0,1); 416 topLayout->addMultiCellWidget(intervalBox,6,6,0,1);
415 QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox); 417 QLabel *autoSaveIntervalLabel = new QLabel(i18n("Auto save delay in minutes:"),intervalBox);
416 mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox); 418 mAutoSaveIntervalSpin = new QSpinBox(0,500,1,intervalBox);
417 autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin); 419 autoSaveIntervalLabel->setBuddy(mAutoSaveIntervalSpin);
418 /* 420 /*
419 QHBox * agendasize = new QHBox ( topFrame ); 421 QHBox * agendasize = new QHBox ( topFrame );
420 422
421 new QLabel (i18n("AllDayAgenda Height:"), agendasize ); 423 new QLabel (i18n("AllDayAgenda Height:"), agendasize );
422 424
423 425
424 mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize); 426 mHourSizeSlider = new QSlider(24,47,1,24,Horizontal,agendasize);
425 topLayout->addMultiCellWidget(agendasize,7,7,0,1); 427 topLayout->addMultiCellWidget(agendasize,7,7,0,1);
426 */ 428 */
427 KPrefsDialogWidBool *verticalScreen = 429 KPrefsDialogWidBool *verticalScreen =
428 addWidBool(i18n("Show vertical screen (Needs restart)"), 430 addWidBool(i18n("Show vertical screen (Needs restart)"),
429 &(KOPrefs::instance()->mVerticalScreen),topFrame); 431 &(KOPrefs::instance()->mVerticalScreen),topFrame);
430 //topLayout->addWidget(verticalScreen->checkBox(),ii++,0); 432 //topLayout->addWidget(verticalScreen->checkBox(),ii++,0);
431 topLayout->addMultiCellWidget(verticalScreen->checkBox(),7,7,0,1); 433 topLayout->addMultiCellWidget(verticalScreen->checkBox(),7,7,0,1);
432 434
433 KPrefsDialogWidBool *ask = 435 KPrefsDialogWidBool *ask =
434 addWidBool(i18n("Ask for quit when closing KO/Pi"), 436 addWidBool(i18n("Ask for quit when closing KO/Pi"),
435 &(KOPrefs::instance()->mAskForQuit),topFrame); 437 &(KOPrefs::instance()->mAskForQuit),topFrame);
436 topLayout->addMultiCellWidget(ask->checkBox(),8,8,0,1); 438 topLayout->addMultiCellWidget(ask->checkBox(),8,8,0,1);
437 439
438 440
439 /* 441 /*
440 KPrefsDialogWidBool *confirmCheck = 442 KPrefsDialogWidBool *confirmCheck =
441 addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm), 443 addWidBool(i18n("Confirm &deletes"),&(KOPrefs::instance()->mConfirm),
442 topFrame); 444 topFrame);
443 topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1); 445 topLayout->addMultiCellWidget(confirmCheck->checkBox(),7,7,0,1);
444 446
445 447
446 mEnableGroupScheduling = 448 mEnableGroupScheduling =
447 addWidBool(i18n("Enable group scheduling"), 449 addWidBool(i18n("Enable group scheduling"),
448 &(KOPrefs::instance()->mEnableGroupScheduling),topFrame); 450 &(KOPrefs::instance()->mEnableGroupScheduling),topFrame);
449 topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0); 451 topLayout->addWidget(mEnableGroupScheduling->checkBox(),8,0);
450 connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()), 452 connect(mEnableGroupScheduling->checkBox(),SIGNAL(clicked()),
451 SLOT(warningGroupScheduling())); 453 SLOT(warningGroupScheduling()));
452 454
453 mEnableProjectView = 455 mEnableProjectView =
454 addWidBool(i18n("Enable project view"), 456 addWidBool(i18n("Enable project view"),
455 &(KOPrefs::instance()->mEnableProjectView),topFrame); 457 &(KOPrefs::instance()->mEnableProjectView),topFrame);
456 topLayout->addWidget(mEnableProjectView->checkBox(),9,0); 458 topLayout->addWidget(mEnableProjectView->checkBox(),9,0);
457 connect(mEnableProjectView->checkBox(),SIGNAL(clicked()), 459 connect(mEnableProjectView->checkBox(),SIGNAL(clicked()),
458 SLOT(warningProjectView())); 460 SLOT(warningProjectView()));
459 461
460 // Can't be disabled anymore 462 // Can't be disabled anymore
461 mEnableGroupScheduling->checkBox()->hide(); 463 mEnableGroupScheduling->checkBox()->hide();
462 464
463 // Disable setting, because this feature now becomes stable 465 // Disable setting, because this feature now becomes stable
464 mEnableProjectView->checkBox()->hide(); 466 mEnableProjectView->checkBox()->hide();
465 467
466 KPrefsDialogWidRadios *defaultFormatGroup = 468 KPrefsDialogWidRadios *defaultFormatGroup =
467 addWidRadios(i18n("Default Calendar Format"), 469 addWidRadios(i18n("Default Calendar Format"),
468 &(KOPrefs::instance()->mDefaultFormat),topFrame); 470 &(KOPrefs::instance()->mDefaultFormat),topFrame);
469 defaultFormatGroup->addRadio(i18n("vCalendar")); 471 defaultFormatGroup->addRadio(i18n("vCalendar"));
470 defaultFormatGroup->addRadio(i18n("iCalendar")); 472 defaultFormatGroup->addRadio(i18n("iCalendar"));
471 473
472 topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1); 474 topLayout->addMultiCellWidget(defaultFormatGroup->groupBox(),10,10,0,1);
473 475
474 // Default format unconditionally is iCalendar 476 // Default format unconditionally is iCalendar
475 defaultFormatGroup->groupBox()->hide(); 477 defaultFormatGroup->groupBox()->hide();
476 478
477 KPrefsDialogWidRadios *mailClientGroup = 479 KPrefsDialogWidRadios *mailClientGroup =
478 addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient), 480 addWidRadios(i18n("Mail Client"),&(KOPrefs::instance()->mMailClient),
479 topFrame); 481 topFrame);
480 mailClientGroup->addRadio(i18n("KMail")); 482 mailClientGroup->addRadio(i18n("KMail"));
481 mailClientGroup->addRadio(i18n("Sendmail")); 483 mailClientGroup->addRadio(i18n("Sendmail"));
482 topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1); 484 topLayout->addMultiCellWidget(mailClientGroup->groupBox(),11,11,0,1);
483 485
484 KPrefsDialogWidBool *htmlsave = 486 KPrefsDialogWidBool *htmlsave =
485 addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave), 487 addWidBool(i18n("Export to HTML with every save"),&(KOPrefs::instance()->mHtmlWithSave),
486 topFrame); 488 topFrame);
487 topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1); 489 topLayout->addMultiCellWidget(htmlsave->checkBox(),12,12,0,1);
488 490
489 KPrefsDialogWidRadios *destinationGroup = 491 KPrefsDialogWidRadios *destinationGroup =
490 addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination), 492 addWidRadios(i18n("New Events/Todos should"),&(KOPrefs::instance()->mDestination),
491 topFrame); 493 topFrame);
492 destinationGroup->addRadio(i18n("be added to the standard resource")); 494 destinationGroup->addRadio(i18n("be added to the standard resource"));
493 destinationGroup->addRadio(i18n("be asked which resource to use")); 495 destinationGroup->addRadio(i18n("be asked which resource to use"));
494 topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1); 496 topLayout->addMultiCellWidget(destinationGroup->groupBox(),13,13,0,1);
495 497
496 topLayout->setRowStretch(14,1); 498 topLayout->setRowStretch(14,1);
497 */ 499 */
498} 500}
499 501
500 502
501void KOPrefsDialog::setupTimeTab() 503void KOPrefsDialog::setupTimeTab()
502{ 504{
503 QFrame *topFrame = addPage(i18n("Time"),0,0); 505 QFrame *topFrame = addPage(i18n("Time"),0,0);
504 // DesktopIcon("clock",KIcon::SizeMedium)); 506 // DesktopIcon("clock",KIcon::SizeMedium));
505 507
506 QGridLayout *topLayout = new QGridLayout(topFrame,4,2); 508 QGridLayout *topLayout = new QGridLayout(topFrame,4,2);
507 topLayout->setSpacing(spacingHint()); 509 topLayout->setSpacing(spacingHint());
508 topLayout->setMargin(marginHint()); 510 topLayout->setMargin(marginHint());
509 511
510 QHBox *dummy = new QHBox(topFrame); 512 QHBox *dummy = new QHBox(topFrame);
511 KPrefsDialogWidTime *dayBegins = 513 KPrefsDialogWidTime *dayBegins =
512 addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), 514 addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
513 dummy); 515 dummy);
514 //topLayout->addWidget(dayBegins->label(),2,0); 516 //topLayout->addWidget(dayBegins->label(),2,0);
515 517
516 //topLayout->addWidget(dayBegins->spinBox(),2,1); 518 //topLayout->addWidget(dayBegins->spinBox(),2,1);
517 topLayout->addMultiCellWidget(dummy,0,0,0,1); 519 topLayout->addMultiCellWidget(dummy,0,0,0,1);
518 520
519 topLayout->addWidget(new QLabel(i18n("Default appointment time:"), 521 topLayout->addWidget(new QLabel(i18n("Default appointment time:"),
520 topFrame),1,0); 522 topFrame),1,0);
521 mStartTimeSpin = new QSpinBox(0,23,1,topFrame); 523 mStartTimeSpin = new QSpinBox(0,23,1,topFrame);
522 mStartTimeSpin->setSuffix(":00"); 524 mStartTimeSpin->setSuffix(":00");
523 topLayout->addWidget(mStartTimeSpin,1,1); 525 topLayout->addWidget(mStartTimeSpin,1,1);
524 526
525 topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"), 527 topLayout->addWidget(new QLabel(i18n("Def. duration of new app.:"),
526 topFrame),2,0); 528 topFrame),2,0);
527 mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame); 529 mDefaultDurationSpin = new QSpinBox(0,23,1,topFrame);
528 mDefaultDurationSpin->setSuffix(":00"); 530 mDefaultDurationSpin->setSuffix(":00");
529 topLayout->addWidget(mDefaultDurationSpin,2,1); 531 topLayout->addWidget(mDefaultDurationSpin,2,1);
530 532
531 QStringList alarmList; 533 QStringList alarmList;
532 alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes") 534 alarmList << i18n("1 minute") << i18n("5 minutes") << i18n("10 minutes")
533 << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ; 535 << i18n("15 minutes") << i18n("30 minutes")<< i18n("1 hour")<< i18n("3 hours") << i18n("24 hours") ;
534 topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame), 536 topLayout->addWidget(new QLabel(i18n("Default alarm time:"),topFrame),
535 3,0); 537 3,0);
536 mAlarmTimeCombo = new QComboBox(topFrame); 538 mAlarmTimeCombo = new QComboBox(topFrame);
537 mAlarmTimeCombo->insertStringList(alarmList); 539 mAlarmTimeCombo->insertStringList(alarmList);
538 topLayout->addWidget(mAlarmTimeCombo,3,1); 540 topLayout->addWidget(mAlarmTimeCombo,3,1);
539 541
540 542
541 QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal, 543 QGroupBox *workingHoursGroup = new QGroupBox(1,Horizontal,
542 i18n("Working Hours"), 544 i18n("Working Hours"),
543 topFrame); 545 topFrame);
544 topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1); 546 topLayout->addMultiCellWidget(workingHoursGroup,4,4,0,1);
545 workingHoursGroup->layout()->setSpacing( 0 ); 547 workingHoursGroup->layout()->setSpacing( 0 );
546 workingHoursGroup->layout()->setMargin( 4 ); 548 workingHoursGroup->layout()->setMargin( 4 );
547 QHBox *workStartBox = new QHBox(workingHoursGroup); 549 QHBox *workStartBox = new QHBox(workingHoursGroup);
548 // workStartBox->setMargin( 0 ); 550 // workStartBox->setMargin( 0 );
549 addWidTime(i18n("Daily starting hour:"), 551 addWidTime(i18n("Daily starting hour:"),
550 &(KOPrefs::instance()->mWorkingHoursStart),workStartBox); 552 &(KOPrefs::instance()->mWorkingHoursStart),workStartBox);
551 553
552 QHBox *workEndBox = new QHBox(workingHoursGroup); 554 QHBox *workEndBox = new QHBox(workingHoursGroup);
553 //workEndBox->setMargin( 0 ); 555 //workEndBox->setMargin( 0 );
554 addWidTime(i18n("Daily ending hour:"), 556 addWidTime(i18n("Daily ending hour:"),
555 &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox); 557 &(KOPrefs::instance()->mWorkingHoursEnd),workEndBox);
556 QVBox *excludeBox = new QVBox(workingHoursGroup); 558 QVBox *excludeBox = new QVBox(workingHoursGroup);
557 //excludeBox->setMargin( 0 ); 559 //excludeBox->setMargin( 0 );
558 addWidBool(i18n("Exclude holidays"), 560 addWidBool(i18n("Exclude holidays"),
559 &(KOPrefs::instance()->mExcludeHolidays),excludeBox); 561 &(KOPrefs::instance()->mExcludeHolidays),excludeBox);
560 562
561 addWidBool(i18n("Exclude Saturdays"), 563 addWidBool(i18n("Exclude Saturdays"),
562 &(KOPrefs::instance()->mExcludeSaturdays),excludeBox); 564 &(KOPrefs::instance()->mExcludeSaturdays),excludeBox);
563 565
564// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"), 566// KPrefsDialogWidBool *marcusBainsShowSeconds = addWidBool(i18n("Show seconds on Marcus Bains line"),
565 // &(KOPrefs::instance()->mMarcusBainsShowSeconds), 567 // &(KOPrefs::instance()->mMarcusBainsShowSeconds),
566 // topFrame); 568 // topFrame);
567// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0); 569// topLayout->addWidget(marcusBainsShowSeconds->checkBox(),5,0);
568 570
569 // topLayout->setRowStretch(6,1); 571 // topLayout->setRowStretch(6,1);
570} 572}
571 573
572 574
573void KOPrefsDialog::setupViewsTab() 575void KOPrefsDialog::setupViewsTab()
574{ 576{
575 577
576 QFrame *topFrame = addPage(i18n("Views"),0,0); 578 QFrame *topFrame = addPage(i18n("Views"),0,0);
577 // DesktopIcon("viewmag",KIcon::SizeMedium)); 579 // DesktopIcon("viewmag",KIcon::SizeMedium));
578 580
579 QGridLayout *topLayout = new QGridLayout(topFrame,6,1); 581 QGridLayout *topLayout = new QGridLayout(topFrame,6,1);
580 topLayout->setSpacing(spacingHint()); 582 topLayout->setSpacing(spacingHint());
581 topLayout->setMargin(marginHint()); 583 topLayout->setMargin(marginHint());
582 584
583// QBoxLayout *dayBeginsLayout = new QHBoxLayout; 585// QBoxLayout *dayBeginsLayout = new QHBoxLayout;
584// topLayout->addLayout(dayBeginsLayout,0,0); 586// topLayout->addLayout(dayBeginsLayout,0,0);
585 587
586// KPrefsDialogWidTime *dayBegins = 588// KPrefsDialogWidTime *dayBegins =
587// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins), 589// addWidTime(i18n("Day begins at:"),&(KOPrefs::instance()->mDayBegins),
588// topFrame); 590// topFrame);
589// dayBeginsLayout->addWidget(dayBegins->label()); 591// dayBeginsLayout->addWidget(dayBegins->label());
590// dayBeginsLayout->addStretch(1); 592// dayBeginsLayout->addStretch(1);
591// dayBeginsLayout->addWidget(dayBegins->spinBox()); 593// dayBeginsLayout->addWidget(dayBegins->spinBox());
592 594
593// QBoxLayout *nextDaysLayout = new QHBoxLayout; 595// QBoxLayout *nextDaysLayout = new QHBoxLayout;
594// topLayout->addLayout(nextDaysLayout,1,0); 596// topLayout->addLayout(nextDaysLayout,1,0);
595// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame)); 597// nextDaysLayout->addWidget(new QLabel(i18n("Days to show in Next-X-Days view:"),topFrame));
596// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame); 598// mNextXDaysSpin = new QSpinBox(2,14,1,topFrame);
597// nextDaysLayout->addStretch(1); 599// nextDaysLayout->addStretch(1);
598// nextDaysLayout->addWidget(mNextXDaysSpin); 600// nextDaysLayout->addWidget(mNextXDaysSpin);
599 601
600 602
601 int ii = 0; 603 int ii = 0;
602 KPrefsDialogWidBool *dummy = 604 KPrefsDialogWidBool *dummy =
603 addWidBool(i18n("Edit item on doubleclick (if not, show)"), 605 addWidBool(i18n("Edit item on doubleclick (if not, show)"),
604 &(KOPrefs::instance()->mEditOnDoubleClick),topFrame); 606 &(KOPrefs::instance()->mEditOnDoubleClick),topFrame);
605 topLayout->addWidget(dummy->checkBox(),ii++,0); 607 topLayout->addWidget(dummy->checkBox(),ii++,0);
606 608
607 dummy = 609 dummy =
608 addWidBool(i18n("Show time in agenda items"), 610 addWidBool(i18n("Show time in agenda items"),
609 &(KOPrefs::instance()->mShowTimeInAgenda),topFrame); 611 &(KOPrefs::instance()->mShowTimeInAgenda),topFrame);
610 topLayout->addWidget(dummy->checkBox(),ii++,0); 612 topLayout->addWidget(dummy->checkBox(),ii++,0);
611 613
612 dummy = 614 dummy =
613 addWidBool(i18n("Highlight current day in agenda"), 615 addWidBool(i18n("Highlight current day in agenda"),
614 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame); 616 &(KOPrefs::instance()->mHighlightCurrentDay),topFrame);
615 topLayout->addWidget(dummy->checkBox(),ii++,0); 617 topLayout->addWidget(dummy->checkBox(),ii++,0);
616 618
617 dummy = 619 dummy =
618 addWidBool(i18n("Use light color for highlight current day"), 620 addWidBool(i18n("Use light color for highlight current day"),
619 &(KOPrefs::instance()->mUseHighlightLightColor),topFrame); 621 &(KOPrefs::instance()->mUseHighlightLightColor),topFrame);
620 topLayout->addWidget(dummy->checkBox(),ii++,0); 622 topLayout->addWidget(dummy->checkBox(),ii++,0);
621 623
622 KPrefsDialogWidBool *dailyRecur = 624 KPrefsDialogWidBool *dailyRecur =
623 addWidBool(i18n("Show events that recur daily in date nav."), 625 addWidBool(i18n("Show events that recur daily in date nav."),
624 &(KOPrefs::instance()->mDailyRecur),topFrame); 626 &(KOPrefs::instance()->mDailyRecur),topFrame);
625 topLayout->addWidget(dailyRecur->checkBox(),ii++,0); 627 topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
626 628
627 KPrefsDialogWidBool *weeklyRecur = 629 KPrefsDialogWidBool *weeklyRecur =
628 addWidBool(i18n("Show ev. that recur weekly in date nav."), 630 addWidBool(i18n("Show ev. that recur weekly in date nav."),
629 &(KOPrefs::instance()->mWeeklyRecur),topFrame); 631 &(KOPrefs::instance()->mWeeklyRecur),topFrame);
630 topLayout->addWidget(weeklyRecur->checkBox(),ii++,0); 632 topLayout->addWidget(weeklyRecur->checkBox(),ii++,0);
631 if ( QApplication::desktop()->width() > 640 ) { 633 if ( QApplication::desktop()->width() > 640 ) {
632 634
633 KPrefsDialogWidBool *enableToolTips = 635 KPrefsDialogWidBool *enableToolTips =
634 addWidBool(i18n("Enable tooltips displaying summary of ev."), 636 addWidBool(i18n("Enable tooltips displaying summary of ev."),
635 &(KOPrefs::instance()->mEnableToolTips),topFrame); 637 &(KOPrefs::instance()->mEnableToolTips),topFrame);
636 topLayout->addWidget(enableToolTips->checkBox(),ii++,0); 638 topLayout->addWidget(enableToolTips->checkBox(),ii++,0);
637 639
638 } 640 }
639 641
640 KPrefsDialogWidBool *marcusBainsEnabled = 642 KPrefsDialogWidBool *marcusBainsEnabled =
641 addWidBool(i18n("Show Marcus Bains line"), 643 addWidBool(i18n("Show Marcus Bains line"),
642 &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame); 644 &(KOPrefs::instance()->mMarcusBainsEnabled),topFrame);
643 topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0); 645 topLayout->addWidget(marcusBainsEnabled->checkBox(),ii++,0);
644 646
645 647
646 // topLayout->addWidget(hourSizeGroup,ii++,0); 648 // topLayout->addWidget(hourSizeGroup,ii++,0);
647 // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0); 649 // topLayout->addMultiCellWidget(hourSizeGroup,ii,ii,0,0);
648 //topLayout->setRowStretch(11,1); 650 //topLayout->setRowStretch(11,1);
649 651
650 652
651 653
652 654
653 655
654 656
655 topFrame = addPage(i18n("ViewChange"),0,0); 657 topFrame = addPage(i18n("ViewChange"),0,0);
656 // DesktopIcon("viewmag",KIcon::SizeMedium)); 658 // DesktopIcon("viewmag",KIcon::SizeMedium));
657 659
658 topLayout = new QGridLayout(topFrame,6,1); 660 topLayout = new QGridLayout(topFrame,6,1);
659 topLayout->setSpacing(spacingHint()); 661 topLayout->setSpacing(spacingHint());
660 topLayout->setMargin(marginHint()); 662 topLayout->setMargin(marginHint());
661 ii = 0; 663 ii = 0;
662 664
663 665
664 dummy = 666 dummy =
665 addWidBool(i18n("Hold fullscreen on view change"), 667 addWidBool(i18n("Hold fullscreen on view change"),
666 &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame); 668 &(KOPrefs::instance()->mViewChangeHoldFullscreen),topFrame);
667 topLayout->addWidget(dummy->checkBox(),ii++,0); 669 topLayout->addWidget(dummy->checkBox(),ii++,0);
668 670
669 dummy = 671 dummy =
670 addWidBool(i18n("Hold non-fullscreen on view change"), 672 addWidBool(i18n("Hold non-fullscreen on view change"),
671 &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame); 673 &(KOPrefs::instance()->mViewChangeHoldNonFullscreen),topFrame);
672 topLayout->addWidget(dummy->checkBox(),ii++,0); 674 topLayout->addWidget(dummy->checkBox(),ii++,0);
673 675
674 676
675 KPrefsDialogWidBool *fullViewTodo = 677 KPrefsDialogWidBool *fullViewTodo =
676 addWidBool(i18n("Event list view uses full window"), 678 addWidBool(i18n("Event list view uses full window"),
677 &(KOPrefs::instance()->mFullViewTodo),topFrame); 679 &(KOPrefs::instance()->mFullViewTodo),topFrame);
678 topLayout->addWidget(fullViewTodo->checkBox(),ii++,0); 680 topLayout->addWidget(fullViewTodo->checkBox(),ii++,0);
679 681
680 KPrefsDialogWidBool *fullViewMonth = 682 KPrefsDialogWidBool *fullViewMonth =
681 addWidBool(i18n("Next days view uses full window"), 683 addWidBool(i18n("Next days view uses full window"),
682 &(KOPrefs::instance()->mFullViewMonth),topFrame); 684 &(KOPrefs::instance()->mFullViewMonth),topFrame);
683 topLayout->addWidget(fullViewMonth->checkBox(),ii++,0); 685 topLayout->addWidget(fullViewMonth->checkBox(),ii++,0);
684 686
685 dummy = 687 dummy =
686 addWidBool(i18n("Set agenda to DayBeginsAt on change"), 688 addWidBool(i18n("Set agenda to DayBeginsAt on change"),
687 &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame); 689 &(KOPrefs::instance()->mSetTimeToDayStartAt),topFrame);
688 topLayout->addWidget(dummy->checkBox(),ii++,0); 690 topLayout->addWidget(dummy->checkBox(),ii++,0);
689 691
690 dummy = 692 dummy =
691 addWidBool(i18n("Set agenda to current time on change"), 693 addWidBool(i18n("Set agenda to current time on change"),
692 &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); 694 &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame);
693 topLayout->addWidget(dummy->checkBox(),ii++,0); 695 topLayout->addWidget(dummy->checkBox(),ii++,0);
694 696
695 dummy = 697 dummy =
696 addWidBool(i18n("Listview uses monthly timespan"), 698 addWidBool(i18n("Listview uses monthly timespan"),
697 &(KOPrefs::instance()->mListViewMonthTimespan),topFrame); 699 &(KOPrefs::instance()->mListViewMonthTimespan),topFrame);
698 topLayout->addWidget(dummy->checkBox(),ii++,0); 700 topLayout->addWidget(dummy->checkBox(),ii++,0);
699 dummy = 701 dummy =
700 addWidBool(i18n("Highlight selection in Time Edit"), 702 addWidBool(i18n("Highlight selection in Time Edit"),
701 &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame); 703 &(KOPrefs::instance()->mHightlightDateTimeEdit),topFrame);
702 topLayout->addWidget( dummy->checkBox(), ii++,0); 704 topLayout->addWidget( dummy->checkBox(), ii++,0);
703 705
704 706
705 707
706 708
707 709
708 topFrame = addPage(i18n("Month View"),0,0); 710 topFrame = addPage(i18n("Month View"),0,0);
709 // DesktopIcon("viewmag",KIcon::SizeMedium)); 711 // DesktopIcon("viewmag",KIcon::SizeMedium));
710 712
711 topLayout = new QGridLayout(topFrame,5,1); 713 topLayout = new QGridLayout(topFrame,5,1);
712 topLayout->setSpacing(spacingHint()); 714 topLayout->setSpacing(spacingHint());
713 topLayout->setMargin(marginHint()); 715 topLayout->setMargin(marginHint());
714 ii = 0; 716 ii = 0;
715 QLabel *lab; 717 QLabel *lab;
716 QHBox *habo = new QHBox( topFrame ); 718 QHBox *habo = new QHBox( topFrame );
717 if ( QApplication::desktop()->width() < 320 ) { 719 if ( QApplication::desktop()->width() < 320 ) {
718 lab = new QLabel ( i18n("Show events that recur "), topFrame ); 720 lab = new QLabel ( i18n("Show events that recur "), topFrame );
719 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 721 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
720 ii++; 722 ii++;
721 723
722 } else { 724 } else {
723 new QLabel ( i18n("Show events that recur "), habo ); 725 new QLabel ( i18n("Show events that recur "), habo );
724 726
725 } 727 }
726 dailyRecur = 728 dailyRecur =
727 addWidBool(i18n("daily"), 729 addWidBool(i18n("daily"),
728 &(KOPrefs::instance()->mMonthDailyRecur),habo); 730 &(KOPrefs::instance()->mMonthDailyRecur),habo);
729 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); 731 // topLayout->addWidget(dailyRecur->checkBox(),ii++,0);
730 732
731 weeklyRecur = 733 weeklyRecur =
732 addWidBool(i18n("weekly"), 734 addWidBool(i18n("weekly"),
733 &(KOPrefs::instance()->mMonthWeeklyRecur),habo); 735 &(KOPrefs::instance()->mMonthWeeklyRecur),habo);
734 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 736 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
735 ii++; 737 ii++;
736 738
737 739
738 habo = new QHBox( topFrame ); 740 habo = new QHBox( topFrame );
739 if ( QApplication::desktop()->width() < 320 ) { 741 if ( QApplication::desktop()->width() < 320 ) {
740 lab = new QLabel (i18n("Show in every cell ") , topFrame ); 742 lab = new QLabel (i18n("Show in every cell ") , topFrame );
741 topLayout->addMultiCellWidget(lab,ii, ii,0,1); 743 topLayout->addMultiCellWidget(lab,ii, ii,0,1);
742 ii++; 744 ii++;
743 745
744 } else { 746 } else {
745 new QLabel ( i18n("Show in every cell "), habo ); 747 new QLabel ( i18n("Show in every cell "), habo );
746 } 748 }
747 weeklyRecur = 749 weeklyRecur =
748 addWidBool(i18n("short month"), 750 addWidBool(i18n("short month"),
749 &(KOPrefs::instance()->mMonthShowShort),habo); 751 &(KOPrefs::instance()->mMonthShowShort),habo);
750 weeklyRecur = 752 weeklyRecur =
751 addWidBool(i18n("icons"), 753 addWidBool(i18n("icons"),
752 &(KOPrefs::instance()->mMonthShowIcons),habo); 754 &(KOPrefs::instance()->mMonthShowIcons),habo);
753 755
754 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 756 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
755 ii++; 757 ii++;
756#ifdef DESKTOP_VERSION 758#ifdef DESKTOP_VERSION
757 KPrefsDialogWidBool *enableMonthScroll = 759 KPrefsDialogWidBool *enableMonthScroll =
758 addWidBool(i18n("Enable scrollbars in month view cells"), 760 addWidBool(i18n("Enable scrollbars in month view cells"),
759 &(KOPrefs::instance()->mEnableMonthScroll),topFrame); 761 &(KOPrefs::instance()->mEnableMonthScroll),topFrame);
760 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); 762 topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0);
761#endif 763#endif
762 764
763 dummy = 765 dummy =
764 addWidBool(i18n("Show Sat/Sun together"), 766 addWidBool(i18n("Show Sat/Sun together"),
765 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); 767 &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame);
766 topLayout->addWidget(dummy->checkBox(),ii++,0); 768 topLayout->addWidget(dummy->checkBox(),ii++,0);
767 769
768 KPrefsDialogWidBool *coloredCategoriesInMonthView = 770 KPrefsDialogWidBool *coloredCategoriesInMonthView =
769 addWidBool(i18n("Month view uses category colors"), 771 addWidBool(i18n("Month view uses category colors"),
770 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); 772 &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame);
771 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 773 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
772 774
773 dummy = 775 dummy =
774 addWidBool(i18n("Categorie colors are applied to text"), 776 addWidBool(i18n("Categorie colors are applied to text"),
775 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); 777 &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame);
776 topLayout->addWidget(dummy->checkBox(),ii++,0); 778 topLayout->addWidget(dummy->checkBox(),ii++,0);
777 coloredCategoriesInMonthView = 779 coloredCategoriesInMonthView =
778 addWidBool(i18n("Month view uses day colors"), 780 addWidBool(i18n("Month view uses day colors"),
779 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); 781 &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame);
780 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); 782 topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0);
781 783
782 KPrefsDialogWidColor *holidayColor = 784 KPrefsDialogWidColor *holidayColor =
783 addWidColor(i18n("Day color odd months"), 785 addWidColor(i18n("Day color odd months"),
784 &(KOPrefs::instance()->mMonthViewOddColor),topFrame); 786 &(KOPrefs::instance()->mMonthViewOddColor),topFrame);
785 topLayout->addWidget(holidayColor->label(),ii,0); 787 topLayout->addWidget(holidayColor->label(),ii,0);
786 topLayout->addWidget(holidayColor->button(),ii++,1); 788 topLayout->addWidget(holidayColor->button(),ii++,1);
787 789
788 holidayColor = 790 holidayColor =
789 addWidColor(i18n("Day color even months"), 791 addWidColor(i18n("Day color even months"),
790 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); 792 &(KOPrefs::instance()->mMonthViewEvenColor),topFrame);
791 topLayout->addWidget(holidayColor->label(),ii,0); 793 topLayout->addWidget(holidayColor->label(),ii,0);
792 topLayout->addWidget(holidayColor->button(),ii++,1); 794 topLayout->addWidget(holidayColor->button(),ii++,1);
793 795
794 796
795 holidayColor = 797 holidayColor =
796 addWidColor(i18n("Color for Sundays + category \"Holiday\""), 798 addWidColor(i18n("Color for Sundays + category \"Holiday\""),
797 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); 799 &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame);
798 topLayout->addWidget(holidayColor->label(),ii,0); 800 topLayout->addWidget(holidayColor->label(),ii,0);
799 topLayout->addWidget(holidayColor->button(),ii++,1); 801 topLayout->addWidget(holidayColor->button(),ii++,1);
800 // *********************** What'sNext View 802 // *********************** What'sNext View
801 topFrame = addPage(i18n("What's Next View"),0,0); 803 topFrame = addPage(i18n("What's Next View"),0,0);
802 // DesktopIcon("viewmag",KIcon::SizeMedium)); 804 // DesktopIcon("viewmag",KIcon::SizeMedium));
803 805
804 topLayout = new QGridLayout(topFrame,4,1); 806 topLayout = new QGridLayout(topFrame,4,1);
805 topLayout->setSpacing(spacingHint()); 807 topLayout->setSpacing(spacingHint());
806 topLayout->setMargin(marginHint()); 808 topLayout->setMargin(marginHint());
807 ii = 0; 809 ii = 0;
808 KPrefsDialogWidBool *passwdk = 810 KPrefsDialogWidBool *passwdk =
809 811
810 addWidBool(i18n("Show events, that are done in \nWhat's Next view"), 812 addWidBool(i18n("Show events, that are done in \nWhat's Next view"),
811 &(KOPrefs::instance()->mWNViewShowsPast),topFrame); 813 &(KOPrefs::instance()->mWNViewShowsPast),topFrame);
812 topLayout->addWidget(passwdk->checkBox(), ii++,0); 814 topLayout->addWidget(passwdk->checkBox(), ii++,0);
813 passwdk = 815 passwdk =
814 addWidBool(i18n("Show parent To-Do's in What's Next view"), 816 addWidBool(i18n("Show parent To-Do's in What's Next view"),
815 &(KOPrefs::instance()->mWNViewShowsParents),topFrame); 817 &(KOPrefs::instance()->mWNViewShowsParents),topFrame);
816 topLayout->addWidget(passwdk->checkBox(), ii++,0); 818 topLayout->addWidget(passwdk->checkBox(), ii++,0);
817 819
818 passwdk = 820 passwdk =
819 addWidBool(i18n("Show location in What's Next view"), 821 addWidBool(i18n("Show location in What's Next view"),
820 &(KOPrefs::instance()->mWNViewShowLocation),topFrame); 822 &(KOPrefs::instance()->mWNViewShowLocation),topFrame);
821 topLayout->addWidget(passwdk->checkBox(), ii++,0); 823 topLayout->addWidget(passwdk->checkBox(), ii++,0);
822 824
823 passwdk = 825 passwdk =
824 addWidBool(i18n("Show Sync Events in \nWhat's Next/Agenda view"), 826 addWidBool(i18n("Show Sync Events in \nWhat's Next/Agenda view"),
825 &(KOPrefs::instance()->mShowSyncEvents),topFrame); 827 &(KOPrefs::instance()->mShowSyncEvents),topFrame);
826 topLayout->addWidget(passwdk->checkBox(), ii++,0); 828 topLayout->addWidget(passwdk->checkBox(), ii++,0);
827 passwdk = 829 passwdk =
828 addWidBool(i18n("Use short date in \nWhat's Next/Event view"), 830 addWidBool(i18n("Use short date in \nWhat's Next/Event view"),
829 &(KOPrefs::instance()->mShortDateInViewer),topFrame); 831 &(KOPrefs::instance()->mShortDateInViewer),topFrame);
830 topLayout->addWidget(passwdk->checkBox(), ii++,0); 832 topLayout->addWidget(passwdk->checkBox(), ii++,0);
831 833
832 834
833 835
834 836
835 // *********************** Todo View 837 // *********************** Todo View
836 838
837 topFrame = addPage(i18n("Todo View"),0,0); 839 topFrame = addPage(i18n("Todo View"),0,0);
838 // DesktopIcon("viewmag",KIcon::SizeMedium)); 840 // DesktopIcon("viewmag",KIcon::SizeMedium));
839 841
840 topLayout = new QGridLayout(topFrame,4,1); 842 topLayout = new QGridLayout(topFrame,4,1);
841 topLayout->setSpacing(spacingHint()); 843 topLayout->setSpacing(spacingHint());
842 topLayout->setMargin(marginHint()); 844 topLayout->setMargin(marginHint());
843 ii = 0; 845 ii = 0;
844dummy = 846dummy =
845 addWidBool(i18n("Hide not running Todos in To-do view"), 847 addWidBool(i18n("Hide not running Todos in To-do view"),
846 &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); 848 &(KOPrefs::instance()->mHideNonStartedTodos),topFrame);
847 topLayout->addWidget(dummy->checkBox(),ii++,0); 849 topLayout->addWidget(dummy->checkBox(),ii++,0);
848 850
849 851
850 KPrefsDialogWidBool *showCompletedTodo = 852 KPrefsDialogWidBool *showCompletedTodo =
851 addWidBool(i18n("To-do view shows completed Todos"), 853 addWidBool(i18n("To-do view shows completed Todos"),
852 &(KOPrefs::instance()->mShowCompletedTodo),topFrame); 854 &(KOPrefs::instance()->mShowCompletedTodo),topFrame);
853 topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); 855 topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0);
854 dummy = 856 dummy =
855 addWidBool(i18n("To-do view shows complete as 'xx %'"), 857 addWidBool(i18n("To-do view shows complete as 'xx %'"),
856 &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); 858 &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame);
857 topLayout->addWidget(dummy->checkBox(),ii++,0); 859 topLayout->addWidget(dummy->checkBox(),ii++,0);
858 860
859 dummy = 861 dummy =
860 addWidBool(i18n("Small To-do view uses smaller font"), 862 addWidBool(i18n("Small To-do view uses smaller font"),
861 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); 863 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame);
862 topLayout->addWidget(dummy->checkBox(),ii++,0); 864 topLayout->addWidget(dummy->checkBox(),ii++,0);
863 865
864 866
865 867
866 dummy = 868 dummy =
867 addWidBool(i18n("Todo view uses category colors"), 869 addWidBool(i18n("Todo view uses category colors"),
868 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); 870 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame);
869 topLayout->addWidget(dummy->checkBox(),ii++,0); 871 topLayout->addWidget(dummy->checkBox(),ii++,0);
870 872
871 873
872 QWidget* wid = new QWidget( topFrame ); 874 QWidget* wid = new QWidget( topFrame );
873 // Todo due today color 875 // Todo due today color
874 KPrefsDialogWidColor *todoDueTodayColor = 876 KPrefsDialogWidColor *todoDueTodayColor =
875 addWidColor(i18n("Todo due today color:"), 877 addWidColor(i18n("Todo due today color:"),
876 &(KOPrefs::instance()->mTodoDueTodayColor),wid); 878 &(KOPrefs::instance()->mTodoDueTodayColor),wid);
877 QHBoxLayout *widLayout = new QHBoxLayout(wid); 879 QHBoxLayout *widLayout = new QHBoxLayout(wid);
878 widLayout->addWidget( todoDueTodayColor->label() ); 880 widLayout->addWidget( todoDueTodayColor->label() );
879 widLayout->addWidget( todoDueTodayColor->button() ); 881 widLayout->addWidget( todoDueTodayColor->button() );
880 topLayout->addWidget(wid,ii++,0); 882 topLayout->addWidget(wid,ii++,0);
881 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); 883 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1);
882 884
883 // Todo overdue color 885 // Todo overdue color
884 wid = new QWidget( topFrame ); 886 wid = new QWidget( topFrame );
885 widLayout = new QHBoxLayout(wid); 887 widLayout = new QHBoxLayout(wid);
886 KPrefsDialogWidColor *todoOverdueColor = 888 KPrefsDialogWidColor *todoOverdueColor =
887 addWidColor(i18n("Todo overdue color:"), 889 addWidColor(i18n("Todo overdue color:"),
888 &(KOPrefs::instance()->mTodoOverdueColor),wid); 890 &(KOPrefs::instance()->mTodoOverdueColor),wid);
889 widLayout->addWidget(todoOverdueColor->label()); 891 widLayout->addWidget(todoOverdueColor->label());
890 widLayout->addWidget(todoOverdueColor->button()); 892 widLayout->addWidget(todoOverdueColor->button());
891 topLayout->addWidget(wid,ii++,0); 893 topLayout->addWidget(wid,ii++,0);
892 894
893 dummy = 895 dummy =
894 addWidBool(i18n("Colors are applied to text"), 896 addWidBool(i18n("Colors are applied to text"),
895 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); 897 &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame);
896 topLayout->addWidget(dummy->checkBox(),ii++,0); 898 topLayout->addWidget(dummy->checkBox(),ii++,0);
897 899
898 dummy = 900 dummy =
899 addWidBool(i18n("Allday Agenda view shows todos"), 901 addWidBool(i18n("Allday Agenda view shows todos"),
900 &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); 902 &(KOPrefs::instance()->mShowTodoInAgenda),topFrame);
901 topLayout->addWidget(dummy->checkBox(),ii++,0); 903 topLayout->addWidget(dummy->checkBox(),ii++,0);
902 904
903 905
904 906
905 907
906 topFrame = addPage(i18n("Alarm"),0,0); 908 topFrame = addPage(i18n("Alarm"),0,0);
907 // DesktopIcon("viewmag",KIcon::SizeMedium)); 909 // DesktopIcon("viewmag",KIcon::SizeMedium));
908 910
909 topLayout = new QGridLayout(topFrame,2,1); 911 topLayout = new QGridLayout(topFrame,2,1);
910 topLayout->setSpacing(spacingHint()); 912 topLayout->setSpacing(spacingHint());
911 topLayout->setMargin(marginHint()); 913 topLayout->setMargin(marginHint());
912 int iii = 0; 914 int iii = 0;
913 915
914 dummy = 916 dummy =
915 addWidBool(i18n("Use internal alarm notification"), 917 addWidBool(i18n("Use internal alarm notification"),
916 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); 918 &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame);
917 topLayout->addWidget(dummy->checkBox(),iii++,0); 919 topLayout->addWidget(dummy->checkBox(),iii++,0);
918 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); 920 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);
919 921
920 topLayout->addWidget(lab ,iii++,0); 922 topLayout->addWidget(lab ,iii++,0);
921#ifndef DESKTOP_VERSION 923#ifndef DESKTOP_VERSION
922 lab->setAlignment( AlignLeft|WordBreak|AlignTop); 924 lab->setAlignment( AlignLeft|WordBreak|AlignTop);
923#else 925#else
924 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 926 lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
925 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 927 lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
926#endif 928#endif
927 929
928 QHBox* dummyBox = new QHBox(topFrame); 930 QHBox* dummyBox = new QHBox(topFrame);
929 new QLabel(i18n("Play beeps count:"),dummyBox); 931 new QLabel(i18n("Play beeps count:"),dummyBox);
930 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); 932 mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox);
931 topLayout->addWidget(dummyBox,iii++,0); 933 topLayout->addWidget(dummyBox,iii++,0);
932 934
933 dummyBox = new QHBox(topFrame); 935 dummyBox = new QHBox(topFrame);
934 new QLabel(i18n("Beeps interval in sec:"),dummyBox); 936 new QLabel(i18n("Beeps interval in sec:"),dummyBox);
935 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); 937 mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox);
936 topLayout->addWidget(dummyBox,iii++,0); 938 topLayout->addWidget(dummyBox,iii++,0);
937 939
938 dummyBox = new QHBox(topFrame); 940 dummyBox = new QHBox(topFrame);
939 new QLabel(i18n("Default suspend time in min:"),dummyBox); 941 new QLabel(i18n("Default suspend time in min:"),dummyBox);
940 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); 942 mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox);
941 topLayout->addWidget(dummyBox,iii++,0); 943 topLayout->addWidget(dummyBox,iii++,0);
942 944
943 dummyBox = new QHBox(topFrame); 945 dummyBox = new QHBox(topFrame);
944 new QLabel(i18n("Auto suspend count:"),dummyBox); 946 new QLabel(i18n("Auto suspend count:"),dummyBox);
945 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); 947 mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox);
946 topLayout->addWidget(dummyBox,iii++,0); 948 topLayout->addWidget(dummyBox,iii++,0);
947 949
948 950
949 951
950 952
951 953
952 954
953 955
954 QHBox* hbo = new QHBox ( topFrame ); 956 QHBox* hbo = new QHBox ( topFrame );
955 mDefaultAlarmFile = new QLineEdit(hbo); 957 mDefaultAlarmFile = new QLineEdit(hbo);
956 QPushButton * loadTemplate = new QPushButton(hbo); 958 QPushButton * loadTemplate = new QPushButton(hbo);
957 QPixmap icon; 959 QPixmap icon;
958 if ( QApplication::desktop()->width() < 321 ) 960 if ( QApplication::desktop()->width() < 321 )
959 icon = SmallIcon("fileimport16"); 961 icon = SmallIcon("fileimport16");
960 else 962 else
961 icon = SmallIcon("fileimport"); 963 icon = SmallIcon("fileimport");
962 loadTemplate->setIconSet (icon ) ; 964 loadTemplate->setIconSet (icon ) ;
963 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); 965 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) );
964 int size = loadTemplate->sizeHint().height(); 966 int size = loadTemplate->sizeHint().height();
965 loadTemplate->setFixedSize( size, size ); 967 loadTemplate->setFixedSize( size, size );
966 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); 968 //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame);
967 // topLayout->addWidget(lab ,iii++,0); 969 // topLayout->addWidget(lab ,iii++,0);
968 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); 970 lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame);
969 topLayout->addWidget(lab ,iii++,0); 971 topLayout->addWidget(lab ,iii++,0);
970 topLayout->addWidget(hbo,iii++,0); 972 topLayout->addWidget(hbo,iii++,0);
971 // 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); 973 // 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);
972 974
973// topLayout->addWidget(lab ,iii++,0); 975// topLayout->addWidget(lab ,iii++,0);
974// #ifndef DESKTOP_VERSION 976// #ifndef DESKTOP_VERSION
975// lab->setAlignment( AlignLeft|WordBreak|AlignTop); 977// lab->setAlignment( AlignLeft|WordBreak|AlignTop);
976// #else 978// #else
977// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 979// lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
978// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); 980// lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) );
979// #endif 981// #endif
980 982
981 983
982} 984}
983 985
984void KOPrefsDialog::selectSoundFile() 986void KOPrefsDialog::selectSoundFile()
985{ 987{
986 QString fileName = mDefaultAlarmFile->text(); 988 QString fileName = mDefaultAlarmFile->text();
987 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); 989 fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this );
988 if ( fileName.length() > 0 ) 990 if ( fileName.length() > 0 )
989 mDefaultAlarmFile->setText( fileName ); 991 mDefaultAlarmFile->setText( fileName );
990} 992}
991void KOPrefsDialog::setupFontsTab() 993void KOPrefsDialog::setupFontsTab()
992{ 994{
993 995
994 QFrame *topFrame = addPage(i18n("Fonts"),0,0); 996 QFrame *topFrame = addPage(i18n("Fonts"),0,0);
995 // DesktopIcon("fonts",KIcon::SizeMedium)); 997 // DesktopIcon("fonts",KIcon::SizeMedium));
996 998
997 QGridLayout *topLayout = new QGridLayout(topFrame,7,3); 999 QGridLayout *topLayout = new QGridLayout(topFrame,7,3);
998 topLayout->setSpacing(1); 1000 topLayout->setSpacing(1);
999 topLayout->setMargin(3); 1001 topLayout->setMargin(3);
1000 KPrefsDialogWidFont * tVFont; 1002 KPrefsDialogWidFont * tVFont;
1001 int i = 0; 1003 int i = 0;
1002 KPrefsDialogWidFont *timeLabelsFont = 1004 KPrefsDialogWidFont *timeLabelsFont =
1003 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), 1005 addWidFont(i18n("23"),i18n("DateNavigator:(nr)"),
1004 &(KOPrefs::instance()->mDateNavigatorFont),topFrame); 1006 &(KOPrefs::instance()->mDateNavigatorFont),topFrame);
1005 topLayout->addWidget(timeLabelsFont->label(),i,0); 1007 topLayout->addWidget(timeLabelsFont->label(),i,0);
1006 topLayout->addWidget(timeLabelsFont->preview(),i,1); 1008 topLayout->addWidget(timeLabelsFont->preview(),i,1);
1007 topLayout->addWidget(timeLabelsFont->button(),i,2); 1009 topLayout->addWidget(timeLabelsFont->button(),i,2);
1008 ++i; 1010 ++i;
1009 1011
1010 1012
1011 timeLabelsFont = 1013 timeLabelsFont =
1012 addWidFont(i18n("Mon 15"),i18n("Date Labels:"), 1014 addWidFont(i18n("Mon 15"),i18n("Date Labels:"),
1013 &(KOPrefs::instance()->mTimeLabelsFont),topFrame); 1015 &(KOPrefs::instance()->mTimeLabelsFont),topFrame);
1014 topLayout->addWidget(timeLabelsFont->label(),i,0); 1016 topLayout->addWidget(timeLabelsFont->label(),i,0);
1015 topLayout->addWidget(timeLabelsFont->preview(),i,1); 1017 topLayout->addWidget(timeLabelsFont->preview(),i,1);
1016 topLayout->addWidget(timeLabelsFont->button(),i,2); 1018 topLayout->addWidget(timeLabelsFont->button(),i,2);
1017 ++i; 1019 ++i;
1018 1020
1019 KPrefsDialogWidFont *timeBarFont = 1021 KPrefsDialogWidFont *timeBarFont =
1020 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), 1022 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"),
1021 &(KOPrefs::instance()->mTimeBarFont),topFrame); 1023 &(KOPrefs::instance()->mTimeBarFont),topFrame);
1022 topLayout->addWidget(timeBarFont->label(),i,0); 1024 topLayout->addWidget(timeBarFont->label(),i,0);
1023 topLayout->addWidget(timeBarFont->preview(),i,1); 1025 topLayout->addWidget(timeBarFont->preview(),i,1);
1024 topLayout->addWidget(timeBarFont->button(),i,2); 1026 topLayout->addWidget(timeBarFont->button(),i,2);
1025 ++i; 1027 ++i;
1026 1028
1027 1029
1028 KPrefsDialogWidFont *marcusBainsFont = 1030 KPrefsDialogWidFont *marcusBainsFont =
1029 addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), 1031 addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"),
1030 &(KOPrefs::instance()->mMarcusBainsFont),topFrame); 1032 &(KOPrefs::instance()->mMarcusBainsFont),topFrame);
1031 topLayout->addWidget(marcusBainsFont->label(),i,0); 1033 topLayout->addWidget(marcusBainsFont->label(),i,0);
1032 topLayout->addWidget(marcusBainsFont->preview(),i,1); 1034 topLayout->addWidget(marcusBainsFont->preview(),i,1);
1033 topLayout->addWidget(marcusBainsFont->button(),i,2); 1035 topLayout->addWidget(marcusBainsFont->button(),i,2);
1034 ++i; 1036 ++i;
1035 1037
1036 tVFont = 1038 tVFont =
1037 addWidFont(i18n("Summary"),i18n("Event Viewer:"), 1039 addWidFont(i18n("Summary"),i18n("Event Viewer:"),
1038 &(KOPrefs::instance()->mEventViewFont),topFrame); 1040 &(KOPrefs::instance()->mEventViewFont),topFrame);
1039 topLayout->addWidget(tVFont->label(),i,0); 1041 topLayout->addWidget(tVFont->label(),i,0);
1040 topLayout->addWidget(tVFont->preview(),i,1); 1042 topLayout->addWidget(tVFont->preview(),i,1);
1041 topLayout->addWidget(tVFont->button(),i,2); 1043 topLayout->addWidget(tVFont->button(),i,2);
1042 ++i; 1044 ++i;
1043 1045
1044 1046
1045 1047
1046 tVFont = 1048 tVFont =
1047 addWidFont(i18n("Details"),i18n("EditorBox:"), 1049 addWidFont(i18n("Details"),i18n("EditorBox:"),
1048 &(KOPrefs::instance()->mEditBoxFont),topFrame); 1050 &(KOPrefs::instance()->mEditBoxFont),topFrame);
1049 topLayout->addWidget(tVFont->label(),i,0); 1051 topLayout->addWidget(tVFont->label(),i,0);
1050 topLayout->addWidget(tVFont->preview(),i,1); 1052 topLayout->addWidget(tVFont->preview(),i,1);
1051 topLayout->addWidget(tVFont->button(),i,2); 1053 topLayout->addWidget(tVFont->button(),i,2);
1052 ++i; 1054 ++i;
1053 1055
1054 1056
1055 1057
1056 topLayout->setColStretch(1,1); 1058 topLayout->setColStretch(1,1);
1057 topLayout->setRowStretch(4,1); 1059 topLayout->setRowStretch(4,1);
1058 1060
1059 1061
1060 i = 0; 1062 i = 0;
1061 topFrame = addPage(i18n("View Fonts"),0, 1063 topFrame = addPage(i18n("View Fonts"),0,
1062 DesktopIcon("fonts",KIcon::SizeMedium)); 1064 DesktopIcon("fonts",KIcon::SizeMedium));
1063 1065
1064 topLayout = new QGridLayout(topFrame,7,3); 1066 topLayout = new QGridLayout(topFrame,7,3);
1065 topLayout->setSpacing(1); 1067 topLayout->setSpacing(1);
1066 topLayout->setMargin(3); 1068 topLayout->setMargin(3);
1067 1069
1068 tVFont = 1070 tVFont =
1069 addWidFont(i18n("Configure KO"),i18n("What's Next View:"), 1071 addWidFont(i18n("Configure KO"),i18n("What's Next View:"),
1070 &(KOPrefs::instance()->mWhatsNextFont),topFrame); 1072 &(KOPrefs::instance()->mWhatsNextFont),topFrame);
1071 topLayout->addWidget(tVFont->label(),i,0); 1073 topLayout->addWidget(tVFont->label(),i,0);
1072 topLayout->addWidget(tVFont->preview(),i,1); 1074 topLayout->addWidget(tVFont->preview(),i,1);
1073 topLayout->addWidget(tVFont->button(),i,2); 1075 topLayout->addWidget(tVFont->button(),i,2);
1074 ++i; 1076 ++i;
1075 KPrefsDialogWidFont *agendaViewFont = 1077 KPrefsDialogWidFont *agendaViewFont =
1076 addWidFont(i18n("Event text"),i18n("Agenda view:"), 1078 addWidFont(i18n("Event text"),i18n("Agenda view:"),
1077 &(KOPrefs::instance()->mAgendaViewFont),topFrame); 1079 &(KOPrefs::instance()->mAgendaViewFont),topFrame);
1078 topLayout->addWidget(agendaViewFont->label(),i,0); 1080 topLayout->addWidget(agendaViewFont->label(),i,0);
1079 topLayout->addWidget(agendaViewFont->preview(),i,1); 1081 topLayout->addWidget(agendaViewFont->preview(),i,1);
1080 topLayout->addWidget(agendaViewFont->button(),i,2); 1082 topLayout->addWidget(agendaViewFont->button(),i,2);
1081 ++i; 1083 ++i;
1082 1084
1083 1085
1084 KPrefsDialogWidFont *monthViewFont = 1086 KPrefsDialogWidFont *monthViewFont =
1085 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"), 1087 addWidFont(KGlobal::locale()->formatTime(QTime(12,34)) + " " + i18n("Event"),
1086 i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame); 1088 i18n("Month view:"),&(KOPrefs::instance()->mMonthViewFont),topFrame);
1087 topLayout->addWidget(monthViewFont->label(),i,0); 1089 topLayout->addWidget(monthViewFont->label(),i,0);
1088 topLayout->addWidget(monthViewFont->preview(),i,1); 1090 topLayout->addWidget(monthViewFont->preview(),i,1);
1089 topLayout->addWidget(monthViewFont->button(),i,2); 1091 topLayout->addWidget(monthViewFont->button(),i,2);
1090 ++i; 1092 ++i;
1091 1093
1092 1094
1093 KPrefsDialogWidFont *lVFont = 1095 KPrefsDialogWidFont *lVFont =
1094 addWidFont(i18n("Event"),i18n("List View:"), 1096 addWidFont(i18n("Event"),i18n("List View:"),
1095 &(KOPrefs::instance()->mListViewFont),topFrame); 1097 &(KOPrefs::instance()->mListViewFont),topFrame);
1096 topLayout->addWidget(lVFont->label(),i,0); 1098 topLayout->addWidget(lVFont->label(),i,0);
1097 topLayout->addWidget(lVFont->preview(),i,1); 1099 topLayout->addWidget(lVFont->preview(),i,1);
1098 topLayout->addWidget(lVFont->button(),i,2); 1100 topLayout->addWidget(lVFont->button(),i,2);
1099 ++i; 1101 ++i;
1100 1102
1101 1103
1102 tVFont = 1104 tVFont =
1103 addWidFont(i18n("ToDo"),i18n("ToDoView:"), 1105 addWidFont(i18n("ToDo"),i18n("ToDoView:"),
1104 &(KOPrefs::instance()->mTodoViewFont),topFrame); 1106 &(KOPrefs::instance()->mTodoViewFont),topFrame);
1105 topLayout->addWidget(tVFont->label(),i,0); 1107 topLayout->addWidget(tVFont->label(),i,0);
1106 topLayout->addWidget(tVFont->preview(),i,1); 1108 topLayout->addWidget(tVFont->preview(),i,1);
1107 topLayout->addWidget(tVFont->button(),i,2); 1109 topLayout->addWidget(tVFont->button(),i,2);
1108 ++i; 1110 ++i;
1109 1111
1110 1112
1111 tVFont = 1113 tVFont =
1112 addWidFont(i18n("Today"),i18n("JournalView:"), 1114 addWidFont(i18n("Today"),i18n("JournalView:"),
1113 &(KOPrefs::instance()->mJornalViewFont),topFrame); 1115 &(KOPrefs::instance()->mJornalViewFont),topFrame);
1114 topLayout->addWidget(tVFont->label(),i,0); 1116 topLayout->addWidget(tVFont->label(),i,0);
1115 topLayout->addWidget(tVFont->preview(),i,1); 1117 topLayout->addWidget(tVFont->preview(),i,1);
1116 topLayout->addWidget(tVFont->button(),i,2); 1118 topLayout->addWidget(tVFont->button(),i,2);
1117 ++i; 1119 ++i;
1118 1120
1119 1121
1120 1122
1121 1123
1122 topLayout->setColStretch(1,1); 1124 topLayout->setColStretch(1,1);
1123 topLayout->setRowStretch(4,1); 1125 topLayout->setRowStretch(4,1);
1124 1126
1125 1127
1126 1128
1127 1129
1128} 1130}
1129 1131
1130void KOPrefsDialog::setupColorsTab() 1132void KOPrefsDialog::setupColorsTab()
1131{ 1133{
1132 QFrame *topFrame = addPage(i18n("Colors"),0,0); 1134 QFrame *topFrame = addPage(i18n("Colors"),0,0);
1133 // DesktopIcon("colorize",KIcon::SizeMedium)); 1135 // DesktopIcon("colorize",KIcon::SizeMedium));
1134 1136
1135 QGridLayout *topLayout = new QGridLayout(topFrame,5,2); 1137 QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
1136 // topLayout->setSpacing(spacingHint()); 1138 // topLayout->setSpacing(spacingHint());
1137 // topLayout->setMargin(marginHint()); 1139 // topLayout->setMargin(marginHint());
1138 1140
1139 topLayout->setSpacing(2); 1141 topLayout->setSpacing(2);
1140 topLayout->setMargin(3); 1142 topLayout->setMargin(3);
1141 1143
1142 int ii = 1; 1144 int ii = 1;
1143 QGroupBox *categoryGroup ; 1145 QGroupBox *categoryGroup ;
1144 1146
1145 categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"), 1147 categoryGroup = new QGroupBox(1,Vertical,i18n("Categories"),
1146 topFrame); 1148 topFrame);
1147 topLayout->addMultiCellWidget(categoryGroup,0,0,0,1); 1149 topLayout->addMultiCellWidget(categoryGroup,0,0,0,1);
1148 1150
1149 mCategoryCombo = new QComboBox(categoryGroup); 1151 mCategoryCombo = new QComboBox(categoryGroup);
1150 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); 1152 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
1151 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor())); 1153 connect(mCategoryCombo,SIGNAL(activated(int)),SLOT(updateCategoryColor()));
1152 1154
1153 mCategoryButton = new KColorButton(categoryGroup); 1155 mCategoryButton = new KColorButton(categoryGroup);
1154 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor())); 1156 connect(mCategoryButton,SIGNAL(changed(const QColor &)),SLOT(setCategoryColor()));
1155 updateCategoryColor(); 1157 updateCategoryColor();
1156 1158
1157 1159
1158 // Holiday Color 1160 // Holiday Color
1159 1161
1160 KPrefsDialogWidColor *holidayColor = 1162 KPrefsDialogWidColor *holidayColor =
1161 addWidColor(i18n("Holiday color:"), 1163 addWidColor(i18n("Holiday color:"),
1162 &(KOPrefs::instance()->mHolidayColor),topFrame); 1164 &(KOPrefs::instance()->mHolidayColor),topFrame);
1163 topLayout->addWidget(holidayColor->label(),ii,0); 1165 topLayout->addWidget(holidayColor->label(),ii,0);
1164 topLayout->addWidget(holidayColor->button(),ii++,1); 1166 topLayout->addWidget(holidayColor->button(),ii++,1);
1165 1167
1166 // Highlight Color 1168 // Highlight Color
1167 KPrefsDialogWidColor *highlightColor = 1169 KPrefsDialogWidColor *highlightColor =
1168 addWidColor(i18n("Highlight color:"), 1170 addWidColor(i18n("Highlight color:"),
1169 &(KOPrefs::instance()->mHighlightColor),topFrame); 1171 &(KOPrefs::instance()->mHighlightColor),topFrame);
1170 topLayout->addWidget(highlightColor->label(),ii,0); 1172 topLayout->addWidget(highlightColor->label(),ii,0);
1171 topLayout->addWidget(highlightColor->button(),ii++,1); 1173 topLayout->addWidget(highlightColor->button(),ii++,1);
1172 1174
1173 // Event color 1175 // Event color
1174 KPrefsDialogWidColor *eventColor = 1176 KPrefsDialogWidColor *eventColor =
1175 addWidColor(i18n("Default event color:"), 1177 addWidColor(i18n("Default event color:"),
1176 &(KOPrefs::instance()->mEventColor),topFrame); 1178 &(KOPrefs::instance()->mEventColor),topFrame);
1177 topLayout->addWidget(eventColor->label(),ii,0); 1179 topLayout->addWidget(eventColor->label(),ii,0);
1178 topLayout->addWidget(eventColor->button(),ii++,1); 1180 topLayout->addWidget(eventColor->button(),ii++,1);
1179 1181
1180 // agenda view background color 1182 // agenda view background color
1181 KPrefsDialogWidColor *agendaBgColor = 1183 KPrefsDialogWidColor *agendaBgColor =
1182 addWidColor(i18n("Agenda view background color:"), 1184 addWidColor(i18n("Agenda view background color:"),
1183 &(KOPrefs::instance()->mAgendaBgColor),topFrame); 1185 &(KOPrefs::instance()->mAgendaBgColor),topFrame);
1184 topLayout->addWidget(agendaBgColor->label(),ii,0); 1186 topLayout->addWidget(agendaBgColor->label(),ii,0);
1185 topLayout->addWidget(agendaBgColor->button(),ii++,1); 1187 topLayout->addWidget(agendaBgColor->button(),ii++,1);
1186 1188
1187 // working hours color 1189 // working hours color
1188 KPrefsDialogWidColor *workingHoursColor = 1190 KPrefsDialogWidColor *workingHoursColor =
1189 addWidColor(i18n("Working hours color:"), 1191 addWidColor(i18n("Working hours color:"),
1190 &(KOPrefs::instance()->mWorkingHoursColor),topFrame); 1192 &(KOPrefs::instance()->mWorkingHoursColor),topFrame);
1191 topLayout->addWidget(workingHoursColor->label(),ii,0); 1193 topLayout->addWidget(workingHoursColor->label(),ii,0);
1192 topLayout->addWidget(workingHoursColor->button(),ii++,1); 1194 topLayout->addWidget(workingHoursColor->button(),ii++,1);
1193 1195
1194 KPrefsDialogWidBool *sb = 1196 KPrefsDialogWidBool *sb =
1195 addWidBool(i18n("Use colors for application:"), 1197 addWidBool(i18n("Use colors for application:"),
1196 &(KOPrefs::instance()->mUseAppColors),topFrame); 1198 &(KOPrefs::instance()->mUseAppColors),topFrame);
1197 topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 ); 1199 topLayout->addMultiCellWidget(sb->checkBox(), ii, ii, 0,1 );
1198 1200
1199 ii++; 1201 ii++;
1200 KPrefsDialogWidColor * workingHoursColor1 = 1202 KPrefsDialogWidColor * workingHoursColor1 =
1201 addWidColor(i18n("Buttons, menus, etc.:"), 1203 addWidColor(i18n("Buttons, menus, etc.:"),
1202 &(KOPrefs::instance()->mAppColor1),topFrame); 1204 &(KOPrefs::instance()->mAppColor1),topFrame);
1203 topLayout->addWidget(workingHoursColor1->label(),ii,0); 1205 topLayout->addWidget(workingHoursColor1->label(),ii,0);
1204 topLayout->addWidget(workingHoursColor1->button(),ii++,1); 1206 topLayout->addWidget(workingHoursColor1->button(),ii++,1);
1205 1207
1206 KPrefsDialogWidColor * workingHoursColor2 = 1208 KPrefsDialogWidColor * workingHoursColor2 =
1207 addWidColor(i18n("Frames, labels, etc.:"), 1209 addWidColor(i18n("Frames, labels, etc.:"),
1208 &(KOPrefs::instance()->mAppColor2),topFrame); 1210 &(KOPrefs::instance()->mAppColor2),topFrame);
1209 topLayout->addWidget(workingHoursColor2->label(),ii,0); 1211 topLayout->addWidget(workingHoursColor2->label(),ii,0);
1210 topLayout->addWidget(workingHoursColor2->button(),ii++,1); 1212 topLayout->addWidget(workingHoursColor2->button(),ii++,1);
1211 1213
1212 1214
1213 1215
1214} 1216}
1215 1217
1216void KOPrefsDialog::setCategoryColor() 1218void KOPrefsDialog::setCategoryColor()
1217{ 1219{
1218 mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color())); 1220 mCategoryDict.replace(mCategoryCombo->currentText(), new QColor(mCategoryButton->color()));
1219} 1221}
1220 1222
1221void KOPrefsDialog::updateCategoryColor() 1223void KOPrefsDialog::updateCategoryColor()
1222{ 1224{
1223 QString cat = mCategoryCombo->currentText(); 1225 QString cat = mCategoryCombo->currentText();
1224 QColor *color = mCategoryDict.find(cat); 1226 QColor *color = mCategoryDict.find(cat);
1225 if (!color) { 1227 if (!color) {
1226 color = KOPrefs::instance()->categoryColor(cat); 1228 color = KOPrefs::instance()->categoryColor(cat);
1227 } 1229 }
1228 if (color) { 1230 if (color) {
1229 mCategoryButton->setColor(*color); 1231 mCategoryButton->setColor(*color);
1230 } 1232 }
1231} 1233}
1232 1234
1233void KOPrefsDialog::setupPrinterTab() 1235void KOPrefsDialog::setupPrinterTab()
1234{ 1236{
1235 mPrinterTab = addPage(i18n("Printing"),0, 1237 mPrinterTab = addPage(i18n("Printing"),0,
1236 DesktopIcon("fileprint",KIcon::SizeMedium)); 1238 DesktopIcon("fileprint",KIcon::SizeMedium));
1237 1239
1238 QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2); 1240 QGridLayout *topLayout = new QGridLayout(mPrinterTab,5,2);
1239 topLayout->setSpacing(spacingHint()); 1241 topLayout->setSpacing(spacingHint());
1240 topLayout->setMargin(marginHint()); 1242 topLayout->setMargin(marginHint());
1241 1243
1242 topLayout->setRowStretch(4,1); 1244 topLayout->setRowStretch(4,1);
1243} 1245}
1244 1246
1245void KOPrefsDialog::setupGroupSchedulingTab() 1247void KOPrefsDialog::setupGroupSchedulingTab()
1246{ 1248{
1247#if 0 1249#if 0
1248 QFrame *topFrame = addPage(i18n("Group Scheduling"),0, 1250 QFrame *topFrame = addPage(i18n("Group Scheduling"),0,
1249 DesktopIcon("personal",KIcon::SizeMedium)); 1251 DesktopIcon("personal",KIcon::SizeMedium));
1250 1252
1251 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 1253 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
1252 topLayout->setSpacing(spacingHint()); 1254 topLayout->setSpacing(spacingHint());
1253 topLayout->setMargin(marginHint()); 1255 topLayout->setMargin(marginHint());
1254 1256
1255#if 0 1257#if 0
1256 KPrefsDialogWidRadios *schedulerGroup = 1258 KPrefsDialogWidRadios *schedulerGroup =
1257 addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler), 1259 addWidRadios(i18n("Scheduler Mail Client"),&(KOPrefs::instance()->mIMIPScheduler),
1258 topFrame); 1260 topFrame);
1259 schedulerGroup->addRadio("Dummy"); // Only for debugging 1261 schedulerGroup->addRadio("Dummy"); // Only for debugging
1260 schedulerGroup->addRadio(i18n("Mail client")); 1262 schedulerGroup->addRadio(i18n("Mail client"));
1261 1263
1262 topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1); 1264 topLayout->addMultiCellWidget(schedulerGroup->groupBox(),0,0,0,1);
1263#endif 1265#endif
1264 1266
1265 KPrefsDialogWidRadios *sendGroup = 1267 KPrefsDialogWidRadios *sendGroup =
1266 addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend), 1268 addWidRadios(i18n("Scheduler Mails Should Be"),&(KOPrefs::instance()->mIMIPSend),
1267 topFrame); 1269 topFrame);
1268 sendGroup->addRadio(i18n("Send to outbox")); 1270 sendGroup->addRadio(i18n("Send to outbox"));
1269 sendGroup->addRadio(i18n("Send directly")); 1271 sendGroup->addRadio(i18n("Send directly"));
1270 1272
1271 topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1); 1273 topLayout->addMultiCellWidget(sendGroup->groupBox(),1,1,0,1);
1272 1274
1273 topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1); 1275 topLayout->addMultiCellWidget(new QLabel(i18n("Additional email addresses:"),topFrame),2,2,0,1);
1274 mAMails = new QListView(topFrame); 1276 mAMails = new QListView(topFrame);
1275 mAMails->addColumn(i18n("Email"),300); 1277 mAMails->addColumn(i18n("Email"),300);
1276 topLayout->addMultiCellWidget(mAMails,3,3,0,1); 1278 topLayout->addMultiCellWidget(mAMails,3,3,0,1);
1277 1279
1278 topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0); 1280 topLayout->addWidget(new QLabel(i18n("Additional email address:"),topFrame),4,0);
1279 aEmailsEdit = new QLineEdit(topFrame); 1281 aEmailsEdit = new QLineEdit(topFrame);
1280 aEmailsEdit->setEnabled(false); 1282 aEmailsEdit->setEnabled(false);
1281 topLayout->addWidget(aEmailsEdit,4,1); 1283 topLayout->addWidget(aEmailsEdit,4,1);
1282 1284
1283 QPushButton *add = new QPushButton(i18n("New"),topFrame,"new"); 1285 QPushButton *add = new QPushButton(i18n("New"),topFrame,"new");
1284 topLayout->addWidget(add,5,0); 1286 topLayout->addWidget(add,5,0);
1285 QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove"); 1287 QPushButton *del = new QPushButton(i18n("Remove"),topFrame,"remove");
1286 topLayout->addWidget(del,5,1); 1288 topLayout->addWidget(del,5,1);
1287 1289
1288 //topLayout->setRowStretch(2,1); 1290 //topLayout->setRowStretch(2,1);
1289 connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) ); 1291 connect(add, SIGNAL( clicked() ), this, SLOT(addItem()) );
1290 connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) ); 1292 connect(del, SIGNAL( clicked() ), this, SLOT(removeItem()) );
1291 connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem())); 1293 connect(aEmailsEdit,SIGNAL( textChanged(const QString&) ), this,SLOT(updateItem()));
1292 connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput())); 1294 connect(mAMails,SIGNAL(selectionChanged(QListViewItem *)),SLOT(updateInput()));
1293#endif 1295#endif
1294} 1296}
1295 1297
1296void KOPrefsDialog::setupGroupAutomationTab() 1298void KOPrefsDialog::setupGroupAutomationTab()
1297{ 1299{
1298 return; 1300 return;
1299 QFrame *topFrame = addPage(i18n("Group Automation"),0, 1301 QFrame *topFrame = addPage(i18n("Group Automation"),0,
1300 DesktopIcon("personal",KIcon::SizeMedium)); 1302 DesktopIcon("personal",KIcon::SizeMedium));
1301 1303
1302 QGridLayout *topLayout = new QGridLayout(topFrame,5,1); 1304 QGridLayout *topLayout = new QGridLayout(topFrame,5,1);
1303 topLayout->setSpacing(spacingHint()); 1305 topLayout->setSpacing(spacingHint());
1304 topLayout->setMargin(marginHint()); 1306 topLayout->setMargin(marginHint());
1305 1307
1306 KPrefsDialogWidRadios *autoRefreshGroup = 1308 KPrefsDialogWidRadios *autoRefreshGroup =
1307 addWidRadios(i18n("Auto Send Refresh"), 1309 addWidRadios(i18n("Auto Send Refresh"),
1308 &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame); 1310 &(KOPrefs::instance()->mIMIPAutoRefresh),topFrame);
1309 autoRefreshGroup->addRadio(i18n("Never")); 1311 autoRefreshGroup->addRadio(i18n("Never"));
1310 autoRefreshGroup->addRadio(i18n("If attendee is in addressbook")); 1312 autoRefreshGroup->addRadio(i18n("If attendee is in addressbook"));
1311 //autoRefreshGroup->addRadio(i18n("selected emails")); 1313 //autoRefreshGroup->addRadio(i18n("selected emails"));
1312 topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0); 1314 topLayout->addMultiCellWidget(autoRefreshGroup->groupBox(),0,0,0,0);
1313 1315
1314 KPrefsDialogWidRadios *autoInsertGroup = 1316 KPrefsDialogWidRadios *autoInsertGroup =
1315 addWidRadios(i18n("Auto Insert IMIP Replies"), 1317 addWidRadios(i18n("Auto Insert IMIP Replies"),
1316 &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame); 1318 &(KOPrefs::instance()->mIMIPAutoInsertReply),topFrame);
1317 autoInsertGroup->addRadio(i18n("Never")); 1319 autoInsertGroup->addRadio(i18n("Never"));
1318 autoInsertGroup->addRadio(i18n("If attendee is in addressbook")); 1320 autoInsertGroup->addRadio(i18n("If attendee is in addressbook"));
1319 //autoInsertGroup->addRadio(i18n("selected emails")); 1321 //autoInsertGroup->addRadio(i18n("selected emails"));
1320 topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0); 1322 topLayout->addMultiCellWidget(autoInsertGroup->groupBox(),1,1,0,0);
1321 1323
1322 KPrefsDialogWidRadios *autoRequestGroup = 1324 KPrefsDialogWidRadios *autoRequestGroup =
1323 addWidRadios(i18n("Auto Insert IMIP Requests"), 1325 addWidRadios(i18n("Auto Insert IMIP Requests"),
1324 &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame); 1326 &(KOPrefs::instance()->mIMIPAutoInsertRequest),topFrame);
1325 autoRequestGroup->addRadio(i18n("Never")); 1327 autoRequestGroup->addRadio(i18n("Never"));
1326 autoRequestGroup->addRadio(i18n("If organizer is in addressbook")); 1328 autoRequestGroup->addRadio(i18n("If organizer is in addressbook"));
1327 //autoInsertGroup->addRadio(i18n("selected emails")); 1329 //autoInsertGroup->addRadio(i18n("selected emails"));
1328 topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0); 1330 topLayout->addMultiCellWidget(autoRequestGroup->groupBox(),2,2,0,0);
1329 1331
1330 KPrefsDialogWidRadios *autoFreeBusyGroup = 1332 KPrefsDialogWidRadios *autoFreeBusyGroup =
1331 addWidRadios(i18n("Auto Send FreeBusy Information"), 1333 addWidRadios(i18n("Auto Send FreeBusy Information"),
1332 &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame); 1334 &(KOPrefs::instance()->mIMIPAutoFreeBusy),topFrame);
1333 autoFreeBusyGroup->addRadio(i18n("Never")); 1335 autoFreeBusyGroup->addRadio(i18n("Never"));
1334 autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook")); 1336 autoFreeBusyGroup->addRadio(i18n("If requested from an email in addressbook"));
1335 //autoFreeBusyGroup->addRadio(i18n("selected emails")); 1337 //autoFreeBusyGroup->addRadio(i18n("selected emails"));
1336 topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0); 1338 topLayout->addMultiCellWidget(autoFreeBusyGroup->groupBox(),3,3,0,0);
1337 1339
1338 KPrefsDialogWidRadios *autoFreeBusyReplyGroup = 1340 KPrefsDialogWidRadios *autoFreeBusyReplyGroup =
1339 addWidRadios(i18n("Auto Save FreeBusy Replies"), 1341 addWidRadios(i18n("Auto Save FreeBusy Replies"),
1340 &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame); 1342 &(KOPrefs::instance()->mIMIPAutoFreeBusyReply),topFrame);
1341 autoFreeBusyReplyGroup->addRadio(i18n("Never")); 1343 autoFreeBusyReplyGroup->addRadio(i18n("Never"));
1342 autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook")); 1344 autoFreeBusyReplyGroup->addRadio(i18n("If attendee is in addressbook"));
1343 //autoFreeBusyGroup->addRadio(i18n("selected emails")); 1345 //autoFreeBusyGroup->addRadio(i18n("selected emails"));
1344 topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0); 1346 topLayout->addMultiCellWidget(autoFreeBusyReplyGroup->groupBox(),4,4,0,0);
1345} 1347}
1346 1348
1347void KOPrefsDialog::showPrinterTab() 1349void KOPrefsDialog::showPrinterTab()
1348{ 1350{
1349 showPage(pageIndex(mPrinterTab)); 1351 showPage(pageIndex(mPrinterTab));
1350} 1352}
1351 1353
1352 1354
1353void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text, 1355void KOPrefsDialog::setCombo(QComboBox *combo, const QString & text,
1354 const QStringList *tags) 1356 const QStringList *tags)
1355{ 1357{
1356 if (tags) { 1358 if (tags) {
1357 int i = tags->findIndex(text); 1359 int i = tags->findIndex(text);
1358 if (i > 0) combo->setCurrentItem(i); 1360 if (i > 0) combo->setCurrentItem(i);
1359 } else { 1361 } else {
1360 for(int i=0;i<combo->count();++i) { 1362 for(int i=0;i<combo->count();++i) {
1361 if (combo->text(i) == text) { 1363 if (combo->text(i) == text) {
1362 combo->setCurrentItem(i); 1364 combo->setCurrentItem(i);
1363 break; 1365 break;
1364 } 1366 }
1365 } 1367 }
1366 } 1368 }
1367} 1369}
1368 1370
1369void KOPrefsDialog::usrReadConfig() 1371void KOPrefsDialog::usrReadConfig()
1370{ 1372{
1371 kdelibcfg->readConfig(); 1373 kdelibcfg->readConfig();
1372 mNameEdit->setText(KOPrefs::instance()->fullName()); 1374 mNameEdit->setText(KOPrefs::instance()->fullName());
1373 mEmailEdit->setText(KOPrefs::instance()->email()); 1375 mEmailEdit->setText(KOPrefs::instance()->email());
1374 1376
1375 mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval); 1377 mAutoSaveIntervalSpin->setValue(KOPrefs::instance()->mAutoSaveInterval);
1376 // QDate current ( 2001, 1,1); 1378 // QDate current ( 2001, 1,1);
1377 //mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); 1379 //mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1));
1378 //mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); 1380 //mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1));
1379 //setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId)); 1381 //setCombo(mTimeZoneCombo,i18n(KOPrefs::instance()->mTimeZoneId));
1380 //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); 1382 //mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset);
1381 mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime); 1383 mStartTimeSpin->setValue(KOPrefs::instance()->mStartTime);
1382 mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration); 1384 mDefaultDurationSpin->setValue(KOPrefs::instance()->mDefaultDuration);
1383 mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime); 1385 mAlarmTimeCombo->setCurrentItem(KOPrefs::instance()->mAlarmTime);
1384 // if (KOPrefs::instance()->mAllDaySize > 47 ) 1386 // if (KOPrefs::instance()->mAllDaySize > 47 )
1385 // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2; 1387 // KOPrefs::instance()->mAllDaySize = KOPrefs::instance()->mAllDaySize/2;
1386 //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize); 1388 //mHourSizeSlider->setValue(KOPrefs::instance()->mAllDaySize);
1387 1389
1388 mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays); 1390 mNextXDaysSpin->setValue(KOPrefs::instance()->mNextXDays);
1389 mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays); 1391 mWhatsNextSpin->setValue(KOPrefs::instance()->mWhatsNextDays);
1390 mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios); 1392 mPrioSpin->setValue(KOPrefs::instance()->mWhatsNextPrios);
1391 // mAMails->clear(); 1393 // mAMails->clear();
1392 // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin(); 1394 // for ( QStringList::Iterator it = KOPrefs::instance()->mAdditionalMails.begin();
1393// it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) { 1395// it != KOPrefs::instance()->mAdditionalMails.end(); ++it ) {
1394// QListViewItem *item = new QListViewItem(mAMails); 1396// QListViewItem *item = new QListViewItem(mAMails);
1395// item->setText(0,*it); 1397// item->setText(0,*it);
1396// mAMails->insertItem(item); 1398// mAMails->insertItem(item);
1397// } 1399// }
1398 1400
1399 // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP); 1401 // mRemoteIPEdit->setText(KOPrefs::instance()->mRemoteIP);
1400 //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser); 1402 //mRemoteUser->setText(KOPrefs::instance()->mRemoteUser);
1401 //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd); 1403 //mRemotePassWd->setText(KOPrefs::instance()->mRemotePassWd);
1402 //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile); 1404 //mRemoteFile->setText(KOPrefs::instance()->mRemoteFile);
1403 1405
1404 //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile); 1406 //that soundmLocalTempFile->setText(KOPrefs::instance()->mLocalTempFile);
1405 mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile); 1407 mDefaultAlarmFile->setText(KOPrefs::instance()->mDefaultAlarmFile);
1406 //QString dummy = KOPrefs::instance()->mUserDateFormatLong; 1408 //QString dummy = KOPrefs::instance()->mUserDateFormatLong;
1407 //mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") )); 1409 //mUserDateFormatLong->setText(dummy.replace( QRegExp("K"), QString(",") ));
1408 //dummy = KOPrefs::instance()->mUserDateFormatShort; 1410 //dummy = KOPrefs::instance()->mUserDateFormatShort;
1409 //mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") )); 1411 //mUserDateFormatShort->setText(dummy.replace( QRegExp("K"), QString(",") ));
1410 updateCategories(); 1412 updateCategories();
1411 mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps ); 1413 mAlarmPlayBeeps->setValue(KOPrefs::instance()->mAlarmPlayBeeps );
1412 mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime ); 1414 mAlarmSuspendTime->setValue(KOPrefs::instance()->mAlarmSuspendTime );
1413 mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount ); 1415 mAlarmSuspendCount->setValue(KOPrefs::instance()->mAlarmSuspendCount );
1414 mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval ); 1416 mAlarmBeepInterval->setValue(KOPrefs::instance()->mAlarmBeepInterval );
1415} 1417}
1416 1418
1417 1419
1418void KOPrefsDialog::usrWriteConfig() 1420void KOPrefsDialog::usrWriteConfig()
1419{ 1421{
1420 1422
1421 kdelibcfg->writeConfig(); 1423 kdelibcfg->writeConfig();
1422 // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text(); 1424 // KOPrefs::instance()->mRemoteIP = mRemoteIPEdit->text();
1423 //KOPrefs::instance()->mRemoteUser = mRemoteUser->text(); 1425 //KOPrefs::instance()->mRemoteUser = mRemoteUser->text();
1424 //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text(); 1426 //KOPrefs::instance()->mRemotePassWd = mRemotePassWd->text();
1425 //KOPrefs::instance()->mRemoteFile= mRemoteFile->text(); 1427 //KOPrefs::instance()->mRemoteFile= mRemoteFile->text();
1426 //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text(); 1428 //KOPrefs::instance()->mLocalTempFile =mLocalTempFile->text();
1427 KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text(); 1429 KOPrefs::instance()->mDefaultAlarmFile =mDefaultAlarmFile->text();
1428 1430
1429 //KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") ); 1431 //KOPrefs::instance()->mUserDateFormatShort = mUserDateFormatShort->text().replace( QRegExp(","), QString("K") );
1430 //KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") ); 1432 //KOPrefs::instance()->mUserDateFormatLong = mUserDateFormatLong->text().replace( QRegExp(","), QString("K") );
1431 KOPrefs::instance()->setFullName(mNameEdit->text()); 1433 KOPrefs::instance()->setFullName(mNameEdit->text());
1432 KOPrefs::instance()->setEmail(mEmailEdit->text()); 1434 KOPrefs::instance()->setEmail(mEmailEdit->text());
1433 1435
1434 KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value(); 1436 KOPrefs::instance()->mAutoSaveInterval = mAutoSaveIntervalSpin->value();
1435 1437
1436 // KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText(); 1438 // KOPrefs::instance()->mTimeZoneId = mTimeZoneCombo->currentText();
1437 //QDate date; 1439 //QDate date;
1438 //date = mStartDateSavingEdit->date(); 1440 //date = mStartDateSavingEdit->date();
1439 //int sub = 0; 1441 //int sub = 0;
1440 //if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 1442 //if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
1441 // sub = 1; 1443 // sub = 1;
1442// KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub; 1444// KOPrefs::instance()->mDaylightsavingStart = date.dayOfYear()-sub;
1443// date = mEndDateSavingEdit->date(); 1445// date = mEndDateSavingEdit->date();
1444// if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 ) 1446// if ( QDate::leapYear( date.year() ) && date.dayOfYear() > 59 )
1445// sub = 1; 1447// sub = 1;
1446// else 1448// else
1447// sub = 0; 1449// sub = 0;
1448// KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub; 1450// KOPrefs::instance()->mDaylightsavingEnd = date.dayOfYear()-sub;
1449// // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value(); 1451// // KOPrefs::instance()->mTimeZoneOffset = mTimezoneOffsetSpin->value();
1450 1452
1451 KOPrefs::instance()->mStartTime = mStartTimeSpin->value(); 1453 KOPrefs::instance()->mStartTime = mStartTimeSpin->value();
1452 KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value(); 1454 KOPrefs::instance()->mDefaultDuration = mDefaultDurationSpin->value();
1453 KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem(); 1455 KOPrefs::instance()->mAlarmTime = mAlarmTimeCombo->currentItem();
1454 1456
1455 //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value(); 1457 //KOPrefs::instance()->mAllDaySize = mHourSizeSlider->value();
1456 1458
1457 QDictIterator<QColor> it(mCategoryDict); 1459 QDictIterator<QColor> it(mCategoryDict);
1458 while (it.current()) { 1460 while (it.current()) {
1459 KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current()); 1461 KOPrefs::instance()->setCategoryColor(it.currentKey(),*it.current());
1460 ++it; 1462 ++it;
1461 } 1463 }
1462 1464
1463 KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value(); 1465 KOPrefs::instance()->mNextXDays = mNextXDaysSpin->value();
1464 KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value(); 1466 KOPrefs::instance()->mWhatsNextDays = mWhatsNextSpin->value();
1465 KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value(); 1467 KOPrefs::instance()->mWhatsNextPrios = mPrioSpin->value();
1466 1468
1467 KOPrefs::instance()->mAdditionalMails.clear(); 1469 KOPrefs::instance()->mAdditionalMails.clear();
1468 // QListViewItem *item; 1470 // QListViewItem *item;
1469 // item = mAMails->firstChild(); 1471 // item = mAMails->firstChild();
1470 // while (item) 1472 // while (item)
1471 // { 1473 // {
1472 // KOPrefs::instance()->mAdditionalMails.append( item->text(0) ); 1474 // KOPrefs::instance()->mAdditionalMails.append( item->text(0) );
1473 // item = item->nextSibling(); 1475 // item = item->nextSibling();
1474 // } 1476 // }
1475 KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value(); 1477 KOPrefs::instance()->mAlarmPlayBeeps = mAlarmPlayBeeps->value();
1476 KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ; 1478 KOPrefs::instance()->mAlarmSuspendTime = mAlarmSuspendTime->value() ;
1477 KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ; 1479 KOPrefs::instance()->mAlarmSuspendCount= mAlarmSuspendCount->value() ;
1478 KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ; 1480 KOPrefs::instance()->mAlarmBeepInterval= mAlarmBeepInterval->value() ;
1479 1481
1480} 1482}
1481 1483
1482void KOPrefsDialog::updateCategories() 1484void KOPrefsDialog::updateCategories()
1483{ 1485{
1484 mCategoryCombo->clear(); 1486 mCategoryCombo->clear();
1485 mCategoryDict.clear(); 1487 mCategoryDict.clear();
1486 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories); 1488 mCategoryCombo->insertStringList(KOPrefs::instance()->mCustomCategories);
1487 updateCategoryColor(); 1489 updateCategoryColor();
1488} 1490}
1489 1491
1490void KOPrefsDialog::warningGroupScheduling() 1492void KOPrefsDialog::warningGroupScheduling()
1491{ 1493{
1492 warningExperimental(mEnableGroupScheduling->checkBox()->isChecked()); 1494 warningExperimental(mEnableGroupScheduling->checkBox()->isChecked());
1493} 1495}
1494 1496
1495void KOPrefsDialog::warningProjectView() 1497void KOPrefsDialog::warningProjectView()
1496{ 1498{
1497 warningExperimental(mEnableProjectView->checkBox()->isChecked()); 1499 warningExperimental(mEnableProjectView->checkBox()->isChecked());
1498} 1500}
1499 1501
1500void KOPrefsDialog::warningExperimental(bool on) 1502void KOPrefsDialog::warningExperimental(bool on)
1501{ 1503{
1502 if (on) { 1504 if (on) {
1503 KMessageBox::information(this,i18n("This is an experimental feature. " 1505 KMessageBox::information(this,i18n("This is an experimental feature. "
1504 "It may not work, it may do nothing useful and it may cause data loss. " 1506 "It may not work, it may do nothing useful and it may cause data loss. "
1505 "Use with care.\n" 1507 "Use with care.\n"
1506 "You have to restart KOrganizer for this setting to take effect.")); 1508 "You have to restart KOrganizer for this setting to take effect."));
1507 } else { 1509 } else {
1508 KMessageBox::information(this, 1510 KMessageBox::information(this,
1509 i18n("You have to restart KOrganizer for this setting to take effect.")); 1511 i18n("You have to restart KOrganizer for this setting to take effect."));
1510 } 1512 }
1511} 1513}
1512 1514
1513void KOPrefsDialog::toggleEmailSettings(bool on) 1515void KOPrefsDialog::toggleEmailSettings(bool on)
1514{ 1516{
1515 if (on) { 1517 if (on) {
1516 mEmailEdit->setEnabled(false); 1518 mEmailEdit->setEnabled(false);
1517 mNameEdit->setEnabled(false); 1519 mNameEdit->setEnabled(false);
1518 mEmailLabel->setEnabled(false); 1520 mEmailLabel->setEnabled(false);
1519 mNameLabel->setEnabled(false); 1521 mNameLabel->setEnabled(false);
1520 1522
1521 KEMailSettings settings; 1523 KEMailSettings settings;
1522 mNameEdit->setText(settings.getSetting(KEMailSettings::RealName)); 1524 mNameEdit->setText(settings.getSetting(KEMailSettings::RealName));
1523 mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress)); 1525 mEmailEdit->setText(settings.getSetting(KEMailSettings::EmailAddress));
1524 } else { 1526 } else {
1525 mEmailEdit->setEnabled(true); 1527 mEmailEdit->setEnabled(true);
1526 mNameEdit->setEnabled(true); 1528 mNameEdit->setEnabled(true);
1527 mEmailLabel->setEnabled(true); 1529 mEmailLabel->setEnabled(true);
1528 mNameLabel->setEnabled(true); 1530 mNameLabel->setEnabled(true);
1529 } 1531 }
1530} 1532}
1531 1533
1532void KOPrefsDialog::addItem() 1534void KOPrefsDialog::addItem()
1533{ 1535{
1534 // aEmailsEdit->setEnabled(true); 1536 // aEmailsEdit->setEnabled(true);
1535// QListViewItem *item = new QListViewItem(mAMails); 1537// QListViewItem *item = new QListViewItem(mAMails);
1536// mAMails->insertItem(item); 1538// mAMails->insertItem(item);
1537// mAMails->setSelected(item,true); 1539// mAMails->setSelected(item,true);
1538// aEmailsEdit->setText(i18n("(EmptyEmail)")); 1540// aEmailsEdit->setText(i18n("(EmptyEmail)"));
1539} 1541}
1540 1542
1541void KOPrefsDialog::removeItem() 1543void KOPrefsDialog::removeItem()
1542{ 1544{
1543// QListViewItem *item; 1545// QListViewItem *item;
1544// item = mAMails->selectedItem(); 1546// item = mAMails->selectedItem();
1545// if (!item) return; 1547// if (!item) return;
1546// mAMails->takeItem(item); 1548// mAMails->takeItem(item);
1547// item = mAMails->selectedItem(); 1549// item = mAMails->selectedItem();
1548// if (!item) { 1550// if (!item) {
1549// aEmailsEdit->setText(""); 1551// aEmailsEdit->setText("");
1550// aEmailsEdit->setEnabled(false); 1552// aEmailsEdit->setEnabled(false);
1551// } 1553// }
1552// if (mAMails->childCount() == 0) { 1554// if (mAMails->childCount() == 0) {
1553// aEmailsEdit->setEnabled(false); 1555// aEmailsEdit->setEnabled(false);
1554// } 1556// }
1555} 1557}
1556 1558
1557void KOPrefsDialog::updateItem() 1559void KOPrefsDialog::updateItem()
1558{ 1560{
1559 // QListViewItem *item; 1561 // QListViewItem *item;
1560// item = mAMails->selectedItem(); 1562// item = mAMails->selectedItem();
1561// if (!item) return; 1563// if (!item) return;
1562// item->setText(0,aEmailsEdit->text()); 1564// item->setText(0,aEmailsEdit->text());
1563} 1565}
1564 1566
1565void KOPrefsDialog::updateInput() 1567void KOPrefsDialog::updateInput()
1566{ 1568{
1567// QListViewItem *item; 1569// QListViewItem *item;
1568// item = mAMails->selectedItem(); 1570// item = mAMails->selectedItem();
1569// if (!item) return; 1571// if (!item) return;
1570// aEmailsEdit->setEnabled(true); 1572// aEmailsEdit->setEnabled(true);
1571// aEmailsEdit->setText(item->text(0)); 1573// aEmailsEdit->setText(item->text(0));
1572} 1574}
1573void KOPrefsDialog::updateTimezoneOffset( int index ) 1575void KOPrefsDialog::updateTimezoneOffset( int index )
1574{ 1576{
1575 /* 1577 /*
1576 qDebug("updateTimezoneOffset %d ", index); 1578 qDebug("updateTimezoneOffset %d ", index);
1577 if ( index < 24 ) { 1579 if ( index < 24 ) {
1578 mTimezoneOffsetSpin->setEnabled ( false ); 1580 mTimezoneOffsetSpin->setEnabled ( false );
1579 mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 ); 1581 mTimezoneOffsetSpin->setValue( ( index-11 ) * 60 );
1580 1582
1581 1583
1582 } else { 1584 } else {
1583 if ( index == 24 ) { 1585 if ( index == 24 ) {
1584 mTimezoneOffsetSpin->setEnabled ( true ); 1586 mTimezoneOffsetSpin->setEnabled ( true );
1585 mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset); 1587 mTimezoneOffsetSpin->setValue( KOPrefs::instance()->mTimeZoneOffset);
1586 1588
1587 } else { 1589 } else {
1588 mTimezoneOffsetSpin->setEnabled ( false ); 1590 mTimezoneOffsetSpin->setEnabled ( false );
1589 mTimezoneOffsetSpin->setValue( 0 ); 1591 mTimezoneOffsetSpin->setValue( 0 );
1590 } 1592 }
1591 } 1593 }
1592 */ 1594 */
1593} 1595}
1594 1596
1595void KOPrefsDialog::setupTimeZoneTab() 1597void KOPrefsDialog::setupTimeZoneTab()
1596{ 1598{
1597#if 0 1599#if 0
1598 QFrame *topFrame = addPage(i18n("Time Zone"),0,0); 1600 QFrame *topFrame = addPage(i18n("Time Zone"),0,0);
1599 // DesktopIcon("clock",KIcon::SizeMedium)); 1601 // DesktopIcon("clock",KIcon::SizeMedium));
1600 1602
1601 QGridLayout *topLayout = new QGridLayout(topFrame,5,2); 1603 QGridLayout *topLayout = new QGridLayout(topFrame,5,2);
1602 topLayout->setSpacing(spacingHint()); 1604 topLayout->setSpacing(spacingHint());
1603 topLayout->setMargin(marginHint()); 1605 topLayout->setMargin(marginHint());
1604 1606
1605 QHBox *timeZoneBox = new QHBox( topFrame ); 1607 QHBox *timeZoneBox = new QHBox( topFrame );
1606 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 ); 1608 topLayout->addMultiCellWidget( timeZoneBox, 0, 0, 0, 1 );
1607 1609
1608 new QLabel( i18n("Timezone:"), timeZoneBox ); 1610 new QLabel( i18n("Timezone:"), timeZoneBox );
1609 mTimeZoneCombo = new QComboBox( timeZoneBox ); 1611 mTimeZoneCombo = new QComboBox( timeZoneBox );
1610 if ( QApplication::desktop()->width() < 300 ) { 1612 if ( QApplication::desktop()->width() < 300 ) {
1611 mTimeZoneCombo->setMaximumWidth(150); 1613 mTimeZoneCombo->setMaximumWidth(150);
1612 } 1614 }
1613 1615
1614 QStringList list; 1616 QStringList list;
1615 list = KGlobal::locale()->timeZoneList(); 1617 list = KGlobal::locale()->timeZoneList();
1616 mTimeZoneCombo->insertStringList(list); 1618 mTimeZoneCombo->insertStringList(list);
1617 1619
1618 // find the currently set time zone and select it 1620 // find the currently set time zone and select it
1619 QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId; 1621 QString sCurrentlySet = KOPrefs::instance()->mTimeZoneId;
1620 int nCurrentlySet = 11; 1622 int nCurrentlySet = 11;
1621 for (int i = 0; i < mTimeZoneCombo->count(); i++) 1623 for (int i = 0; i < mTimeZoneCombo->count(); i++)
1622 { 1624 {
1623 if (mTimeZoneCombo->text(i) == sCurrentlySet) 1625 if (mTimeZoneCombo->text(i) == sCurrentlySet)
1624 { 1626 {
1625 nCurrentlySet = i; 1627 nCurrentlySet = i;
1626 break; 1628 break;
1627 } 1629 }
1628 } 1630 }
1629 mTimeZoneCombo->setCurrentItem(nCurrentlySet); 1631 mTimeZoneCombo->setCurrentItem(nCurrentlySet);
1630 int iii = 1; 1632 int iii = 1;
1631 KPrefsDialogWidBool *sb = 1633 KPrefsDialogWidBool *sb =
1632 addWidBool(i18n("Timezone has daylight saving"), 1634 addWidBool(i18n("Timezone has daylight saving"),
1633 &(KOPrefs::instance()->mUseDaylightsaving),topFrame); 1635 &(KOPrefs::instance()->mUseDaylightsaving),topFrame);
1634 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1); 1636 topLayout->addMultiCellWidget(sb->checkBox(), iii,iii,0,1);
1635 ++iii; 1637 ++iii;
1636 QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame ); 1638 QLabel* lab = new QLabel( i18n("Actual start and end is the\nsunday before this date."), topFrame );
1637 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 1639 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
1638 ++iii; 1640 ++iii;
1639 lab = new QLabel( i18n("The year in the date is ignored."), topFrame ); 1641 lab = new QLabel( i18n("The year in the date is ignored."), topFrame );
1640 topLayout->addMultiCellWidget(lab, iii,iii,0,1); 1642 topLayout->addMultiCellWidget(lab, iii,iii,0,1);
1641 ++iii; 1643 ++iii;
1642 lab = new QLabel( i18n("Daylight start:"), topFrame ); 1644 lab = new QLabel( i18n("Daylight start:"), topFrame );
1643 topLayout->addWidget(lab, iii,0); 1645 topLayout->addWidget(lab, iii,0);
1644 mStartDateSavingEdit = new KDateEdit(topFrame); 1646 mStartDateSavingEdit = new KDateEdit(topFrame);
1645 topLayout->addWidget(mStartDateSavingEdit, iii,1); 1647 topLayout->addWidget(mStartDateSavingEdit, iii,1);
1646 ++iii; 1648 ++iii;
1647 1649
1648 lab = new QLabel( i18n("Daylight end:"), topFrame ); 1650 lab = new QLabel( i18n("Daylight end:"), topFrame );
1649 topLayout->addWidget(lab, iii,0); 1651 topLayout->addWidget(lab, iii,0);
1650 mEndDateSavingEdit = new KDateEdit(topFrame); 1652 mEndDateSavingEdit = new KDateEdit(topFrame);
1651 topLayout->addWidget(mEndDateSavingEdit, iii,1); 1653 topLayout->addWidget(mEndDateSavingEdit, iii,1);
1652 ++iii; 1654 ++iii;
1653 QDate current ( 2001, 1,1); 1655 QDate current ( 2001, 1,1);
1654 mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1)); 1656 mStartDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingStart-1));
1655 mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1)); 1657 mEndDateSavingEdit->setDate(current.addDays(KOPrefs::instance()->mDaylightsavingEnd-1));
1656#endif 1658#endif
1657 1659
1658} 1660}
1659 1661
diff --git a/korganizer/korganizer.pro b/korganizer/korganizer.pro
index c2602b2..4d67dca 100644
--- a/korganizer/korganizer.pro
+++ b/korganizer/korganizer.pro
@@ -1,193 +1,191 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG = qt warn_on 2 CONFIG += qt warn_off
3 TARGET = kopi 3 TARGET = kopi
4OBJECTS_DIR = _obj/ 4OBJECTS_DIR = _obj/
5MOC_DIR = _moc 5MOC_DIR = _moc
6DESTDIR= ../bin 6DESTDIR= ../bin
7 7
8include( ../variables.pri ) 8include( ../variables.pri )
9 9
10INCLUDEPATH += ../microkde ../ interfaces ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile ../microkde/kio/kio ../libkdepim 10INCLUDEPATH += ../microkde ../ interfaces ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile ../microkde/kio/kio ../libkdepim
11#../qtcompat 11#../qtcompat
12DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL 12DEFINES += KORG_NODND KORG_NOPLUGINS KORG_NOARCHIVE KORG_NOMAIL
13DEFINES += KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER 13DEFINES += KORG_NODCOP KORG_NOKALARMD KORG_NORESOURCEVIEW KORG_NOSPLITTER
14#KORG_NOPRINTER KORG_NOKABC 14#KORG_NOPRINTER KORG_NOKABC
15DEFINES += KORG_NOLVALTERNATION 15DEFINES += KORG_NOLVALTERNATION
16DEFINES += DESKTOP_VERSION 16DEFINES += DESKTOP_VERSION
17unix : { 17unix : {
18LIBS += ../bin/libmicrokdepim.so 18LIBS += ../bin/libmicrokdepim.so
19LIBS += ../bin/libmicrokcal.so 19LIBS += ../bin/libmicrokcal.so
20LIBS += ../bin/libmicrokde.so 20LIBS += ../bin/libmicrokde.so
21LIBS += ../bin/libmicrokabc.so 21LIBS += ../bin/libmicrokabc.so
22#LIBS += -lbluetooth 22#LIBS += -lbluetooth
23#LIBS += -lsdp 23#LIBS += -lsdp
24 24
25#LIBS += -lldap 25#LIBS += -lldap
26OBJECTS_DIR = obj/unix 26OBJECTS_DIR = obj/unix
27MOC_DIR = moc/unix 27MOC_DIR = moc/unix
28} 28}
29win32: { 29win32: {
30RC_FILE = winicons.rc 30RC_FILE = winicons.rc
31DEFINES += _WIN32_ 31DEFINES += _WIN32_
32LIBS += ../bin/microkdepim.lib 32LIBS += ../bin/microkdepim.lib
33LIBS += ../bin/microkcal.lib 33LIBS += ../bin/microkcal.lib
34LIBS += ../bin/microkde.lib 34LIBS += ../bin/microkde.lib
35LIBS += ../bin/microkabc.lib 35LIBS += ../bin/microkabc.lib
36LIBS += ../libical/lib/ical.lib 36LIBS += ../libical/lib/ical.lib
37LIBS += ../libical/lib/icalss.lib 37LIBS += ../libical/lib/icalss.lib
38#LIBS += atls.lib 38#LIBS += atls.lib
39LIBS += mfc71u.lib
40QMAKE_LINK += /NODEFAULTLIB:LIBC 39QMAKE_LINK += /NODEFAULTLIB:LIBC
41#QMAKE_LINK += /NODEFAULTLIB:MSVCRT 40#QMAKE_LINK += /NODEFAULTLIB:MSVCRT
42#QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib 41#QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib
43OBJECTS_DIR = obj/win 42OBJECTS_DIR = obj/win
44MOC_DIR = moc/win 43MOC_DIR = moc/win
44#olimport section
45#blabla: {
46LIBS += mfc71u.lib
47DEFINES += _OL_IMPORT_
48
49HEADERS += ../outport/msoutl9.h \
50 koimportoldialog.h
51SOURCES += ../outport/msoutl9.cpp \
52 koimportoldialog.cpp
53#}
54#olimport section end
55
45} 56}
46 57
47 58
48INTERFACES = kofilterview_base.ui 59INTERFACES = kofilterview_base.ui
49#filteredit_base.ui 60#filteredit_base.ui
50 61
51# kdateedit.h \ 62# kdateedit.h \
52 63
53HEADERS = \ 64HEADERS += \
54 filteredit_base.h \ 65 filteredit_base.h \
55 alarmclient.h \ 66 alarmclient.h \
56 calendarview.h \ 67 calendarview.h \
57 customlistviewitem.h \ 68 customlistviewitem.h \
58 datenavigator.h \ 69 datenavigator.h \
59 docprefs.h \ 70 docprefs.h \
60 filtereditdialog.h \ 71 filtereditdialog.h \
61 incomingdialog.h \ 72 incomingdialog.h \
62 incomingdialog_base.h \ 73 incomingdialog_base.h \
63 interfaces/korganizer/baseview.h \ 74 interfaces/korganizer/baseview.h \
64 interfaces/korganizer/calendarviewbase.h \ 75 interfaces/korganizer/calendarviewbase.h \
65 journalentry.h \ 76 journalentry.h \
66 kdatenavigator.h \ 77 kdatenavigator.h \
67 koagenda.h \ 78 koagenda.h \
68 koagendaitem.h \ 79 koagendaitem.h \
69 koagendaview.h \ 80 koagendaview.h \
70 kocounterdialog.h \ 81 kocounterdialog.h \
71 kodaymatrix.h \ 82 kodaymatrix.h \
72 kodialogmanager.h \ 83 kodialogmanager.h \
73 koeditordetails.h \ 84 koeditordetails.h \
74 koeditorgeneral.h \ 85 koeditorgeneral.h \
75 koeditorgeneralevent.h \ 86 koeditorgeneralevent.h \
76 koeditorgeneraltodo.h \ 87 koeditorgeneraltodo.h \
77 koeditorrecurrence.h \ 88 koeditorrecurrence.h \
78 koeventeditor.h \ 89 koeventeditor.h \
79 koeventpopupmenu.h \ 90 koeventpopupmenu.h \
80 koeventview.h \ 91 koeventview.h \
81 koeventviewer.h \ 92 koeventviewer.h \
82 koeventviewerdialog.h \ 93 koeventviewerdialog.h \
83 kofilterview.h \ 94 kofilterview.h \
84 koglobals.h \ 95 koglobals.h \
85 koincidenceeditor.h \ 96 koincidenceeditor.h \
86 kojournalview.h \ 97 kojournalview.h \
87 kolistview.h \ 98 kolistview.h \
88 kolocationbox.h \ 99 kolocationbox.h \
89 komonthview.h \ 100 komonthview.h \
90 koprefs.h \ 101 koprefs.h \
91 koprefsdialog.h \ 102 koprefsdialog.h \
92 kotimespanview.h \ 103 kotimespanview.h \
93 kotodoeditor.h \ 104 kotodoeditor.h \
94 kotodoview.h \ 105 kotodoview.h \
95 kotodoviewitem.h \ 106 kotodoviewitem.h \
96 koviewmanager.h \ 107 koviewmanager.h \
97 kowhatsnextview.h \ 108 kowhatsnextview.h \
98 ktimeedit.h \ 109 ktimeedit.h \
99 lineview.h \ 110 lineview.h \
100 mainwindow.h \ 111 mainwindow.h \
101 navigatorbar.h \ 112 navigatorbar.h \
102 outgoingdialog.h \ 113 outgoingdialog.h \
103 outgoingdialog_base.h \ 114 outgoingdialog_base.h \
104 publishdialog.h \ 115 publishdialog.h \
105 publishdialog_base.h \ 116 publishdialog_base.h \
106 savetemplatedialog.h \ 117 savetemplatedialog.h \
107 searchdialog.h \ 118 searchdialog.h \
108 simplealarmclient.h \ 119 simplealarmclient.h \
109 statusdialog.h \ 120 statusdialog.h \
110 timeline.h \ 121 timeline.h \
111 timespanview.h \ 122 timespanview.h \
112 version.h \ 123 version.h \
113 ../kalarmd/alarmdialog.h \ 124 ../kalarmd/alarmdialog.h \
114 125
115 126
116SOURCES = \ 127SOURCES += \
117filteredit_base.cpp \ 128filteredit_base.cpp \
118 calendarview.cpp \ 129 calendarview.cpp \
119 datenavigator.cpp \ 130 datenavigator.cpp \
120 docprefs.cpp \ 131 docprefs.cpp \
121 filtereditdialog.cpp \ 132 filtereditdialog.cpp \
122 incomingdialog.cpp \ 133 incomingdialog.cpp \
123 incomingdialog_base.cpp \ 134 incomingdialog_base.cpp \
124 journalentry.cpp \ 135 journalentry.cpp \
125 kdatenavigator.cpp \ 136 kdatenavigator.cpp \
126 koagenda.cpp \ 137 koagenda.cpp \
127 koagendaitem.cpp \ 138 koagendaitem.cpp \
128 koagendaview.cpp \ 139 koagendaview.cpp \
129 kocounterdialog.cpp \ 140 kocounterdialog.cpp \
130 kodaymatrix.cpp \ 141 kodaymatrix.cpp \
131 kodialogmanager.cpp \ 142 kodialogmanager.cpp \
132 koeditordetails.cpp \ 143 koeditordetails.cpp \
133 koeditorgeneral.cpp \ 144 koeditorgeneral.cpp \
134 koeditorgeneralevent.cpp \ 145 koeditorgeneralevent.cpp \
135 koeditorgeneraltodo.cpp \ 146 koeditorgeneraltodo.cpp \
136 koeditorrecurrence.cpp \ 147 koeditorrecurrence.cpp \
137 koeventeditor.cpp \ 148 koeventeditor.cpp \
138 koeventpopupmenu.cpp \ 149 koeventpopupmenu.cpp \
139 koeventview.cpp \ 150 koeventview.cpp \
140 koeventviewer.cpp \ 151 koeventviewer.cpp \
141 koeventviewerdialog.cpp \ 152 koeventviewerdialog.cpp \
142 kofilterview.cpp \ 153 kofilterview.cpp \
143 koglobals.cpp \ 154 koglobals.cpp \
144 koincidenceeditor.cpp \ 155 koincidenceeditor.cpp \
145 kojournalview.cpp \ 156 kojournalview.cpp \
146 kolistview.cpp \ 157 kolistview.cpp \
147 kolocationbox.cpp \ 158 kolocationbox.cpp \
148 komonthview.cpp \ 159 komonthview.cpp \
149 koprefs.cpp \ 160 koprefs.cpp \
150 koprefsdialog.cpp \ 161 koprefsdialog.cpp \
151 kotimespanview.cpp \ 162 kotimespanview.cpp \
152 kotodoeditor.cpp \ 163 kotodoeditor.cpp \
153 kotodoview.cpp \ 164 kotodoview.cpp \
154 kotodoviewitem.cpp \ 165 kotodoviewitem.cpp \
155 koviewmanager.cpp \ 166 koviewmanager.cpp \
156 kowhatsnextview.cpp \ 167 kowhatsnextview.cpp \
157 ktimeedit.cpp \ 168 ktimeedit.cpp \
158 lineview.cpp \ 169 lineview.cpp \
159 main.cpp \ 170 main.cpp \
160 mainwindow.cpp \ 171 mainwindow.cpp \
161 navigatorbar.cpp \ 172 navigatorbar.cpp \
162 outgoingdialog.cpp \ 173 outgoingdialog.cpp \
163 outgoingdialog_base.cpp \ 174 outgoingdialog_base.cpp \
164 publishdialog.cpp \ 175 publishdialog.cpp \
165 publishdialog_base.cpp \ 176 publishdialog_base.cpp \
166 savetemplatedialog.cpp \ 177 savetemplatedialog.cpp \
167 searchdialog.cpp \ 178 searchdialog.cpp \
168 simplealarmclient.cpp \ 179 simplealarmclient.cpp \
169 statusdialog.cpp \ 180 statusdialog.cpp \
170 timeline.cpp \ 181 timeline.cpp \
171 timespanview.cpp \ 182 timespanview.cpp \
172 ../kalarmd/alarmdialog.cpp 183 ../kalarmd/alarmdialog.cpp
173 184
174HEADERS += calprintbase.h calprinter.h calprintplugins.h cellitem.h 185HEADERS += calprintbase.h calprinter.h calprintplugins.h cellitem.h
175INTERFACES += calprintdayconfig_base.ui \ 186INTERFACES += calprintdayconfig_base.ui \
176 calprintmonthconfig_base.ui \ 187 calprintmonthconfig_base.ui \
177 calprinttodoconfig_base.ui \ 188 calprinttodoconfig_base.ui \
178 calprintweekconfig_base.ui 189 calprintweekconfig_base.ui
179SOURCES += calprintbase.cpp calprinter.cpp calprintplugins.cpp cellitem.cpp 190SOURCES += calprintbase.cpp calprinter.cpp calprintplugins.cpp cellitem.cpp
180 191
181
182
183win32: {
184HEADERS += ../outport/msoutl9.h \
185 koimportoldialog.h
186
187
188SOURCES += ../outport/msoutl9.cpp \
189 koimportoldialog.cpp
190
191
192}
193
diff --git a/korganizer/main.cpp b/korganizer/main.cpp
index 2481ca4..4b207d9 100644
--- a/korganizer/main.cpp
+++ b/korganizer/main.cpp
@@ -1,109 +1,110 @@
1 1
2 2
3#ifndef DESKTOP_VERSION 3#ifndef DESKTOP_VERSION
4#include <qpe/qpeapplication.h> 4#include <qpe/qpeapplication.h>
5#include <qcopchannel_qws.h> 5#include <qcopchannel_qws.h>
6#include <qpe/global.h> 6#include <qpe/global.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#else 8#else
9#include <qapplication.h> 9#include <qapplication.h>
10#include <qstring.h> 10#include <qstring.h>
11#include <qwindowsstyle.h> 11#include <qwindowsstyle.h>
12#include <qplatinumstyle.h> 12#include <qplatinumstyle.h>
13#include <qsgistyle.h> 13#include <qsgistyle.h>
14#include <stdlib.h>
14#endif 15#endif
15#include <qtextcodec.h> 16#include <qtextcodec.h>
16 17
17#include <qdir.h> 18#include <qdir.h>
18#include <kstandarddirs.h> 19#include <kstandarddirs.h>
19#include <kglobal.h> 20#include <kglobal.h>
20#include <stdio.h> 21#include <stdio.h>
21#include "mainwindow.h" 22#include "mainwindow.h"
22#include <libkdepim/kpimglobalprefs.h> 23#include <libkdepim/kpimglobalprefs.h>
23void dumpMissing(); 24void dumpMissing();
24int main( int argc, char **argv ) 25int main( int argc, char **argv )
25{ 26{
26#ifndef DESKTOP_VERSION 27#ifndef DESKTOP_VERSION
27 QPEApplication a( argc, argv ); 28 QPEApplication a( argc, argv );
28 a.setKeepRunning (); 29 a.setKeepRunning ();
29#else 30#else
30 QApplication a( argc, argv ); 31 QApplication a( argc, argv );
31 QApplication::setStyle( new QPlatinumStyle ()); 32 QApplication::setStyle( new QPlatinumStyle ());
32 QString hdir = QDir::homeDirPath(); 33#ifdef _WIN32_
33 // there is a bug when creating dirs for WIN 98 34 QString hdir ( getenv( "HOME") );
34 // it is difficult to fix, because we have no WIN 98 runnung 35 if ( hdir.isEmpty() ) {
35 // such that we try it to create the dirs at startup here 36 QString hd ("C:/" );
36 if ( hdir == "C:\\" ) { // win 98 or ME 37 //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd );
37 QDir app_dir; 38 if ( QDir::homeDirPath().lower() == hd.lower() ) {
38 if ( !app_dir.exists("C:\\kdepim") ) 39 _putenv( "HOME=C:");
39 app_dir.mkdir ("C:\\kdepim"); 40 //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) );
40 if ( !app_dir.exists("C:\\kdepim\\apps") ) 41 }
41 app_dir.mkdir ("C:\\kdepim\\apps"); 42 } else {
42 if ( !app_dir.exists("C:\\kdepim\\config") ) 43 QDir app_dir;
43 app_dir.mkdir ("C:\\kdepim\\config"); 44 if ( !app_dir.exists(hdir) )
44 if ( !app_dir.exists("C:\\kdepim\\apps\\korganizer") ) 45 app_dir.mkdir (hdir);
45 app_dir.mkdir ("C:\\kdepim\\apps\\korganizer");
46 } 46 }
47#endif 47#endif
48#endif
48 bool exitHelp = false; 49 bool exitHelp = false;
49 if ( argc > 1 ) { 50 if ( argc > 1 ) {
50 QString command = argv[1]; 51 QString command = argv[1];
51 if ( command == "-help" ){ 52 if ( command == "-help" ){
52 printf("KO/Pi command line commands:\n"); 53 printf("KO/Pi command line commands:\n");
53 printf(" no command: Start KO/Pi in usual way\n"); 54 printf(" no command: Start KO/Pi in usual way\n");
54 printf(" -help: This output\n"); 55 printf(" -help: This output\n");
55 printf("Next Option: Open or Show after start:\n"); 56 printf("Next Option: Open or Show after start:\n");
56 printf(" -newTodo: New Todo dialog\n"); 57 printf(" -newTodo: New Todo dialog\n");
57 printf(" -newEvent: New Event dialog\n"); 58 printf(" -newEvent: New Event dialog\n");
58 printf(" -showList: List view\n"); 59 printf(" -showList: List view\n");
59 printf(" -showDay: Day view\n"); 60 printf(" -showDay: Day view\n");
60 printf(" -showWWeek: Work Week view\n"); 61 printf(" -showWWeek: Work Week view\n");
61 printf(" -showWeek: Week view\n"); 62 printf(" -showWeek: Week view\n");
62 printf(" -showTodo: Todo view\n"); 63 printf(" -showTodo: Todo view\n");
63 printf(" -showJournal: Journal view\n"); 64 printf(" -showJournal: Journal view\n");
64 printf(" -showKO: Next Days view\n"); 65 printf(" -showKO: Next Days view\n");
65 printf(" -showWNext: What's Next view\n"); 66 printf(" -showWNext: What's Next view\n");
66 printf(" -showNextXView: Next X View\n"); 67 printf(" -showNextXView: Next X View\n");
67 printf(" -new[Y] and -show[X] may be used togehther\n"); 68 printf(" -new[Y] and -show[X] may be used togehther\n");
68 printf(" KO/Pi is exiting now. Bye!\n"); 69 printf(" KO/Pi is exiting now. Bye!\n");
69 exitHelp = true; 70 exitHelp = true;
70 } 71 }
71 } 72 }
72 if ( ! exitHelp ) { 73 if ( ! exitHelp ) {
73 KGlobal::setAppName( "korganizer" ); 74 KGlobal::setAppName( "korganizer" );
74 QString fileName ; 75 QString fileName ;
75#ifndef DESKTOP_VERSION 76#ifndef DESKTOP_VERSION
76 fileName = getenv("QPEDIR"); 77 fileName = getenv("QPEDIR");
77 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); 78 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/");
78#else 79#else
79 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; 80 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/";
80 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 81 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
81#endif 82#endif
82 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); 83 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer")));
83 MainWindow m; 84 MainWindow m;
84#ifndef DESKTOP_VERSION 85#ifndef DESKTOP_VERSION
85 86
86 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); 87 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
87 a.showMainWidget(&m ); 88 a.showMainWidget(&m );
88#else 89#else
89 a.setMainWidget(&m ); 90 a.setMainWidget(&m );
90 m.show(); 91 m.show();
91 //m.resize( 800, 600 ); 92 //m.resize( 800, 600 );
92 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); 93 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
93#endif 94#endif
94 if ( argc > 1 ) { 95 if ( argc > 1 ) {
95 QCString command = argv[1]; 96 QCString command = argv[1];
96 if ( argc > 2 ) 97 if ( argc > 2 )
97 command += argv[2]; 98 command += argv[2];
98 qApp->processEvents(); 99 qApp->processEvents();
99 m.recieve(command, QByteArray() ); 100 m.recieve(command, QByteArray() );
100 101
101 } 102 }
102 103
103 a.exec(); 104 a.exec();
104 dumpMissing(); 105 dumpMissing();
105 106
106 KPimGlobalPrefs::instance()->writeConfig(); 107 KPimGlobalPrefs::instance()->writeConfig();
107 } 108 }
108 qDebug("KO: Bye! "); 109 qDebug("KO: Bye! ");
109} 110}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 7b07a2e..26ea1e2 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,1911 +1,1913 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qwhatsthis.h> 6#include <qwhatsthis.h>
7#include <qpushbutton.h> 7#include <qpushbutton.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10#include <qtextcodec.h> 10#include <qtextcodec.h>
11#include <qfile.h> 11#include <qfile.h>
12#include <qdir.h> 12#include <qdir.h>
13#include <qapp.h> 13#include <qapp.h>
14#include <qfileinfo.h> 14#include <qfileinfo.h>
15#include <qlabel.h> 15#include <qlabel.h>
16#include <qspinbox.h> 16#include <qspinbox.h>
17#include <qcheckbox.h> 17#include <qcheckbox.h>
18#include <qmap.h> 18#include <qmap.h>
19#include <qwmatrix.h> 19#include <qwmatrix.h>
20#include <qtextbrowser.h> 20#include <qtextbrowser.h>
21#include <qtextstream.h> 21#include <qtextstream.h>
22#ifndef DESKTOP_VERSION 22#ifndef DESKTOP_VERSION
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qpemenubar.h> 24#include <qpe/qpemenubar.h>
25#include <qpe/qpetoolbar.h> 25#include <qpe/qpetoolbar.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qtopia/alarmserver.h> 28#include <qtopia/alarmserver.h>
29#include <qtopia/qcopenvelope_qws.h> 29#include <qtopia/qcopenvelope_qws.h>
30#include <unistd.h> // for sleep 30#include <unistd.h> // for sleep
31#else 31#else
32#include <qmenubar.h> 32#include <qmenubar.h>
33#include <qtoolbar.h> 33#include <qtoolbar.h>
34#include <qapplication.h> 34#include <qapplication.h>
35//#include <resource.h> 35//#include <resource.h>
36 36
37#endif 37#endif
38#include <libkcal/calendarlocal.h> 38#include <libkcal/calendarlocal.h>
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
40#include <libkcal/phoneformat.h> 40#include <libkcal/phoneformat.h>
41#include <libkdepim/ksyncprofile.h> 41#include <libkdepim/ksyncprofile.h>
42#include <libkdepim/phoneaccess.h> 42#include <libkdepim/phoneaccess.h>
43#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "calendarview.h" 46#include "calendarview.h"
47#include "koviewmanager.h" 47#include "koviewmanager.h"
48#include "datenavigator.h" 48#include "datenavigator.h"
49#include "koagendaview.h" 49#include "koagendaview.h"
50#include "koagenda.h" 50#include "koagenda.h"
51#include "kodialogmanager.h" 51#include "kodialogmanager.h"
52#include "kdialogbase.h" 52#include "kdialogbase.h"
53#include "kapplication.h" 53#include "kapplication.h"
54#include "kofilterview.h" 54#include "kofilterview.h"
55#include "kstandarddirs.h" 55#include "kstandarddirs.h"
56#include "koprefs.h" 56#include "koprefs.h"
57#include "kfiledialog.h" 57#include "kfiledialog.h"
58#include "koglobals.h" 58#include "koglobals.h"
59#include "kglobal.h" 59#include "kglobal.h"
60#include "klocale.h" 60#include "klocale.h"
61#include "kconfig.h" 61#include "kconfig.h"
62#include "simplealarmclient.h" 62#include "simplealarmclient.h"
63#include "externalapphandler.h" 63#include "externalapphandler.h"
64 64
65using namespace KCal; 65using namespace KCal;
66#ifndef _WIN32_ 66#ifndef _WIN32_
67#include <unistd.h> 67#include <unistd.h>
68#else 68#else
69#ifdef _OL_IMPORT_
69#include "koimportoldialog.h" 70#include "koimportoldialog.h"
70#endif 71#endif
72#endif
71#include "mainwindow.h" 73#include "mainwindow.h"
72 74
73class KOex2phonePrefs : public QDialog 75class KOex2phonePrefs : public QDialog
74{ 76{
75 public: 77 public:
76 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 78 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
77 QDialog( parent, name, true ) 79 QDialog( parent, name, true )
78 { 80 {
79 setCaption( i18n("Export to phone options") ); 81 setCaption( i18n("Export to phone options") );
80 QVBoxLayout* lay = new QVBoxLayout( this ); 82 QVBoxLayout* lay = new QVBoxLayout( this );
81 lay->setSpacing( 3 ); 83 lay->setSpacing( 3 );
82 lay->setMargin( 3 ); 84 lay->setMargin( 3 );
83 QLabel *lab; 85 QLabel *lab;
84 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 86 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
85 lab->setAlignment (AlignHCenter ); 87 lab->setAlignment (AlignHCenter );
86 QHBox* temphb; 88 QHBox* temphb;
87 temphb = new QHBox( this ); 89 temphb = new QHBox( this );
88 new QLabel( i18n("I/O device: "), temphb ); 90 new QLabel( i18n("I/O device: "), temphb );
89 mPhoneDevice = new QLineEdit( temphb); 91 mPhoneDevice = new QLineEdit( temphb);
90 lay->addWidget( temphb ); 92 lay->addWidget( temphb );
91 temphb = new QHBox( this ); 93 temphb = new QHBox( this );
92 new QLabel( i18n("Connection: "), temphb ); 94 new QLabel( i18n("Connection: "), temphb );
93 mPhoneConnection = new QLineEdit( temphb); 95 mPhoneConnection = new QLineEdit( temphb);
94 lay->addWidget( temphb ); 96 lay->addWidget( temphb );
95 temphb = new QHBox( this ); 97 temphb = new QHBox( this );
96 new QLabel( i18n("Model(opt.): "), temphb ); 98 new QLabel( i18n("Model(opt.): "), temphb );
97 mPhoneModel = new QLineEdit( temphb); 99 mPhoneModel = new QLineEdit( temphb);
98 lay->addWidget( temphb ); 100 lay->addWidget( temphb );
99 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 101 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
100 mWriteBackFuture->setChecked( true ); 102 mWriteBackFuture->setChecked( true );
101 lay->addWidget( mWriteBackFuture ); 103 lay->addWidget( mWriteBackFuture );
102 temphb = new QHBox( this ); 104 temphb = new QHBox( this );
103 new QLabel( i18n("Max. weeks in future: ") , temphb ); 105 new QLabel( i18n("Max. weeks in future: ") , temphb );
104 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 106 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
105 mWriteBackFutureWeeks->setValue( 8 ); 107 mWriteBackFutureWeeks->setValue( 8 );
106 lay->addWidget( temphb ); 108 lay->addWidget( temphb );
107 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 109 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
108 lab->setAlignment (AlignHCenter ); 110 lab->setAlignment (AlignHCenter );
109 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 111 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
110 lay->addWidget( ok ); 112 lay->addWidget( ok );
111 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 113 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
112 lay->addWidget( cancel ); 114 lay->addWidget( cancel );
113 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 115 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
114 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 116 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
115 resize( 220, 240 ); 117 resize( 220, 240 );
116 qApp->processEvents(); 118 qApp->processEvents();
117 int dw = QApplication::desktop()->width(); 119 int dw = QApplication::desktop()->width();
118 int dh = QApplication::desktop()->height(); 120 int dh = QApplication::desktop()->height();
119 move( (dw-width())/2, (dh - height() )/2 ); 121 move( (dw-width())/2, (dh - height() )/2 );
120 } 122 }
121 123
122public: 124public:
123 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 125 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
124 QCheckBox* mWriteBackFuture; 126 QCheckBox* mWriteBackFuture;
125 QSpinBox* mWriteBackFutureWeeks; 127 QSpinBox* mWriteBackFutureWeeks;
126}; 128};
127 129
128int globalFlagBlockStartup; 130int globalFlagBlockStartup;
129MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 131MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
130 QMainWindow( parent, name ) 132 QMainWindow( parent, name )
131{ 133{
132 134
133#ifdef DESKTOP_VERSION 135#ifdef DESKTOP_VERSION
134 setFont( QFont("Arial"), 14 ); 136 setFont( QFont("Arial"), 14 );
135#endif 137#endif
136 mClosed = false; 138 mClosed = false;
137 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 139 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
138 QString confFile = locateLocal("config","korganizerrc"); 140 QString confFile = locateLocal("config","korganizerrc");
139 QFileInfo finf ( confFile ); 141 QFileInfo finf ( confFile );
140 bool showWarning = !finf.exists(); 142 bool showWarning = !finf.exists();
141 setIcon(SmallIcon( "ko24" ) ); 143 setIcon(SmallIcon( "ko24" ) );
142 mBlockAtStartup = true; 144 mBlockAtStartup = true;
143 mFlagKeyPressed = false; 145 mFlagKeyPressed = false;
144 setCaption("KOrganizer/Pi"); 146 setCaption("KOrganizer/Pi");
145 KOPrefs *p = KOPrefs::instance(); 147 KOPrefs *p = KOPrefs::instance();
146 KPimGlobalPrefs::instance()->setGlobalConfig(); 148 KPimGlobalPrefs::instance()->setGlobalConfig();
147 if ( p->mHourSize > 18 ) 149 if ( p->mHourSize > 18 )
148 p->mHourSize = 18; 150 p->mHourSize = 18;
149 QMainWindow::ToolBarDock tbd; 151 QMainWindow::ToolBarDock tbd;
150 if ( p->mToolBarHor ) { 152 if ( p->mToolBarHor ) {
151 if ( p->mToolBarUp ) 153 if ( p->mToolBarUp )
152 tbd = Bottom; 154 tbd = Bottom;
153 else 155 else
154 tbd = Top; 156 tbd = Top;
155 } 157 }
156 else { 158 else {
157 if ( p->mToolBarUp ) 159 if ( p->mToolBarUp )
158 tbd = Right; 160 tbd = Right;
159 else 161 else
160 tbd = Left; 162 tbd = Left;
161 } 163 }
162 if ( KOPrefs::instance()->mUseAppColors ) 164 if ( KOPrefs::instance()->mUseAppColors )
163 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 165 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
164 globalFlagBlockStartup = 1; 166 globalFlagBlockStartup = 1;
165 iconToolBar = new QPEToolBar( this ); 167 iconToolBar = new QPEToolBar( this );
166 addToolBar (iconToolBar , tbd ); 168 addToolBar (iconToolBar , tbd );
167 mCalendarModifiedFlag = false; 169 mCalendarModifiedFlag = false;
168 170
169 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 171 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
170 splash->setAlignment ( AlignCenter ); 172 splash->setAlignment ( AlignCenter );
171 setCentralWidget( splash ); 173 setCentralWidget( splash );
172#ifndef DESKTOP_VERSION 174#ifndef DESKTOP_VERSION
173 showMaximized(); 175 showMaximized();
174#endif 176#endif
175 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 177 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
176 setDefaultPreferences(); 178 setDefaultPreferences();
177 mCalendar = new CalendarLocal(); 179 mCalendar = new CalendarLocal();
178 mView = new CalendarView( mCalendar, this,"mCalendar " ); 180 mView = new CalendarView( mCalendar, this,"mCalendar " );
179 mView->hide(); 181 mView->hide();
180 //mView->resize(splash->size() ); 182 //mView->resize(splash->size() );
181 initActions(); 183 initActions();
182 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 184 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
183 mSyncManager->setBlockSave(false); 185 mSyncManager->setBlockSave(false);
184 mView->setSyncManager(mSyncManager); 186 mView->setSyncManager(mSyncManager);
185#ifndef DESKTOP_VERSION 187#ifndef DESKTOP_VERSION
186 iconToolBar->show(); 188 iconToolBar->show();
187 qApp->processEvents(); 189 qApp->processEvents();
188#endif 190#endif
189 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 191 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
190 int vh = height() ; 192 int vh = height() ;
191 int vw = width(); 193 int vw = width();
192 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 194 //qDebug("Toolbar hei %d ",iconToolBar->height() );
193 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 195 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
194 vh -= iconToolBar->height(); 196 vh -= iconToolBar->height();
195 } else { 197 } else {
196 vw -= iconToolBar->height(); 198 vw -= iconToolBar->height();
197 } 199 }
198 //mView->setMaximumSize( splash->size() ); 200 //mView->setMaximumSize( splash->size() );
199 //mView->resize( splash->size() ); 201 //mView->resize( splash->size() );
200 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 202 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
201 mView->readSettings(); 203 mView->readSettings();
202 bool newFile = false; 204 bool newFile = false;
203 if( !QFile::exists( defaultFileName() ) ) { 205 if( !QFile::exists( defaultFileName() ) ) {
204 QFileInfo finfo ( defaultFileName() ); 206 QFileInfo finfo ( defaultFileName() );
205 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 207 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
206 qDebug("oldfile %s ", oldFile.latin1()); 208 qDebug("oldfile %s ", oldFile.latin1());
207 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; 209 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
208 finfo.setFile( oldFile ); 210 finfo.setFile( oldFile );
209 if (finfo.exists() ) { 211 if (finfo.exists() ) {
210 KMessageBox::information( this, message); 212 KMessageBox::information( this, message);
211 mView->openCalendar( oldFile ); 213 mView->openCalendar( oldFile );
212 qApp->processEvents(); 214 qApp->processEvents();
213 } else { 215 } else {
214 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 216 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
215 finfo.setFile( oldFile ); 217 finfo.setFile( oldFile );
216 if (finfo.exists() ) { 218 if (finfo.exists() ) {
217 KMessageBox::information( this, message); 219 KMessageBox::information( this, message);
218 mView->openCalendar( oldFile ); 220 mView->openCalendar( oldFile );
219 qApp->processEvents(); 221 qApp->processEvents();
220 } 222 }
221 } 223 }
222 mView->saveCalendar( defaultFileName() ); 224 mView->saveCalendar( defaultFileName() );
223 newFile = true; 225 newFile = true;
224 } 226 }
225 227
226 QTime neededSaveTime = QDateTime::currentDateTime().time(); 228 QTime neededSaveTime = QDateTime::currentDateTime().time();
227 mView->openCalendar( defaultFileName() ); 229 mView->openCalendar( defaultFileName() );
228 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 230 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
229 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 231 qDebug("KO: Calendar loading time: %d ms",msNeeded );
230 232
231 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 233 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
232 KOPrefs::instance()->setCategoryDefaults(); 234 KOPrefs::instance()->setCategoryDefaults();
233 int count = mView->addCategories(); 235 int count = mView->addCategories();
234 } 236 }
235 processIncidenceSelection( 0 ); 237 processIncidenceSelection( 0 );
236 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 238 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
237 SLOT( processIncidenceSelection( Incidence * ) ) ); 239 SLOT( processIncidenceSelection( Incidence * ) ) );
238 connect( mView, SIGNAL( modifiedChanged( bool ) ), 240 connect( mView, SIGNAL( modifiedChanged( bool ) ),
239 SLOT( slotModifiedChanged( bool ) ) ); 241 SLOT( slotModifiedChanged( bool ) ) );
240 242
241 243
242 connect( mView, SIGNAL( tempDisableBR(bool) ), 244 connect( mView, SIGNAL( tempDisableBR(bool) ),
243 SLOT( disableBR(bool) ) ); 245 SLOT( disableBR(bool) ) );
244 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 246 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
245 mView->setModified( false ); 247 mView->setModified( false );
246 mBlockAtStartup = false; 248 mBlockAtStartup = false;
247 mView->setModified( false ); 249 mView->setModified( false );
248 setCentralWidget( mView ); 250 setCentralWidget( mView );
249 globalFlagBlockStartup = 0; 251 globalFlagBlockStartup = 0;
250 mView->show(); 252 mView->show();
251 delete splash; 253 delete splash;
252 if ( newFile ) 254 if ( newFile )
253 mView->updateConfig(); 255 mView->updateConfig();
254 // qApp->processEvents(); 256 // qApp->processEvents();
255 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 257 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
256 //fillSyncMenu(); 258 //fillSyncMenu();
257 259
258 260
259 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 261 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
260 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 262 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
261 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 263 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
262 mSyncManager->setDefaultFileName( defaultFileName()); 264 mSyncManager->setDefaultFileName( defaultFileName());
263 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 265 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
264 mSyncManager->fillSyncMenu(); 266 mSyncManager->fillSyncMenu();
265 267
266 268
267 269
268 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 270 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
269 if ( showWarning ) { 271 if ( showWarning ) {
270 KMessageBox::information( this, 272 KMessageBox::information( this,
271 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 273 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
272 qApp->processEvents(); 274 qApp->processEvents();
273 mView->dialogManager()->showSyncOptions(); 275 mView->dialogManager()->showSyncOptions();
274 } 276 }
275 277
276 //US listen for result adressed from Ka/Pi 278 //US listen for result adressed from Ka/Pi
277#ifndef DESKTOP_VERSION 279#ifndef DESKTOP_VERSION
278 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 280 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
279#endif 281#endif
280#ifndef DESKTOP_VERSION 282#ifndef DESKTOP_VERSION
281 infrared = 0; 283 infrared = 0;
282#endif 284#endif
283 285
284 mBRdisabled = false; 286 mBRdisabled = false;
285 //toggleBeamReceive(); 287 //toggleBeamReceive();
286} 288}
287MainWindow::~MainWindow() 289MainWindow::~MainWindow()
288{ 290{
289 //qDebug("MainWindow::~MainWindow() "); 291 //qDebug("MainWindow::~MainWindow() ");
290 //save toolbar location 292 //save toolbar location
291 delete mCalendar; 293 delete mCalendar;
292 delete mSyncManager; 294 delete mSyncManager;
293#ifndef DESKTOP_VERSION 295#ifndef DESKTOP_VERSION
294 if ( infrared ) 296 if ( infrared )
295 delete infrared; 297 delete infrared;
296#endif 298#endif
297 299
298 300
299} 301}
300 302
301void MainWindow::disableBR(bool b) 303void MainWindow::disableBR(bool b)
302{ 304{
303#ifndef DESKTOP_VERSION 305#ifndef DESKTOP_VERSION
304 if ( b ) { 306 if ( b ) {
305 if ( infrared ) { 307 if ( infrared ) {
306 toggleBeamReceive(); 308 toggleBeamReceive();
307 mBRdisabled = true; 309 mBRdisabled = true;
308 } 310 }
309 mBRdisabled = true; 311 mBRdisabled = true;
310 } else { 312 } else {
311 if ( mBRdisabled ) { 313 if ( mBRdisabled ) {
312 mBRdisabled = false; 314 mBRdisabled = false;
313 //makes no sense,because other cal ap is probably running 315 //makes no sense,because other cal ap is probably running
314 // toggleBeamReceive(); 316 // toggleBeamReceive();
315 } 317 }
316 } 318 }
317#endif 319#endif
318 320
319} 321}
320bool MainWindow::beamReceiveEnabled() 322bool MainWindow::beamReceiveEnabled()
321{ 323{
322#ifndef DESKTOP_VERSION 324#ifndef DESKTOP_VERSION
323 return ( infrared != 0 ); 325 return ( infrared != 0 );
324#endif 326#endif
325 return false; 327 return false;
326} 328}
327 329
328void MainWindow::toggleBeamReceive() 330void MainWindow::toggleBeamReceive()
329{ 331{
330 if ( mBRdisabled ) 332 if ( mBRdisabled )
331 return; 333 return;
332#ifndef DESKTOP_VERSION 334#ifndef DESKTOP_VERSION
333 if ( infrared ) { 335 if ( infrared ) {
334 qDebug("disable BeamReceive "); 336 qDebug("disable BeamReceive ");
335 delete infrared; 337 delete infrared;
336 infrared = 0; 338 infrared = 0;
337 brAction->setOn(false); 339 brAction->setOn(false);
338 return; 340 return;
339 } 341 }
340 qDebug("enable BeamReceive "); 342 qDebug("enable BeamReceive ");
341 brAction->setOn(true); 343 brAction->setOn(true);
342 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 344 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
343 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 345 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
344#endif 346#endif
345} 347}
346void MainWindow::showMaximized () 348void MainWindow::showMaximized ()
347{ 349{
348#ifndef DESKTOP_VERSION 350#ifndef DESKTOP_VERSION
349 if ( ! globalFlagBlockStartup ) 351 if ( ! globalFlagBlockStartup )
350 if ( mClosed ) 352 if ( mClosed )
351 mView->goToday(); 353 mView->goToday();
352#endif 354#endif
353 QWidget::showMaximized () ; 355 QWidget::showMaximized () ;
354 mClosed = false; 356 mClosed = false;
355} 357}
356void MainWindow::closeEvent( QCloseEvent* ce ) 358void MainWindow::closeEvent( QCloseEvent* ce )
357{ 359{
358 360
359 361
360 362
361 if ( ! KOPrefs::instance()->mAskForQuit ) { 363 if ( ! KOPrefs::instance()->mAskForQuit ) {
362 saveOnClose(); 364 saveOnClose();
363 mClosed = true; 365 mClosed = true;
364 ce->accept(); 366 ce->accept();
365 return; 367 return;
366 368
367 } 369 }
368 370
369 switch( QMessageBox::information( this, "KO/Pi", 371 switch( QMessageBox::information( this, "KO/Pi",
370 i18n("Do you really want\nto close KO/Pi?"), 372 i18n("Do you really want\nto close KO/Pi?"),
371 i18n("Close"), i18n("No"), 373 i18n("Close"), i18n("No"),
372 0, 0 ) ) { 374 0, 0 ) ) {
373 case 0: 375 case 0:
374 saveOnClose(); 376 saveOnClose();
375 mClosed = true; 377 mClosed = true;
376 ce->accept(); 378 ce->accept();
377 break; 379 break;
378 case 1: 380 case 1:
379 ce->ignore(); 381 ce->ignore();
380 break; 382 break;
381 case 2: 383 case 2:
382 384
383 default: 385 default:
384 break; 386 break;
385 } 387 }
386 388
387 389
388} 390}
389 391
390void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 392void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
391{ 393{
392 QDataStream stream( data, IO_ReadOnly ); 394 QDataStream stream( data, IO_ReadOnly );
393 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 395 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
394 //QString datamess; 396 //QString datamess;
395 //qDebug("message "); 397 //qDebug("message ");
396 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 398 qDebug("KO: QCOP message received: %s ", cmsg.data() );
397 399
398 if ( cmsg == "setDocument(QString)" ) { 400 if ( cmsg == "setDocument(QString)" ) {
399 QDataStream stream( data, IO_ReadOnly ); 401 QDataStream stream( data, IO_ReadOnly );
400 QString fileName; 402 QString fileName;
401 stream >> fileName; 403 stream >> fileName;
402 //qDebug("filename %s ", fileName.latin1()); 404 //qDebug("filename %s ", fileName.latin1());
403 showMaximized(); 405 showMaximized();
404 raise(); 406 raise();
405 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 407 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
406 mSyncManager->slotSyncMenu( 1002 ); 408 mSyncManager->slotSyncMenu( 1002 );
407 return; 409 return;
408 } 410 }
409 411
410 if ( cmsg == "-writeFile" ) { 412 if ( cmsg == "-writeFile" ) {
411 // I made from the "-writeFile" an "-writeAlarm" 413 // I made from the "-writeFile" an "-writeAlarm"
412 mView->viewManager()->showWhatsNextView(); 414 mView->viewManager()->showWhatsNextView();
413 mCalendar->checkAlarmForIncidence( 0, true); 415 mCalendar->checkAlarmForIncidence( 0, true);
414 showMaximized(); 416 showMaximized();
415 raise(); 417 raise();
416 return; 418 return;
417 419
418 } 420 }
419 if ( cmsg == "-writeFileSilent" ) { 421 if ( cmsg == "-writeFileSilent" ) {
420 // I made from the "-writeFile" an "-writeAlarm" 422 // I made from the "-writeFile" an "-writeAlarm"
421 // mView->viewManager()->showWhatsNextView(); 423 // mView->viewManager()->showWhatsNextView();
422 mCalendar->checkAlarmForIncidence( 0, true); 424 mCalendar->checkAlarmForIncidence( 0, true);
423 //showMaximized(); 425 //showMaximized();
424 //raise(); 426 //raise();
425 hide(); 427 hide();
426 return; 428 return;
427 } 429 }
428 if ( cmsg == "-newCountdown" ) { 430 if ( cmsg == "-newCountdown" ) {
429 qDebug("newCountdown "); 431 qDebug("newCountdown ");
430 432
431 } 433 }
432 QString msg ; 434 QString msg ;
433 QString allmsg = cmsg; 435 QString allmsg = cmsg;
434 while ( allmsg.length() > 0 ) { 436 while ( allmsg.length() > 0 ) {
435 int nextC = allmsg.find( "-", 1 ); 437 int nextC = allmsg.find( "-", 1 );
436 if ( nextC == -1 ) { 438 if ( nextC == -1 ) {
437 msg = allmsg; 439 msg = allmsg;
438 allmsg = ""; 440 allmsg = "";
439 } else{ 441 } else{
440 msg = allmsg.left( nextC ); 442 msg = allmsg.left( nextC );
441 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 443 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
442 } 444 }
443 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 445 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
444 if ( msg == "-newEvent" ) { 446 if ( msg == "-newEvent" ) {
445 mView->newEvent(); 447 mView->newEvent();
446 } 448 }
447 if ( msg == "-newTodo" ) { 449 if ( msg == "-newTodo" ) {
448 mView->newTodo(); 450 mView->newTodo();
449 451
450 } 452 }
451 if ( msg == "-showWN" ) { 453 if ( msg == "-showWN" ) {
452 mView->viewManager()->showWhatsNextView(); 454 mView->viewManager()->showWhatsNextView();
453 } 455 }
454 if ( msg == "-showTodo" ) { 456 if ( msg == "-showTodo" ) {
455 mView->viewManager()->showTodoView(); 457 mView->viewManager()->showTodoView();
456 } 458 }
457 if ( msg == "-showList" ) { 459 if ( msg == "-showList" ) {
458 mView->viewManager()->showListView(); 460 mView->viewManager()->showListView();
459 } 461 }
460 else if ( msg == "-showDay" ) { 462 else if ( msg == "-showDay" ) {
461 mView->viewManager()->showDayView(); 463 mView->viewManager()->showDayView();
462 } 464 }
463 else if ( msg == "-showWWeek" ) { 465 else if ( msg == "-showWWeek" ) {
464 mView->viewManager()->showWorkWeekView(); 466 mView->viewManager()->showWorkWeekView();
465 } 467 }
466 else if ( msg == "-ringSync" ) { 468 else if ( msg == "-ringSync" ) {
467 mSyncManager->multiSync( false ); 469 mSyncManager->multiSync( false );
468 } 470 }
469 else if ( msg == "-showWeek" ) { 471 else if ( msg == "-showWeek" ) {
470 mView->viewManager()->showWeekView(); 472 mView->viewManager()->showWeekView();
471 } 473 }
472 else if ( msg == "-showTodo" ) { 474 else if ( msg == "-showTodo" ) {
473 mView->viewManager()->showTodoView(); 475 mView->viewManager()->showTodoView();
474 } 476 }
475 else if ( msg == "-showJournal" ) { 477 else if ( msg == "-showJournal" ) {
476 mView->dateNavigator()->selectDates( 1 ); 478 mView->dateNavigator()->selectDates( 1 );
477 mView->dateNavigator()->selectToday(); 479 mView->dateNavigator()->selectToday();
478 mView->viewManager()->showJournalView(); 480 mView->viewManager()->showJournalView();
479 } 481 }
480 else if ( msg == "-showKO" ) { 482 else if ( msg == "-showKO" ) {
481 mView->viewManager()->showNextXView(); 483 mView->viewManager()->showNextXView();
482 } 484 }
483 else if ( msg == "-showWNext" || msg == "nextView()" ) { 485 else if ( msg == "-showWNext" || msg == "nextView()" ) {
484 mView->viewManager()->showWhatsNextView(); 486 mView->viewManager()->showWhatsNextView();
485 } 487 }
486 else if ( msg == "-showNextXView" ) { 488 else if ( msg == "-showNextXView" ) {
487 mView->viewManager()->showNextXView(); 489 mView->viewManager()->showNextXView();
488 } 490 }
489 491
490 492
491 } 493 }
492 494
493 showMaximized(); 495 showMaximized();
494 raise(); 496 raise();
495} 497}
496 498
497QPixmap MainWindow::loadPixmap( QString name ) 499QPixmap MainWindow::loadPixmap( QString name )
498{ 500{
499 return SmallIcon( name ); 501 return SmallIcon( name );
500 502
501} 503}
502void MainWindow::initActions() 504void MainWindow::initActions()
503{ 505{
504 //KOPrefs::instance()->mShowFullMenu 506 //KOPrefs::instance()->mShowFullMenu
505 iconToolBar->clear(); 507 iconToolBar->clear();
506 KOPrefs *p = KOPrefs::instance(); 508 KOPrefs *p = KOPrefs::instance();
507 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 509 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
508 510
509 QPopupMenu *viewMenu = new QPopupMenu( this ); 511 QPopupMenu *viewMenu = new QPopupMenu( this );
510 QPopupMenu *actionMenu = new QPopupMenu( this ); 512 QPopupMenu *actionMenu = new QPopupMenu( this );
511 QPopupMenu *importMenu = new QPopupMenu( this ); 513 QPopupMenu *importMenu = new QPopupMenu( this );
512 selectFilterMenu = new QPopupMenu( this ); 514 selectFilterMenu = new QPopupMenu( this );
513 selectFilterMenu->setCheckable( true ); 515 selectFilterMenu->setCheckable( true );
514 syncMenu = new QPopupMenu( this ); 516 syncMenu = new QPopupMenu( this );
515 configureAgendaMenu = new QPopupMenu( this ); 517 configureAgendaMenu = new QPopupMenu( this );
516 configureToolBarMenu = new QPopupMenu( this ); 518 configureToolBarMenu = new QPopupMenu( this );
517 QPopupMenu *helpMenu = new QPopupMenu( this ); 519 QPopupMenu *helpMenu = new QPopupMenu( this );
518 if ( KOPrefs::instance()->mShowFullMenu ) { 520 if ( KOPrefs::instance()->mShowFullMenu ) {
519 QMenuBar *menuBar1; 521 QMenuBar *menuBar1;
520 menuBar1 = menuBar(); 522 menuBar1 = menuBar();
521 menuBar1->insertItem( i18n("File"), importMenu ); 523 menuBar1->insertItem( i18n("File"), importMenu );
522 menuBar1->insertItem( i18n("View"), viewMenu ); 524 menuBar1->insertItem( i18n("View"), viewMenu );
523 menuBar1->insertItem( i18n("Actions"), actionMenu ); 525 menuBar1->insertItem( i18n("Actions"), actionMenu );
524 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 526 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
525 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 527 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
526 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 528 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
527 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 529 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
528 menuBar1->insertItem( i18n("Help"), helpMenu ); 530 menuBar1->insertItem( i18n("Help"), helpMenu );
529 } else { 531 } else {
530 QPEMenuBar *menuBar1; 532 QPEMenuBar *menuBar1;
531 menuBar1 = new QPEMenuBar( iconToolBar ); 533 menuBar1 = new QPEMenuBar( iconToolBar );
532 QPopupMenu *menuBar = new QPopupMenu( this ); 534 QPopupMenu *menuBar = new QPopupMenu( this );
533 menuBar1->insertItem( i18n("ME"), menuBar); 535 menuBar1->insertItem( i18n("ME"), menuBar);
534 menuBar->insertItem( i18n("File"), importMenu ); 536 menuBar->insertItem( i18n("File"), importMenu );
535 menuBar->insertItem( i18n("View"), viewMenu ); 537 menuBar->insertItem( i18n("View"), viewMenu );
536 menuBar->insertItem( i18n("Actions"), actionMenu ); 538 menuBar->insertItem( i18n("Actions"), actionMenu );
537 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 539 menuBar->insertItem( i18n("Synchronize"), syncMenu );
538 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 540 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
539 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 541 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
540 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 542 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
541 menuBar->insertItem( i18n("Help"), helpMenu ); 543 menuBar->insertItem( i18n("Help"), helpMenu );
542 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 544 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
543 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 545 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
544 } 546 }
545 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 547 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
546 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); 548 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) );
547 549
548 // ****************** 550 // ******************
549 QAction *action; 551 QAction *action;
550 QIconSet icon; 552 QIconSet icon;
551 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 553 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
552 configureToolBarMenu->setCheckable( true ); 554 configureToolBarMenu->setCheckable( true );
553 555
554 QString pathString = ""; 556 QString pathString = "";
555 if ( !p->mToolBarMiniIcons ) { 557 if ( !p->mToolBarMiniIcons ) {
556 if ( QApplication::desktop()->width() < 480 ) 558 if ( QApplication::desktop()->width() < 480 )
557 pathString += "icons16/"; 559 pathString += "icons16/";
558 } else 560 } else
559 pathString += "iconsmini/"; 561 pathString += "iconsmini/";
560 configureAgendaMenu->setCheckable( true ); 562 configureAgendaMenu->setCheckable( true );
561 configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); 563 configureAgendaMenu->insertItem(i18n("Tiny"), 4 );
562 configureAgendaMenu->insertItem(i18n("Small"), 6 ); 564 configureAgendaMenu->insertItem(i18n("Small"), 6 );
563 configureAgendaMenu->insertItem(i18n("Medium"), 8 ); 565 configureAgendaMenu->insertItem(i18n("Medium"), 8 );
564 configureAgendaMenu->insertItem(i18n("Normal"), 10 ); 566 configureAgendaMenu->insertItem(i18n("Normal"), 10 );
565 configureAgendaMenu->insertItem(i18n("Large"), 12 ); 567 configureAgendaMenu->insertItem(i18n("Large"), 12 );
566 configureAgendaMenu->insertItem(i18n("Big"), 14 ); 568 configureAgendaMenu->insertItem(i18n("Big"), 14 );
567 configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); 569 configureAgendaMenu->insertItem(i18n("Bigger"), 16 );
568 configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); 570 configureAgendaMenu->insertItem(i18n("Biggest"), 18 );
569 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 571 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
570 572
571 icon = loadPixmap( pathString + "configure" ); 573 icon = loadPixmap( pathString + "configure" );
572 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 574 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
573 action->addTo( actionMenu ); 575 action->addTo( actionMenu );
574 connect( action, SIGNAL( activated() ), 576 connect( action, SIGNAL( activated() ),
575 mView, SLOT( edit_options() ) ); 577 mView, SLOT( edit_options() ) );
576 actionMenu->insertSeparator(); 578 actionMenu->insertSeparator();
577 579
578 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 580 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
579 action->addTo( actionMenu ); 581 action->addTo( actionMenu );
580 connect( action, SIGNAL( activated() ), 582 connect( action, SIGNAL( activated() ),
581 mView, SLOT( undo_delete() ) ); 583 mView, SLOT( undo_delete() ) );
582 actionMenu->insertSeparator(); 584 actionMenu->insertSeparator();
583 585
584 icon = loadPixmap( pathString + "newevent" ); 586 icon = loadPixmap( pathString + "newevent" );
585 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 587 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
586 configureToolBarMenu->insertSeparator(); 588 configureToolBarMenu->insertSeparator();
587 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 589 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
588 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 590 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
589 ne_action->addTo( actionMenu ); 591 ne_action->addTo( actionMenu );
590 connect( ne_action, SIGNAL( activated() ), 592 connect( ne_action, SIGNAL( activated() ),
591 mView, SLOT( newEvent() ) ); 593 mView, SLOT( newEvent() ) );
592 icon = loadPixmap( pathString + "newtodo" ); 594 icon = loadPixmap( pathString + "newtodo" );
593 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 595 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
594 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 596 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
595 nt_action->addTo( actionMenu ); 597 nt_action->addTo( actionMenu );
596 connect( nt_action, SIGNAL( activated() ), 598 connect( nt_action, SIGNAL( activated() ),
597 mView, SLOT( newTodo() ) ); 599 mView, SLOT( newTodo() ) );
598 icon = loadPixmap( pathString + "navi" ); 600 icon = loadPixmap( pathString + "navi" );
599 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 601 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
600 action->addTo( viewMenu ); 602 action->addTo( viewMenu );
601 connect( action, SIGNAL( activated() ), 603 connect( action, SIGNAL( activated() ),
602 mView, SLOT( toggleDateNavigatorWidget() ) ); 604 mView, SLOT( toggleDateNavigatorWidget() ) );
603 icon = loadPixmap( pathString + "filter" ); 605 icon = loadPixmap( pathString + "filter" );
604 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 606 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
605 action->addTo( viewMenu ); 607 action->addTo( viewMenu );
606 connect( action, SIGNAL( activated() ), 608 connect( action, SIGNAL( activated() ),
607 mView, SLOT( toggleFilter() ) ); 609 mView, SLOT( toggleFilter() ) );
608 action = new QAction( i18n("Toggle Allday"), i18n("Toggle Allday"), 0, this ); 610 action = new QAction( i18n("Toggle Allday"), i18n("Toggle Allday"), 0, this );
609 action->addTo( viewMenu ); 611 action->addTo( viewMenu );
610 connect( action, SIGNAL( activated() ), 612 connect( action, SIGNAL( activated() ),
611 mView, SLOT( toggleAllDaySize() ) ); 613 mView, SLOT( toggleAllDaySize() ) );
612 614
613 viewMenu->insertSeparator(); 615 viewMenu->insertSeparator();
614 icon = loadPixmap( pathString + "picker" ); 616 icon = loadPixmap( pathString + "picker" );
615 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 617 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
616 action->addTo( viewMenu ); 618 action->addTo( viewMenu );
617 connect( action, SIGNAL( activated() ), 619 connect( action, SIGNAL( activated() ),
618 mView, SLOT( showDatePicker() ) ); 620 mView, SLOT( showDatePicker() ) );
619 action->addTo( iconToolBar ); 621 action->addTo( iconToolBar );
620 viewMenu->insertSeparator(); 622 viewMenu->insertSeparator();
621 icon = loadPixmap( pathString + "list" ); 623 icon = loadPixmap( pathString + "list" );
622 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 624 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
623 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 625 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
624 showlist_action->addTo( viewMenu ); 626 showlist_action->addTo( viewMenu );
625 connect( showlist_action, SIGNAL( activated() ), 627 connect( showlist_action, SIGNAL( activated() ),
626 mView->viewManager(), SLOT( showListView() ) ); 628 mView->viewManager(), SLOT( showListView() ) );
627 629
628 630
629 icon = loadPixmap( pathString + "day" ); 631 icon = loadPixmap( pathString + "day" );
630 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 632 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
631 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 633 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
632 day1_action->addTo( viewMenu ); 634 day1_action->addTo( viewMenu );
633 // action->addTo( toolBar ); 635 // action->addTo( toolBar );
634 connect( day1_action, SIGNAL( activated() ), 636 connect( day1_action, SIGNAL( activated() ),
635 mView->viewManager(), SLOT( showDayView() ) ); 637 mView->viewManager(), SLOT( showDayView() ) );
636 638
637 icon = loadPixmap( pathString + "workweek" ); 639 icon = loadPixmap( pathString + "workweek" );
638 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 640 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
639 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 641 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
640 day5_action->addTo( viewMenu ); 642 day5_action->addTo( viewMenu );
641 connect( day5_action, SIGNAL( activated() ), 643 connect( day5_action, SIGNAL( activated() ),
642 mView->viewManager(), SLOT( showWorkWeekView() ) ); 644 mView->viewManager(), SLOT( showWorkWeekView() ) );
643 645
644 icon = loadPixmap( pathString + "week" ); 646 icon = loadPixmap( pathString + "week" );
645 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 647 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
646 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 648 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
647 day7_action->addTo( viewMenu ); 649 day7_action->addTo( viewMenu );
648 connect( day7_action, SIGNAL( activated() ), 650 connect( day7_action, SIGNAL( activated() ),
649 mView->viewManager(), SLOT( showWeekView() ) ); 651 mView->viewManager(), SLOT( showWeekView() ) );
650 652
651 icon = loadPixmap( pathString + "month" ); 653 icon = loadPixmap( pathString + "month" );
652 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 654 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
653 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 655 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
654 month_action->addTo( viewMenu ); 656 month_action->addTo( viewMenu );
655 connect( month_action, SIGNAL( activated() ), 657 connect( month_action, SIGNAL( activated() ),
656 mView->viewManager(), SLOT( showMonthView() ) ); 658 mView->viewManager(), SLOT( showMonthView() ) );
657 659
658 icon = loadPixmap( pathString + "todo" ); 660 icon = loadPixmap( pathString + "todo" );
659 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 661 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
660 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 662 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
661 todoview_action->addTo( viewMenu ); 663 todoview_action->addTo( viewMenu );
662 connect( todoview_action, SIGNAL( activated() ), 664 connect( todoview_action, SIGNAL( activated() ),
663 mView->viewManager(), SLOT( showTodoView() ) ); 665 mView->viewManager(), SLOT( showTodoView() ) );
664 666
665 icon = loadPixmap( pathString + "journal" ); 667 icon = loadPixmap( pathString + "journal" );
666 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 668 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
667 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 669 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
668 viewjournal_action->addTo( viewMenu ); 670 viewjournal_action->addTo( viewMenu );
669 connect( viewjournal_action, SIGNAL( activated() ), 671 connect( viewjournal_action, SIGNAL( activated() ),
670 mView->viewManager(), SLOT( showJournalView() ) ); 672 mView->viewManager(), SLOT( showJournalView() ) );
671 673
672 icon = loadPixmap( pathString + "xdays" ); 674 icon = loadPixmap( pathString + "xdays" );
673 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 675 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
674 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 676 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
675 xdays_action->addTo( viewMenu ); 677 xdays_action->addTo( viewMenu );
676 connect( xdays_action, SIGNAL( activated() ), 678 connect( xdays_action, SIGNAL( activated() ),
677 mView->viewManager(), SLOT( showNextXView() ) ); 679 mView->viewManager(), SLOT( showNextXView() ) );
678 680
679 icon = loadPixmap( pathString + "whatsnext" ); 681 icon = loadPixmap( pathString + "whatsnext" );
680 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 682 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
681 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 683 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
682 whatsnext_action->addTo( viewMenu ); 684 whatsnext_action->addTo( viewMenu );
683 connect( whatsnext_action, SIGNAL( activated() ), 685 connect( whatsnext_action, SIGNAL( activated() ),
684 mView->viewManager(), SLOT( showWhatsNextView() ) ); 686 mView->viewManager(), SLOT( showWhatsNextView() ) );
685 687
686#if 0 688#if 0
687 action = new QAction( "view_timespan", "Time Span", 0, this ); 689 action = new QAction( "view_timespan", "Time Span", 0, this );
688 action->addTo( viewMenu ); 690 action->addTo( viewMenu );
689 connect( action, SIGNAL( activated() ), 691 connect( action, SIGNAL( activated() ),
690 mView->viewManager(), SLOT( showTimeSpanView() ) ); 692 mView->viewManager(), SLOT( showTimeSpanView() ) );
691#endif 693#endif
692 694
693 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 695 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
694 this ); 696 this );
695 mNewSubTodoAction->addTo( actionMenu ); 697 mNewSubTodoAction->addTo( actionMenu );
696 connect( mNewSubTodoAction, SIGNAL( activated() ), 698 connect( mNewSubTodoAction, SIGNAL( activated() ),
697 mView, SLOT( newSubTodo() ) ); 699 mView, SLOT( newSubTodo() ) );
698 700
699 actionMenu->insertSeparator(); 701 actionMenu->insertSeparator();
700 702
701 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 703 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
702 mShowAction->addTo( actionMenu ); 704 mShowAction->addTo( actionMenu );
703 connect( mShowAction, SIGNAL( activated() ), 705 connect( mShowAction, SIGNAL( activated() ),
704 mView, SLOT( showIncidence() ) ); 706 mView, SLOT( showIncidence() ) );
705 707
706 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 708 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
707 mEditAction->addTo( actionMenu ); 709 mEditAction->addTo( actionMenu );
708 connect( mEditAction, SIGNAL( activated() ), 710 connect( mEditAction, SIGNAL( activated() ),
709 mView, SLOT( editIncidence() ) ); 711 mView, SLOT( editIncidence() ) );
710 712
711 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 713 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
712 mDeleteAction->addTo( actionMenu ); 714 mDeleteAction->addTo( actionMenu );
713 connect( mDeleteAction, SIGNAL( activated() ), 715 connect( mDeleteAction, SIGNAL( activated() ),
714 mView, SLOT( deleteIncidence() ) ); 716 mView, SLOT( deleteIncidence() ) );
715 717
716 718
717 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 719 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
718 mCloneAction->addTo( actionMenu ); 720 mCloneAction->addTo( actionMenu );
719 connect( mCloneAction, SIGNAL( activated() ), 721 connect( mCloneAction, SIGNAL( activated() ),
720 mView, SLOT( cloneIncidence() ) ); 722 mView, SLOT( cloneIncidence() ) );
721 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 723 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
722 mMoveAction->addTo( actionMenu ); 724 mMoveAction->addTo( actionMenu );
723 connect( mMoveAction, SIGNAL( activated() ), 725 connect( mMoveAction, SIGNAL( activated() ),
724 mView, SLOT( moveIncidence() ) ); 726 mView, SLOT( moveIncidence() ) );
725 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 727 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
726 mBeamAction->addTo( actionMenu ); 728 mBeamAction->addTo( actionMenu );
727 connect( mBeamAction, SIGNAL( activated() ), 729 connect( mBeamAction, SIGNAL( activated() ),
728 mView, SLOT( beamIncidence() ) ); 730 mView, SLOT( beamIncidence() ) );
729 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 731 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
730 mCancelAction->addTo( actionMenu ); 732 mCancelAction->addTo( actionMenu );
731 connect( mCancelAction, SIGNAL( activated() ), 733 connect( mCancelAction, SIGNAL( activated() ),
732 mView, SLOT( toggleCancelIncidence() ) ); 734 mView, SLOT( toggleCancelIncidence() ) );
733 735
734 actionMenu->insertSeparator(); 736 actionMenu->insertSeparator();
735 737
736 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 738 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
737 this ); 739 this );
738 action->addTo( actionMenu ); 740 action->addTo( actionMenu );
739 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 741 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
740 742
741 icon = loadPixmap( pathString + "search" ); 743 icon = loadPixmap( pathString + "search" );
742 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 744 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
743 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 745 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
744 search_action->addTo( actionMenu ); 746 search_action->addTo( actionMenu );
745 connect( search_action, SIGNAL( activated() ), 747 connect( search_action, SIGNAL( activated() ),
746 mView->dialogManager(), SLOT( showSearchDialog() ) ); 748 mView->dialogManager(), SLOT( showSearchDialog() ) );
747 749
748 icon = loadPixmap( pathString + "today" ); 750 icon = loadPixmap( pathString + "today" );
749 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 751 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
750 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 752 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
751 today_action->addTo( actionMenu ); 753 today_action->addTo( actionMenu );
752 connect( today_action, SIGNAL( activated() ), 754 connect( today_action, SIGNAL( activated() ),
753 mView, SLOT( goToday() ) ); 755 mView, SLOT( goToday() ) );
754 756
755 if ( KOPrefs::instance()->mShowFullMenu ) { 757 if ( KOPrefs::instance()->mShowFullMenu ) {
756 actionMenu->insertSeparator(); 758 actionMenu->insertSeparator();
757 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 759 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
758 760
759 } 761 }
760 // actionMenu->insertSeparator(); 762 // actionMenu->insertSeparator();
761 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 763 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
762 this ); 764 this );
763 action->addTo( importMenu ); 765 action->addTo( importMenu );
764 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 766 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
765 action = new QAction( "import_quick", i18n("Import last file"), 0, 767 action = new QAction( "import_quick", i18n("Import last file"), 0,
766 this ); 768 this );
767 action->addTo( importMenu ); 769 action->addTo( importMenu );
768 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 770 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
769 importMenu->insertSeparator(); 771 importMenu->insertSeparator();
770 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 772 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
771 this ); 773 this );
772 action->addTo( importMenu ); 774 action->addTo( importMenu );
773 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 775 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
774#ifndef DESKTOP_VERSION 776#ifndef DESKTOP_VERSION
775 importMenu->insertSeparator(); 777 importMenu->insertSeparator();
776 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 778 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
777 this ); 779 this );
778 action->addTo( importMenu ); 780 action->addTo( importMenu );
779 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 781 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
780#else 782#else
781#ifdef _WIN32_ 783#ifdef _OL_IMPORT_
782 importMenu->insertSeparator(); 784 importMenu->insertSeparator();
783 action = new QAction( "import_ol", i18n("Import from OL"), 0, 785 action = new QAction( "import_ol", i18n("Import from OL"), 0,
784 this ); 786 this );
785 action->addTo( importMenu ); 787 action->addTo( importMenu );
786 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 788 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
787#endif 789#endif
788#endif 790#endif
789 791
790 importMenu->insertSeparator(); 792 importMenu->insertSeparator();
791 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 793 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
792 this ); 794 this );
793 action->addTo( importMenu ); 795 action->addTo( importMenu );
794 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 796 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
795 797
796 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 798 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
797 this ); 799 this );
798 action->addTo( importMenu ); 800 action->addTo( importMenu );
799 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 801 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
800 802
801 importMenu->insertSeparator(); 803 importMenu->insertSeparator();
802 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 804 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
803 this ); 805 this );
804 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 806 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
805 807
806 808
807 //LR 809 //LR
808 QPopupMenu *ex2phone = new QPopupMenu( this ); 810 QPopupMenu *ex2phone = new QPopupMenu( this );
809 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 811 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
810 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 812 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
811 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 813 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
812 importMenu->insertItem( i18n("Export to phone"), ex2phone ); 814 importMenu->insertItem( i18n("Export to phone"), ex2phone );
813 815
814 importMenu->insertSeparator(); 816 importMenu->insertSeparator();
815 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 817 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
816 this ); 818 this );
817 action->addTo( importMenu ); 819 action->addTo( importMenu );
818 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 820 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
819#ifndef DESKTOP_VERSION 821#ifndef DESKTOP_VERSION
820 importMenu->insertSeparator(); 822 importMenu->insertSeparator();
821 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 823 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
822 this ); 824 this );
823 brAction->addTo( importMenu ); 825 brAction->addTo( importMenu );
824 brAction->setToggleAction (true ) ; 826 brAction->setToggleAction (true ) ;
825 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 827 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
826 828
827 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 829 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
828 this ); 830 this );
829 action->addTo( importMenu ); 831 action->addTo( importMenu );
830 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 832 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
831 833
832 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 834 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
833 this ); 835 this );
834 action->addTo( importMenu ); 836 action->addTo( importMenu );
835 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 837 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
836#else 838#else
837 importMenu->insertSeparator(); 839 importMenu->insertSeparator();
838 icon = loadPixmap( pathString + "print" ); 840 icon = loadPixmap( pathString + "print" );
839 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 841 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
840 action->addTo( importMenu ); 842 action->addTo( importMenu );
841 connect( action, SIGNAL( activated() ), 843 connect( action, SIGNAL( activated() ),
842 this, SLOT( printCal() ) ); 844 this, SLOT( printCal() ) );
843 845
844 icon = loadPixmap( pathString + "print" ); 846 icon = loadPixmap( pathString + "print" );
845 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 847 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
846 action->addTo( importMenu ); 848 action->addTo( importMenu );
847 connect( action, SIGNAL( activated() ), 849 connect( action, SIGNAL( activated() ),
848 this, SLOT( printSel() ) ); 850 this, SLOT( printSel() ) );
849 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 851 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
850 action->addTo( importMenu ); 852 action->addTo( importMenu );
851 connect( action, SIGNAL( activated() ), 853 connect( action, SIGNAL( activated() ),
852 mView->viewManager(), SIGNAL( printWNV() ) ); 854 mView->viewManager(), SIGNAL( printWNV() ) );
853#endif 855#endif
854 importMenu->insertSeparator(); 856 importMenu->insertSeparator();
855 action = new QAction( "beam all", i18n("Save"), 0, 857 action = new QAction( "beam all", i18n("Save"), 0,
856 this ); 858 this );
857 action->addTo( importMenu ); 859 action->addTo( importMenu );
858 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 860 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
859 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 861 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
860 this ); 862 this );
861 action->addTo( importMenu ); 863 action->addTo( importMenu );
862 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 864 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
863 865
864 //menuBar->insertItem( "Configure",configureMenu ); 866 //menuBar->insertItem( "Configure",configureMenu );
865 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 867 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
866 icon = loadPixmap( "korganizer/korganizer" ); 868 icon = loadPixmap( "korganizer/korganizer" );
867 869
868 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 870 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
869 action->addTo( helpMenu ); 871 action->addTo( helpMenu );
870 connect( action, SIGNAL( activated() ), 872 connect( action, SIGNAL( activated() ),
871 SLOT( whatsNew() ) ); 873 SLOT( whatsNew() ) );
872 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 874 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
873 action->addTo( helpMenu ); 875 action->addTo( helpMenu );
874 connect( action, SIGNAL( activated() ), 876 connect( action, SIGNAL( activated() ),
875 SLOT( features() ) ); 877 SLOT( features() ) );
876 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 878 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
877 action->addTo( helpMenu ); 879 action->addTo( helpMenu );
878 connect( action, SIGNAL( activated() ), 880 connect( action, SIGNAL( activated() ),
879 SLOT( keyBindings() ) ); 881 SLOT( keyBindings() ) );
880 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 882 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
881 action->addTo( helpMenu ); 883 action->addTo( helpMenu );
882 connect( action, SIGNAL( activated() ), 884 connect( action, SIGNAL( activated() ),
883 SLOT( synchowto() ) ); 885 SLOT( synchowto() ) );
884 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 886 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
885 action->addTo( helpMenu ); 887 action->addTo( helpMenu );
886 connect( action, SIGNAL( activated() ), 888 connect( action, SIGNAL( activated() ),
887 SLOT( kdesynchowto() ) ); 889 SLOT( kdesynchowto() ) );
888 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 890 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
889 action->addTo( helpMenu ); 891 action->addTo( helpMenu );
890 connect( action, SIGNAL( activated() ), 892 connect( action, SIGNAL( activated() ),
891 SLOT( multisynchowto() ) ); 893 SLOT( multisynchowto() ) );
892 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 894 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
893 action->addTo( helpMenu ); 895 action->addTo( helpMenu );
894 connect( action, SIGNAL( activated() ), 896 connect( action, SIGNAL( activated() ),
895 SLOT( aboutAutoSaving() ) ); 897 SLOT( aboutAutoSaving() ) );
896 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 898 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
897 action->addTo( helpMenu ); 899 action->addTo( helpMenu );
898 connect( action, SIGNAL( activated() ), 900 connect( action, SIGNAL( activated() ),
899 SLOT( aboutKnownBugs() ) ); 901 SLOT( aboutKnownBugs() ) );
900 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 902 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
901 action->addTo( helpMenu ); 903 action->addTo( helpMenu );
902 connect( action, SIGNAL( activated() ), 904 connect( action, SIGNAL( activated() ),
903 SLOT( usertrans() ) ); 905 SLOT( usertrans() ) );
904 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 906 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
905 action->addTo( helpMenu ); 907 action->addTo( helpMenu );
906 connect( action, SIGNAL( activated() ), 908 connect( action, SIGNAL( activated() ),
907 SLOT( faq() ) ); 909 SLOT( faq() ) );
908 action = new QAction( "licence", i18n("Licence..."), 0, this ); 910 action = new QAction( "licence", i18n("Licence..."), 0, this );
909 action->addTo( helpMenu ); 911 action->addTo( helpMenu );
910 connect( action, SIGNAL( activated() ), 912 connect( action, SIGNAL( activated() ),
911 SLOT( licence() ) ); 913 SLOT( licence() ) );
912 action = new QAction( "about", i18n("About..."), 0, this ); 914 action = new QAction( "about", i18n("About..."), 0, this );
913 action->addTo( helpMenu ); 915 action->addTo( helpMenu );
914 connect( action, SIGNAL( activated() ), 916 connect( action, SIGNAL( activated() ),
915 SLOT( about() ) ); 917 SLOT( about() ) );
916 //menuBar->insertSeparator(); 918 //menuBar->insertSeparator();
917 919
918 // ****************************************************** 920 // ******************************************************
919 // menubar icons 921 // menubar icons
920 922
921 923
922 iconToolBar->setHorizontalStretchable (true ); 924 iconToolBar->setHorizontalStretchable (true );
923 //menuBar->insertItem( iconToolBar ); 925 //menuBar->insertItem( iconToolBar );
924 //xdays_action 926 //xdays_action
925 if (p-> mShowIconNewEvent) 927 if (p-> mShowIconNewEvent)
926 ne_action->addTo( iconToolBar ); 928 ne_action->addTo( iconToolBar );
927 if (p->mShowIconNewTodo ) 929 if (p->mShowIconNewTodo )
928 nt_action->addTo( iconToolBar ); 930 nt_action->addTo( iconToolBar );
929 if (p-> mShowIconSearch) 931 if (p-> mShowIconSearch)
930 search_action->addTo( iconToolBar ); 932 search_action->addTo( iconToolBar );
931 if (p-> mShowIconNext) 933 if (p-> mShowIconNext)
932 whatsnext_action->addTo( iconToolBar ); 934 whatsnext_action->addTo( iconToolBar );
933 if (p-> mShowIconNextDays) 935 if (p-> mShowIconNextDays)
934 xdays_action->addTo( iconToolBar ); 936 xdays_action->addTo( iconToolBar );
935 if (p-> mShowIconList) 937 if (p-> mShowIconList)
936 showlist_action->addTo( iconToolBar ); 938 showlist_action->addTo( iconToolBar );
937 if (p-> mShowIconDay1) 939 if (p-> mShowIconDay1)
938 day1_action->addTo( iconToolBar ); 940 day1_action->addTo( iconToolBar );
939 if (p-> mShowIconDay5) 941 if (p-> mShowIconDay5)
940 day5_action->addTo( iconToolBar ); 942 day5_action->addTo( iconToolBar );
941 if (p-> mShowIconDay7) 943 if (p-> mShowIconDay7)
942 day7_action->addTo( iconToolBar ); 944 day7_action->addTo( iconToolBar );
943 if (p-> mShowIconMonth) 945 if (p-> mShowIconMonth)
944 month_action->addTo( iconToolBar ); 946 month_action->addTo( iconToolBar );
945 if (p-> mShowIconTodoview) 947 if (p-> mShowIconTodoview)
946 todoview_action->addTo( iconToolBar ); 948 todoview_action->addTo( iconToolBar );
947 if (p-> mShowIconJournal) 949 if (p-> mShowIconJournal)
948 viewjournal_action->addTo( iconToolBar ); 950 viewjournal_action->addTo( iconToolBar );
949 icon = loadPixmap( pathString + "2leftarrowB" ); 951 icon = loadPixmap( pathString + "2leftarrowB" );
950 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 952 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
951 if (p-> mShowIconBackFast) { 953 if (p-> mShowIconBackFast) {
952 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 954 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
953 connect( action, SIGNAL( activated() ), 955 connect( action, SIGNAL( activated() ),
954 mView, SLOT( goPreviousMonth() ) ); 956 mView, SLOT( goPreviousMonth() ) );
955 action->addTo( iconToolBar ); 957 action->addTo( iconToolBar );
956 } 958 }
957 icon = loadPixmap( pathString + "1leftarrowB" ); 959 icon = loadPixmap( pathString + "1leftarrowB" );
958 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 960 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
959 if (p-> mShowIconBack) { 961 if (p-> mShowIconBack) {
960 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 962 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
961 connect( action, SIGNAL( activated() ), 963 connect( action, SIGNAL( activated() ),
962 mView, SLOT( goPrevious() ) ); 964 mView, SLOT( goPrevious() ) );
963 action->addTo( iconToolBar ); 965 action->addTo( iconToolBar );
964 } 966 }
965 if (p-> mShowIconToday) 967 if (p-> mShowIconToday)
966 today_action->addTo( iconToolBar ); 968 today_action->addTo( iconToolBar );
967 icon = loadPixmap( pathString + "1rightarrowB" ); 969 icon = loadPixmap( pathString + "1rightarrowB" );
968 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 970 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
969 if (p-> mShowIconForward) { 971 if (p-> mShowIconForward) {
970 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 972 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
971 connect( action, SIGNAL( activated() ), 973 connect( action, SIGNAL( activated() ),
972 mView, SLOT( goNext() ) ); 974 mView, SLOT( goNext() ) );
973 action->addTo( iconToolBar ); 975 action->addTo( iconToolBar );
974 } 976 }
975 icon = loadPixmap( pathString + "2rightarrowB" ); 977 icon = loadPixmap( pathString + "2rightarrowB" );
976 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 978 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
977 if (p-> mShowIconForwardFast) { 979 if (p-> mShowIconForwardFast) {
978 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 980 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
979 connect( action, SIGNAL( activated() ), 981 connect( action, SIGNAL( activated() ),
980 mView, SLOT( goNextMonth() ) ); 982 mView, SLOT( goNextMonth() ) );
981 action->addTo( iconToolBar ); 983 action->addTo( iconToolBar );
982 } 984 }
983 985
984 986
985 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 987 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
986 988
987 if (p-> mShowIconNewEvent) 989 if (p-> mShowIconNewEvent)
988 configureToolBarMenu->setItemChecked( 10, true ); 990 configureToolBarMenu->setItemChecked( 10, true );
989 if (p->mShowIconNewTodo ) 991 if (p->mShowIconNewTodo )
990 configureToolBarMenu->setItemChecked( 20, true ); 992 configureToolBarMenu->setItemChecked( 20, true );
991 if (p-> mShowIconSearch) 993 if (p-> mShowIconSearch)
992 configureToolBarMenu->setItemChecked( 120, true ); 994 configureToolBarMenu->setItemChecked( 120, true );
993 if (p-> mShowIconList) 995 if (p-> mShowIconList)
994 configureToolBarMenu->setItemChecked( 30, true ); 996 configureToolBarMenu->setItemChecked( 30, true );
995 if (p-> mShowIconDay1) 997 if (p-> mShowIconDay1)
996 configureToolBarMenu->setItemChecked( 40, true ); 998 configureToolBarMenu->setItemChecked( 40, true );
997 if (p-> mShowIconDay5) 999 if (p-> mShowIconDay5)
998 configureToolBarMenu->setItemChecked( 50, true ); 1000 configureToolBarMenu->setItemChecked( 50, true );
999 if (p-> mShowIconDay7) 1001 if (p-> mShowIconDay7)
1000 configureToolBarMenu->setItemChecked( 60, true ); 1002 configureToolBarMenu->setItemChecked( 60, true );
1001 if (p-> mShowIconMonth) 1003 if (p-> mShowIconMonth)
1002 configureToolBarMenu->setItemChecked( 70, true ); 1004 configureToolBarMenu->setItemChecked( 70, true );
1003 if (p-> mShowIconTodoview) 1005 if (p-> mShowIconTodoview)
1004 configureToolBarMenu->setItemChecked( 80, true ); 1006 configureToolBarMenu->setItemChecked( 80, true );
1005 if (p-> mShowIconBackFast) 1007 if (p-> mShowIconBackFast)
1006 configureToolBarMenu->setItemChecked( 200, true ); 1008 configureToolBarMenu->setItemChecked( 200, true );
1007 if (p-> mShowIconBack) 1009 if (p-> mShowIconBack)
1008 configureToolBarMenu->setItemChecked( 210, true ); 1010 configureToolBarMenu->setItemChecked( 210, true );
1009 if (p-> mShowIconToday) 1011 if (p-> mShowIconToday)
1010 configureToolBarMenu->setItemChecked( 130, true ); 1012 configureToolBarMenu->setItemChecked( 130, true );
1011 if (p-> mShowIconForward) 1013 if (p-> mShowIconForward)
1012 configureToolBarMenu->setItemChecked( 220, true ); 1014 configureToolBarMenu->setItemChecked( 220, true );
1013 if (p-> mShowIconForwardFast) 1015 if (p-> mShowIconForwardFast)
1014 configureToolBarMenu->setItemChecked( 230, true ); 1016 configureToolBarMenu->setItemChecked( 230, true );
1015 if (p-> mShowIconNextDays) 1017 if (p-> mShowIconNextDays)
1016 configureToolBarMenu->setItemChecked( 100, true ); 1018 configureToolBarMenu->setItemChecked( 100, true );
1017 if (p-> mShowIconNext) 1019 if (p-> mShowIconNext)
1018 configureToolBarMenu->setItemChecked( 110, true ); 1020 configureToolBarMenu->setItemChecked( 110, true );
1019 if (p-> mShowIconJournal) 1021 if (p-> mShowIconJournal)
1020 configureToolBarMenu->setItemChecked( 90, true ); 1022 configureToolBarMenu->setItemChecked( 90, true );
1021 if (p-> mShowIconWhatsThis) 1023 if (p-> mShowIconWhatsThis)
1022 configureToolBarMenu->setItemChecked( 300, true ); 1024 configureToolBarMenu->setItemChecked( 300, true );
1023 1025
1024 QLabel* dummy = new QLabel( iconToolBar ); 1026 QLabel* dummy = new QLabel( iconToolBar );
1025 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1027 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1026 if (!p-> mShowIconStretch) 1028 if (!p-> mShowIconStretch)
1027 iconToolBar->setStretchableWidget ( dummy ) ; 1029 iconToolBar->setStretchableWidget ( dummy ) ;
1028 else 1030 else
1029 configureToolBarMenu->setItemChecked( 5, true ); 1031 configureToolBarMenu->setItemChecked( 5, true );
1030 if (p-> mShowIconWhatsThis) 1032 if (p-> mShowIconWhatsThis)
1031 QWhatsThis::whatsThisButton ( iconToolBar ); 1033 QWhatsThis::whatsThisButton ( iconToolBar );
1032 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1034 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1033 configureAgenda( p->mHourSize ); 1035 configureAgenda( p->mHourSize );
1034 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1036 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1035} 1037}
1036 1038
1037void MainWindow::exportToPhone( int mode ) 1039void MainWindow::exportToPhone( int mode )
1038{ 1040{
1039 1041
1040 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1042 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1041 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1043 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1042 KOex2phonePrefs ex2phone; 1044 KOex2phonePrefs ex2phone;
1043 1045
1044 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1046 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1045 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1047 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1046 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1048 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1047 if ( mode == 1 ) 1049 if ( mode == 1 )
1048 ex2phone.setCaption(i18n("Export complete calendar")); 1050 ex2phone.setCaption(i18n("Export complete calendar"));
1049 if ( mode == 2 ) 1051 if ( mode == 2 )
1050 ex2phone.setCaption(i18n("Export filtered calendar")); 1052 ex2phone.setCaption(i18n("Export filtered calendar"));
1051 1053
1052 if ( !ex2phone.exec() ) { 1054 if ( !ex2phone.exec() ) {
1053 return; 1055 return;
1054 } 1056 }
1055 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1057 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1056 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1058 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1057 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1059 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1058 1060
1059 int inFuture = 0; 1061 int inFuture = 0;
1060 if ( ex2phone.mWriteBackFuture->isChecked() ) 1062 if ( ex2phone.mWriteBackFuture->isChecked() )
1061 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1063 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1062 QPtrList<Incidence> delSel; 1064 QPtrList<Incidence> delSel;
1063 if ( mode == 1 ) 1065 if ( mode == 1 )
1064 delSel = mCalendar->rawIncidences(); 1066 delSel = mCalendar->rawIncidences();
1065 if ( mode == 2 ) 1067 if ( mode == 2 )
1066 delSel = mCalendar->incidences(); 1068 delSel = mCalendar->incidences();
1067 CalendarLocal* cal = new CalendarLocal(); 1069 CalendarLocal* cal = new CalendarLocal();
1068 cal->setLocalTime(); 1070 cal->setLocalTime();
1069 Incidence *incidence = delSel.first(); 1071 Incidence *incidence = delSel.first();
1070 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1072 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1071 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1073 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1072 while ( incidence ) { 1074 while ( incidence ) {
1073 if ( incidence->type() != "Journal" ) { 1075 if ( incidence->type() != "Journal" ) {
1074 bool add = true; 1076 bool add = true;
1075 if ( inFuture ) { 1077 if ( inFuture ) {
1076 QDateTime dt; 1078 QDateTime dt;
1077 if ( incidence->type() == "Todo" ) { 1079 if ( incidence->type() == "Todo" ) {
1078 Todo * t = (Todo*)incidence; 1080 Todo * t = (Todo*)incidence;
1079 if ( t->hasDueDate() ) 1081 if ( t->hasDueDate() )
1080 dt = t->dtDue(); 1082 dt = t->dtDue();
1081 else 1083 else
1082 dt = cur.addSecs( 62 ); 1084 dt = cur.addSecs( 62 );
1083 } 1085 }
1084 else { 1086 else {
1085 bool ok; 1087 bool ok;
1086 dt = incidence->getNextOccurence( cur, &ok ); 1088 dt = incidence->getNextOccurence( cur, &ok );
1087 if ( !ok ) 1089 if ( !ok )
1088 dt = cur.addSecs( -62 ); 1090 dt = cur.addSecs( -62 );
1089 } 1091 }
1090 if ( dt < cur || dt > end ) { 1092 if ( dt < cur || dt > end ) {
1091 add = false; 1093 add = false;
1092 } 1094 }
1093 } 1095 }
1094 if ( add ) { 1096 if ( add ) {
1095 Incidence *in = incidence->clone(); 1097 Incidence *in = incidence->clone();
1096 cal->addIncidence( in ); 1098 cal->addIncidence( in );
1097 } 1099 }
1098 } 1100 }
1099 incidence = delSel.next(); 1101 incidence = delSel.next();
1100 } 1102 }
1101 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1103 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1102 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1104 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1103 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1105 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1104 1106
1105 setCaption( i18n("Writing to phone...")); 1107 setCaption( i18n("Writing to phone..."));
1106 if ( PhoneFormat::writeToPhone( cal ) ) 1108 if ( PhoneFormat::writeToPhone( cal ) )
1107 setCaption( i18n("Export to phone successful!")); 1109 setCaption( i18n("Export to phone successful!"));
1108 else 1110 else
1109 setCaption( i18n("Error exporting to phone!")); 1111 setCaption( i18n("Error exporting to phone!"));
1110 delete cal; 1112 delete cal;
1111} 1113}
1112 1114
1113 1115
1114void MainWindow::setDefaultPreferences() 1116void MainWindow::setDefaultPreferences()
1115{ 1117{
1116 KOPrefs *p = KOPrefs::instance(); 1118 KOPrefs *p = KOPrefs::instance();
1117 1119
1118 p->mCompactDialogs = true; 1120 p->mCompactDialogs = true;
1119 p->mConfirm = true; 1121 p->mConfirm = true;
1120 // p->mEnableQuickTodo = false; 1122 // p->mEnableQuickTodo = false;
1121 1123
1122} 1124}
1123 1125
1124QString MainWindow::resourcePath() 1126QString MainWindow::resourcePath()
1125{ 1127{
1126 return KGlobal::iconLoader()->iconPath(); 1128 return KGlobal::iconLoader()->iconPath();
1127} 1129}
1128 1130
1129void MainWindow::displayText( QString text ,QString cap ) 1131void MainWindow::displayText( QString text ,QString cap )
1130{ 1132{
1131 QDialog dia( this, "name", true ); ; 1133 QDialog dia( this, "name", true ); ;
1132 dia.setCaption( cap ); 1134 dia.setCaption( cap );
1133 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1135 QVBoxLayout* lay = new QVBoxLayout( &dia );
1134 lay->setSpacing( 3 ); 1136 lay->setSpacing( 3 );
1135 lay->setMargin( 3 ); 1137 lay->setMargin( 3 );
1136 QTextBrowser tb ( &dia ); 1138 QTextBrowser tb ( &dia );
1137 lay->addWidget( &tb ); 1139 lay->addWidget( &tb );
1138 tb.setText( text ); 1140 tb.setText( text );
1139#ifdef DESKTOP_VERSION 1141#ifdef DESKTOP_VERSION
1140 dia.resize( 640, 480); 1142 dia.resize( 640, 480);
1141#else 1143#else
1142 dia.showMaximized(); 1144 dia.showMaximized();
1143#endif 1145#endif
1144 dia.exec(); 1146 dia.exec();
1145} 1147}
1146 1148
1147void MainWindow::features() 1149void MainWindow::features()
1148{ 1150{
1149 1151
1150 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1152 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1151} 1153}
1152 1154
1153void MainWindow::usertrans() 1155void MainWindow::usertrans()
1154{ 1156{
1155 1157
1156 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1158 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1157} 1159}
1158 1160
1159void MainWindow::kdesynchowto() 1161void MainWindow::kdesynchowto()
1160{ 1162{
1161 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1163 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1162} 1164}
1163void MainWindow::multisynchowto() 1165void MainWindow::multisynchowto()
1164{ 1166{
1165 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1167 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1166} 1168}
1167void MainWindow::synchowto() 1169void MainWindow::synchowto()
1168{ 1170{
1169 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1171 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1170} 1172}
1171void MainWindow::faq() 1173void MainWindow::faq()
1172{ 1174{
1173 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1175 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1174 1176
1175} 1177}
1176void MainWindow::whatsNew() 1178void MainWindow::whatsNew()
1177{ 1179{
1178 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1180 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1179 1181
1180} 1182}
1181void MainWindow::licence() 1183void MainWindow::licence()
1182{ 1184{
1183 KApplication::showLicence(); 1185 KApplication::showLicence();
1184 1186
1185} 1187}
1186void MainWindow::about() 1188void MainWindow::about()
1187{ 1189{
1188 QString version; 1190 QString version;
1189#include <../version> 1191#include <../version>
1190 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1192 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1191 i18n("KOrganizer/Platform-independent\n") + 1193 i18n("KOrganizer/Platform-independent\n") +
1192 "(KO/Pi) " + version + " - " + 1194 "(KO/Pi) " + version + " - " +
1193 1195
1194#ifdef DESKTOP_VERSION 1196#ifdef DESKTOP_VERSION
1195 i18n("Desktop Edition\n") + 1197 i18n("Desktop Edition\n") +
1196#else 1198#else
1197 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + 1199 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") +
1198#endif 1200#endif
1199 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); 1201 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") );
1200} 1202}
1201void MainWindow::keyBindings() 1203void MainWindow::keyBindings()
1202{ 1204{
1203 QString cap = i18n("KO/Pi Keys + Colors"); 1205 QString cap = i18n("KO/Pi Keys + Colors");
1204 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1206 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1205 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1207 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1206 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1208 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1207 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1209 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1208 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1210 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1209 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1211 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1210 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1212 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1211 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1213 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1212 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1214 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1213 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1215 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1214 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1216 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1215 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1217 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1216 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1218 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1217 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1219 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1218 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1220 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1219 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1221 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1220 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1222 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1221 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1223 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1222 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1224 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1223 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1225 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1224 i18n("<p><h3>In agenda view:</h3></p>\n") + 1226 i18n("<p><h3>In agenda view:</h3></p>\n") +
1225 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1227 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1226 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1228 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1227 i18n("<p><h3>In todo view:</h3></p>\n") + 1229 i18n("<p><h3>In todo view:</h3></p>\n") +
1228 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1230 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1229 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1231 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1230 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1232 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1231 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1233 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1232 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1234 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1233 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1235 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1234 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1236 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1235 i18n("<p><h3>In list view:</h3></p>\n") + 1237 i18n("<p><h3>In list view:</h3></p>\n") +
1236 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1238 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1237 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1239 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1238 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1240 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1239 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1241 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1240 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1242 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1241 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1243 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1242 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1244 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1243 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1245 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1244 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1246 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1245 i18n("<p><b>E</b>: Edit item</p>\n") + 1247 i18n("<p><b>E</b>: Edit item</p>\n") +
1246 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1248 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1247 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1249 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1248 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1250 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1249 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1251 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1250 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1252 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1251 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1253 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1252 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1254 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1253 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1255 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1254 i18n("<p><b>White</b>: Item readonly</p>\n"); 1256 i18n("<p><b>White</b>: Item readonly</p>\n");
1255 displayText( text, cap); 1257 displayText( text, cap);
1256} 1258}
1257void MainWindow::aboutAutoSaving() 1259void MainWindow::aboutAutoSaving()
1258{ 1260{
1259 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); 1261 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n");
1260 1262
1261 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1263 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1262 1264
1263} 1265}
1264void MainWindow::aboutKnownBugs() 1266void MainWindow::aboutKnownBugs()
1265{ 1267{
1266 QMessageBox* msg; 1268 QMessageBox* msg;
1267 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1269 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1268 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1270 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1269 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1271 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1270 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1272 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1271 i18n("\nor report them in the bugtracker on\n") + 1273 i18n("\nor report them in the bugtracker on\n") +
1272 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1274 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1273 QMessageBox::NoIcon, 1275 QMessageBox::NoIcon,
1274 QMessageBox::Ok, 1276 QMessageBox::Ok,
1275 QMessageBox::NoButton, 1277 QMessageBox::NoButton,
1276 QMessageBox::NoButton); 1278 QMessageBox::NoButton);
1277 msg->exec(); 1279 msg->exec();
1278 delete msg; 1280 delete msg;
1279 1281
1280} 1282}
1281 1283
1282QString MainWindow::defaultFileName() 1284QString MainWindow::defaultFileName()
1283{ 1285{
1284 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1286 return locateLocal( "data", "korganizer/mycalendar.ics" );
1285} 1287}
1286QString MainWindow::syncFileName() 1288QString MainWindow::syncFileName()
1287{ 1289{
1288#ifdef DESKTOP_VERSION 1290#ifdef DESKTOP_VERSION
1289 return locateLocal( "tmp", "synccalendar.ics" ); 1291 return locateLocal( "tmp", "synccalendar.ics" );
1290#else 1292#else
1291 return QString( "/tmp/synccalendar.ics" ); 1293 return QString( "/tmp/synccalendar.ics" );
1292#endif 1294#endif
1293} 1295}
1294 1296
1295void MainWindow::processIncidenceSelection( Incidence *incidence ) 1297void MainWindow::processIncidenceSelection( Incidence *incidence )
1296{ 1298{
1297 if ( !incidence ) { 1299 if ( !incidence ) {
1298 enableIncidenceActions( false ); 1300 enableIncidenceActions( false );
1299 1301
1300 mNewSubTodoAction->setEnabled( false ); 1302 mNewSubTodoAction->setEnabled( false );
1301 setCaptionToDates(); 1303 setCaptionToDates();
1302 return; 1304 return;
1303 1305
1304 } 1306 }
1305 1307
1306 //KGlobal::locale()->formatDateTime(nextA, true); 1308 //KGlobal::locale()->formatDateTime(nextA, true);
1307 QString startString = ""; 1309 QString startString = "";
1308 if ( incidence->type() != "Todo" ) { 1310 if ( incidence->type() != "Todo" ) {
1309 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1311 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1310 if ( incidence->doesFloat() ) { 1312 if ( incidence->doesFloat() ) {
1311 startString += ": "+incidence->dtStartDateStr( true ); 1313 startString += ": "+incidence->dtStartDateStr( true );
1312 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1314 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1313 1315
1314 } else { 1316 } else {
1315 startString = ": "+incidence->dtStartStr(true); 1317 startString = ": "+incidence->dtStartStr(true);
1316 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1318 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1317 1319
1318 } 1320 }
1319 1321
1320 } else { 1322 } else {
1321 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1323 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1322 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1324 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1323 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1325 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1324 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1326 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1325 } 1327 }
1326 1328
1327 } 1329 }
1328 else 1330 else
1329 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1331 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1330 if ( !incidence->location().isEmpty() ) 1332 if ( !incidence->location().isEmpty() )
1331 startString += " (" +incidence->location()+")"; 1333 startString += " (" +incidence->location()+")";
1332 setCaption( incidence->summary()+startString); 1334 setCaption( incidence->summary()+startString);
1333 1335
1334 enableIncidenceActions( true ); 1336 enableIncidenceActions( true );
1335 1337
1336 if ( incidence->type() == "Event" ) { 1338 if ( incidence->type() == "Event" ) {
1337 mShowAction->setText( i18n("Show Event...") ); 1339 mShowAction->setText( i18n("Show Event...") );
1338 mEditAction->setText( i18n("Edit Event...") ); 1340 mEditAction->setText( i18n("Edit Event...") );
1339 mDeleteAction->setText( i18n("Delete Event...") ); 1341 mDeleteAction->setText( i18n("Delete Event...") );
1340 1342
1341 mNewSubTodoAction->setEnabled( false ); 1343 mNewSubTodoAction->setEnabled( false );
1342 } else if ( incidence->type() == "Todo" ) { 1344 } else if ( incidence->type() == "Todo" ) {
1343 mShowAction->setText( i18n("Show Todo...") ); 1345 mShowAction->setText( i18n("Show Todo...") );
1344 mEditAction->setText( i18n("Edit Todo...") ); 1346 mEditAction->setText( i18n("Edit Todo...") );
1345 mDeleteAction->setText( i18n("Delete Todo...") ); 1347 mDeleteAction->setText( i18n("Delete Todo...") );
1346 1348
1347 mNewSubTodoAction->setEnabled( true ); 1349 mNewSubTodoAction->setEnabled( true );
1348 } else { 1350 } else {
1349 mShowAction->setText( i18n("Show...") ); 1351 mShowAction->setText( i18n("Show...") );
1350 mShowAction->setText( i18n("Edit...") ); 1352 mShowAction->setText( i18n("Edit...") );
1351 mShowAction->setText( i18n("Delete...") ); 1353 mShowAction->setText( i18n("Delete...") );
1352 1354
1353 mNewSubTodoAction->setEnabled( false ); 1355 mNewSubTodoAction->setEnabled( false );
1354 } 1356 }
1355} 1357}
1356 1358
1357void MainWindow::enableIncidenceActions( bool enabled ) 1359void MainWindow::enableIncidenceActions( bool enabled )
1358{ 1360{
1359 mShowAction->setEnabled( enabled ); 1361 mShowAction->setEnabled( enabled );
1360 mEditAction->setEnabled( enabled ); 1362 mEditAction->setEnabled( enabled );
1361 mDeleteAction->setEnabled( enabled ); 1363 mDeleteAction->setEnabled( enabled );
1362 1364
1363 mCloneAction->setEnabled( enabled ); 1365 mCloneAction->setEnabled( enabled );
1364 mMoveAction->setEnabled( enabled ); 1366 mMoveAction->setEnabled( enabled );
1365 mBeamAction->setEnabled( enabled ); 1367 mBeamAction->setEnabled( enabled );
1366 mCancelAction->setEnabled( enabled ); 1368 mCancelAction->setEnabled( enabled );
1367} 1369}
1368 1370
1369void MainWindow::importOL() 1371void MainWindow::importOL()
1370{ 1372{
1371#ifdef _WIN32_ 1373#ifdef _OL_IMPORT_
1372 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1374 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1373 id->exec(); 1375 id->exec();
1374 delete id; 1376 delete id;
1375 mView->updateView(); 1377 mView->updateView();
1376#endif 1378#endif
1377} 1379}
1378void MainWindow::importBday() 1380void MainWindow::importBday()
1379{ 1381{
1380 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1382 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1381 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1383 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1382 i18n("Import!"), i18n("Cancel"), 0, 1384 i18n("Import!"), i18n("Cancel"), 0,
1383 0, 1 ); 1385 0, 1 );
1384 if ( result == 0 ) { 1386 if ( result == 0 ) {
1385 mView->importBday(); 1387 mView->importBday();
1386 1388
1387 } 1389 }
1388 1390
1389 1391
1390} 1392}
1391void MainWindow::importQtopia() 1393void MainWindow::importQtopia()
1392{ 1394{
1393#ifndef DESKTOP_VERSION 1395#ifndef DESKTOP_VERSION
1394 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1396 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1395 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), 1397 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"),
1396 i18n("Import!"), i18n("Cancel"), 0, 1398 i18n("Import!"), i18n("Cancel"), 0,
1397 0, 1 ); 1399 0, 1 );
1398 if ( result == 0 ) { 1400 if ( result == 0 ) {
1399 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1401 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1400 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1402 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1401 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1403 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1402 mView->importQtopia( categories, datebook, todolist ); 1404 mView->importQtopia( categories, datebook, todolist );
1403 } 1405 }
1404#else 1406#else
1405 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1407 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1406 i18n("Not supported \non desktop!\n"), 1408 i18n("Not supported \non desktop!\n"),
1407 i18n("Ok"), i18n("Cancel"), 0, 1409 i18n("Ok"), i18n("Cancel"), 0,
1408 0, 1 ); 1410 0, 1 );
1409 1411
1410#endif 1412#endif
1411} 1413}
1412 1414
1413void MainWindow::saveOnClose() 1415void MainWindow::saveOnClose()
1414{ 1416{
1415 KOPrefs *p = KOPrefs::instance(); 1417 KOPrefs *p = KOPrefs::instance();
1416 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1418 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1417 p->mToolBarUp = iconToolBar->x() > width()/2 || 1419 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1418 iconToolBar->y() > height()/2; 1420 iconToolBar->y() > height()/2;
1419 mView->writeSettings(); 1421 mView->writeSettings();
1420 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1422 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1421 save(); 1423 save();
1422} 1424}
1423void MainWindow::slotModifiedChanged( bool changed ) 1425void MainWindow::slotModifiedChanged( bool changed )
1424{ 1426{
1425 if ( mBlockAtStartup ) 1427 if ( mBlockAtStartup )
1426 return; 1428 return;
1427 int msec; 1429 int msec;
1428 // we store the changes after 1 minute, 1430 // we store the changes after 1 minute,
1429 // and for safety reasons after 10 minutes again 1431 // and for safety reasons after 10 minutes again
1430 if ( !mSyncManager->blockSave() ) 1432 if ( !mSyncManager->blockSave() )
1431 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1433 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1432 else 1434 else
1433 msec = 1000 * 600; 1435 msec = 1000 * 600;
1434 mSaveTimer.start( msec, true ); // 1 minute 1436 mSaveTimer.start( msec, true ); // 1 minute
1435 qDebug("KO: Saving File in %d secs!", msec/1000); 1437 qDebug("KO: Saving File in %d secs!", msec/1000);
1436 mCalendarModifiedFlag = true; 1438 mCalendarModifiedFlag = true;
1437} 1439}
1438void MainWindow::save() 1440void MainWindow::save()
1439{ 1441{
1440 if ( mSyncManager->blockSave() ) 1442 if ( mSyncManager->blockSave() )
1441 return; 1443 return;
1442 mSyncManager->setBlockSave(true); 1444 mSyncManager->setBlockSave(true);
1443 if ( mView->checkFileVersion( defaultFileName()) ) { 1445 if ( mView->checkFileVersion( defaultFileName()) ) {
1444 1446
1445 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1447 QTime neededSaveTime = QDateTime::currentDateTime().time();
1446 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1448 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1447 qDebug("KO: Start saving data to file!"); 1449 qDebug("KO: Start saving data to file!");
1448 mView->saveCalendar( defaultFileName() ); 1450 mView->saveCalendar( defaultFileName() );
1449 1451
1450 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1452 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1451 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1453 qDebug("KO: Needed %d ms for saving.",msNeeded );
1452 QString savemes; 1454 QString savemes;
1453 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1455 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1454 setCaption(savemes); 1456 setCaption(savemes);
1455 } else 1457 } else
1456 setCaption(i18n("Saving cancelled!")); 1458 setCaption(i18n("Saving cancelled!"));
1457 mCalendarModifiedFlag = false; 1459 mCalendarModifiedFlag = false;
1458 mSyncManager->setBlockSave( false ); 1460 mSyncManager->setBlockSave( false );
1459} 1461}
1460 1462
1461void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1463void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1462{ 1464{
1463 if ( !e->isAutoRepeat() ) { 1465 if ( !e->isAutoRepeat() ) {
1464 mFlagKeyPressed = false; 1466 mFlagKeyPressed = false;
1465 } 1467 }
1466} 1468}
1467void MainWindow::keyPressEvent ( QKeyEvent * e ) 1469void MainWindow::keyPressEvent ( QKeyEvent * e )
1468{ 1470{
1469 qApp->processEvents(); 1471 qApp->processEvents();
1470 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1472 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1471 e->ignore(); 1473 e->ignore();
1472 // qDebug(" ignore %d",e->isAutoRepeat() ); 1474 // qDebug(" ignore %d",e->isAutoRepeat() );
1473 return; 1475 return;
1474 } 1476 }
1475 if (! e->isAutoRepeat() ) 1477 if (! e->isAutoRepeat() )
1476 mFlagKeyPressed = true; 1478 mFlagKeyPressed = true;
1477 KOPrefs *p = KOPrefs::instance(); 1479 KOPrefs *p = KOPrefs::instance();
1478 bool showSelectedDates = false; 1480 bool showSelectedDates = false;
1479 int size; 1481 int size;
1480 int pro = 0; 1482 int pro = 0;
1481 //qDebug("MainWindow::keyPressEvent "); 1483 //qDebug("MainWindow::keyPressEvent ");
1482 switch ( e->key() ) { 1484 switch ( e->key() ) {
1483 case Qt::Key_Right: 1485 case Qt::Key_Right:
1484 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1486 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1485 mView->goNextMonth(); 1487 mView->goNextMonth();
1486 else 1488 else
1487 mView->goNext(); 1489 mView->goNext();
1488 showSelectedDates = true; 1490 showSelectedDates = true;
1489 break; 1491 break;
1490 case Qt::Key_Left: 1492 case Qt::Key_Left:
1491 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1493 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1492 mView->goPreviousMonth(); 1494 mView->goPreviousMonth();
1493 else 1495 else
1494 mView->goPrevious(); 1496 mView->goPrevious();
1495 showSelectedDates = true; 1497 showSelectedDates = true;
1496 break; 1498 break;
1497 case Qt::Key_Down: 1499 case Qt::Key_Down:
1498 mView->viewManager()->agendaView()->scrollOneHourDown(); 1500 mView->viewManager()->agendaView()->scrollOneHourDown();
1499 break; 1501 break;
1500 case Qt::Key_Up: 1502 case Qt::Key_Up:
1501 mView->viewManager()->agendaView()->scrollOneHourUp(); 1503 mView->viewManager()->agendaView()->scrollOneHourUp();
1502 break; 1504 break;
1503 case Qt::Key_I: 1505 case Qt::Key_I:
1504 mView->showIncidence(); 1506 mView->showIncidence();
1505 break; 1507 break;
1506 case Qt::Key_Delete: 1508 case Qt::Key_Delete:
1507 case Qt::Key_Backspace: 1509 case Qt::Key_Backspace:
1508 mView->deleteIncidence(); 1510 mView->deleteIncidence();
1509 break; 1511 break;
1510 case Qt::Key_D: 1512 case Qt::Key_D:
1511 mView->viewManager()->showDayView(); 1513 mView->viewManager()->showDayView();
1512 showSelectedDates = true; 1514 showSelectedDates = true;
1513 break; 1515 break;
1514 case Qt::Key_O: 1516 case Qt::Key_O:
1515 mView->toggleFilerEnabled( ); 1517 mView->toggleFilerEnabled( );
1516 break; 1518 break;
1517 case Qt::Key_0: 1519 case Qt::Key_0:
1518 case Qt::Key_1: 1520 case Qt::Key_1:
1519 case Qt::Key_2: 1521 case Qt::Key_2:
1520 case Qt::Key_3: 1522 case Qt::Key_3:
1521 case Qt::Key_4: 1523 case Qt::Key_4:
1522 case Qt::Key_5: 1524 case Qt::Key_5:
1523 case Qt::Key_6: 1525 case Qt::Key_6:
1524 case Qt::Key_7: 1526 case Qt::Key_7:
1525 case Qt::Key_8: 1527 case Qt::Key_8:
1526 case Qt::Key_9: 1528 case Qt::Key_9:
1527 pro = e->key()-48; 1529 pro = e->key()-48;
1528 if ( pro == 0 ) 1530 if ( pro == 0 )
1529 pro = 10; 1531 pro = 10;
1530 if ( e->state() == Qt::ControlButton) 1532 if ( e->state() == Qt::ControlButton)
1531 pro += 10; 1533 pro += 10;
1532 break; 1534 break;
1533 case Qt::Key_M: 1535 case Qt::Key_M:
1534 mView->viewManager()->showMonthView(); 1536 mView->viewManager()->showMonthView();
1535 showSelectedDates = true; 1537 showSelectedDates = true;
1536 break; 1538 break;
1537 case Qt::Key_Insert: 1539 case Qt::Key_Insert:
1538 mView->newEvent(); 1540 mView->newEvent();
1539 break; 1541 break;
1540 case Qt::Key_S : 1542 case Qt::Key_S :
1541 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1543 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1542 mView->newSubTodo(); 1544 mView->newSubTodo();
1543 else 1545 else
1544 mView->dialogManager()->showSearchDialog(); 1546 mView->dialogManager()->showSearchDialog();
1545 break; 1547 break;
1546 case Qt::Key_Y : 1548 case Qt::Key_Y :
1547 case Qt::Key_Z : 1549 case Qt::Key_Z :
1548 mView->viewManager()->showWorkWeekView(); 1550 mView->viewManager()->showWorkWeekView();
1549 showSelectedDates = true; 1551 showSelectedDates = true;
1550 break; 1552 break;
1551 case Qt::Key_U : 1553 case Qt::Key_U :
1552 mView->viewManager()->showWeekView(); 1554 mView->viewManager()->showWeekView();
1553 showSelectedDates = true; 1555 showSelectedDates = true;
1554 break; 1556 break;
1555 case Qt::Key_H : 1557 case Qt::Key_H :
1556 keyBindings(); 1558 keyBindings();
1557 break; 1559 break;
1558 case Qt::Key_W: 1560 case Qt::Key_W:
1559 mView->viewManager()->showWhatsNextView(); 1561 mView->viewManager()->showWhatsNextView();
1560 break; 1562 break;
1561 case Qt::Key_L: 1563 case Qt::Key_L:
1562 mView->viewManager()->showListView(); 1564 mView->viewManager()->showListView();
1563 break; 1565 break;
1564 case Qt::Key_N: 1566 case Qt::Key_N:
1565 mView->viewManager()->showNextXView(); 1567 mView->viewManager()->showNextXView();
1566 showSelectedDates = true; 1568 showSelectedDates = true;
1567 break; 1569 break;
1568 case Qt::Key_V: 1570 case Qt::Key_V:
1569 mView->viewManager()->showTodoView(); 1571 mView->viewManager()->showTodoView();
1570 break; 1572 break;
1571 case Qt::Key_C: 1573 case Qt::Key_C:
1572 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1574 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1573 break; 1575 break;
1574 case Qt::Key_P: 1576 case Qt::Key_P:
1575 mView->showDatePicker( ); 1577 mView->showDatePicker( );
1576 break; 1578 break;
1577 case Qt::Key_F: 1579 case Qt::Key_F:
1578 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1580 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1579 mView->editFilters(); 1581 mView->editFilters();
1580 else 1582 else
1581 mView->toggleFilter(); 1583 mView->toggleFilter();
1582 break; 1584 break;
1583 case Qt::Key_X: 1585 case Qt::Key_X:
1584 mView->toggleDateNavigatorWidget(); 1586 mView->toggleDateNavigatorWidget();
1585 break; 1587 break;
1586 case Qt::Key_Space: 1588 case Qt::Key_Space:
1587 mView->toggleExpand(); 1589 mView->toggleExpand();
1588 break; 1590 break;
1589 case Qt::Key_A: 1591 case Qt::Key_A:
1590 mView->toggleAllDaySize(); 1592 mView->toggleAllDaySize();
1591 break; 1593 break;
1592 case Qt::Key_T: 1594 case Qt::Key_T:
1593 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1595 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1594 mView->newTodo(); 1596 mView->newTodo();
1595 else { 1597 else {
1596 mView->goToday(); 1598 mView->goToday();
1597 showSelectedDates = true; 1599 showSelectedDates = true;
1598 } 1600 }
1599 break; 1601 break;
1600 case Qt::Key_J: 1602 case Qt::Key_J:
1601 mView->viewManager()->showJournalView(); 1603 mView->viewManager()->showJournalView();
1602 break; 1604 break;
1603 case Qt::Key_B: 1605 case Qt::Key_B:
1604 mView->editIncidenceDescription();; 1606 mView->editIncidenceDescription();;
1605 break; 1607 break;
1606 // case Qt::Key_Return: 1608 // case Qt::Key_Return:
1607 case Qt::Key_E: 1609 case Qt::Key_E:
1608 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1610 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1609 mView->newEvent(); 1611 mView->newEvent();
1610 else 1612 else
1611 mView->editIncidence(); 1613 mView->editIncidence();
1612 break; 1614 break;
1613 case Qt::Key_Plus: 1615 case Qt::Key_Plus:
1614 size = p->mHourSize +2; 1616 size = p->mHourSize +2;
1615 if ( size <= 18 ) 1617 if ( size <= 18 )
1616 configureAgenda( size ); 1618 configureAgenda( size );
1617 break; 1619 break;
1618 case Qt::Key_Minus: 1620 case Qt::Key_Minus:
1619 size = p->mHourSize - 2; 1621 size = p->mHourSize - 2;
1620 if ( size >= 4 ) 1622 if ( size >= 4 )
1621 configureAgenda( size ); 1623 configureAgenda( size );
1622 break; 1624 break;
1623 1625
1624 1626
1625 default: 1627 default:
1626 e->ignore(); 1628 e->ignore();
1627 } 1629 }
1628 if ( pro > 0 ) { 1630 if ( pro > 0 ) {
1629 mView->selectFilter( pro-1 ); 1631 mView->selectFilter( pro-1 );
1630 } 1632 }
1631 if ( showSelectedDates ) { 1633 if ( showSelectedDates ) {
1632 ;// setCaptionToDates(); 1634 ;// setCaptionToDates();
1633 } 1635 }
1634 1636
1635} 1637}
1636 1638
1637void MainWindow::fillFilterMenu() 1639void MainWindow::fillFilterMenu()
1638{ 1640{
1639 selectFilterMenu->clear(); 1641 selectFilterMenu->clear();
1640 bool disable = false; 1642 bool disable = false;
1641 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 1643 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
1642 selectFilterMenu->insertSeparator(); 1644 selectFilterMenu->insertSeparator();
1643 if ( mView->filterView()->filtersEnabled() ) { 1645 if ( mView->filterView()->filtersEnabled() ) {
1644 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); 1646 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 );
1645 } 1647 }
1646 else { 1648 else {
1647 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); 1649 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 );
1648 disable = true; 1650 disable = true;
1649 } 1651 }
1650 selectFilterMenu->insertSeparator(); 1652 selectFilterMenu->insertSeparator();
1651 QPtrList<CalFilter> fili = mView->filters(); 1653 QPtrList<CalFilter> fili = mView->filters();
1652 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1654 CalFilter *curfilter = mView->filterView()->selectedFilter();
1653 CalFilter *filter = fili.first(); 1655 CalFilter *filter = fili.first();
1654 int iii = 2; 1656 int iii = 2;
1655 while(filter) { 1657 while(filter) {
1656 selectFilterMenu->insertItem( filter->name(), iii ); 1658 selectFilterMenu->insertItem( filter->name(), iii );
1657 if ( filter == curfilter) 1659 if ( filter == curfilter)
1658 selectFilterMenu->setItemChecked( iii, true ); 1660 selectFilterMenu->setItemChecked( iii, true );
1659 if ( disable ) 1661 if ( disable )
1660 selectFilterMenu->setItemEnabled( iii, false ); 1662 selectFilterMenu->setItemEnabled( iii, false );
1661 filter = fili.next(); 1663 filter = fili.next();
1662 ++iii; 1664 ++iii;
1663 } 1665 }
1664} 1666}
1665void MainWindow::selectFilter( int fil ) 1667void MainWindow::selectFilter( int fil )
1666{ 1668{
1667 if ( fil == 0 ) { 1669 if ( fil == 0 ) {
1668 mView->editFilters( ); 1670 mView->editFilters( );
1669 } else if ( fil == 1 ){ 1671 } else if ( fil == 1 ){
1670 mView->toggleFilerEnabled( ); 1672 mView->toggleFilerEnabled( );
1671 } else { 1673 } else {
1672 mView->selectFilter( fil-2 ); 1674 mView->selectFilter( fil-2 );
1673 } 1675 }
1674} 1676}
1675void MainWindow::configureToolBar( int item ) 1677void MainWindow::configureToolBar( int item )
1676{ 1678{
1677 1679
1678 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1680 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1679 KOPrefs *p = KOPrefs::instance(); 1681 KOPrefs *p = KOPrefs::instance();
1680 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1682 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1681 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1683 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1682 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1684 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1683 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1685 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1684 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1686 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1685 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1687 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1686 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1688 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1687 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1689 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1688 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1690 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1689 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1691 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1690 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1692 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1691 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1693 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1692 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1694 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1693 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 1695 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1694 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 1696 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1695 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1697 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1696 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1698 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1697 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1699 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1698 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1700 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1699 // initActions(); 1701 // initActions();
1700} 1702}
1701 1703
1702void MainWindow::setCaptionToDates() 1704void MainWindow::setCaptionToDates()
1703{ 1705{
1704 QString selDates; 1706 QString selDates;
1705 selDates = KGlobal::locale()->formatDate(mView->startDate(), true); 1707 selDates = KGlobal::locale()->formatDate(mView->startDate(), true);
1706 if (mView->startDate() < mView->endDate() ) 1708 if (mView->startDate() < mView->endDate() )
1707 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1709 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1708 else { 1710 else {
1709 QString addString; 1711 QString addString;
1710 if ( mView->startDate() == QDateTime::currentDateTime().date() ) 1712 if ( mView->startDate() == QDateTime::currentDateTime().date() )
1711 addString = i18n("Today"); 1713 addString = i18n("Today");
1712 else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) 1714 else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) )
1713 addString = i18n("Tomorrow"); 1715 addString = i18n("Tomorrow");
1714 if ( !addString.isEmpty() ) 1716 if ( !addString.isEmpty() )
1715 selDates = addString+", "+selDates ; 1717 selDates = addString+", "+selDates ;
1716 } 1718 }
1717 setCaption( i18n("Dates: ") + selDates ); 1719 setCaption( i18n("Dates: ") + selDates );
1718 1720
1719} 1721}
1720// parameter item == 0: reinit 1722// parameter item == 0: reinit
1721void MainWindow::configureAgenda( int item ) 1723void MainWindow::configureAgenda( int item )
1722{ 1724{
1723 1725
1724 KOPrefs *p = KOPrefs::instance(); 1726 KOPrefs *p = KOPrefs::instance();
1725 1727
1726 int i; 1728 int i;
1727 // do not allow 4 for widgets higher than 480 1729 // do not allow 4 for widgets higher than 480
1728 // if ( QApplication::desktop()->height() > 480 ) { 1730 // if ( QApplication::desktop()->height() > 480 ) {
1729// if ( item == 4 ) 1731// if ( item == 4 )
1730// item = 6; 1732// item = 6;
1731// } 1733// }
1732 for ( i = 4; i <= 18; i= i+2 ) 1734 for ( i = 4; i <= 18; i= i+2 )
1733 configureAgendaMenu->setItemChecked( i, false ); 1735 configureAgendaMenu->setItemChecked( i, false );
1734 configureAgendaMenu->setItemChecked( item, true ); 1736 configureAgendaMenu->setItemChecked( item, true );
1735 if ( p->mHourSize == item ) 1737 if ( p->mHourSize == item )
1736 return; 1738 return;
1737 p->mHourSize=item; 1739 p->mHourSize=item;
1738 mView->viewManager()->agendaView()->updateConfig(); 1740 mView->viewManager()->agendaView()->updateConfig();
1739} 1741}
1740 1742
1741void MainWindow::saveCalendar() 1743void MainWindow::saveCalendar()
1742{ 1744{
1743 QString fn = KOPrefs::instance()->mLastSaveFile; 1745 QString fn = KOPrefs::instance()->mLastSaveFile;
1744 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 1746 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
1745 1747
1746 if ( fn == "" ) 1748 if ( fn == "" )
1747 return; 1749 return;
1748 QFileInfo info; 1750 QFileInfo info;
1749 info.setFile( fn ); 1751 info.setFile( fn );
1750 QString mes; 1752 QString mes;
1751 bool createbup = true; 1753 bool createbup = true;
1752 if ( info. exists() ) { 1754 if ( info. exists() ) {
1753 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 1755 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
1754 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1756 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1755 i18n("Overwrite!"), i18n("Cancel"), 0, 1757 i18n("Overwrite!"), i18n("Cancel"), 0,
1756 0, 1 ); 1758 0, 1 );
1757 if ( result != 0 ) { 1759 if ( result != 0 ) {
1758 createbup = false; 1760 createbup = false;
1759 } 1761 }
1760 } 1762 }
1761 if ( createbup ) { 1763 if ( createbup ) {
1762 mView->saveCalendar( fn ); 1764 mView->saveCalendar( fn );
1763 mes = i18n("KO/Pi:Saved %1").arg(fn); 1765 mes = i18n("KO/Pi:Saved %1").arg(fn);
1764 KOPrefs::instance()->mLastSaveFile = fn; 1766 KOPrefs::instance()->mLastSaveFile = fn;
1765 setCaption(mes); 1767 setCaption(mes);
1766 } 1768 }
1767} 1769}
1768void MainWindow::loadCalendar() 1770void MainWindow::loadCalendar()
1769{ 1771{
1770 1772
1771 QString fn = KOPrefs::instance()->mLastLoadFile; 1773 QString fn = KOPrefs::instance()->mLastLoadFile;
1772 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 1774 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
1773 1775
1774 if ( fn == "" ) 1776 if ( fn == "" )
1775 return; 1777 return;
1776 QFileInfo info; 1778 QFileInfo info;
1777 info.setFile( fn ); 1779 info.setFile( fn );
1778 QString mess; 1780 QString mess;
1779 bool loadbup = true; 1781 bool loadbup = true;
1780 if ( info. exists() ) { 1782 if ( info. exists() ) {
1781 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1783 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1782 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 1784 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
1783 mess, 1785 mess,
1784 i18n("Load!"), i18n("Cancel"), 0, 1786 i18n("Load!"), i18n("Cancel"), 0,
1785 0, 1 ); 1787 0, 1 );
1786 if ( result != 0 ) { 1788 if ( result != 0 ) {
1787 loadbup = false; 1789 loadbup = false;
1788 } 1790 }
1789 } else { 1791 } else {
1790 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1792 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1791 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 1793 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
1792 0, 1 ); 1794 0, 1 );
1793 1795
1794 return; 1796 return;
1795 } 1797 }
1796 if ( loadbup ) { 1798 if ( loadbup ) {
1797 mView->openCalendar( fn ); 1799 mView->openCalendar( fn );
1798 KOPrefs::instance()->mLastLoadFile = fn; 1800 KOPrefs::instance()->mLastLoadFile = fn;
1799 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 1801 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
1800 setCaption(mess); 1802 setCaption(mess);
1801 } 1803 }
1802 1804
1803} 1805}
1804void MainWindow::quickImportIcal() 1806void MainWindow::quickImportIcal()
1805{ 1807{
1806 importFile( KOPrefs::instance()->mLastImportFile, false ); 1808 importFile( KOPrefs::instance()->mLastImportFile, false );
1807} 1809}
1808void MainWindow::importFile( QString fn, bool quick ) 1810void MainWindow::importFile( QString fn, bool quick )
1809{ 1811{
1810 QFileInfo info; 1812 QFileInfo info;
1811 info.setFile( fn ); 1813 info.setFile( fn );
1812 QString mess; 1814 QString mess;
1813 bool loadbup = true; 1815 bool loadbup = true;
1814 if ( !info. exists() ) { 1816 if ( !info. exists() ) {
1815 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 1817 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
1816 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1818 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1817 mess ); 1819 mess );
1818 return; 1820 return;
1819 } 1821 }
1820 int result = 0; 1822 int result = 0;
1821 if ( !quick ) { 1823 if ( !quick ) {
1822 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1824 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1823 result = QMessageBox::warning( this, "KO/Pi: Warning!", 1825 result = QMessageBox::warning( this, "KO/Pi: Warning!",
1824 mess, 1826 mess,
1825 "Import", "Cancel", 0, 1827 "Import", "Cancel", 0,
1826 0, 1 ); 1828 0, 1 );
1827 } 1829 }
1828 if ( result == 0 ) { 1830 if ( result == 0 ) {
1829 if ( mView->openCalendar( fn, true )) { 1831 if ( mView->openCalendar( fn, true )) {
1830 KOPrefs::instance()->mLastImportFile = fn; 1832 KOPrefs::instance()->mLastImportFile = fn;
1831 setCaption(i18n("Imported file successfully")); 1833 setCaption(i18n("Imported file successfully"));
1832 } else { 1834 } else {
1833 setCaption(i18n("Error importing file")); 1835 setCaption(i18n("Error importing file"));
1834 } 1836 }
1835 } 1837 }
1836} 1838}
1837 1839
1838void MainWindow::importIcal() 1840void MainWindow::importIcal()
1839{ 1841{
1840 1842
1841 QString fn =KOPrefs::instance()->mLastImportFile; 1843 QString fn =KOPrefs::instance()->mLastImportFile;
1842 1844
1843 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 1845 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
1844 if ( fn == "" ) 1846 if ( fn == "" )
1845 return; 1847 return;
1846 importFile( fn, true ); 1848 importFile( fn, true );
1847 1849
1848} 1850}
1849 1851
1850void MainWindow::exportVCalendar() 1852void MainWindow::exportVCalendar()
1851{ 1853{
1852 QString fn = KOPrefs::instance()->mLastVcalFile; 1854 QString fn = KOPrefs::instance()->mLastVcalFile;
1853 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 1855 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
1854 if ( fn == "" ) 1856 if ( fn == "" )
1855 return; 1857 return;
1856 QFileInfo info; 1858 QFileInfo info;
1857 info.setFile( fn ); 1859 info.setFile( fn );
1858 QString mes; 1860 QString mes;
1859 bool createbup = true; 1861 bool createbup = true;
1860 if ( info. exists() ) { 1862 if ( info. exists() ) {
1861 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 1863 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
1862 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1864 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1863 i18n("Overwrite!"), i18n("Cancel"), 0, 1865 i18n("Overwrite!"), i18n("Cancel"), 0,
1864 0, 1 ); 1866 0, 1 );
1865 if ( result != 0 ) { 1867 if ( result != 0 ) {
1866 createbup = false; 1868 createbup = false;
1867 } 1869 }
1868 } 1870 }
1869 if ( createbup ) { 1871 if ( createbup ) {
1870 if ( mView->exportVCalendar( fn ) ) { 1872 if ( mView->exportVCalendar( fn ) ) {
1871 KOPrefs::instance()->mLastVcalFile = fn; 1873 KOPrefs::instance()->mLastVcalFile = fn;
1872 if ( fn.length() > 20 ) 1874 if ( fn.length() > 20 )
1873 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 1875 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
1874 else 1876 else
1875 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 1877 mes = i18n("KO/Pi:Exported to %1").arg(fn );
1876 setCaption(mes); 1878 setCaption(mes);
1877 } 1879 }
1878 } 1880 }
1879 1881
1880} 1882}
1881 1883
1882void MainWindow::syncFileRequest() 1884void MainWindow::syncFileRequest()
1883{ 1885{
1884 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 1886 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
1885 mSyncManager->slotSyncMenu( 999 ); 1887 mSyncManager->slotSyncMenu( 999 );
1886 } 1888 }
1887 save(); 1889 save();
1888} 1890}
1889void MainWindow::getFile( bool success ) 1891void MainWindow::getFile( bool success )
1890{ 1892{
1891 if ( ! success ) { 1893 if ( ! success ) {
1892 setCaption( i18n("Error receiving file. Nothing changed!") ); 1894 setCaption( i18n("Error receiving file. Nothing changed!") );
1893 return; 1895 return;
1894 } 1896 }
1895 mView->openCalendar( defaultFileName() ); 1897 mView->openCalendar( defaultFileName() );
1896 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 1898 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
1897 mSyncManager->slotSyncMenu( 999 ); 1899 mSyncManager->slotSyncMenu( 999 );
1898 } 1900 }
1899 setCaption( i18n("Pi-Sync successful!") ); 1901 setCaption( i18n("Pi-Sync successful!") );
1900} 1902}
1901 1903
1902void MainWindow::printSel( ) 1904void MainWindow::printSel( )
1903{ 1905{
1904 mView->viewManager()->agendaView()->agenda()->printSelection(); 1906 mView->viewManager()->agendaView()->agenda()->printSelection();
1905} 1907}
1906 1908
1907void MainWindow::printCal() 1909void MainWindow::printCal()
1908{ 1910{
1909 mView->print();//mCp->showDialog(); 1911 mView->print();//mCp->showDialog();
1910} 1912}
1911 1913