summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-20 12:05:18 (UTC)
committer zautrix <zautrix>2004-10-20 12:05:18 (UTC)
commit5cf3c1bce58a6487af166e637e54571e98156fd0 (patch) (unidiff)
tree2e1ba14350aa322bb21729cf462b96e658fa6929
parente2a0df411042d986adb31b28f9e0a2f17395358c (diff)
downloadkdepimpi-5cf3c1bce58a6487af166e637e54571e98156fd0.zip
kdepimpi-5cf3c1bce58a6487af166e637e54571e98156fd0.tar.gz
kdepimpi-5cf3c1bce58a6487af166e637e54571e98156fd0.tar.bz2
OL import fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp8
-rw-r--r--kaddressbook/kaimportoldialog.cpp46
-rw-r--r--korganizer/koimportoldialog.cpp3
-rw-r--r--korganizer/mainwindow.cpp8
4 files changed, 57 insertions, 8 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 980e436..1074a62 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,1916 +1,1920 @@
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 118
119 119
120#include <kresources/selectdialog.h> 120#include <kresources/selectdialog.h>
121#include <kmessagebox.h> 121#include <kmessagebox.h>
122 122
123#include <picture.h> 123#include <picture.h>
124#include <resource.h> 124#include <resource.h>
125 125
126//US#include <qsplitter.h> 126//US#include <qsplitter.h>
127#include <qmap.h> 127#include <qmap.h>
128#include <qdir.h> 128#include <qdir.h>
129#include <qfile.h> 129#include <qfile.h>
130#include <qvbox.h> 130#include <qvbox.h>
131#include <qlayout.h> 131#include <qlayout.h>
132#include <qclipboard.h> 132#include <qclipboard.h>
133#include <qtextstream.h> 133#include <qtextstream.h>
134 134
135#include <libkdepim/categoryselectdialog.h> 135#include <libkdepim/categoryselectdialog.h>
136#include <kabc/vcardconverter.h> 136#include <kabc/vcardconverter.h>
137 137
138 138
139#include "addresseeutil.h" 139#include "addresseeutil.h"
140#include "undocmds.h" 140#include "undocmds.h"
141#include "addresseeeditordialog.h" 141#include "addresseeeditordialog.h"
142#include "viewmanager.h" 142#include "viewmanager.h"
143#include "details/detailsviewcontainer.h" 143#include "details/detailsviewcontainer.h"
144#include "kabprefs.h" 144#include "kabprefs.h"
145#include "xxportmanager.h" 145#include "xxportmanager.h"
146#include "incsearchwidget.h" 146#include "incsearchwidget.h"
147#include "jumpbuttonbar.h" 147#include "jumpbuttonbar.h"
148#include "extensionmanager.h" 148#include "extensionmanager.h"
149#include "addresseeconfig.h" 149#include "addresseeconfig.h"
150#include <kcmultidialog.h> 150#include <kcmultidialog.h>
151 151
152#ifdef _WIN32_ 152#ifdef _WIN32_
153 153
154#include "kaimportoldialog.h" 154#include "kaimportoldialog.h"
155#else 155#else
156#include <unistd.h> 156#include <unistd.h>
157#endif 157#endif
158// sync includes 158// sync includes
159#include <libkdepim/ksyncprofile.h> 159#include <libkdepim/ksyncprofile.h>
160#include <libkdepim/ksyncprefsdialog.h> 160#include <libkdepim/ksyncprefsdialog.h>
161 161
162class KAex2phonePrefs : public QDialog 162class KAex2phonePrefs : public QDialog
163{ 163{
164 public: 164 public:
165 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 165 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
166 QDialog( parent, name, true ) 166 QDialog( parent, name, true )
167 { 167 {
168 setCaption( i18n("Export to phone options") ); 168 setCaption( i18n("Export to phone options") );
169 QVBoxLayout* lay = new QVBoxLayout( this ); 169 QVBoxLayout* lay = new QVBoxLayout( this );
170 lay->setSpacing( 3 ); 170 lay->setSpacing( 3 );
171 lay->setMargin( 3 ); 171 lay->setMargin( 3 );
172 QLabel *lab; 172 QLabel *lab;
173 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 173 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
174 lab->setAlignment (AlignHCenter ); 174 lab->setAlignment (AlignHCenter );
175 QHBox* temphb; 175 QHBox* temphb;
176 temphb = new QHBox( this ); 176 temphb = new QHBox( this );
177 new QLabel( i18n("I/O device: "), temphb ); 177 new QLabel( i18n("I/O device: "), temphb );
178 mPhoneDevice = new QLineEdit( temphb); 178 mPhoneDevice = new QLineEdit( temphb);
179 lay->addWidget( temphb ); 179 lay->addWidget( temphb );
180 temphb = new QHBox( this ); 180 temphb = new QHBox( this );
181 new QLabel( i18n("Connection: "), temphb ); 181 new QLabel( i18n("Connection: "), temphb );
182 mPhoneConnection = new QLineEdit( temphb); 182 mPhoneConnection = new QLineEdit( temphb);
183 lay->addWidget( temphb ); 183 lay->addWidget( temphb );
184 temphb = new QHBox( this ); 184 temphb = new QHBox( this );
185 new QLabel( i18n("Model(opt.): "), temphb ); 185 new QLabel( i18n("Model(opt.): "), temphb );
186 mPhoneModel = new QLineEdit( temphb); 186 mPhoneModel = new QLineEdit( temphb);
187 lay->addWidget( temphb ); 187 lay->addWidget( temphb );
188 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); 188 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
189 // lay->addWidget( mWriteToSim ); 189 // lay->addWidget( mWriteToSim );
190 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); 190 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
191 lab->setAlignment (AlignHCenter ); 191 lab->setAlignment (AlignHCenter );
192 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 192 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
193 lay->addWidget( ok ); 193 lay->addWidget( ok );
194 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 194 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
195 lay->addWidget( cancel ); 195 lay->addWidget( cancel );
196 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 196 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
197 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 197 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
198 resize( 220, 240 ); 198 resize( 220, 240 );
199 199
200 } 200 }
201 201
202public: 202public:
203 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 203 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
204 QCheckBox* mWriteToSim; 204 QCheckBox* mWriteToSim;
205}; 205};
206 206
207 207
208bool pasteWithNewUid = true; 208bool pasteWithNewUid = true;
209 209
210#ifdef KAB_EMBEDDED 210#ifdef KAB_EMBEDDED
211KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 211KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
212 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 212 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
213 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 213 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
214 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 214 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
215#else //KAB_EMBEDDED 215#else //KAB_EMBEDDED
216KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 216KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
217 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 217 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
218 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 218 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
219 mReadWrite( readWrite ), mModified( false ) 219 mReadWrite( readWrite ), mModified( false )
220#endif //KAB_EMBEDDED 220#endif //KAB_EMBEDDED
221{ 221{
222 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 222 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
223 // syncManager->setBlockSave(false); 223 // syncManager->setBlockSave(false);
224 mExtensionBarSplitter = 0; 224 mExtensionBarSplitter = 0;
225 mIsPart = !parent->inherits( "KAddressBookMain" ); 225 mIsPart = !parent->inherits( "KAddressBookMain" );
226 mAddressBook = KABC::StdAddressBook::self(); 226 mAddressBook = KABC::StdAddressBook::self();
227 KABC::StdAddressBook::setAutomaticSave( false ); 227 KABC::StdAddressBook::setAutomaticSave( false );
228 228
229#ifndef KAB_EMBEDDED 229#ifndef KAB_EMBEDDED
230 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 230 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
231#endif //KAB_EMBEDDED 231#endif //KAB_EMBEDDED
232 232
233 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 233 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
234 SLOT( addressBookChanged() ) ); 234 SLOT( addressBookChanged() ) );
235 235
236#if 0 236#if 0
237 // LP moved to addressbook init method 237 // LP moved to addressbook init method
238 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 238 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
239 "X-Department", "KADDRESSBOOK" ); 239 "X-Department", "KADDRESSBOOK" );
240 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 240 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
241 "X-Profession", "KADDRESSBOOK" ); 241 "X-Profession", "KADDRESSBOOK" );
242 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 242 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
243 "X-AssistantsName", "KADDRESSBOOK" ); 243 "X-AssistantsName", "KADDRESSBOOK" );
244 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 244 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
245 "X-ManagersName", "KADDRESSBOOK" ); 245 "X-ManagersName", "KADDRESSBOOK" );
246 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 246 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
247 "X-SpousesName", "KADDRESSBOOK" ); 247 "X-SpousesName", "KADDRESSBOOK" );
248 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 248 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
249 "X-Office", "KADDRESSBOOK" ); 249 "X-Office", "KADDRESSBOOK" );
250 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 250 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
251 "X-IMAddress", "KADDRESSBOOK" ); 251 "X-IMAddress", "KADDRESSBOOK" );
252 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 252 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
253 "X-Anniversary", "KADDRESSBOOK" ); 253 "X-Anniversary", "KADDRESSBOOK" );
254 254
255 //US added this field to become compatible with Opie/qtopia addressbook 255 //US added this field to become compatible with Opie/qtopia addressbook
256 // values can be "female" or "male" or "". An empty field represents undefined. 256 // values can be "female" or "male" or "". An empty field represents undefined.
257 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 257 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
258 "X-Gender", "KADDRESSBOOK" ); 258 "X-Gender", "KADDRESSBOOK" );
259 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 259 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
260 "X-Children", "KADDRESSBOOK" ); 260 "X-Children", "KADDRESSBOOK" );
261 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 261 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
262 "X-FreeBusyUrl", "KADDRESSBOOK" ); 262 "X-FreeBusyUrl", "KADDRESSBOOK" );
263#endif 263#endif
264 initGUI(); 264 initGUI();
265 265
266 mIncSearchWidget->setFocus(); 266 mIncSearchWidget->setFocus();
267 267
268 268
269 connect( mViewManager, SIGNAL( selected( const QString& ) ), 269 connect( mViewManager, SIGNAL( selected( const QString& ) ),
270 SLOT( setContactSelected( const QString& ) ) ); 270 SLOT( setContactSelected( const QString& ) ) );
271 connect( mViewManager, SIGNAL( executed( const QString& ) ), 271 connect( mViewManager, SIGNAL( executed( const QString& ) ),
272 SLOT( executeContact( const QString& ) ) ); 272 SLOT( executeContact( const QString& ) ) );
273 273
274 connect( mViewManager, SIGNAL( deleteRequest( ) ), 274 connect( mViewManager, SIGNAL( deleteRequest( ) ),
275 SLOT( deleteContacts( ) ) ); 275 SLOT( deleteContacts( ) ) );
276 connect( mViewManager, SIGNAL( modified() ), 276 connect( mViewManager, SIGNAL( modified() ),
277 SLOT( setModified() ) ); 277 SLOT( setModified() ) );
278 278
279 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 279 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
280 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 280 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
281 281
282 connect( mXXPortManager, SIGNAL( modified() ), 282 connect( mXXPortManager, SIGNAL( modified() ),
283 SLOT( setModified() ) ); 283 SLOT( setModified() ) );
284 284
285 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 285 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
286 SLOT( incrementalSearch( const QString& ) ) ); 286 SLOT( incrementalSearch( const QString& ) ) );
287 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 287 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
288 mJumpButtonBar, SLOT( recreateButtons() ) ); 288 mJumpButtonBar, SLOT( recreateButtons() ) );
289 289
290 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 290 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
291 SLOT( sendMail( const QString& ) ) ); 291 SLOT( sendMail( const QString& ) ) );
292 292
293 293
294 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 294 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
295 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&))); 295 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&)));
296 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 296 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
297 297
298 298
299#ifndef KAB_EMBEDDED 299#ifndef KAB_EMBEDDED
300 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 300 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
301 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 301 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
302 302
303 connect( mDetails, SIGNAL( browse( const QString& ) ), 303 connect( mDetails, SIGNAL( browse( const QString& ) ),
304 SLOT( browse( const QString& ) ) ); 304 SLOT( browse( const QString& ) ) );
305 305
306 306
307 mAddressBookService = new KAddressBookService( this ); 307 mAddressBookService = new KAddressBookService( this );
308 308
309#endif //KAB_EMBEDDED 309#endif //KAB_EMBEDDED
310 310
311 mMessageTimer = new QTimer( this ); 311 mMessageTimer = new QTimer( this );
312 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); 312 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
313 mEditorDialog = 0; 313 mEditorDialog = 0;
314 createAddresseeEditorDialog( this ); 314 createAddresseeEditorDialog( this );
315 setModified( false ); 315 setModified( false );
316 mBRdisabled = 0; 316 mBRdisabled = 0;
317#ifndef DESKTOP_VERSION 317#ifndef DESKTOP_VERSION
318 infrared = 0; 318 infrared = 0;
319#endif 319#endif
320 toggleBeamReceive( ); 320 toggleBeamReceive( );
321} 321}
322 322
323KABCore::~KABCore() 323KABCore::~KABCore()
324{ 324{
325 // save(); 325 // save();
326 //saveSettings(); 326 //saveSettings();
327 //KABPrefs::instance()->writeConfig(); 327 //KABPrefs::instance()->writeConfig();
328 delete AddresseeConfig::instance(); 328 delete AddresseeConfig::instance();
329 mAddressBook = 0; 329 mAddressBook = 0;
330 KABC::StdAddressBook::close(); 330 KABC::StdAddressBook::close();
331 331
332 delete syncManager; 332 delete syncManager;
333#ifndef DESKTOP_VERSION
333 if ( infrared ) 334 if ( infrared )
334 delete infrared; 335 delete infrared;
336#endif
335} 337}
336void KABCore::receive( const QCString& cmsg, const QByteArray& data ) 338void KABCore::receive( const QCString& cmsg, const QByteArray& data )
337{ 339{
338 qDebug("KA: QCOP message received: %s ", cmsg.data() ); 340 qDebug("KA: QCOP message received: %s ", cmsg.data() );
339 if ( cmsg == "setDocument(QString)" ) { 341 if ( cmsg == "setDocument(QString)" ) {
340 QDataStream stream( data, IO_ReadOnly ); 342 QDataStream stream( data, IO_ReadOnly );
341 QString fileName; 343 QString fileName;
342 stream >> fileName; 344 stream >> fileName;
343 recieve( fileName ); 345 recieve( fileName );
344 return; 346 return;
345 } 347 }
346} 348}
347void KABCore::toggleBeamReceive( ) 349void KABCore::toggleBeamReceive( )
348{ 350{
349 if ( mBRdisabled ) 351 if ( mBRdisabled )
350 return; 352 return;
351#ifndef DESKTOP_VERSION 353#ifndef DESKTOP_VERSION
352 if ( infrared ) { 354 if ( infrared ) {
353 qDebug("AB disable BeamReceive "); 355 qDebug("AB disable BeamReceive ");
354 delete infrared; 356 delete infrared;
355 infrared = 0; 357 infrared = 0;
356 mActionBR->setChecked(false); 358 mActionBR->setChecked(false);
357 return; 359 return;
358 } 360 }
359 qDebug("AB enable BeamReceive "); 361 qDebug("AB enable BeamReceive ");
360 mActionBR->setChecked(true); 362 mActionBR->setChecked(true);
361 363
362 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; 364 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
363 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); 365 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
364#endif 366#endif
365} 367}
366 368
367 369
368void KABCore::disableBR(bool b) 370void KABCore::disableBR(bool b)
369{ 371{
372#ifndef DESKTOP_VERSION
370 if ( b ) { 373 if ( b ) {
371 if ( infrared ) { 374 if ( infrared ) {
372 toggleBeamReceive( ); 375 toggleBeamReceive( );
373 mBRdisabled = true;
374 } 376 }
377 mBRdisabled = true;
375 } else { 378 } else {
376 if ( mBRdisabled ) { 379 if ( mBRdisabled ) {
377 mBRdisabled = false; 380 mBRdisabled = false;
378 toggleBeamReceive( ); 381 //toggleBeamReceive( );
379 } 382 }
380 } 383 }
384#endif
381 385
382} 386}
383void KABCore::recieve( QString fn ) 387void KABCore::recieve( QString fn )
384{ 388{
385 //qDebug("KABCore::recieve "); 389 //qDebug("KABCore::recieve ");
386 int count = mAddressBook->importFromFile( fn, true ); 390 int count = mAddressBook->importFromFile( fn, true );
387 mViewManager->refreshView(); 391 mViewManager->refreshView();
388 message(i18n("%1 contact(s) received!").arg( count )); 392 message(i18n("%1 contact(s) received!").arg( count ));
389 topLevelWidget()->showMaximized(); 393 topLevelWidget()->showMaximized();
390 topLevelWidget()->raise(); 394 topLevelWidget()->raise();
391} 395}
392void KABCore::restoreSettings() 396void KABCore::restoreSettings()
393{ 397{
394 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 398 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
395 399
396 bool state; 400 bool state;
397 401
398 if (mMultipleViewsAtOnce) 402 if (mMultipleViewsAtOnce)
399 state = KABPrefs::instance()->mDetailsPageVisible; 403 state = KABPrefs::instance()->mDetailsPageVisible;
400 else 404 else
401 state = false; 405 state = false;
402 406
403 mActionDetails->setChecked( state ); 407 mActionDetails->setChecked( state );
404 setDetailsVisible( state ); 408 setDetailsVisible( state );
405 409
406 state = KABPrefs::instance()->mJumpButtonBarVisible; 410 state = KABPrefs::instance()->mJumpButtonBarVisible;
407 411
408 mActionJumpBar->setChecked( state ); 412 mActionJumpBar->setChecked( state );
409 setJumpButtonBarVisible( state ); 413 setJumpButtonBarVisible( state );
410/*US 414/*US
411 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 415 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
412 if ( splitterSize.count() == 0 ) { 416 if ( splitterSize.count() == 0 ) {
413 splitterSize.append( width() / 2 ); 417 splitterSize.append( width() / 2 );
414 splitterSize.append( width() / 2 ); 418 splitterSize.append( width() / 2 );
415 } 419 }
416 mMiniSplitter->setSizes( splitterSize ); 420 mMiniSplitter->setSizes( splitterSize );
417 if ( mExtensionBarSplitter ) { 421 if ( mExtensionBarSplitter ) {
418 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 422 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
419 if ( splitterSize.count() == 0 ) { 423 if ( splitterSize.count() == 0 ) {
420 splitterSize.append( width() / 2 ); 424 splitterSize.append( width() / 2 );
421 splitterSize.append( width() / 2 ); 425 splitterSize.append( width() / 2 );
422 } 426 }
423 mExtensionBarSplitter->setSizes( splitterSize ); 427 mExtensionBarSplitter->setSizes( splitterSize );
424 428
425 } 429 }
426*/ 430*/
427 mViewManager->restoreSettings(); 431 mViewManager->restoreSettings();
428 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 432 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
429 mExtensionManager->restoreSettings(); 433 mExtensionManager->restoreSettings();
430#ifdef DESKTOP_VERSION 434#ifdef DESKTOP_VERSION
431 int wid = width(); 435 int wid = width();
432 if ( wid < 10 ) 436 if ( wid < 10 )
433 wid = 400; 437 wid = 400;
434#else 438#else
435 int wid = QApplication::desktop()->width(); 439 int wid = QApplication::desktop()->width();
436 if ( wid < 640 ) 440 if ( wid < 640 )
437 wid = QApplication::desktop()->height(); 441 wid = QApplication::desktop()->height();
438#endif 442#endif
439 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 443 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
440 if ( true /*splitterSize.count() == 0*/ ) { 444 if ( true /*splitterSize.count() == 0*/ ) {
441 splitterSize.append( wid / 2 ); 445 splitterSize.append( wid / 2 );
442 splitterSize.append( wid / 2 ); 446 splitterSize.append( wid / 2 );
443 } 447 }
444 mMiniSplitter->setSizes( splitterSize ); 448 mMiniSplitter->setSizes( splitterSize );
445 if ( mExtensionBarSplitter ) { 449 if ( mExtensionBarSplitter ) {
446 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 450 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
447 if ( true /*splitterSize.count() == 0*/ ) { 451 if ( true /*splitterSize.count() == 0*/ ) {
448 splitterSize.append( wid / 2 ); 452 splitterSize.append( wid / 2 );
449 splitterSize.append( wid / 2 ); 453 splitterSize.append( wid / 2 );
450 } 454 }
451 mExtensionBarSplitter->setSizes( splitterSize ); 455 mExtensionBarSplitter->setSizes( splitterSize );
452 456
453 } 457 }
454 458
455 459
456} 460}
457 461
458void KABCore::saveSettings() 462void KABCore::saveSettings()
459{ 463{
460 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 464 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
461 if ( mExtensionBarSplitter ) 465 if ( mExtensionBarSplitter )
462 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 466 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
463 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 467 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
464 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 468 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
465#ifndef KAB_EMBEDDED 469#ifndef KAB_EMBEDDED
466 470
467 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 471 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
468 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 472 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
469#endif //KAB_EMBEDDED 473#endif //KAB_EMBEDDED
470 mExtensionManager->saveSettings(); 474 mExtensionManager->saveSettings();
471 mViewManager->saveSettings(); 475 mViewManager->saveSettings();
472 476
473 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 477 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
474} 478}
475 479
476KABC::AddressBook *KABCore::addressBook() const 480KABC::AddressBook *KABCore::addressBook() const
477{ 481{
478 return mAddressBook; 482 return mAddressBook;
479} 483}
480 484
481KConfig *KABCore::config() 485KConfig *KABCore::config()
482{ 486{
483#ifndef KAB_EMBEDDED 487#ifndef KAB_EMBEDDED
484 return KABPrefs::instance()->config(); 488 return KABPrefs::instance()->config();
485#else //KAB_EMBEDDED 489#else //KAB_EMBEDDED
486 return KABPrefs::instance()->getConfig(); 490 return KABPrefs::instance()->getConfig();
487#endif //KAB_EMBEDDED 491#endif //KAB_EMBEDDED
488} 492}
489 493
490KActionCollection *KABCore::actionCollection() const 494KActionCollection *KABCore::actionCollection() const
491{ 495{
492 return mGUIClient->actionCollection(); 496 return mGUIClient->actionCollection();
493} 497}
494 498
495KABC::Field *KABCore::currentSearchField() const 499KABC::Field *KABCore::currentSearchField() const
496{ 500{
497 if (mIncSearchWidget) 501 if (mIncSearchWidget)
498 return mIncSearchWidget->currentField(); 502 return mIncSearchWidget->currentField();
499 else 503 else
500 return 0; 504 return 0;
501} 505}
502 506
503QStringList KABCore::selectedUIDs() const 507QStringList KABCore::selectedUIDs() const
504{ 508{
505 return mViewManager->selectedUids(); 509 return mViewManager->selectedUids();
506} 510}
507 511
508KABC::Resource *KABCore::requestResource( QWidget *parent ) 512KABC::Resource *KABCore::requestResource( QWidget *parent )
509{ 513{
510 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 514 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
511 515
512 QPtrList<KRES::Resource> kresResources; 516 QPtrList<KRES::Resource> kresResources;
513 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 517 QPtrListIterator<KABC::Resource> resIt( kabcResources );
514 KABC::Resource *resource; 518 KABC::Resource *resource;
515 while ( ( resource = resIt.current() ) != 0 ) { 519 while ( ( resource = resIt.current() ) != 0 ) {
516 ++resIt; 520 ++resIt;
517 if ( !resource->readOnly() ) { 521 if ( !resource->readOnly() ) {
518 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 522 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
519 if ( res ) 523 if ( res )
520 kresResources.append( res ); 524 kresResources.append( res );
521 } 525 }
522 } 526 }
523 527
524 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 528 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
525 return static_cast<KABC::Resource*>( res ); 529 return static_cast<KABC::Resource*>( res );
526} 530}
527 531
528#ifndef KAB_EMBEDDED 532#ifndef KAB_EMBEDDED
529KAboutData *KABCore::createAboutData() 533KAboutData *KABCore::createAboutData()
530#else //KAB_EMBEDDED 534#else //KAB_EMBEDDED
531void KABCore::createAboutData() 535void KABCore::createAboutData()
532#endif //KAB_EMBEDDED 536#endif //KAB_EMBEDDED
533{ 537{
534#ifndef KAB_EMBEDDED 538#ifndef KAB_EMBEDDED
535 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 539 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
536 "3.1", I18N_NOOP( "The KDE Address Book" ), 540 "3.1", I18N_NOOP( "The KDE Address Book" ),
537 KAboutData::License_GPL_V2, 541 KAboutData::License_GPL_V2,
538 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 542 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
539 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 543 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
540 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 544 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
541 about->addAuthor( "Cornelius Schumacher", 545 about->addAuthor( "Cornelius Schumacher",
542 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 546 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
543 "schumacher@kde.org" ); 547 "schumacher@kde.org" );
544 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 548 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
545 "mpilone@slac.com" ); 549 "mpilone@slac.com" );
546 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 550 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
547 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 551 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
548 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 552 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
549 "michel@klaralvdalens-datakonsult.se" ); 553 "michel@klaralvdalens-datakonsult.se" );
550 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 554 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
551 "hansen@kde.org" ); 555 "hansen@kde.org" );
552 556
553 return about; 557 return about;
554#endif //KAB_EMBEDDED 558#endif //KAB_EMBEDDED
555 559
556 QString version; 560 QString version;
557#include <../version> 561#include <../version>
558 QMessageBox::about( this, "About KAddressbook/Pi", 562 QMessageBox::about( this, "About KAddressbook/Pi",
559 "KAddressbook/Platform-independent\n" 563 "KAddressbook/Platform-independent\n"
560 "(KA/Pi) " +version + " - " + 564 "(KA/Pi) " +version + " - " +
561#ifdef DESKTOP_VERSION 565#ifdef DESKTOP_VERSION
562 "Desktop Edition\n" 566 "Desktop Edition\n"
563#else 567#else
564 "PDA-Edition\n" 568 "PDA-Edition\n"
565 "for: Zaurus 5500 / 7x0 / 8x0\n" 569 "for: Zaurus 5500 / 7x0 / 8x0\n"
566#endif 570#endif
567 571
568 "(c) 2004 Ulf Schenk\n" 572 "(c) 2004 Ulf Schenk\n"
569 "(c) 2004 Lutz Rogowski\n" 573 "(c) 2004 Lutz Rogowski\n"
570 "(c) 1997-2003, The KDE PIM Team\n" 574 "(c) 1997-2003, The KDE PIM Team\n"
571 "Tobias Koenig Current maintainer\ntokoe@kde.org\n" 575 "Tobias Koenig Current maintainer\ntokoe@kde.org\n"
572 "Don Sanders Original author\n" 576 "Don Sanders Original author\n"
573 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" 577 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n"
574 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" 578 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n"
575 "Greg Stern DCOP interface\n" 579 "Greg Stern DCOP interface\n"
576 "Mark Westcot Contact pinning\n" 580 "Mark Westcot Contact pinning\n"
577 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 581 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
578 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" 582 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n"
579#ifdef _WIN32_ 583#ifdef _WIN32_
580 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" 584 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n"
581#endif 585#endif
582 ); 586 );
583} 587}
584 588
585void KABCore::setContactSelected( const QString &uid ) 589void KABCore::setContactSelected( const QString &uid )
586{ 590{
587 KABC::Addressee addr = mAddressBook->findByUid( uid ); 591 KABC::Addressee addr = mAddressBook->findByUid( uid );
588 if ( !mDetails->isHidden() ) 592 if ( !mDetails->isHidden() )
589 mDetails->setAddressee( addr ); 593 mDetails->setAddressee( addr );
590 594
591 if ( !addr.isEmpty() ) { 595 if ( !addr.isEmpty() ) {
592 emit contactSelected( addr.formattedName() ); 596 emit contactSelected( addr.formattedName() );
593 KABC::Picture pic = addr.photo(); 597 KABC::Picture pic = addr.photo();
594 if ( pic.isIntern() ) { 598 if ( pic.isIntern() ) {
595//US emit contactSelected( pic.data() ); 599//US emit contactSelected( pic.data() );
596//US instead use: 600//US instead use:
597 QPixmap px; 601 QPixmap px;
598 if (pic.data().isNull() != true) 602 if (pic.data().isNull() != true)
599 { 603 {
600 px.convertFromImage(pic.data()); 604 px.convertFromImage(pic.data());
601 } 605 }
602 606
603 emit contactSelected( px ); 607 emit contactSelected( px );
604 } 608 }
605 } 609 }
606 610
607 611
608 mExtensionManager->setSelectionChanged(); 612 mExtensionManager->setSelectionChanged();
609 613
610 // update the actions 614 // update the actions
611 bool selected = !uid.isEmpty(); 615 bool selected = !uid.isEmpty();
612 616
613 if ( mReadWrite ) { 617 if ( mReadWrite ) {
614 mActionCut->setEnabled( selected ); 618 mActionCut->setEnabled( selected );
615 mActionPaste->setEnabled( selected ); 619 mActionPaste->setEnabled( selected );
616 } 620 }
617 621
618 mActionCopy->setEnabled( selected ); 622 mActionCopy->setEnabled( selected );
619 mActionDelete->setEnabled( selected ); 623 mActionDelete->setEnabled( selected );
620 mActionEditAddressee->setEnabled( selected ); 624 mActionEditAddressee->setEnabled( selected );
621 mActionMail->setEnabled( selected ); 625 mActionMail->setEnabled( selected );
622 mActionMailVCard->setEnabled( selected ); 626 mActionMailVCard->setEnabled( selected );
623 //if (mActionBeam) 627 //if (mActionBeam)
624 //mActionBeam->setEnabled( selected ); 628 //mActionBeam->setEnabled( selected );
625 629
626 if (mActionBeamVCard) 630 if (mActionBeamVCard)
627 mActionBeamVCard->setEnabled( selected ); 631 mActionBeamVCard->setEnabled( selected );
628 632
629 mActionExport2phone->setEnabled( selected ); 633 mActionExport2phone->setEnabled( selected );
630 mActionWhoAmI->setEnabled( selected ); 634 mActionWhoAmI->setEnabled( selected );
631 mActionCategories->setEnabled( selected ); 635 mActionCategories->setEnabled( selected );
632} 636}
633 637
634void KABCore::sendMail() 638void KABCore::sendMail()
635{ 639{
636 sendMail( mViewManager->selectedEmails().join( ", " ) ); 640 sendMail( mViewManager->selectedEmails().join( ", " ) );
637} 641}
638 642
639void KABCore::sendMail( const QString& emaillist ) 643void KABCore::sendMail( const QString& emaillist )
640{ 644{
641 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " 645 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
642 if (emaillist.contains(",") > 0) 646 if (emaillist.contains(",") > 0)
643 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); 647 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
644 else 648 else
645 ExternalAppHandler::instance()->mailToOneContact( emaillist ); 649 ExternalAppHandler::instance()->mailToOneContact( emaillist );
646} 650}
647 651
648 652
649 653
650void KABCore::mailVCard() 654void KABCore::mailVCard()
651{ 655{
652 QStringList uids = mViewManager->selectedUids(); 656 QStringList uids = mViewManager->selectedUids();
653 if ( !uids.isEmpty() ) 657 if ( !uids.isEmpty() )
654 mailVCard( uids ); 658 mailVCard( uids );
655} 659}
656 660
657void KABCore::mailVCard( const QStringList& uids ) 661void KABCore::mailVCard( const QStringList& uids )
658{ 662{
659 QStringList urls; 663 QStringList urls;
660 664
661// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 665// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
662 666
663 QString dirName = "/tmp/" + KApplication::randomString( 8 ); 667 QString dirName = "/tmp/" + KApplication::randomString( 8 );
664 668
665 669
666 670
667 QDir().mkdir( dirName, true ); 671 QDir().mkdir( dirName, true );
668 672
669 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 673 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
670 KABC::Addressee a = mAddressBook->findByUid( *it ); 674 KABC::Addressee a = mAddressBook->findByUid( *it );
671 675
672 if ( a.isEmpty() ) 676 if ( a.isEmpty() )
673 continue; 677 continue;
674 678
675 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 679 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
676 680
677 QString fileName = dirName + "/" + name; 681 QString fileName = dirName + "/" + name;
678 682
679 QFile outFile(fileName); 683 QFile outFile(fileName);
680 684
681 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 685 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
682 KABC::VCardConverter converter; 686 KABC::VCardConverter converter;
683 QString vcard; 687 QString vcard;
684 688
685 converter.addresseeToVCard( a, vcard ); 689 converter.addresseeToVCard( a, vcard );
686 690
687 QTextStream t( &outFile ); // use a text stream 691 QTextStream t( &outFile ); // use a text stream
688 t.setEncoding( QTextStream::UnicodeUTF8 ); 692 t.setEncoding( QTextStream::UnicodeUTF8 );
689 t << vcard; 693 t << vcard;
690 694
691 outFile.close(); 695 outFile.close();
692 696
693 urls.append( fileName ); 697 urls.append( fileName );
694 } 698 }
695 } 699 }
696 700
697 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 701 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
698 702
699 703
700/*US 704/*US
701 kapp->invokeMailer( QString::null, QString::null, QString::null, 705 kapp->invokeMailer( QString::null, QString::null, QString::null,
702 QString::null, // subject 706 QString::null, // subject
703 QString::null, // body 707 QString::null, // body
704 QString::null, 708 QString::null,
705 urls ); // attachments 709 urls ); // attachments
706*/ 710*/
707 711
708} 712}
709 713
710/** 714/**
711 Beams the "WhoAmI contact. 715 Beams the "WhoAmI contact.
712*/ 716*/
713void KABCore::beamMySelf() 717void KABCore::beamMySelf()
714{ 718{
715 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 719 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
716 if (!a.isEmpty()) 720 if (!a.isEmpty())
717 { 721 {
718 QStringList uids; 722 QStringList uids;
719 uids << a.uid(); 723 uids << a.uid();
720 724
721 beamVCard(uids); 725 beamVCard(uids);
722 } else { 726 } else {
723 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 727 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
724 728
725 729
726 } 730 }
727} 731}
728 732
729void KABCore::export2phone() 733void KABCore::export2phone()
730{ 734{
731 735
732 KAex2phonePrefs ex2phone; 736 KAex2phonePrefs ex2phone;
733 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 737 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
734 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 738 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
735 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 739 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
736 740
737 if ( !ex2phone.exec() ) { 741 if ( !ex2phone.exec() ) {
738 return; 742 return;
739 } 743 }
740 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 744 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
741 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 745 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
742 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 746 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
743 747
744 748
745 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 749 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
746 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 750 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
747 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 751 KPimGlobalPrefs::instance()->mEx2PhoneModel );
748 752
749 QStringList uids = mViewManager->selectedUids(); 753 QStringList uids = mViewManager->selectedUids();
750 if ( uids.isEmpty() ) 754 if ( uids.isEmpty() )
751 return; 755 return;
752 756
753 QString fileName = getPhoneFile(); 757 QString fileName = getPhoneFile();
754 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) 758 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
755 return; 759 return;
756 760
757 message(i18n("Exporting to phone...")); 761 message(i18n("Exporting to phone..."));
758 QTimer::singleShot( 1, this , SLOT ( writeToPhone())); 762 QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
759 763
760} 764}
761QString KABCore::getPhoneFile() 765QString KABCore::getPhoneFile()
762{ 766{
763#ifdef DESKTOP_VERSION 767#ifdef DESKTOP_VERSION
764 return locateLocal("tmp", "phonefile.vcf"); 768 return locateLocal("tmp", "phonefile.vcf");
765#else 769#else
766 return "/tmp/phonefile.vcf"; 770 return "/tmp/phonefile.vcf";
767#endif 771#endif
768 772
769} 773}
770void KABCore::writeToPhone( ) 774void KABCore::writeToPhone( )
771{ 775{
772 if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) 776 if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
773 message(i18n("Export to phone finished!")); 777 message(i18n("Export to phone finished!"));
774 else 778 else
775 qDebug(i18n("Error exporting to phone")); 779 qDebug(i18n("Error exporting to phone"));
776} 780}
777void KABCore::beamVCard() 781void KABCore::beamVCard()
778{ 782{
779 QStringList uids = mViewManager->selectedUids(); 783 QStringList uids = mViewManager->selectedUids();
780 if ( !uids.isEmpty() ) 784 if ( !uids.isEmpty() )
781 beamVCard( uids ); 785 beamVCard( uids );
782} 786}
783 787
784 788
785void KABCore::beamVCard(const QStringList& uids) 789void KABCore::beamVCard(const QStringList& uids)
786{ 790{
787 791
788 // LR: we should use the /tmp dir on the Zaurus, 792 // LR: we should use the /tmp dir on the Zaurus,
789 // because: /tmp = RAM, (HOME)/kdepim = flash memory 793 // because: /tmp = RAM, (HOME)/kdepim = flash memory
790 794
791#ifdef DESKTOP_VERSION 795#ifdef DESKTOP_VERSION
792 QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); 796 QString fileName = locateLocal("tmp", "kapibeamfile.vcf");
793#else 797#else
794 QString fileName = "/tmp/kapibeamfile.vcf"; 798 QString fileName = "/tmp/kapibeamfile.vcf";
795#endif 799#endif
796 800
797 KABC::VCardConverter converter; 801 KABC::VCardConverter converter;
798 QString description; 802 QString description;
799 QString datastream; 803 QString datastream;
800 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 804 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
801 KABC::Addressee a = mAddressBook->findByUid( *it ); 805 KABC::Addressee a = mAddressBook->findByUid( *it );
802 806
803 if ( a.isEmpty() ) 807 if ( a.isEmpty() )
804 continue; 808 continue;
805 809
806 if (description.isEmpty()) 810 if (description.isEmpty())
807 description = a.formattedName(); 811 description = a.formattedName();
808 812
809 QString vcard; 813 QString vcard;
810 converter.addresseeToVCard( a, vcard ); 814 converter.addresseeToVCard( a, vcard );
811 int start = 0; 815 int start = 0;
812 int next; 816 int next;
813 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 817 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
814 int semi = vcard.find(";", next); 818 int semi = vcard.find(";", next);
815 int dopp = vcard.find(":", next); 819 int dopp = vcard.find(":", next);
816 int sep; 820 int sep;
817 if ( semi < dopp && semi >= 0 ) 821 if ( semi < dopp && semi >= 0 )
818 sep = semi ; 822 sep = semi ;
819 else 823 else
820 sep = dopp; 824 sep = dopp;
821 datastream +=vcard.mid( start, next - start); 825 datastream +=vcard.mid( start, next - start);
822 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 826 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
823 start = sep; 827 start = sep;
824 } 828 }
825 datastream += vcard.mid( start,vcard.length() ); 829 datastream += vcard.mid( start,vcard.length() );
826 } 830 }
827#ifndef DESKTOP_VERSION 831#ifndef DESKTOP_VERSION
828 QFile outFile(fileName); 832 QFile outFile(fileName);
829 if ( outFile.open(IO_WriteOnly) ) { 833 if ( outFile.open(IO_WriteOnly) ) {
830 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 834 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
831 QTextStream t( &outFile ); // use a text stream 835 QTextStream t( &outFile ); // use a text stream
832 //t.setEncoding( QTextStream::UnicodeUTF8 ); 836 //t.setEncoding( QTextStream::UnicodeUTF8 );
833 t.setEncoding( QTextStream::Latin1 ); 837 t.setEncoding( QTextStream::Latin1 );
834 t <<datastream.latin1(); 838 t <<datastream.latin1();
835 outFile.close(); 839 outFile.close();
836 Ir *ir = new Ir( this ); 840 Ir *ir = new Ir( this );
837 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 841 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
838 ir->send( fileName, description, "text/x-vCard" ); 842 ir->send( fileName, description, "text/x-vCard" );
839 } else { 843 } else {
840 qDebug("Error open temp beam file "); 844 qDebug("Error open temp beam file ");
841 return; 845 return;
842 } 846 }
843#endif 847#endif
844 848
845} 849}
846 850
847void KABCore::beamDone( Ir *ir ) 851void KABCore::beamDone( Ir *ir )
848{ 852{
849#ifndef DESKTOP_VERSION 853#ifndef DESKTOP_VERSION
850 delete ir; 854 delete ir;
851#endif 855#endif
852 topLevelWidget()->raise(); 856 topLevelWidget()->raise();
853 message( i18n("Beaming finished!") ); 857 message( i18n("Beaming finished!") );
854} 858}
855 859
856 860
857void KABCore::browse( const QString& url ) 861void KABCore::browse( const QString& url )
858{ 862{
859#ifndef KAB_EMBEDDED 863#ifndef KAB_EMBEDDED
860 kapp->invokeBrowser( url ); 864 kapp->invokeBrowser( url );
861#else //KAB_EMBEDDED 865#else //KAB_EMBEDDED
862 qDebug("KABCore::browse must be fixed"); 866 qDebug("KABCore::browse must be fixed");
863#endif //KAB_EMBEDDED 867#endif //KAB_EMBEDDED
864} 868}
865 869
866void KABCore::selectAllContacts() 870void KABCore::selectAllContacts()
867{ 871{
868 mViewManager->setSelected( QString::null, true ); 872 mViewManager->setSelected( QString::null, true );
869} 873}
870 874
871void KABCore::deleteContacts() 875void KABCore::deleteContacts()
872{ 876{
873 QStringList uidList = mViewManager->selectedUids(); 877 QStringList uidList = mViewManager->selectedUids();
874 deleteContacts( uidList ); 878 deleteContacts( uidList );
875} 879}
876 880
877void KABCore::deleteContacts( const QStringList &uids ) 881void KABCore::deleteContacts( const QStringList &uids )
878{ 882{
879 if ( uids.count() > 0 ) { 883 if ( uids.count() > 0 ) {
880 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 884 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
881 UndoStack::instance()->push( command ); 885 UndoStack::instance()->push( command );
882 RedoStack::instance()->clear(); 886 RedoStack::instance()->clear();
883 887
884 // now if we deleted anything, refresh 888 // now if we deleted anything, refresh
885 setContactSelected( QString::null ); 889 setContactSelected( QString::null );
886 setModified( true ); 890 setModified( true );
887 } 891 }
888} 892}
889 893
890void KABCore::copyContacts() 894void KABCore::copyContacts()
891{ 895{
892 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 896 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
893 897
894 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 898 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
895 899
896 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 900 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
897 901
898 QClipboard *cb = QApplication::clipboard(); 902 QClipboard *cb = QApplication::clipboard();
899 cb->setText( clipText ); 903 cb->setText( clipText );
900} 904}
901 905
902void KABCore::cutContacts() 906void KABCore::cutContacts()
903{ 907{
904 QStringList uidList = mViewManager->selectedUids(); 908 QStringList uidList = mViewManager->selectedUids();
905 909
906//US if ( uidList.size() > 0 ) { 910//US if ( uidList.size() > 0 ) {
907 if ( uidList.count() > 0 ) { 911 if ( uidList.count() > 0 ) {
908 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 912 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
909 UndoStack::instance()->push( command ); 913 UndoStack::instance()->push( command );
910 RedoStack::instance()->clear(); 914 RedoStack::instance()->clear();
911 915
912 setModified( true ); 916 setModified( true );
913 } 917 }
914} 918}
915 919
916void KABCore::pasteContacts() 920void KABCore::pasteContacts()
917{ 921{
918 QClipboard *cb = QApplication::clipboard(); 922 QClipboard *cb = QApplication::clipboard();
919 923
920 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 924 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
921 925
922 pasteContacts( list ); 926 pasteContacts( list );
923} 927}
924 928
925void KABCore::pasteContacts( KABC::Addressee::List &list ) 929void KABCore::pasteContacts( KABC::Addressee::List &list )
926{ 930{
927 KABC::Resource *resource = requestResource( this ); 931 KABC::Resource *resource = requestResource( this );
928 KABC::Addressee::List::Iterator it; 932 KABC::Addressee::List::Iterator it;
929 for ( it = list.begin(); it != list.end(); ++it ) 933 for ( it = list.begin(); it != list.end(); ++it )
930 (*it).setResource( resource ); 934 (*it).setResource( resource );
931 935
932 PwPasteCommand *command = new PwPasteCommand( this, list ); 936 PwPasteCommand *command = new PwPasteCommand( this, list );
933 UndoStack::instance()->push( command ); 937 UndoStack::instance()->push( command );
934 RedoStack::instance()->clear(); 938 RedoStack::instance()->clear();
935 939
936 setModified( true ); 940 setModified( true );
937} 941}
938 942
939void KABCore::setWhoAmI() 943void KABCore::setWhoAmI()
940{ 944{
941 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 945 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
942 946
943 if ( addrList.count() > 1 ) { 947 if ( addrList.count() > 1 ) {
944 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 948 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
945 return; 949 return;
946 } 950 }
947 951
948 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 952 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
949 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 953 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
950 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 954 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
951} 955}
952 956
953void KABCore::setCategories() 957void KABCore::setCategories()
954{ 958{
955 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 959 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
956 if ( !dlg.exec() ) 960 if ( !dlg.exec() )
957 return; 961 return;
958 962
959 bool merge = false; 963 bool merge = false;
960 QString msg = i18n( "Merge with existing categories?" ); 964 QString msg = i18n( "Merge with existing categories?" );
961 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 965 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
962 merge = true; 966 merge = true;
963 967
964 QStringList categories = dlg.selectedCategories(); 968 QStringList categories = dlg.selectedCategories();
965 969
966 QStringList uids = mViewManager->selectedUids(); 970 QStringList uids = mViewManager->selectedUids();
967 QStringList::Iterator it; 971 QStringList::Iterator it;
968 for ( it = uids.begin(); it != uids.end(); ++it ) { 972 for ( it = uids.begin(); it != uids.end(); ++it ) {
969 KABC::Addressee addr = mAddressBook->findByUid( *it ); 973 KABC::Addressee addr = mAddressBook->findByUid( *it );
970 if ( !addr.isEmpty() ) { 974 if ( !addr.isEmpty() ) {
971 if ( !merge ) 975 if ( !merge )
972 addr.setCategories( categories ); 976 addr.setCategories( categories );
973 else { 977 else {
974 QStringList addrCategories = addr.categories(); 978 QStringList addrCategories = addr.categories();
975 QStringList::Iterator catIt; 979 QStringList::Iterator catIt;
976 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 980 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
977 if ( !addrCategories.contains( *catIt ) ) 981 if ( !addrCategories.contains( *catIt ) )
978 addrCategories.append( *catIt ); 982 addrCategories.append( *catIt );
979 } 983 }
980 addr.setCategories( addrCategories ); 984 addr.setCategories( addrCategories );
981 } 985 }
982 986
983 mAddressBook->insertAddressee( addr ); 987 mAddressBook->insertAddressee( addr );
984 } 988 }
985 } 989 }
986 990
987 if ( uids.count() > 0 ) 991 if ( uids.count() > 0 )
988 setModified( true ); 992 setModified( true );
989} 993}
990 994
991void KABCore::setSearchFields( const KABC::Field::List &fields ) 995void KABCore::setSearchFields( const KABC::Field::List &fields )
992{ 996{
993 mIncSearchWidget->setFields( fields ); 997 mIncSearchWidget->setFields( fields );
994} 998}
995 999
996void KABCore::incrementalSearch( const QString& text ) 1000void KABCore::incrementalSearch( const QString& text )
997{ 1001{
998 mViewManager->doSearch( text, mIncSearchWidget->currentField() ); 1002 mViewManager->doSearch( text, mIncSearchWidget->currentField() );
999} 1003}
1000 1004
1001void KABCore::setModified() 1005void KABCore::setModified()
1002{ 1006{
1003 setModified( true ); 1007 setModified( true );
1004} 1008}
1005 1009
1006void KABCore::setModifiedWOrefresh() 1010void KABCore::setModifiedWOrefresh()
1007{ 1011{
1008 // qDebug("KABCore::setModifiedWOrefresh() "); 1012 // qDebug("KABCore::setModifiedWOrefresh() ");
1009 mModified = true; 1013 mModified = true;
1010 mActionSave->setEnabled( mModified ); 1014 mActionSave->setEnabled( mModified );
1011#ifdef DESKTOP_VERSION 1015#ifdef DESKTOP_VERSION
1012 mDetails->refreshView(); 1016 mDetails->refreshView();
1013#endif 1017#endif
1014 1018
1015} 1019}
1016void KABCore::setModified( bool modified ) 1020void KABCore::setModified( bool modified )
1017{ 1021{
1018 mModified = modified; 1022 mModified = modified;
1019 mActionSave->setEnabled( mModified ); 1023 mActionSave->setEnabled( mModified );
1020 1024
1021 if ( modified ) 1025 if ( modified )
1022 mJumpButtonBar->recreateButtons(); 1026 mJumpButtonBar->recreateButtons();
1023 1027
1024 mViewManager->refreshView(); 1028 mViewManager->refreshView();
1025 mDetails->refreshView(); 1029 mDetails->refreshView();
1026 1030
1027} 1031}
1028 1032
1029bool KABCore::modified() const 1033bool KABCore::modified() const
1030{ 1034{
1031 return mModified; 1035 return mModified;
1032} 1036}
1033 1037
1034void KABCore::contactModified( const KABC::Addressee &addr ) 1038void KABCore::contactModified( const KABC::Addressee &addr )
1035{ 1039{
1036 1040
1037 Command *command = 0; 1041 Command *command = 0;
1038 QString uid; 1042 QString uid;
1039 1043
1040 // check if it exists already 1044 // check if it exists already
1041 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 1045 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
1042 if ( origAddr.isEmpty() ) 1046 if ( origAddr.isEmpty() )
1043 command = new PwNewCommand( mAddressBook, addr ); 1047 command = new PwNewCommand( mAddressBook, addr );
1044 else { 1048 else {
1045 command = new PwEditCommand( mAddressBook, origAddr, addr ); 1049 command = new PwEditCommand( mAddressBook, origAddr, addr );
1046 uid = addr.uid(); 1050 uid = addr.uid();
1047 } 1051 }
1048 1052
1049 UndoStack::instance()->push( command ); 1053 UndoStack::instance()->push( command );
1050 RedoStack::instance()->clear(); 1054 RedoStack::instance()->clear();
1051 1055
1052 setModified( true ); 1056 setModified( true );
1053} 1057}
1054 1058
1055void KABCore::newContact() 1059void KABCore::newContact()
1056{ 1060{
1057 1061
1058 1062
1059 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 1063 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
1060 1064
1061 QPtrList<KRES::Resource> kresResources; 1065 QPtrList<KRES::Resource> kresResources;
1062 QPtrListIterator<KABC::Resource> it( kabcResources ); 1066 QPtrListIterator<KABC::Resource> it( kabcResources );
1063 KABC::Resource *resource; 1067 KABC::Resource *resource;
1064 while ( ( resource = it.current() ) != 0 ) { 1068 while ( ( resource = it.current() ) != 0 ) {
1065 ++it; 1069 ++it;
1066 if ( !resource->readOnly() ) { 1070 if ( !resource->readOnly() ) {
1067 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 1071 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
1068 if ( res ) 1072 if ( res )
1069 kresResources.append( res ); 1073 kresResources.append( res );
1070 } 1074 }
1071 } 1075 }
1072 1076
1073 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 1077 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
1074 resource = static_cast<KABC::Resource*>( res ); 1078 resource = static_cast<KABC::Resource*>( res );
1075 1079
1076 if ( resource ) { 1080 if ( resource ) {
1077 KABC::Addressee addr; 1081 KABC::Addressee addr;
1078 addr.setResource( resource ); 1082 addr.setResource( resource );
1079 mEditorDialog->setAddressee( addr ); 1083 mEditorDialog->setAddressee( addr );
1080 KApplication::execDialog ( mEditorDialog ); 1084 KApplication::execDialog ( mEditorDialog );
1081 1085
1082 } else 1086 } else
1083 return; 1087 return;
1084 1088
1085 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 1089 // mEditorDict.insert( dialog->addressee().uid(), dialog );
1086 1090
1087 1091
1088} 1092}
1089 1093
1090void KABCore::addEmail( QString aStr ) 1094void KABCore::addEmail( QString aStr )
1091{ 1095{
1092#ifndef KAB_EMBEDDED 1096#ifndef KAB_EMBEDDED
1093 QString fullName, email; 1097 QString fullName, email;
1094 1098
1095 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 1099 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
1096 1100
1097 // Try to lookup the addressee matching the email address 1101 // Try to lookup the addressee matching the email address
1098 bool found = false; 1102 bool found = false;
1099 QStringList emailList; 1103 QStringList emailList;
1100 KABC::AddressBook::Iterator it; 1104 KABC::AddressBook::Iterator it;
1101 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 1105 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
1102 emailList = (*it).emails(); 1106 emailList = (*it).emails();
1103 if ( emailList.contains( email ) > 0 ) { 1107 if ( emailList.contains( email ) > 0 ) {
1104 found = true; 1108 found = true;
1105 (*it).setNameFromString( fullName ); 1109 (*it).setNameFromString( fullName );
1106 editContact( (*it).uid() ); 1110 editContact( (*it).uid() );
1107 } 1111 }
1108 } 1112 }
1109 1113
1110 if ( !found ) { 1114 if ( !found ) {
1111 KABC::Addressee addr; 1115 KABC::Addressee addr;
1112 addr.setNameFromString( fullName ); 1116 addr.setNameFromString( fullName );
1113 addr.insertEmail( email, true ); 1117 addr.insertEmail( email, true );
1114 1118
1115 mAddressBook->insertAddressee( addr ); 1119 mAddressBook->insertAddressee( addr );
1116 mViewManager->refreshView( addr.uid() ); 1120 mViewManager->refreshView( addr.uid() );
1117 editContact( addr.uid() ); 1121 editContact( addr.uid() );
1118 } 1122 }
1119#else //KAB_EMBEDDED 1123#else //KAB_EMBEDDED
1120 qDebug("KABCore::addEmail finsih method"); 1124 qDebug("KABCore::addEmail finsih method");
1121#endif //KAB_EMBEDDED 1125#endif //KAB_EMBEDDED
1122} 1126}
1123 1127
1124void KABCore::importVCard( const KURL &url, bool showPreview ) 1128void KABCore::importVCard( const KURL &url, bool showPreview )
1125{ 1129{
1126 mXXPortManager->importVCard( url, showPreview ); 1130 mXXPortManager->importVCard( url, showPreview );
1127} 1131}
1128void KABCore::importFromOL() 1132void KABCore::importFromOL()
1129{ 1133{
1130#ifdef _WIN32_ 1134#ifdef _WIN32_
1131 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 1135 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
1132 idgl->exec(); 1136 idgl->exec();
1133 KABC::Addressee::List list = idgl->getAddressList(); 1137 KABC::Addressee::List list = idgl->getAddressList();
1134 if ( list.count() > 0 ) { 1138 if ( list.count() > 0 ) {
1135 KABC::Addressee::List listNew; 1139 KABC::Addressee::List listNew;
1136 KABC::Addressee::List listExisting; 1140 KABC::Addressee::List listExisting;
1137 KABC::Addressee::List::Iterator it; 1141 KABC::Addressee::List::Iterator it;
1138 KABC::AddressBook::Iterator iter; 1142 KABC::AddressBook::Iterator iter;
1139 for ( it = list.begin(); it != list.end(); ++it ) { 1143 for ( it = list.begin(); it != list.end(); ++it ) {
1140 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1144 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
1141 listNew.append( (*it) ); 1145 listNew.append( (*it) );
1142 else 1146 else
1143 listExisting.append( (*it) ); 1147 listExisting.append( (*it) );
1144 } 1148 }
1145 if ( listExisting.count() > 0 ) 1149 if ( listExisting.count() > 0 )
1146 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1150 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1147 if ( listNew.count() > 0 ) { 1151 if ( listNew.count() > 0 ) {
1148 pasteWithNewUid = false; 1152 pasteWithNewUid = false;
1149 pasteContacts( listNew ); 1153 pasteContacts( listNew );
1150 pasteWithNewUid = true; 1154 pasteWithNewUid = true;
1151 } 1155 }
1152 } 1156 }
1153 delete idgl; 1157 delete idgl;
1154#endif 1158#endif
1155} 1159}
1156 1160
1157void KABCore::importVCard( const QString &vCard, bool showPreview ) 1161void KABCore::importVCard( const QString &vCard, bool showPreview )
1158{ 1162{
1159 mXXPortManager->importVCard( vCard, showPreview ); 1163 mXXPortManager->importVCard( vCard, showPreview );
1160} 1164}
1161 1165
1162//US added a second method without defaultparameter 1166//US added a second method without defaultparameter
1163void KABCore::editContact2() { 1167void KABCore::editContact2() {
1164 editContact( QString::null ); 1168 editContact( QString::null );
1165} 1169}
1166 1170
1167void KABCore::editContact( const QString &uid ) 1171void KABCore::editContact( const QString &uid )
1168{ 1172{
1169 1173
1170 if ( mExtensionManager->isQuickEditVisible() ) 1174 if ( mExtensionManager->isQuickEditVisible() )
1171 return; 1175 return;
1172 1176
1173 // First, locate the contact entry 1177 // First, locate the contact entry
1174 QString localUID = uid; 1178 QString localUID = uid;
1175 if ( localUID.isNull() ) { 1179 if ( localUID.isNull() ) {
1176 QStringList uidList = mViewManager->selectedUids(); 1180 QStringList uidList = mViewManager->selectedUids();
1177 if ( uidList.count() > 0 ) 1181 if ( uidList.count() > 0 )
1178 localUID = *( uidList.at( 0 ) ); 1182 localUID = *( uidList.at( 0 ) );
1179 } 1183 }
1180 1184
1181 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1185 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1182 if ( !addr.isEmpty() ) { 1186 if ( !addr.isEmpty() ) {
1183 mEditorDialog->setAddressee( addr ); 1187 mEditorDialog->setAddressee( addr );
1184 KApplication::execDialog ( mEditorDialog ); 1188 KApplication::execDialog ( mEditorDialog );
1185 } 1189 }
1186} 1190}
1187 1191
1188/** 1192/**
1189 Shows or edits the detail view for the given uid. If the uid is QString::null, 1193 Shows or edits the detail view for the given uid. If the uid is QString::null,
1190 the method will try to find a selected addressee in the view. 1194 the method will try to find a selected addressee in the view.
1191 */ 1195 */
1192void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) 1196void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1193{ 1197{
1194 if ( mMultipleViewsAtOnce ) 1198 if ( mMultipleViewsAtOnce )
1195 { 1199 {
1196 editContact( uid ); 1200 editContact( uid );
1197 } 1201 }
1198 else 1202 else
1199 { 1203 {
1200 setDetailsVisible( true ); 1204 setDetailsVisible( true );
1201 mActionDetails->setChecked(true); 1205 mActionDetails->setChecked(true);
1202 } 1206 }
1203 1207
1204} 1208}
1205 1209
1206void KABCore::save() 1210void KABCore::save()
1207{ 1211{
1208 if (syncManager->blockSave()) 1212 if (syncManager->blockSave())
1209 return; 1213 return;
1210 if ( !mModified ) 1214 if ( !mModified )
1211 return; 1215 return;
1212 1216
1213 syncManager->setBlockSave(true); 1217 syncManager->setBlockSave(true);
1214 QString text = i18n( "There was an error while attempting to save\n the " 1218 QString text = i18n( "There was an error while attempting to save\n the "
1215 "address book. Please check that some \nother application is " 1219 "address book. Please check that some \nother application is "
1216 "not using it. " ); 1220 "not using it. " );
1217 message(i18n("Saving addressbook ... ")); 1221 message(i18n("Saving addressbook ... "));
1218#ifndef KAB_EMBEDDED 1222#ifndef KAB_EMBEDDED
1219 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1223 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1220 if ( !b || !b->save() ) { 1224 if ( !b || !b->save() ) {
1221 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1225 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1222 } 1226 }
1223#else //KAB_EMBEDDED 1227#else //KAB_EMBEDDED
1224 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1228 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1225 if ( !b || !b->save() ) { 1229 if ( !b || !b->save() ) {
1226 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1230 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1227 } 1231 }
1228#endif //KAB_EMBEDDED 1232#endif //KAB_EMBEDDED
1229 1233
1230 message(i18n("Addressbook saved!")); 1234 message(i18n("Addressbook saved!"));
1231 setModified( false ); 1235 setModified( false );
1232 syncManager->setBlockSave(false); 1236 syncManager->setBlockSave(false);
1233} 1237}
1234 1238
1235 1239
1236void KABCore::undo() 1240void KABCore::undo()
1237{ 1241{
1238 UndoStack::instance()->undo(); 1242 UndoStack::instance()->undo();
1239 1243
1240 // Refresh the view 1244 // Refresh the view
1241 mViewManager->refreshView(); 1245 mViewManager->refreshView();
1242} 1246}
1243 1247
1244void KABCore::redo() 1248void KABCore::redo()
1245{ 1249{
1246 RedoStack::instance()->redo(); 1250 RedoStack::instance()->redo();
1247 1251
1248 // Refresh the view 1252 // Refresh the view
1249 mViewManager->refreshView(); 1253 mViewManager->refreshView();
1250} 1254}
1251 1255
1252void KABCore::setJumpButtonBarVisible( bool visible ) 1256void KABCore::setJumpButtonBarVisible( bool visible )
1253{ 1257{
1254 if (mMultipleViewsAtOnce) 1258 if (mMultipleViewsAtOnce)
1255 { 1259 {
1256 if ( visible ) 1260 if ( visible )
1257 mJumpButtonBar->show(); 1261 mJumpButtonBar->show();
1258 else 1262 else
1259 mJumpButtonBar->hide(); 1263 mJumpButtonBar->hide();
1260 } 1264 }
1261 else 1265 else
1262 { 1266 {
1263 // show the jumpbar only if "the details are hidden" == "viewmanager are shown" 1267 // show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1264 if (mViewManager->isVisible()) 1268 if (mViewManager->isVisible())
1265 { 1269 {
1266 if ( visible ) 1270 if ( visible )
1267 mJumpButtonBar->show(); 1271 mJumpButtonBar->show();
1268 else 1272 else
1269 mJumpButtonBar->hide(); 1273 mJumpButtonBar->hide();
1270 } 1274 }
1271 else 1275 else
1272 { 1276 {
1273 mJumpButtonBar->hide(); 1277 mJumpButtonBar->hide();
1274 } 1278 }
1275 } 1279 }
1276} 1280}
1277 1281
1278 1282
1279void KABCore::setDetailsToState() 1283void KABCore::setDetailsToState()
1280{ 1284{
1281 setDetailsVisible( mActionDetails->isChecked() ); 1285 setDetailsVisible( mActionDetails->isChecked() );
1282} 1286}
1283 1287
1284 1288
1285 1289
1286void KABCore::setDetailsVisible( bool visible ) 1290void KABCore::setDetailsVisible( bool visible )
1287{ 1291{
1288 if (visible && mDetails->isHidden()) 1292 if (visible && mDetails->isHidden())
1289 { 1293 {
1290 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1294 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1291 if ( addrList.count() > 0 ) 1295 if ( addrList.count() > 0 )
1292 mDetails->setAddressee( addrList[ 0 ] ); 1296 mDetails->setAddressee( addrList[ 0 ] );
1293 } 1297 }
1294 1298
1295 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between 1299 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between
1296 // the listview and the detailview. We do that by changing the splitbar size. 1300 // the listview and the detailview. We do that by changing the splitbar size.
1297 if (mMultipleViewsAtOnce) 1301 if (mMultipleViewsAtOnce)
1298 { 1302 {
1299 if ( visible ) 1303 if ( visible )
1300 mDetails->show(); 1304 mDetails->show();
1301 else 1305 else
1302 mDetails->hide(); 1306 mDetails->hide();
1303 } 1307 }
1304 else 1308 else
1305 { 1309 {
1306 if ( visible ) { 1310 if ( visible ) {
1307 mViewManager->hide(); 1311 mViewManager->hide();
1308 mDetails->show(); 1312 mDetails->show();
1309 } 1313 }
1310 else { 1314 else {
1311 mViewManager->show(); 1315 mViewManager->show();
1312 mDetails->hide(); 1316 mDetails->hide();
1313 } 1317 }
1314 setJumpButtonBarVisible( !visible ); 1318 setJumpButtonBarVisible( !visible );
1315 } 1319 }
1316 1320
1317} 1321}
1318 1322
1319void KABCore::extensionChanged( int id ) 1323void KABCore::extensionChanged( int id )
1320{ 1324{
1321 //change the details view only for non desktop systems 1325 //change the details view only for non desktop systems
1322#ifndef DESKTOP_VERSION 1326#ifndef DESKTOP_VERSION
1323 1327
1324 if (id == 0) 1328 if (id == 0)
1325 { 1329 {
1326 //the user disabled the extension. 1330 //the user disabled the extension.
1327 1331
1328 if (mMultipleViewsAtOnce) 1332 if (mMultipleViewsAtOnce)
1329 { // enable detailsview again 1333 { // enable detailsview again
1330 setDetailsVisible( true ); 1334 setDetailsVisible( true );
1331 mActionDetails->setChecked( true ); 1335 mActionDetails->setChecked( true );
1332 } 1336 }
1333 else 1337 else
1334 { //go back to the listview 1338 { //go back to the listview
1335 setDetailsVisible( false ); 1339 setDetailsVisible( false );
1336 mActionDetails->setChecked( false ); 1340 mActionDetails->setChecked( false );
1337 mActionDetails->setEnabled(true); 1341 mActionDetails->setEnabled(true);
1338 } 1342 }
1339 1343
1340 } 1344 }
1341 else 1345 else
1342 { 1346 {
1343 //the user enabled the extension. 1347 //the user enabled the extension.
1344 setDetailsVisible( false ); 1348 setDetailsVisible( false );
1345 mActionDetails->setChecked( false ); 1349 mActionDetails->setChecked( false );
1346 1350
1347 if (!mMultipleViewsAtOnce) 1351 if (!mMultipleViewsAtOnce)
1348 { 1352 {
1349 mActionDetails->setEnabled(false); 1353 mActionDetails->setEnabled(false);
1350 } 1354 }
1351 1355
1352 mExtensionManager->setSelectionChanged(); 1356 mExtensionManager->setSelectionChanged();
1353 1357
1354 } 1358 }
1355 1359
1356#endif// DESKTOP_VERSION 1360#endif// DESKTOP_VERSION
1357 1361
1358} 1362}
1359 1363
1360 1364
1361void KABCore::extensionModified( const KABC::Addressee::List &list ) 1365void KABCore::extensionModified( const KABC::Addressee::List &list )
1362{ 1366{
1363 1367
1364 if ( list.count() != 0 ) { 1368 if ( list.count() != 0 ) {
1365 KABC::Addressee::List::ConstIterator it; 1369 KABC::Addressee::List::ConstIterator it;
1366 for ( it = list.begin(); it != list.end(); ++it ) 1370 for ( it = list.begin(); it != list.end(); ++it )
1367 mAddressBook->insertAddressee( *it ); 1371 mAddressBook->insertAddressee( *it );
1368 if ( list.count() > 1 ) 1372 if ( list.count() > 1 )
1369 setModified(); 1373 setModified();
1370 else 1374 else
1371 setModifiedWOrefresh(); 1375 setModifiedWOrefresh();
1372 } 1376 }
1373 if ( list.count() == 0 ) 1377 if ( list.count() == 0 )
1374 mViewManager->refreshView(); 1378 mViewManager->refreshView();
1375 else 1379 else
1376 mViewManager->refreshView( list[ 0 ].uid() ); 1380 mViewManager->refreshView( list[ 0 ].uid() );
1377 1381
1378 1382
1379 1383
1380} 1384}
1381 1385
1382QString KABCore::getNameByPhone( const QString &phone ) 1386QString KABCore::getNameByPhone( const QString &phone )
1383{ 1387{
1384#ifndef KAB_EMBEDDED 1388#ifndef KAB_EMBEDDED
1385 QRegExp r( "[/*/-/ ]" ); 1389 QRegExp r( "[/*/-/ ]" );
1386 QString localPhone( phone ); 1390 QString localPhone( phone );
1387 1391
1388 bool found = false; 1392 bool found = false;
1389 QString ownerName = ""; 1393 QString ownerName = "";
1390 KABC::AddressBook::Iterator iter; 1394 KABC::AddressBook::Iterator iter;
1391 KABC::PhoneNumber::List::Iterator phoneIter; 1395 KABC::PhoneNumber::List::Iterator phoneIter;
1392 KABC::PhoneNumber::List phoneList; 1396 KABC::PhoneNumber::List phoneList;
1393 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { 1397 for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) {
1394 phoneList = (*iter).phoneNumbers(); 1398 phoneList = (*iter).phoneNumbers();
1395 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); 1399 for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() );
1396 ++phoneIter) { 1400 ++phoneIter) {
1397 // Get rid of separator chars so just the numbers are compared. 1401 // Get rid of separator chars so just the numbers are compared.
1398 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { 1402 if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) {
1399 ownerName = (*iter).formattedName(); 1403 ownerName = (*iter).formattedName();
1400 found = true; 1404 found = true;
1401 } 1405 }
1402 } 1406 }
1403 } 1407 }
1404 1408
1405 return ownerName; 1409 return ownerName;
1406#else //KAB_EMBEDDED 1410#else //KAB_EMBEDDED
1407 qDebug("KABCore::getNameByPhone finsih method"); 1411 qDebug("KABCore::getNameByPhone finsih method");
1408 return ""; 1412 return "";
1409#endif //KAB_EMBEDDED 1413#endif //KAB_EMBEDDED
1410 1414
1411} 1415}
1412 1416
1413void KABCore::openConfigDialog() 1417void KABCore::openConfigDialog()
1414{ 1418{
1415 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); 1419 KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true );
1416 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); 1420 KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" );
1417 ConfigureDialog->addModule(kabcfg ); 1421 ConfigureDialog->addModule(kabcfg );
1418 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); 1422 KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" );
1419 ConfigureDialog->addModule(kdelibcfg ); 1423 ConfigureDialog->addModule(kdelibcfg );
1420 1424
1421 connect( ConfigureDialog, SIGNAL( applyClicked() ), 1425 connect( ConfigureDialog, SIGNAL( applyClicked() ),
1422 this, SLOT( configurationChanged() ) ); 1426 this, SLOT( configurationChanged() ) );
1423 connect( ConfigureDialog, SIGNAL( okClicked() ), 1427 connect( ConfigureDialog, SIGNAL( okClicked() ),
1424 this, SLOT( configurationChanged() ) ); 1428 this, SLOT( configurationChanged() ) );
1425 saveSettings(); 1429 saveSettings();
1426#ifndef DESKTOP_VERSION 1430#ifndef DESKTOP_VERSION
1427 ConfigureDialog->showMaximized(); 1431 ConfigureDialog->showMaximized();
1428#endif 1432#endif
1429 if ( ConfigureDialog->exec() ) 1433 if ( ConfigureDialog->exec() )
1430 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); 1434 KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") );
1431 delete ConfigureDialog; 1435 delete ConfigureDialog;
1432} 1436}
1433 1437
1434void KABCore::openLDAPDialog() 1438void KABCore::openLDAPDialog()
1435{ 1439{
1436#ifndef KAB_EMBEDDED 1440#ifndef KAB_EMBEDDED
1437 if ( !mLdapSearchDialog ) { 1441 if ( !mLdapSearchDialog ) {
1438 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); 1442 mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this );
1439 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, 1443 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager,
1440 SLOT( refreshView() ) ); 1444 SLOT( refreshView() ) );
1441 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, 1445 connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this,
1442 SLOT( setModified() ) ); 1446 SLOT( setModified() ) );
1443 } else 1447 } else
1444 mLdapSearchDialog->restoreSettings(); 1448 mLdapSearchDialog->restoreSettings();
1445 1449
1446 if ( mLdapSearchDialog->isOK() ) 1450 if ( mLdapSearchDialog->isOK() )
1447 mLdapSearchDialog->exec(); 1451 mLdapSearchDialog->exec();
1448#else //KAB_EMBEDDED 1452#else //KAB_EMBEDDED
1449 qDebug("KABCore::openLDAPDialog() finsih method"); 1453 qDebug("KABCore::openLDAPDialog() finsih method");
1450#endif //KAB_EMBEDDED 1454#endif //KAB_EMBEDDED
1451} 1455}
1452 1456
1453void KABCore::print() 1457void KABCore::print()
1454{ 1458{
1455#ifndef KAB_EMBEDDED 1459#ifndef KAB_EMBEDDED
1456 KPrinter printer; 1460 KPrinter printer;
1457 if ( !printer.setup( this ) ) 1461 if ( !printer.setup( this ) )
1458 return; 1462 return;
1459 1463
1460 KABPrinting::PrintingWizard wizard( &printer, mAddressBook, 1464 KABPrinting::PrintingWizard wizard( &printer, mAddressBook,
1461 mViewManager->selectedUids(), this ); 1465 mViewManager->selectedUids(), this );
1462 1466
1463 wizard.exec(); 1467 wizard.exec();
1464#else //KAB_EMBEDDED 1468#else //KAB_EMBEDDED
1465 qDebug("KABCore::print() finsih method"); 1469 qDebug("KABCore::print() finsih method");
1466#endif //KAB_EMBEDDED 1470#endif //KAB_EMBEDDED
1467 1471
1468} 1472}
1469 1473
1470 1474
1471void KABCore::addGUIClient( KXMLGUIClient *client ) 1475void KABCore::addGUIClient( KXMLGUIClient *client )
1472{ 1476{
1473 if ( mGUIClient ) 1477 if ( mGUIClient )
1474 mGUIClient->insertChildClient( client ); 1478 mGUIClient->insertChildClient( client );
1475 else 1479 else
1476 KMessageBox::error( this, "no KXMLGUICLient"); 1480 KMessageBox::error( this, "no KXMLGUICLient");
1477} 1481}
1478 1482
1479 1483
1480void KABCore::configurationChanged() 1484void KABCore::configurationChanged()
1481{ 1485{
1482 mExtensionManager->reconfigure(); 1486 mExtensionManager->reconfigure();
1483} 1487}
1484 1488
1485void KABCore::addressBookChanged() 1489void KABCore::addressBookChanged()
1486{ 1490{
1487/*US 1491/*US
1488 QDictIterator<AddresseeEditorDialog> it( mEditorDict ); 1492 QDictIterator<AddresseeEditorDialog> it( mEditorDict );
1489 while ( it.current() ) { 1493 while ( it.current() ) {
1490 if ( it.current()->dirty() ) { 1494 if ( it.current()->dirty() ) {
1491 QString text = i18n( "Data has been changed externally. Unsaved " 1495 QString text = i18n( "Data has been changed externally. Unsaved "
1492 "changes will be lost." ); 1496 "changes will be lost." );
1493 KMessageBox::information( this, text ); 1497 KMessageBox::information( this, text );
1494 } 1498 }
1495 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); 1499 it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) );
1496 ++it; 1500 ++it;
1497 } 1501 }
1498*/ 1502*/
1499 if (mEditorDialog) 1503 if (mEditorDialog)
1500 { 1504 {
1501 if (mEditorDialog->dirty()) 1505 if (mEditorDialog->dirty())
1502 { 1506 {
1503 QString text = i18n( "Data has been changed externally. Unsaved " 1507 QString text = i18n( "Data has been changed externally. Unsaved "
1504 "changes will be lost." ); 1508 "changes will be lost." );
1505 KMessageBox::information( this, text ); 1509 KMessageBox::information( this, text );
1506 } 1510 }
1507 QString currentuid = mEditorDialog->addressee().uid(); 1511 QString currentuid = mEditorDialog->addressee().uid();
1508 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) ); 1512 mEditorDialog->setAddressee( mAddressBook->findByUid( currentuid ) );
1509 } 1513 }
1510 mViewManager->refreshView(); 1514 mViewManager->refreshView();
1511// mDetails->refreshView(); 1515// mDetails->refreshView();
1512 1516
1513 1517
1514} 1518}
1515 1519
1516AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, 1520AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent,
1517 const char *name ) 1521 const char *name )
1518{ 1522{
1519 1523
1520 if ( mEditorDialog == 0 ) { 1524 if ( mEditorDialog == 0 ) {
1521 mEditorDialog = new AddresseeEditorDialog( this, parent, 1525 mEditorDialog = new AddresseeEditorDialog( this, parent,
1522 name ? name : "editorDialog" ); 1526 name ? name : "editorDialog" );
1523 1527
1524 1528
1525 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ), 1529 connect( mEditorDialog, SIGNAL( contactModified( const KABC::Addressee& ) ),
1526 SLOT( contactModified( const KABC::Addressee& ) ) ); 1530 SLOT( contactModified( const KABC::Addressee& ) ) );
1527 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ), 1531 //connect( mEditorDialog, SIGNAL( editorDestroyed( const QString& ) ),
1528 // SLOT( slotEditorDestroyed( const QString& ) ) ; 1532 // SLOT( slotEditorDestroyed( const QString& ) ) ;
1529 } 1533 }
1530 1534
1531 return mEditorDialog; 1535 return mEditorDialog;
1532} 1536}
1533 1537
1534void KABCore::slotEditorDestroyed( const QString &uid ) 1538void KABCore::slotEditorDestroyed( const QString &uid )
1535{ 1539{
1536 //mEditorDict.remove( uid ); 1540 //mEditorDict.remove( uid );
1537} 1541}
1538 1542
1539void KABCore::initGUI() 1543void KABCore::initGUI()
1540{ 1544{
1541#ifndef KAB_EMBEDDED 1545#ifndef KAB_EMBEDDED
1542 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1546 QHBoxLayout *topLayout = new QHBoxLayout( this );
1543 topLayout->setSpacing( KDialogBase::spacingHint() ); 1547 topLayout->setSpacing( KDialogBase::spacingHint() );
1544 1548
1545 mExtensionBarSplitter = new QSplitter( this ); 1549 mExtensionBarSplitter = new QSplitter( this );
1546 mExtensionBarSplitter->setOrientation( Qt::Vertical ); 1550 mExtensionBarSplitter->setOrientation( Qt::Vertical );
1547 1551
1548 mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); 1552 mDetailsSplitter = new QSplitter( mExtensionBarSplitter );
1549 1553
1550 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1554 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1551 mIncSearchWidget = new IncSearchWidget( viewSpace ); 1555 mIncSearchWidget = new IncSearchWidget( viewSpace );
1552 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1556 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1553 SLOT( incrementalSearch( const QString& ) ) ); 1557 SLOT( incrementalSearch( const QString& ) ) );
1554 1558
1555 mViewManager = new ViewManager( this, viewSpace ); 1559 mViewManager = new ViewManager( this, viewSpace );
1556 viewSpace->setStretchFactor( mViewManager, 1 ); 1560 viewSpace->setStretchFactor( mViewManager, 1 );
1557 1561
1558 mDetails = new ViewContainer( mDetailsSplitter ); 1562 mDetails = new ViewContainer( mDetailsSplitter );
1559 1563
1560 mJumpButtonBar = new JumpButtonBar( this, this ); 1564 mJumpButtonBar = new JumpButtonBar( this, this );
1561 1565
1562 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1566 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1563 1567
1564 topLayout->addWidget( mExtensionBarSplitter ); 1568 topLayout->addWidget( mExtensionBarSplitter );
1565 topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); 1569 topLayout->setStretchFactor( mExtensionBarSplitter, 100 );
1566 topLayout->addWidget( mJumpButtonBar ); 1570 topLayout->addWidget( mJumpButtonBar );
1567 topLayout->setStretchFactor( mJumpButtonBar, 1 ); 1571 topLayout->setStretchFactor( mJumpButtonBar, 1 );
1568 1572
1569 mXXPortManager = new XXPortManager( this, this ); 1573 mXXPortManager = new XXPortManager( this, this );
1570 1574
1571#else //KAB_EMBEDDED 1575#else //KAB_EMBEDDED
1572 //US initialize viewMenu before settingup viewmanager. 1576 //US initialize viewMenu before settingup viewmanager.
1573 // Viewmanager needs this menu to plugin submenues. 1577 // Viewmanager needs this menu to plugin submenues.
1574 viewMenu = new QPopupMenu( this ); 1578 viewMenu = new QPopupMenu( this );
1575 settingsMenu = new QPopupMenu( this ); 1579 settingsMenu = new QPopupMenu( this );
1576 //filterMenu = new QPopupMenu( this ); 1580 //filterMenu = new QPopupMenu( this );
1577 ImportMenu = new QPopupMenu( this ); 1581 ImportMenu = new QPopupMenu( this );
1578 ExportMenu = new QPopupMenu( this ); 1582 ExportMenu = new QPopupMenu( this );
1579 syncMenu = new QPopupMenu( this ); 1583 syncMenu = new QPopupMenu( this );
1580 changeMenu= new QPopupMenu( this ); 1584 changeMenu= new QPopupMenu( this );
1581 1585
1582//US since we have no splitter for the embedded system, setup 1586//US since we have no splitter for the embedded system, setup
1583// a layout with two frames. One left and one right. 1587// a layout with two frames. One left and one right.
1584 1588
1585 QBoxLayout *topLayout; 1589 QBoxLayout *topLayout;
1586 1590
1587 // = new QHBoxLayout( this ); 1591 // = new QHBoxLayout( this );
1588// QBoxLayout *topLayout = (QBoxLayout*)layout(); 1592// QBoxLayout *topLayout = (QBoxLayout*)layout();
1589 1593
1590// QWidget *mainBox = new QWidget( this ); 1594// QWidget *mainBox = new QWidget( this );
1591// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); 1595// QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox);
1592 1596
1593#ifdef DESKTOP_VERSION 1597#ifdef DESKTOP_VERSION
1594 topLayout = new QHBoxLayout( this ); 1598 topLayout = new QHBoxLayout( this );
1595 1599
1596 1600
1597 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1601 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1598 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1602 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1599 1603
1600 topLayout->addWidget(mMiniSplitter ); 1604 topLayout->addWidget(mMiniSplitter );
1601 1605
1602 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); 1606 mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter );
1603 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1607 mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1604 mViewManager = new ViewManager( this, mExtensionBarSplitter ); 1608 mViewManager = new ViewManager( this, mExtensionBarSplitter );
1605 mDetails = new ViewContainer( mMiniSplitter ); 1609 mDetails = new ViewContainer( mMiniSplitter );
1606 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); 1610 mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter );
1607#else 1611#else
1608 if ( QApplication::desktop()->width() > 480 ) { 1612 if ( QApplication::desktop()->width() > 480 ) {
1609 topLayout = new QHBoxLayout( this ); 1613 topLayout = new QHBoxLayout( this );
1610 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 1614 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
1611 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 1615 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
1612 } else { 1616 } else {
1613 1617
1614 topLayout = new QHBoxLayout( this ); 1618 topLayout = new QHBoxLayout( this );
1615 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); 1619 mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this);
1616 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 1620 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
1617 } 1621 }
1618 1622
1619 topLayout->addWidget(mMiniSplitter ); 1623 topLayout->addWidget(mMiniSplitter );
1620 mViewManager = new ViewManager( this, mMiniSplitter ); 1624 mViewManager = new ViewManager( this, mMiniSplitter );
1621 mDetails = new ViewContainer( mMiniSplitter ); 1625 mDetails = new ViewContainer( mMiniSplitter );
1622 1626
1623 1627
1624 mExtensionManager = new ExtensionManager( this, mMiniSplitter ); 1628 mExtensionManager = new ExtensionManager( this, mMiniSplitter );
1625#endif 1629#endif
1626 //eh->hide(); 1630 //eh->hide();
1627 // topLayout->addWidget(mExtensionManager ); 1631 // topLayout->addWidget(mExtensionManager );
1628 1632
1629 1633
1630/*US 1634/*US
1631#ifndef KAB_NOSPLITTER 1635#ifndef KAB_NOSPLITTER
1632 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1636 QHBoxLayout *topLayout = new QHBoxLayout( this );
1633//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1637//US topLayout->setSpacing( KDialogBase::spacingHint() );
1634 topLayout->setSpacing( 10 ); 1638 topLayout->setSpacing( 10 );
1635 1639
1636 mDetailsSplitter = new QSplitter( this ); 1640 mDetailsSplitter = new QSplitter( this );
1637 1641
1638 QVBox *viewSpace = new QVBox( mDetailsSplitter ); 1642 QVBox *viewSpace = new QVBox( mDetailsSplitter );
1639 1643
1640 mViewManager = new ViewManager( this, viewSpace ); 1644 mViewManager = new ViewManager( this, viewSpace );
1641 viewSpace->setStretchFactor( mViewManager, 1 ); 1645 viewSpace->setStretchFactor( mViewManager, 1 );
1642 1646
1643 mDetails = new ViewContainer( mDetailsSplitter ); 1647 mDetails = new ViewContainer( mDetailsSplitter );
1644 1648
1645 topLayout->addWidget( mDetailsSplitter ); 1649 topLayout->addWidget( mDetailsSplitter );
1646 topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1650 topLayout->setStretchFactor( mDetailsSplitter, 100 );
1647#else //KAB_NOSPLITTER 1651#else //KAB_NOSPLITTER
1648 QHBoxLayout *topLayout = new QHBoxLayout( this ); 1652 QHBoxLayout *topLayout = new QHBoxLayout( this );
1649//US topLayout->setSpacing( KDialogBase::spacingHint() ); 1653//US topLayout->setSpacing( KDialogBase::spacingHint() );
1650 topLayout->setSpacing( 10 ); 1654 topLayout->setSpacing( 10 );
1651 1655
1652// mDetailsSplitter = new QSplitter( this ); 1656// mDetailsSplitter = new QSplitter( this );
1653 1657
1654 QVBox *viewSpace = new QVBox( this ); 1658 QVBox *viewSpace = new QVBox( this );
1655 1659
1656 mViewManager = new ViewManager( this, viewSpace ); 1660 mViewManager = new ViewManager( this, viewSpace );
1657 viewSpace->setStretchFactor( mViewManager, 1 ); 1661 viewSpace->setStretchFactor( mViewManager, 1 );
1658 1662
1659 mDetails = new ViewContainer( this ); 1663 mDetails = new ViewContainer( this );
1660 1664
1661 topLayout->addWidget( viewSpace ); 1665 topLayout->addWidget( viewSpace );
1662// topLayout->setStretchFactor( mDetailsSplitter, 100 ); 1666// topLayout->setStretchFactor( mDetailsSplitter, 100 );
1663 topLayout->addWidget( mDetails ); 1667 topLayout->addWidget( mDetails );
1664#endif //KAB_NOSPLITTER 1668#endif //KAB_NOSPLITTER
1665*/ 1669*/
1666 1670
1667 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 1671 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
1668 syncManager->setBlockSave(false); 1672 syncManager->setBlockSave(false);
1669 1673
1670 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 1674 connect(syncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
1671 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 1675 connect(syncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
1672 syncManager->setDefaultFileName( sentSyncFile()); 1676 syncManager->setDefaultFileName( sentSyncFile());
1673 //connect(syncManager , SIGNAL( ), this, SLOT( ) ); 1677 //connect(syncManager , SIGNAL( ), this, SLOT( ) );
1674 1678
1675#endif //KAB_EMBEDDED 1679#endif //KAB_EMBEDDED
1676 initActions(); 1680 initActions();
1677 1681
1678#ifdef KAB_EMBEDDED 1682#ifdef KAB_EMBEDDED
1679 addActionsManually(); 1683 addActionsManually();
1680 //US make sure the export and import menues are initialized before creating the xxPortManager. 1684 //US make sure the export and import menues are initialized before creating the xxPortManager.
1681 mXXPortManager = new XXPortManager( this, this ); 1685 mXXPortManager = new XXPortManager( this, this );
1682 1686
1683 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); 1687 // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() );
1684 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); 1688 //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget);
1685 // mActionQuit->plug ( mMainWindow->toolBar()); 1689 // mActionQuit->plug ( mMainWindow->toolBar());
1686 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); 1690 //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() );
1687 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); 1691 //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget);
1688 // mIncSearchWidget->hide(); 1692 // mIncSearchWidget->hide();
1689 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1693 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1690 SLOT( incrementalSearch( const QString& ) ) ); 1694 SLOT( incrementalSearch( const QString& ) ) );
1691 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); 1695 connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) );
1692 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); 1696 connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) );
1693 1697
1694 mJumpButtonBar = new JumpButtonBar( this, this ); 1698 mJumpButtonBar = new JumpButtonBar( this, this );
1695 1699
1696 topLayout->addWidget( mJumpButtonBar ); 1700 topLayout->addWidget( mJumpButtonBar );
1697//US topLayout->setStretchFactor( mJumpButtonBar, 10 ); 1701//US topLayout->setStretchFactor( mJumpButtonBar, 10 );
1698 1702
1699// mMainWindow->getIconToolBar()->raise(); 1703// mMainWindow->getIconToolBar()->raise();
1700 1704
1701#endif //KAB_EMBEDDED 1705#endif //KAB_EMBEDDED
1702 1706
1703} 1707}
1704void KABCore::initActions() 1708void KABCore::initActions()
1705{ 1709{
1706//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1710//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1707 1711
1708#ifndef KAB_EMBEDDED 1712#ifndef KAB_EMBEDDED
1709 connect( QApplication::clipboard(), SIGNAL( dataChanged() ), 1713 connect( QApplication::clipboard(), SIGNAL( dataChanged() ),
1710 SLOT( clipboardDataChanged() ) ); 1714 SLOT( clipboardDataChanged() ) );
1711#endif //KAB_EMBEDDED 1715#endif //KAB_EMBEDDED
1712 1716
1713 // file menu 1717 // file menu
1714 if ( mIsPart ) { 1718 if ( mIsPart ) {
1715 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, 1719 mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this,
1716 SLOT( sendMail() ), actionCollection(), 1720 SLOT( sendMail() ), actionCollection(),
1717 "kaddressbook_mail" ); 1721 "kaddressbook_mail" );
1718 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, 1722 mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this,
1719 SLOT( print() ), actionCollection(), "kaddressbook_print" ); 1723 SLOT( print() ), actionCollection(), "kaddressbook_print" );
1720 1724
1721 } else { 1725 } else {
1722 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); 1726 mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() );
1723 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); 1727 mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() );
1724 } 1728 }
1725 1729
1726 1730
1727 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, 1731 mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this,
1728 SLOT( save() ), actionCollection(), "file_sync" ); 1732 SLOT( save() ), actionCollection(), "file_sync" );
1729 1733
1730 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, 1734 mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this,
1731 SLOT( newContact() ), actionCollection(), "file_new_contact" ); 1735 SLOT( newContact() ), actionCollection(), "file_new_contact" );
1732 1736
1733 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, 1737 mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0,
1734 this, SLOT( mailVCard() ), 1738 this, SLOT( mailVCard() ),
1735 actionCollection(), "file_mail_vcard"); 1739 actionCollection(), "file_mail_vcard");
1736 1740
1737 mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this, 1741 mActionExport2phone = new KAction( i18n( "Selected to phone" ), "ex2phone", 0, this,
1738 SLOT( export2phone() ), actionCollection(), 1742 SLOT( export2phone() ), actionCollection(),
1739 "kaddressbook_ex2phone" ); 1743 "kaddressbook_ex2phone" );
1740 1744
1741 mActionBeamVCard = 0; 1745 mActionBeamVCard = 0;
1742 mActionBeam = 0; 1746 mActionBeam = 0;
1743 1747
1744#ifndef DESKTOP_VERSION 1748#ifndef DESKTOP_VERSION
1745 if ( Ir::supported() ) { 1749 if ( Ir::supported() ) {
1746 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this, 1750 mActionBeamVCard = new KAction( i18n( "Beam selected v&Card(s)" ), "beam", 0, this,
1747 SLOT( beamVCard() ), actionCollection(), 1751 SLOT( beamVCard() ), actionCollection(),
1748 "kaddressbook_beam_vcard" ); 1752 "kaddressbook_beam_vcard" );
1749 1753
1750 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this, 1754 mActionBeam = new KAction( i18n( "&Beam personal vCard" ), "beam", 0, this,
1751 SLOT( beamMySelf() ), actionCollection(), 1755 SLOT( beamMySelf() ), actionCollection(),
1752 "kaddressbook_beam_myself" ); 1756 "kaddressbook_beam_myself" );
1753 } 1757 }
1754#endif 1758#endif
1755 1759
1756 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, 1760 mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0,
1757 this, SLOT( editContact2() ), 1761 this, SLOT( editContact2() ),
1758 actionCollection(), "file_properties" ); 1762 actionCollection(), "file_properties" );
1759 1763
1760#ifdef KAB_EMBEDDED 1764#ifdef KAB_EMBEDDED
1761 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); 1765 // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() );
1762 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, 1766 mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0,
1763 mMainWindow, SLOT( exit() ), 1767 mMainWindow, SLOT( exit() ),
1764 actionCollection(), "quit" ); 1768 actionCollection(), "quit" );
1765#endif //KAB_EMBEDDED 1769#endif //KAB_EMBEDDED
1766 1770
1767 // edit menu 1771 // edit menu
1768 if ( mIsPart ) { 1772 if ( mIsPart ) {
1769 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, 1773 mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this,
1770 SLOT( copyContacts() ), actionCollection(), 1774 SLOT( copyContacts() ), actionCollection(),
1771 "kaddressbook_copy" ); 1775 "kaddressbook_copy" );
1772 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, 1776 mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this,
1773 SLOT( cutContacts() ), actionCollection(), 1777 SLOT( cutContacts() ), actionCollection(),
1774 "kaddressbook_cut" ); 1778 "kaddressbook_cut" );
1775 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, 1779 mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this,
1776 SLOT( pasteContacts() ), actionCollection(), 1780 SLOT( pasteContacts() ), actionCollection(),
1777 "kaddressbook_paste" ); 1781 "kaddressbook_paste" );
1778 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, 1782 mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this,
1779 SLOT( selectAllContacts() ), actionCollection(), 1783 SLOT( selectAllContacts() ), actionCollection(),
1780 "kaddressbook_select_all" ); 1784 "kaddressbook_select_all" );
1781 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, 1785 mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this,
1782 SLOT( undo() ), actionCollection(), 1786 SLOT( undo() ), actionCollection(),
1783 "kaddressbook_undo" ); 1787 "kaddressbook_undo" );
1784 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, 1788 mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z,
1785 this, SLOT( redo() ), actionCollection(), 1789 this, SLOT( redo() ), actionCollection(),
1786 "kaddressbook_redo" ); 1790 "kaddressbook_redo" );
1787 } else { 1791 } else {
1788 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); 1792 mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() );
1789 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); 1793 mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() );
1790 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); 1794 mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() );
1791 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); 1795 mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() );
1792 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); 1796 mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() );
1793 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); 1797 mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() );
1794 } 1798 }
1795 1799
1796 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", 1800 mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete",
1797 Key_Delete, this, SLOT( deleteContacts() ), 1801 Key_Delete, this, SLOT( deleteContacts() ),
1798 actionCollection(), "edit_delete" ); 1802 actionCollection(), "edit_delete" );
1799 1803
1800 mActionUndo->setEnabled( false ); 1804 mActionUndo->setEnabled( false );
1801 mActionRedo->setEnabled( false ); 1805 mActionRedo->setEnabled( false );
1802 1806
1803 // settings menu 1807 // settings menu
1804#ifdef KAB_EMBEDDED 1808#ifdef KAB_EMBEDDED
1805//US special menuentry to configure the addressbook resources. On KDE 1809//US special menuentry to configure the addressbook resources. On KDE
1806// you do that through the control center !!! 1810// you do that through the control center !!!
1807 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, 1811 mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this,
1808 SLOT( configureResources() ), actionCollection(), 1812 SLOT( configureResources() ), actionCollection(),
1809 "kaddressbook_configure_resources" ); 1813 "kaddressbook_configure_resources" );
1810#endif //KAB_EMBEDDED 1814#endif //KAB_EMBEDDED
1811 1815
1812 if ( mIsPart ) { 1816 if ( mIsPart ) {
1813 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, 1817 mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this,
1814 SLOT( openConfigDialog() ), actionCollection(), 1818 SLOT( openConfigDialog() ), actionCollection(),
1815 "kaddressbook_configure" ); 1819 "kaddressbook_configure" );
1816 1820
1817 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, 1821 mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0,
1818 this, SLOT( configureKeyBindings() ), actionCollection(), 1822 this, SLOT( configureKeyBindings() ), actionCollection(),
1819 "kaddressbook_configure_shortcuts" ); 1823 "kaddressbook_configure_shortcuts" );
1820#ifdef KAB_EMBEDDED 1824#ifdef KAB_EMBEDDED
1821 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); 1825 mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() );
1822 mActionConfigureToolbars->setEnabled( false ); 1826 mActionConfigureToolbars->setEnabled( false );
1823#endif //KAB_EMBEDDED 1827#endif //KAB_EMBEDDED
1824 1828
1825 } else { 1829 } else {
1826 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); 1830 mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() );
1827 1831
1828 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); 1832 mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() );
1829 } 1833 }
1830 1834
1831 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, 1835 mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0,
1832 actionCollection(), "options_show_jump_bar" ); 1836 actionCollection(), "options_show_jump_bar" );
1833 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); 1837 connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) );
1834 1838
1835 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0, 1839 mActionDetails = new KToggleAction( i18n( "Show Details" ), "listview", 0,
1836 actionCollection(), "options_show_details" ); 1840 actionCollection(), "options_show_details" );
1837 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); 1841 connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) );
1838 1842
1839 1843
1840 mActionBR = new KToggleAction( i18n( "Beam receice enabled" ), "beam", 0, this, 1844 mActionBR = new KToggleAction( i18n( "Beam receice enabled" ), "beam", 0, this,
1841 SLOT( toggleBeamReceive() ), actionCollection(), 1845 SLOT( toggleBeamReceive() ), actionCollection(),
1842 "kaddressbook_beam_rec" ); 1846 "kaddressbook_beam_rec" );
1843 1847
1844 1848
1845 // misc 1849 // misc
1846 // only enable LDAP lookup if we can handle the protocol 1850 // only enable LDAP lookup if we can handle the protocol
1847#ifndef KAB_EMBEDDED 1851#ifndef KAB_EMBEDDED
1848 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { 1852 if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) {
1849 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, 1853 new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0,
1850 this, SLOT( openLDAPDialog() ), actionCollection(), 1854 this, SLOT( openLDAPDialog() ), actionCollection(),
1851 "ldap_lookup" ); 1855 "ldap_lookup" );
1852 } 1856 }
1853#else //KAB_EMBEDDED 1857#else //KAB_EMBEDDED
1854 //qDebug("KABCore::initActions() LDAP has to be implemented"); 1858 //qDebug("KABCore::initActions() LDAP has to be implemented");
1855#endif //KAB_EMBEDDED 1859#endif //KAB_EMBEDDED
1856 1860
1857 1861
1858 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, 1862 mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this,
1859 SLOT( setWhoAmI() ), actionCollection(), 1863 SLOT( setWhoAmI() ), actionCollection(),
1860 "set_personal" ); 1864 "set_personal" );
1861 1865
1862 1866
1863 1867
1864 1868
1865 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, 1869 mActionCategories = new KAction( i18n( "Set Categories" ), 0, this,
1866 SLOT( setCategories() ), actionCollection(), 1870 SLOT( setCategories() ), actionCollection(),
1867 "edit_set_categories" ); 1871 "edit_set_categories" );
1868 1872
1869 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this, 1873 mActionRemoveVoice = new KAction( i18n( "Remove \"voice\"..." ), 0, this,
1870 SLOT( removeVoice() ), actionCollection(), 1874 SLOT( removeVoice() ), actionCollection(),
1871 "remove_voice" ); 1875 "remove_voice" );
1872 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this, 1876 mActionImportOL = new KAction( i18n( "Import from Outlook..." ), 0, this,
1873 SLOT( importFromOL() ), actionCollection(), 1877 SLOT( importFromOL() ), actionCollection(),
1874 "import_OL" ); 1878 "import_OL" );
1875#ifdef KAB_EMBEDDED 1879#ifdef KAB_EMBEDDED
1876 mActionLicence = new KAction( i18n( "Licence" ), 0, 1880 mActionLicence = new KAction( i18n( "Licence" ), 0,
1877 this, SLOT( showLicence() ), actionCollection(), 1881 this, SLOT( showLicence() ), actionCollection(),
1878 "licence_about_data" ); 1882 "licence_about_data" );
1879 mActionFaq = new KAction( i18n( "Faq" ), 0, 1883 mActionFaq = new KAction( i18n( "Faq" ), 0,
1880 this, SLOT( faq() ), actionCollection(), 1884 this, SLOT( faq() ), actionCollection(),
1881 "faq_about_data" ); 1885 "faq_about_data" );
1882 mActionWN = new KAction( i18n( "What's New?" ), 0, 1886 mActionWN = new KAction( i18n( "What's New?" ), 0,
1883 this, SLOT( whatsnew() ), actionCollection(), 1887 this, SLOT( whatsnew() ), actionCollection(),
1884 "wn" ); 1888 "wn" );
1885 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0, 1889 mActionSyncHowto = new KAction( i18n( "Sync HowTo" ), 0,
1886 this, SLOT( synchowto() ), actionCollection(), 1890 this, SLOT( synchowto() ), actionCollection(),
1887 "sync" ); 1891 "sync" );
1888 1892
1889 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, 1893 mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0,
1890 this, SLOT( createAboutData() ), actionCollection(), 1894 this, SLOT( createAboutData() ), actionCollection(),
1891 "kaddressbook_about_data" ); 1895 "kaddressbook_about_data" );
1892#endif //KAB_EMBEDDED 1896#endif //KAB_EMBEDDED
1893 1897
1894 clipboardDataChanged(); 1898 clipboardDataChanged();
1895 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1899 connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1896 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); 1900 connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) );
1897} 1901}
1898 1902
1899//US we need this function, to plug all actions into the correct menues. 1903//US we need this function, to plug all actions into the correct menues.
1900// KDE uses a XML format to plug the actions, but we work her without this overhead. 1904// KDE uses a XML format to plug the actions, but we work her without this overhead.
1901void KABCore::addActionsManually() 1905void KABCore::addActionsManually()
1902{ 1906{
1903//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); 1907//US qDebug("KABCore::initActions(): mIsPart %i", mIsPart);
1904 1908
1905#ifdef KAB_EMBEDDED 1909#ifdef KAB_EMBEDDED
1906 QPopupMenu *fileMenu = new QPopupMenu( this ); 1910 QPopupMenu *fileMenu = new QPopupMenu( this );
1907 QPopupMenu *editMenu = new QPopupMenu( this ); 1911 QPopupMenu *editMenu = new QPopupMenu( this );
1908 QPopupMenu *helpMenu = new QPopupMenu( this ); 1912 QPopupMenu *helpMenu = new QPopupMenu( this );
1909 1913
1910 KToolBar* tb = mMainWindow->toolBar(); 1914 KToolBar* tb = mMainWindow->toolBar();
1911 1915
1912#ifdef DESKTOP_VERSION 1916#ifdef DESKTOP_VERSION
1913 QMenuBar* mb = mMainWindow->menuBar(); 1917 QMenuBar* mb = mMainWindow->menuBar();
1914 1918
1915 //US setup menubar. 1919 //US setup menubar.
1916 //Disable the following block if you do not want to have a menubar. 1920 //Disable the following block if you do not want to have a menubar.
diff --git a/kaddressbook/kaimportoldialog.cpp b/kaddressbook/kaimportoldialog.cpp
index 10e3c76..848d8af 100644
--- a/kaddressbook/kaimportoldialog.cpp
+++ b/kaddressbook/kaimportoldialog.cpp
@@ -1,695 +1,733 @@
1/* 1/*
2 This file is part of KAddressbook/Pi. 2 This file is part of KAddressbook/Pi.
3 Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> 3 Copyright (c) 2004 Lutz Rogowski <rogowski@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 <qtooltip.h> 24#include <qtooltip.h>
25#include <qframe.h> 25#include <qframe.h>
26#include <qpixmap.h> 26#include <qpixmap.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qprogressbar.h> 28#include <qprogressbar.h>
29#include <qwidgetstack.h> 29#include <qwidgetstack.h>
30#include <qdatetime.h> 30#include <qdatetime.h>
31#include <qdir.h> 31#include <qdir.h>
32#include <qregexp.h>
32#include <qapplication.h> 33#include <qapplication.h>
33#include <qhbox.h> 34#include <qhbox.h>
34#include <qheader.h> 35#include <qheader.h>
35#include <qdatetime.h> 36#include <qdatetime.h>
36#include <qlistview.h> 37#include <qlistview.h>
37 38
38#include <kdebug.h> 39#include <kdebug.h>
39#include <klocale.h> 40#include <klocale.h>
40#include <kstandarddirs.h> 41#include <kstandarddirs.h>
41#include <kmessagebox.h> 42#include <kmessagebox.h>
42#include <kfiledialog.h> 43#include <kfiledialog.h>
43 44
44#include <libkdepim/categoryselectdialog.h> 45#include <libkdepim/categoryselectdialog.h>
45#include <libkdepim/kinputdialog.h> 46#include <libkdepim/kinputdialog.h>
46 47
47#include <libkcal/calendarlocal.h> 48#include <libkcal/calendarlocal.h>
48#include <libkcal/icalformat.h> 49#include <libkcal/icalformat.h>
49 50
50#include <kabc/addresseelist.h> 51#include <kabc/addresseelist.h>
51#include <kabc/phonenumber.h> 52#include <kabc/phonenumber.h>
52 53
53#include "kaimportoldialog.h" 54#include "kaimportoldialog.h"
54 55
55#include "../outport/msoutl9.h" 56#include "../outport/msoutl9.h"
56#include <ole2.h> 57#include <ole2.h>
57#include <comutil.h> 58#include <comutil.h>
58_Application gOlAppAB; 59_Application gOlAppAB;
59 60
60QDateTime mDdate2Qdtr( DATE dt) 61QDateTime mDdate2Qdtr( DATE dt)
61{ 62{
62 COleDateTime odt; 63 COleDateTime odt;
63 SYSTEMTIME st; 64 SYSTEMTIME st;
64 odt = dt; 65 odt = dt;
65 if ( odt.GetStatus() != 0 ) 66 if ( odt.GetStatus() != 0 )
66 return QDateTime(); 67 return QDateTime();
67 odt.GetAsSystemTime(st); 68 odt.GetAsSystemTime(st);
68 if ( st.wYear > 4000 ) // this program as a year 4000 bug! 69 if ( st.wYear > 4000 ) // this program as a year 4000 bug!
69 return QDateTime(); 70 return QDateTime();
70 // it seems so, that 1.1.4501 indicates: DATE invalid 71 // it seems so, that 1.1.4501 indicates: DATE invalid
71 QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) ); 72 QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) );
72 return qdt; 73 return qdt;
73} 74}
74 75
75class OLEListViewItem : public QCheckListItem 76class OLEListViewItem : public QCheckListItem
76{ 77{
77 public: 78 public:
78 OLEListViewItem( QListView *parent, QString text ) : 79 OLEListViewItem( QListView *parent, QString text ) :
79 QCheckListItem( parent, text, QCheckListItem::CheckBox ) { ; }; 80 QCheckListItem( parent, text, QCheckListItem::CheckBox ) { ; };
80 OLEListViewItem( QListViewItem *after, QString text ) : 81 OLEListViewItem( QListViewItem *after, QString text ) :
81 QCheckListItem( after, text, QCheckListItem::CheckBox ) { ; }; 82 QCheckListItem( after, text, QCheckListItem::CheckBox ) { ; };
82 ~OLEListViewItem() {}; 83 ~OLEListViewItem() {};
83 void setData( DWORD data ) {mData= data; }; 84 void setData( DWORD data ) {mData= data; };
84 DWORD data() { return mData ;}; 85 DWORD data() { return mData ;};
85 private: 86 private:
86 DWORD mData; 87 DWORD mData;
87}; 88};
88 89
89KAImportOLdialog::KAImportOLdialog( const QString &caption, 90KAImportOLdialog::KAImportOLdialog( const QString &caption,
90 KABC::AddressBook * aBook, QWidget *parent ) : 91 KABC::AddressBook * aBook, QWidget *parent ) :
91 KDialogBase( Plain, caption, User1 | Close, Ok, 92 KDialogBase( Plain, caption, User1 | Close, Ok,
92 parent, caption, true, false, i18n("Import!") ) 93 parent, caption, true, false, i18n("Import!") )
93{ 94{
94 QHBox * mw = new QHBox( this ); 95 QHBox * mw = new QHBox( this );
95 setMainWidget( mw ); 96 setMainWidget( mw );
96 mListView = new QListView( mw ); 97 mListView = new QListView( mw );
97 mListView->addColumn(i18n("Select Folder to import")); 98 mListView->addColumn(i18n("Select Folder to import"));
98 mListView->addColumn(i18n("Content Type")); 99 mListView->addColumn(i18n("Content Type"));
99 mABook = aBook; 100 mABook = aBook;
100 connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply())); 101 connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply()));
101 setupFolderView(); 102 setupFolderView();
102 resize( sizeHint().width()+50, sizeHint().height()+50 ); 103 resize( sizeHint().width()+50, sizeHint().height()+50 );
103} 104}
104 105
105KAImportOLdialog::~KAImportOLdialog() 106KAImportOLdialog::~KAImportOLdialog()
106{ 107{
107 108
108} 109}
109 110
110KABC::Addressee::List KAImportOLdialog::getAddressList() 111KABC::Addressee::List KAImportOLdialog::getAddressList()
111{ 112{
112 return mAList; 113 return mAList;
113} 114}
114void KAImportOLdialog::setupFolderView() 115void KAImportOLdialog::setupFolderView()
115{ 116{
116 SCODE sc = ::OleInitialize(NULL); 117 SCODE sc = ::OleInitialize(NULL);
117 if ( FAILED ( sc ) ) { 118 if ( FAILED ( sc ) ) {
118 KMessageBox::information(this,"OLE initialisation failed"); 119 KMessageBox::information(this,"OLE initialisation failed");
119 return; 120 return;
120 } 121 }
121 122
122 if(!gOlAppAB.CreateDispatch(_T("Outlook.Application"),NULL)){ 123 if(!gOlAppAB.CreateDispatch(_T("Outlook.Application"),NULL)){
123 KMessageBox::information(this,"Sorry, cannot access Outlook"); 124 KMessageBox::information(this,"Sorry, cannot access Outlook");
124 return ; 125 return ;
125 } 126 }
126 MAPIFolder mfInbox; 127 MAPIFolder mfInbox;
127 MAPIFolder mfRoot; 128 MAPIFolder mfRoot;
128 CString szName; 129 CString szName;
129 _NameSpace olNS; 130 _NameSpace olNS;
130 olNS = gOlAppAB.GetNamespace(_T("MAPI")); 131 olNS = gOlAppAB.GetNamespace(_T("MAPI"));
131 mfInbox = olNS.GetDefaultFolder(6); 132 mfInbox = olNS.GetDefaultFolder(6);
132 mfRoot = mfInbox.GetParent(); 133 mfRoot = mfInbox.GetParent();
133 szName = mfRoot.GetName(); 134 szName = mfRoot.GetName();
134 long iType = mfRoot.GetDefaultItemType(); 135 long iType = mfRoot.GetDefaultItemType();
135 QString mes; 136 QString mes;
136 mes = QString::fromUcs2( szName.GetBuffer() ); 137 mes = QString::fromUcs2( szName.GetBuffer() );
137 OLEListViewItem * root = new OLEListViewItem( mListView, mes ); 138 OLEListViewItem * root = new OLEListViewItem( mListView, mes );
138 mfRoot.m_lpDispatch->AddRef(); 139 mfRoot.m_lpDispatch->AddRef();
139 addFolder( root, mfRoot.m_lpDispatch ); 140 addFolder( root, mfRoot.m_lpDispatch );
140 root->setOpen( true ); 141 root->setOpen( true );
141 mListView->setSortColumn( 0 ); 142 mListView->setSortColumn( 0 );
142 mListView->sort( ); 143 mListView->sort( );
143} 144}
144 145
145 146
146void KAImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent) 147void KAImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent)
147{ 148{
148 MAPIFolder mfParent(dispParent), mfChild; 149 MAPIFolder mfParent(dispParent), mfChild;
149 _Folders folders; 150 _Folders folders;
150 _variant_t fndx((long)0); 151 _variant_t fndx((long)0);
151 CString szName; 152 CString szName;
152 long iType; 153 long iType;
153 OLEListViewItem* hChild; 154 OLEListViewItem* hChild;
154 155
155 folders = mfParent.GetFolders(); 156 folders = mfParent.GetFolders();
156 for(int i=1; i <= folders.GetCount(); ++i) 157 for(int i=1; i <= folders.GetCount(); ++i)
157 { 158 {
158 fndx = (long)i; 159 fndx = (long)i;
159 mfChild = folders.Item(fndx.Detach()); 160 mfChild = folders.Item(fndx.Detach());
160 mfChild.m_lpDispatch->AddRef(); 161 mfChild.m_lpDispatch->AddRef();
161 szName = mfChild.GetName(); 162 szName = mfChild.GetName();
162 iType = mfChild.GetDefaultItemType(); 163 iType = mfChild.GetDefaultItemType();
163 hChild = new OLEListViewItem( iParent , QString::fromUcs2( szName.GetBuffer() ) ); 164 hChild = new OLEListViewItem( iParent , QString::fromUcs2( szName.GetBuffer() ) );
164 if ( iType != 2) 165 if ( iType != 2)
165 hChild->setEnabled( false ); 166 hChild->setEnabled( false );
166 QString ts; 167 QString ts;
167 switch( iType ) { 168 switch( iType ) {
168 case 0: 169 case 0:
169 ts = i18n("Mail"); 170 ts = i18n("Mail");
170 break; 171 break;
171 case 1: 172 case 1:
172 ts = i18n("Calendar"); 173 ts = i18n("Calendar");
173 break; 174 break;
174 case 2: 175 case 2:
175 ts = i18n("Contacts"); 176 ts = i18n("Contacts");
176 break; 177 break;
177 case 3: 178 case 3:
178 ts = i18n("Todos"); 179 ts = i18n("Todos");
179 break; 180 break;
180 case 4: 181 case 4:
181 ts = i18n("Journals"); 182 ts = i18n("Journals");
182 break; 183 break;
183 case 5: 184 case 5:
184 ts = i18n("Notes"); 185 ts = i18n("Notes");
185 break; 186 break;
186 default: 187 default:
187 ts = i18n("Unknown"); 188 ts = i18n("Unknown");
188 } 189 }
189 hChild->setText( 1,ts); 190 hChild->setText( 1,ts);
190 hChild->setData( (DWORD) mfChild.m_lpDispatch ); 191 hChild->setData( (DWORD) mfChild.m_lpDispatch );
191 mfChild.m_lpDispatch->AddRef(); 192 mfChild.m_lpDispatch->AddRef();
192 addFolder(hChild, mfChild.m_lpDispatch); 193 addFolder(hChild, mfChild.m_lpDispatch);
193 } 194 }
194} 195}
195 196
196void KAImportOLdialog::slotApply() 197void KAImportOLdialog::slotApply()
197{ 198{
198 importedItems = 0; 199 importedItems = 0;
199 OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild(); 200 OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild();
200 while ( child ) { 201 while ( child ) {
201 if ( child->isOn() ) 202 if ( child->isOn() )
202 readContactData( child->data() ); 203 readContactData( child->data() );
203 child = (OLEListViewItem*) child->itemBelow(); 204 child = (OLEListViewItem*) child->itemBelow();
204 } 205 }
205 QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems); 206 QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems);
206 KMessageBox::information(this,mes); 207 KMessageBox::information(this,mes);
207} 208}
208void KAImportOLdialog::readContactData( DWORD folder ) 209void KAImportOLdialog::readContactData( DWORD folder )
209{ 210{
210 211
211 LPDISPATCH dispItem = (LPDISPATCH)folder; 212 LPDISPATCH dispItem = (LPDISPATCH)folder;
212 dispItem->AddRef(); 213 dispItem->AddRef();
213 MAPIFolder mf(dispItem); 214 MAPIFolder mf(dispItem);
214 mf.m_lpDispatch->AddRef(); 215 mf.m_lpDispatch->AddRef();
215 _Items folderItems; 216 _Items folderItems;
216 _variant_t indx((long)0); 217 _variant_t indx((long)0);
217 LPDISPATCH itm; 218 LPDISPATCH itm;
218 int i; 219 int i;
219 folderItems = mf.GetItems(); 220 folderItems = mf.GetItems();
220 QProgressBar bar( folderItems.GetCount(),0 ); 221 QProgressBar bar( folderItems.GetCount(),0 );
221 bar.setCaption (i18n("Importing - close to abort!") ); 222 bar.setCaption (i18n("Importing - close to abort!") );
222 int h = bar.sizeHint().height() ; 223 int h = bar.sizeHint().height() ;
223 int w = 300; 224 int w = 300;
224 int dw = QApplication::desktop()->width(); 225 int dw = QApplication::desktop()->width();
225 int dh = QApplication::desktop()->height(); 226 int dh = QApplication::desktop()->height();
226 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 227 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
227 bar.show(); 228 bar.show();
228 for(i=1; i <= folderItems.GetCount(); ++i) 229 for(i=1; i <= folderItems.GetCount(); ++i)
229 { 230 {
230 qApp->processEvents(); 231 qApp->processEvents();
231 if ( ! bar.isVisible() ) 232 if ( ! bar.isVisible() )
232 return ; 233 return ;
233 bar.setProgress( i ); 234 bar.setProgress( i );
234 indx = (long)i; 235 indx = (long)i;
235 itm = folderItems.Item(indx.Detach()); 236 itm = folderItems.Item(indx.Detach());
236 _ContactItem * pItem = (_ContactItem *)&itm; 237 _ContactItem * pItem = (_ContactItem *)&itm;
237 ol2kapiContact( pItem ); 238 ol2kapiContact( pItem );
238 itm->Release(); 239 itm->Release();
239 } 240 }
240} 241}
241void KAImportOLdialog::slotOk() 242void KAImportOLdialog::slotOk()
242{ 243{
243 QDialog::accept(); 244 QDialog::accept();
244} 245}
245 246
246void KAImportOLdialog::ol2kapiContact( _ContactItem * aItem ) 247void KAImportOLdialog::ol2kapiContact( _ContactItem * aItem )
247{ 248{
248 KABC::Addressee addressee; 249 KABC::Addressee addressee;
249 250
250 addressee.setUid( QString::fromUcs2(aItem->GetEntryID().GetBuffer())); 251 addressee.setUid( QString::fromUcs2(aItem->GetEntryID().GetBuffer()));
251 //GetLastModificationTime() 252 //GetLastModificationTime()
252 //addressee.setName( const QString &name ); 253 //addressee.setName( const QString &name );
253 //addressee.setFormattedName( const QString &formattedName ); 254 //addressee.setFormattedName( const QString &formattedName );
254 addressee.setFamilyName( QString::fromUcs2(aItem->GetLastName().GetBuffer()) ); 255 addressee.setFamilyName( QString::fromUcs2(aItem->GetLastName().GetBuffer()) );
255 addressee.setGivenName( QString::fromUcs2(aItem->GetFirstName().GetBuffer()) ); 256 addressee.setGivenName( QString::fromUcs2(aItem->GetFirstName().GetBuffer()) );
256 addressee.setAdditionalName( QString::fromUcs2(aItem->GetMiddleName().GetBuffer()) ); 257 addressee.setAdditionalName( QString::fromUcs2(aItem->GetMiddleName().GetBuffer()) );
257 addressee.setPrefix(QString::fromUcs2(aItem->GetTitle().GetBuffer()) ); 258 addressee.setPrefix(QString::fromUcs2(aItem->GetTitle().GetBuffer()) );
258 addressee.setSuffix( QString::fromUcs2(aItem->GetSuffix().GetBuffer()) ); 259 addressee.setSuffix( QString::fromUcs2(aItem->GetSuffix().GetBuffer()) );
259 addressee.setNickName( QString::fromUcs2(aItem->GetNickName().GetBuffer()) ); 260 addressee.setNickName( QString::fromUcs2(aItem->GetNickName().GetBuffer()) );
260 QDateTime dtb = mDdate2Qdtr(aItem->GetBirthday()); 261 QDateTime dtb = mDdate2Qdtr(aItem->GetBirthday());
261 if ( dtb.isValid() ) 262 if ( dtb.isValid() )
262 addressee.setBirthday( mDdate2Qdtr(aItem->GetBirthday())); 263 addressee.setBirthday( mDdate2Qdtr(aItem->GetBirthday()));
263 264
264 //QString::fromUcs2(aItem->.GetBuffer()) 265 //QString::fromUcs2(aItem->.GetBuffer())
265 //addressee.setMailer( const QString &mailer ); 266 //addressee.setMailer( const QString &mailer );
266 //addressee.setTimeZone( const TimeZone &timeZone ); 267 //addressee.setTimeZone( const TimeZone &timeZone );
267 //addressee.setGeo( const Geo &geo ); 268 //addressee.setGeo( const Geo &geo );
268 //addressee.setTitle( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) );// titel is the prefix 269 //addressee.setTitle( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) );// titel is the prefix
269 addressee.setRole( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) ); 270 addressee.setRole( QString::fromUcs2(aItem->GetJobTitle().GetBuffer()) );
270 addressee.setOrganization( QString::fromUcs2(aItem->GetCompanyName().GetBuffer()) ); 271 addressee.setOrganization( QString::fromUcs2(aItem->GetCompanyName().GetBuffer()).replace( QRegExp("\\r"), "") );
271 QString notesStr = QString::fromUcs2(aItem->GetBody().GetBuffer()); 272 QString notesStr = QString::fromUcs2(aItem->GetBody().GetBuffer());
273 notesStr.replace( QRegExp("\\r"), "");
272 274
273 addressee.setProductId( QString::fromUcs2(aItem->GetCustomerID().GetBuffer()) ); 275 addressee.setProductId( QString::fromUcs2(aItem->GetCustomerID().GetBuffer()) );
274 //addressee.setRevision( const QDateTime &revision ); 276 //addressee.setRevision( const QDateTime &revision );
275 // addressee.setSortString( const QString &sortString ); 277 // addressee.setSortString( const QString &sortString );
276 addressee.setUrl( QString::fromUcs2(aItem->GetWebPage().GetBuffer()) ); 278 addressee.setUrl( QString::fromUcs2(aItem->GetWebPage().GetBuffer()) );
277 279
278 QString tempS; 280 QString tempS;
279 tempS = QString::fromUcs2(aItem->GetNetMeetingAlias().GetBuffer())+" AT SERVER: " +QString::fromUcs2(aItem->GetNetMeetingServer().GetBuffer()); 281 tempS = QString::fromUcs2(aItem->GetNetMeetingAlias().GetBuffer())+" AT SERVER: " +QString::fromUcs2(aItem->GetNetMeetingServer().GetBuffer());
280 if ( tempS.length() > 12 ) 282 if ( tempS.length() > 12 )
281 addressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", tempS ); 283 addressee.insertCustom( "KADDRESSBOOK", "X-IMAddress", tempS );
282 tempS = QString::fromUcs2(aItem->GetSpouse().GetBuffer()); 284 tempS = QString::fromUcs2(aItem->GetSpouse().GetBuffer());
283 if ( !tempS.isEmpty() ) 285 if ( !tempS.isEmpty() )
284 addressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", tempS ); 286 addressee.insertCustom( "KADDRESSBOOK", "X-SpousesName", tempS );
285 tempS = QString::fromUcs2(aItem->GetManagerName().GetBuffer()); 287 tempS = QString::fromUcs2(aItem->GetManagerName().GetBuffer());
286 if ( !tempS.isEmpty() ) 288 if ( !tempS.isEmpty() )
287 addressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", tempS ); 289 addressee.insertCustom( "KADDRESSBOOK", "X-ManagersName", tempS );
288 tempS = QString::fromUcs2(aItem->GetAssistantName().GetBuffer()); 290 tempS = QString::fromUcs2(aItem->GetAssistantName().GetBuffer());
289 if ( !tempS.isEmpty() ) 291 if ( !tempS.isEmpty() )
290 addressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", tempS ); 292 addressee.insertCustom( "KADDRESSBOOK", "X-AssistantsName", tempS );
291 tempS = QString::fromUcs2(aItem->GetDepartment().GetBuffer()); 293 tempS = QString::fromUcs2(aItem->GetDepartment().GetBuffer());
292 if ( !tempS.isEmpty() ) 294 if ( !tempS.isEmpty() )
293 addressee.insertCustom( "KADDRESSBOOK", "X-Department", tempS ); 295 addressee.insertCustom( "KADDRESSBOOK", "X-Department", tempS );
294 tempS = QString::fromUcs2(aItem->GetOfficeLocation().GetBuffer()); 296 tempS = QString::fromUcs2(aItem->GetOfficeLocation().GetBuffer()).replace( QRegExp("\\r"), "");
295 if ( !tempS.isEmpty() ) 297 if ( !tempS.isEmpty() )
296 addressee.insertCustom( "KADDRESSBOOK", "X-Office",tempS ); 298 addressee.insertCustom( "KADDRESSBOOK", "X-Office",tempS );
297 tempS = QString::fromUcs2(aItem->GetProfession().GetBuffer()); 299 tempS = QString::fromUcs2(aItem->GetProfession().GetBuffer());
298 if ( !tempS.isEmpty() ) 300 if ( !tempS.isEmpty() )
299 addressee.insertCustom( "KADDRESSBOOK", "X-Profession", tempS ); 301 addressee.insertCustom( "KADDRESSBOOK", "X-Profession", tempS );
300 dtb = mDdate2Qdtr(aItem->GetAnniversary()); 302 dtb = mDdate2Qdtr(aItem->GetAnniversary());
301 if (dtb.isValid() ) { 303 if (dtb.isValid() ) {
302 QString dt = KGlobal::locale()->formatDate( dtb.date() , true, KLocale::ISODate); 304 QString dt = KGlobal::locale()->formatDate( dtb.date() , true, KLocale::ISODate);
303 addressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt); 305 addressee.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt);
304 } 306 }
305 int sec = aItem->GetSensitivity() ; 307 int sec = aItem->GetSensitivity() ;
306 if ( sec > 1 )// mapping pers -> private 308 if ( sec > 1 )// mapping pers -> private
307 --sec; 309 --sec;
308 addressee.setSecrecy( sec ); 310 addressee.setSecrecy( sec );
309 //addressee.setLogo( const Picture &logo ); 311 //addressee.setLogo( const Picture &logo );
310 //addressee.setPhoto( const Picture &photo ); 312 //addressee.setPhoto( const Picture &photo );
311 //addressee.setSound( const Sound &sound ); 313 //addressee.setSound( const Sound &sound );
312 //addressee.setAgent( const Agent &agent ); 314 //addressee.setAgent( const Agent &agent );
313 QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer()); 315 QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer()).replace( QRegExp("\\r"), "");
314 addressee.setCategories( QStringList::split( ";", cat )); 316 addressee.setCategories( QStringList::split( ";", cat ));
315 317
316 QString phoneS; 318 QString phoneS;
317 319
318 phoneS = QString::fromUcs2( aItem->GetAssistantTelephoneNumber().GetBuffer()); 320 phoneS = QString::fromUcs2( aItem->GetAssistantTelephoneNumber().GetBuffer());
319 if ( ! phoneS.isEmpty()) 321 if ( ! phoneS.isEmpty())
320 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Voice ) ); 322 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Voice ) );
321 phoneS = QString::fromUcs2( aItem->GetBusinessTelephoneNumber().GetBuffer()); 323 phoneS = QString::fromUcs2( aItem->GetBusinessTelephoneNumber().GetBuffer());
322 if ( ! phoneS.isEmpty()) 324 if ( ! phoneS.isEmpty())
323 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work ) ); 325 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work ) );
324 phoneS = QString::fromUcs2( aItem->GetBusiness2TelephoneNumber().GetBuffer()); 326 phoneS = QString::fromUcs2( aItem->GetBusiness2TelephoneNumber().GetBuffer());
325 if ( ! phoneS.isEmpty()) 327 if ( ! phoneS.isEmpty())
326 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work ) ); 328 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work ) );
327 phoneS = QString::fromUcs2( aItem->GetBusinessFaxNumber().GetBuffer()); 329 phoneS = QString::fromUcs2( aItem->GetBusinessFaxNumber().GetBuffer());
328 if ( ! phoneS.isEmpty()) 330 if ( ! phoneS.isEmpty())
329 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Fax ) ); 331 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Fax ) );
330 phoneS = QString::fromUcs2( aItem->GetCarTelephoneNumber().GetBuffer()); 332 phoneS = QString::fromUcs2( aItem->GetCarTelephoneNumber().GetBuffer());
331 if ( ! phoneS.isEmpty()) 333 if ( ! phoneS.isEmpty())
332 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Car ) ); 334 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Car ) );
333 phoneS = QString::fromUcs2( aItem->GetHomeTelephoneNumber().GetBuffer()); 335 phoneS = QString::fromUcs2( aItem->GetHomeTelephoneNumber().GetBuffer());
334 if ( ! phoneS.isEmpty()) 336 if ( ! phoneS.isEmpty())
335 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home ) ); 337 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home ) );
336 phoneS = QString::fromUcs2( aItem->GetHome2TelephoneNumber().GetBuffer()); 338 phoneS = QString::fromUcs2( aItem->GetHome2TelephoneNumber().GetBuffer());
337 if ( ! phoneS.isEmpty()) 339 if ( ! phoneS.isEmpty())
338 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home ) ); 340 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home ) );
339 phoneS = QString::fromUcs2( aItem->GetHomeFaxNumber().GetBuffer()); 341 phoneS = QString::fromUcs2( aItem->GetHomeFaxNumber().GetBuffer());
340 if ( ! phoneS.isEmpty()) 342 if ( ! phoneS.isEmpty())
341 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home + KABC::PhoneNumber::Fax ) ); 343 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Home + KABC::PhoneNumber::Fax ) );
342 phoneS = QString::fromUcs2( aItem->GetISDNNumber().GetBuffer()); 344 phoneS = QString::fromUcs2( aItem->GetISDNNumber().GetBuffer());
343 if ( ! phoneS.isEmpty()) 345 if ( ! phoneS.isEmpty())
344 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Isdn ) ); 346 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Isdn ) );
345 phoneS = QString::fromUcs2( aItem->GetMobileTelephoneNumber().GetBuffer()); 347 phoneS = QString::fromUcs2( aItem->GetMobileTelephoneNumber().GetBuffer());
346 if ( ! phoneS.isEmpty()) 348 if ( ! phoneS.isEmpty())
347 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Cell ) ); 349 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Cell ) );
348 phoneS = QString::fromUcs2( aItem->GetOtherFaxNumber().GetBuffer()); 350 phoneS = QString::fromUcs2( aItem->GetOtherFaxNumber().GetBuffer());
349 if ( ! phoneS.isEmpty()) 351 if ( ! phoneS.isEmpty())
350 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Fax ) ); 352 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Fax ) );
351 phoneS = QString::fromUcs2( aItem->GetOtherTelephoneNumber().GetBuffer()); 353 phoneS = QString::fromUcs2( aItem->GetOtherTelephoneNumber().GetBuffer());
352 if ( ! phoneS.isEmpty()) 354 if ( ! phoneS.isEmpty())
353 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Voice ) ); 355 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Voice ) );
354 phoneS = QString::fromUcs2( aItem->GetPagerNumber().GetBuffer()); 356 phoneS = QString::fromUcs2( aItem->GetPagerNumber().GetBuffer());
355 if ( ! phoneS.isEmpty()) 357 if ( ! phoneS.isEmpty())
356 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Pager ) ); 358 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Pager ) );
357 phoneS = QString::fromUcs2( aItem->GetPrimaryTelephoneNumber().GetBuffer()); 359 phoneS = QString::fromUcs2( aItem->GetPrimaryTelephoneNumber().GetBuffer());
358 if ( ! phoneS.isEmpty()) 360 if ( ! phoneS.isEmpty())
359 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Pref ) ); 361 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Pref ) );
360 phoneS = QString::fromUcs2( aItem->GetTTYTDDTelephoneNumber().GetBuffer()); 362 phoneS = QString::fromUcs2( aItem->GetTTYTDDTelephoneNumber().GetBuffer());
361 if ( ! phoneS.isEmpty()) 363 if ( ! phoneS.isEmpty())
362 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Modem ) ); 364 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Modem ) );
363 phoneS = QString::fromUcs2( aItem->GetTelexNumber().GetBuffer()); 365 phoneS = QString::fromUcs2( aItem->GetTelexNumber().GetBuffer());
364 if ( ! phoneS.isEmpty()) 366 if ( ! phoneS.isEmpty())
365 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Fax + KABC::PhoneNumber::Bbs ) ); 367 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Fax + KABC::PhoneNumber::Bbs ) );
366 phoneS = QString::fromUcs2( aItem->GetCompanyMainTelephoneNumber().GetBuffer()); 368 phoneS = QString::fromUcs2( aItem->GetCompanyMainTelephoneNumber().GetBuffer());
367 if ( ! phoneS.isEmpty()) 369 if ( ! phoneS.isEmpty())
368 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Pref ) ); 370 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Work + KABC::PhoneNumber::Pref ) );
369 phoneS = QString::fromUcs2( aItem->GetRadioTelephoneNumber().GetBuffer()); 371 phoneS = QString::fromUcs2( aItem->GetRadioTelephoneNumber().GetBuffer());
370 if ( ! phoneS.isEmpty()) 372 if ( ! phoneS.isEmpty())
371 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Video ) ); 373 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Video ) );
372 phoneS = QString::fromUcs2( aItem->GetCallbackTelephoneNumber().GetBuffer()); 374 phoneS = QString::fromUcs2( aItem->GetCallbackTelephoneNumber().GetBuffer());
373 if ( ! phoneS.isEmpty()) 375 if ( ! phoneS.isEmpty())
374 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Voice + KABC::PhoneNumber::Pref ) ); 376 addressee.insertPhoneNumber( KABC::PhoneNumber(phoneS ,KABC::PhoneNumber::Voice + KABC::PhoneNumber::Pref ) );
375 377
376 bool preferred = true; 378 bool preferred = true;
377 phoneS = QString::fromUcs2( aItem->GetEmail1Address().GetBuffer()); 379 phoneS = QString::fromUcs2( aItem->GetEmail1Address().GetBuffer());
378 if ( ! phoneS.isEmpty()) { 380 if ( ! phoneS.isEmpty()) {
379 addressee.insertEmail(phoneS , preferred ); 381 addressee.insertEmail(phoneS , preferred );
380 preferred = false; 382 preferred = false;
381 } 383 }
382 phoneS = QString::fromUcs2( aItem->GetEmail2Address().GetBuffer()); 384 phoneS = QString::fromUcs2( aItem->GetEmail2Address().GetBuffer());
383 if ( ! phoneS.isEmpty()) { 385 if ( ! phoneS.isEmpty()) {
384 addressee.insertEmail(phoneS , preferred ); 386 addressee.insertEmail(phoneS , preferred );
385 preferred = false; 387 preferred = false;
386 } 388 }
387 phoneS = QString::fromUcs2( aItem->GetEmail3Address().GetBuffer()); 389 phoneS = QString::fromUcs2( aItem->GetEmail3Address().GetBuffer());
388 if ( ! phoneS.isEmpty()) { 390 if ( ! phoneS.isEmpty()) {
389 addressee.insertEmail(phoneS , preferred ); 391 addressee.insertEmail(phoneS , preferred );
390 preferred = false; 392 preferred = false;
391 } 393 }
392 // is this the number of the preferred email? 394 // is this the number of the preferred email?
393 //long GetSelectedMailingAddress();??? 395 //long GetSelectedMailingAddress();???
394 396
395 KABC::Address addressHome; 397 KABC::Address addressHome;
396 KABC::Address* addressAdd = &addressHome; 398 KABC::Address* addressAdd = &addressHome;
397 bool insert = false; 399 bool insert = false;
398 phoneS = QString::fromUcs2( aItem->GetHomeAddressCountry().GetBuffer()); 400 phoneS = QString::fromUcs2( aItem->GetHomeAddressCountry().GetBuffer());
401 phoneS.replace( QRegExp("\\r"), "");
399 if ( ! phoneS.isEmpty()) { 402 if ( ! phoneS.isEmpty()) {
400 addressAdd->setCountry(phoneS ); 403 addressAdd->setCountry(phoneS );
401 insert = true; 404 insert = true;
402 } 405 }
403 phoneS = QString::fromUcs2( aItem->GetHomeAddressState().GetBuffer()); 406 phoneS = QString::fromUcs2( aItem->GetHomeAddressState().GetBuffer());
407 phoneS.replace( QRegExp("\\r"), "");
404 if ( ! phoneS.isEmpty()) { 408 if ( ! phoneS.isEmpty()) {
405 addressAdd->setRegion(phoneS ); 409 addressAdd->setRegion(phoneS );
406 insert = true; 410 insert = true;
407 } 411 }
408 phoneS = QString::fromUcs2( aItem->GetHomeAddressCity().GetBuffer()); 412 phoneS = QString::fromUcs2( aItem->GetHomeAddressCity().GetBuffer());
413 phoneS.replace( QRegExp("\\r"), "");
409 if ( ! phoneS.isEmpty()) { 414 if ( ! phoneS.isEmpty()) {
410 addressAdd->setLocality(phoneS ); 415 addressAdd->setLocality(phoneS );
411 insert = true; 416 insert = true;
412 } 417 }
413 phoneS = QString::fromUcs2( aItem->GetHomeAddressPostalCode().GetBuffer()); 418 phoneS = QString::fromUcs2( aItem->GetHomeAddressPostalCode().GetBuffer());
419 phoneS.replace( QRegExp("\\r"), "");
414 if ( ! phoneS.isEmpty()) { 420 if ( ! phoneS.isEmpty()) {
415 addressAdd->setPostalCode(phoneS ); 421 addressAdd->setPostalCode(phoneS );
416 insert = true; 422 insert = true;
417 } 423 }
418 phoneS = QString::fromUcs2( aItem->GetHomeAddressPostOfficeBox().GetBuffer()); 424 phoneS = QString::fromUcs2( aItem->GetHomeAddressPostOfficeBox().GetBuffer());
425 phoneS.replace( QRegExp("\\r"), "");
419 if ( ! phoneS.isEmpty()) { 426 if ( ! phoneS.isEmpty()) {
420 addressAdd->setPostOfficeBox(phoneS ); 427 addressAdd->setPostOfficeBox(phoneS );
421 insert = true; 428 insert = true;
422 } 429 }
423 phoneS = QString::fromUcs2( aItem->GetHomeAddressStreet().GetBuffer()); 430 phoneS = QString::fromUcs2( aItem->GetHomeAddressStreet().GetBuffer());
431 phoneS.replace( QRegExp("\\r"), "");
424 if ( ! phoneS.isEmpty()) { 432 if ( ! phoneS.isEmpty()) {
425 addressAdd->setStreet(phoneS ); 433 addressAdd->setStreet(phoneS );
426 insert = true; 434 insert = true;
427 } 435 }
428 phoneS = QString::fromUcs2( aItem->GetHomeAddress().GetBuffer()); 436 phoneS = QString::fromUcs2( aItem->GetHomeAddress().GetBuffer());
437 phoneS.replace( QRegExp("\\r"), "");
429 if ( ! phoneS.isEmpty()) { 438 if ( ! phoneS.isEmpty()) {
430 // redundant !addressAdd->setExtended(phoneS ); 439 // redundant !addressAdd->setExtended(phoneS );
431 // insert = true; 440 // insert = true;
432 } 441 }
433 addressAdd->setType( KABC::Address::Home ); 442 addressAdd->setType( KABC::Address::Home );
434 if ( insert ) 443 if ( insert )
435 addressee.insertAddress( *addressAdd ); 444 addressee.insertAddress( *addressAdd );
436 // ++++++++++++++++++++++ end of address 445 // ++++++++++++++++++++++ end of address
437 446
438 KABC::Address addressWork; 447 KABC::Address addressWork;
439 addressAdd = &addressWork; 448 addressAdd = &addressWork;
440 insert = false; 449 insert = false;
441 phoneS = QString::fromUcs2( aItem->GetBusinessAddressCountry().GetBuffer()); 450 phoneS = QString::fromUcs2( aItem->GetBusinessAddressCountry().GetBuffer());
451 phoneS.replace( QRegExp("\\r"), "");
442 if ( ! phoneS.isEmpty()) { 452 if ( ! phoneS.isEmpty()) {
443 addressAdd->setCountry(phoneS ); 453 addressAdd->setCountry(phoneS );
444 insert = true; 454 insert = true;
445 } 455 }
446 phoneS = QString::fromUcs2( aItem->GetBusinessAddressState().GetBuffer()); 456 phoneS = QString::fromUcs2( aItem->GetBusinessAddressState().GetBuffer());
457 phoneS.replace( QRegExp("\\r"), "");
447 if ( ! phoneS.isEmpty()) { 458 if ( ! phoneS.isEmpty()) {
448 addressAdd->setRegion(phoneS ); 459 addressAdd->setRegion(phoneS );
449 insert = true; 460 insert = true;
450 } 461 }
451 phoneS = QString::fromUcs2( aItem->GetBusinessAddressCity().GetBuffer()); 462 phoneS = QString::fromUcs2( aItem->GetBusinessAddressCity().GetBuffer());
463 phoneS.replace( QRegExp("\\r"), "");
452 if ( ! phoneS.isEmpty()) { 464 if ( ! phoneS.isEmpty()) {
453 addressAdd->setLocality(phoneS ); 465 addressAdd->setLocality(phoneS );
454 insert = true; 466 insert = true;
455 } 467 }
456 phoneS = QString::fromUcs2( aItem->GetBusinessAddressPostalCode().GetBuffer()); 468 phoneS = QString::fromUcs2( aItem->GetBusinessAddressPostalCode().GetBuffer());
469 phoneS.replace( QRegExp("\\r"), "");
457 if ( ! phoneS.isEmpty()) { 470 if ( ! phoneS.isEmpty()) {
458 addressAdd->setPostalCode(phoneS ); 471 addressAdd->setPostalCode(phoneS );
459 insert = true; 472 insert = true;
460 } 473 }
461 phoneS = QString::fromUcs2( aItem->GetBusinessAddressPostOfficeBox().GetBuffer()); 474 phoneS = QString::fromUcs2( aItem->GetBusinessAddressPostOfficeBox().GetBuffer());
475 phoneS.replace( QRegExp("\\r"), "");
462 if ( ! phoneS.isEmpty()) { 476 if ( ! phoneS.isEmpty()) {
463 addressAdd->setPostOfficeBox(phoneS ); 477 addressAdd->setPostOfficeBox(phoneS );
464 insert = true; 478 insert = true;
465 } 479 }
466 phoneS = QString::fromUcs2( aItem->GetBusinessAddressStreet().GetBuffer()); 480 phoneS = QString::fromUcs2( aItem->GetBusinessAddressStreet().GetBuffer());
481 phoneS.replace( QRegExp("\\r"), "");
467 if ( ! phoneS.isEmpty()) { 482 if ( ! phoneS.isEmpty()) {
468 addressAdd->setStreet(phoneS ); 483 addressAdd->setStreet(phoneS );
469 insert = true; 484 insert = true;
470 } 485 }
471 phoneS = QString::fromUcs2( aItem->GetBusinessAddress().GetBuffer()); 486 phoneS = QString::fromUcs2( aItem->GetBusinessAddress().GetBuffer());
487 phoneS.replace( QRegExp("\\r"), "");
472 if ( ! phoneS.isEmpty()) { 488 if ( ! phoneS.isEmpty()) {
473 // redundant !addressAdd->setExtended(phoneS ); 489 // redundant !addressAdd->setExtended(phoneS );
474 // insert = true; 490 // insert = true;
475 } 491 }
476 addressAdd->setType( KABC::Address::Work ); 492 addressAdd->setType( KABC::Address::Work );
477 if ( insert ) 493 if ( insert )
478 addressee.insertAddress( *addressAdd ); 494 addressee.insertAddress( *addressAdd );
479 // ++++++++++++++++++++++ end of address 495 // ++++++++++++++++++++++ end of address
480 496
481 KABC::Address addressOther; 497 KABC::Address addressOther;
482 addressAdd = &addressOther; 498 addressAdd = &addressOther;
483 insert = false; 499 insert = false;
484 phoneS = QString::fromUcs2( aItem->GetOtherAddressCountry().GetBuffer()); 500 phoneS = QString::fromUcs2( aItem->GetOtherAddressCountry().GetBuffer());
501 phoneS.replace( QRegExp("\\r"), "");
485 if ( ! phoneS.isEmpty()) { 502 if ( ! phoneS.isEmpty()) {
486 addressAdd->setCountry(phoneS ); 503 addressAdd->setCountry(phoneS );
487 insert = true; 504 insert = true;
488 } 505 }
489 phoneS = QString::fromUcs2( aItem->GetOtherAddressState().GetBuffer()); 506 phoneS = QString::fromUcs2( aItem->GetOtherAddressState().GetBuffer());
507 phoneS.replace( QRegExp("\\r"), "");
490 if ( ! phoneS.isEmpty()) { 508 if ( ! phoneS.isEmpty()) {
491 addressAdd->setRegion(phoneS ); 509 addressAdd->setRegion(phoneS );
492 insert = true; 510 insert = true;
493 } 511 }
494 phoneS = QString::fromUcs2( aItem->GetOtherAddressCity().GetBuffer()); 512 phoneS = QString::fromUcs2( aItem->GetOtherAddressCity().GetBuffer());
513 phoneS.replace( QRegExp("\\r"), "");
495 if ( ! phoneS.isEmpty()) { 514 if ( ! phoneS.isEmpty()) {
496 addressAdd->setLocality(phoneS ); 515 addressAdd->setLocality(phoneS );
497 insert = true; 516 insert = true;
498 } 517 }
499 phoneS = QString::fromUcs2( aItem->GetOtherAddressPostalCode().GetBuffer()); 518 phoneS = QString::fromUcs2( aItem->GetOtherAddressPostalCode().GetBuffer());
519 phoneS.replace( QRegExp("\\r"), "");
500 if ( ! phoneS.isEmpty()) { 520 if ( ! phoneS.isEmpty()) {
501 addressAdd->setPostalCode(phoneS ); 521 addressAdd->setPostalCode(phoneS );
502 insert = true; 522 insert = true;
503 } 523 }
504 phoneS = QString::fromUcs2( aItem->GetOtherAddressPostOfficeBox().GetBuffer()); 524 phoneS = QString::fromUcs2( aItem->GetOtherAddressPostOfficeBox().GetBuffer());
525 phoneS.replace( QRegExp("\\r"), "");
505 if ( ! phoneS.isEmpty()) { 526 if ( ! phoneS.isEmpty()) {
506 addressAdd->setPostOfficeBox(phoneS ); 527 addressAdd->setPostOfficeBox(phoneS );
507 insert = true; 528 insert = true;
508 } 529 }
509 phoneS = QString::fromUcs2( aItem->GetOtherAddressStreet().GetBuffer()); 530 phoneS = QString::fromUcs2( aItem->GetOtherAddressStreet().GetBuffer());
531 phoneS.replace( QRegExp("\\r"), "");
510 if ( ! phoneS.isEmpty()) { 532 if ( ! phoneS.isEmpty()) {
511 addressAdd->setStreet(phoneS ); 533 addressAdd->setStreet(phoneS );
512 insert = true; 534 insert = true;
513 } 535 }
514 phoneS = QString::fromUcs2( aItem->GetOtherAddress().GetBuffer()); 536 phoneS = QString::fromUcs2( aItem->GetOtherAddress().GetBuffer());
515 if ( ! phoneS.isEmpty()) { 537 if ( ! phoneS.isEmpty()) {
516 // redundant !addressAdd->setExtended(phoneS ); 538 // redundant !addressAdd->setExtended(phoneS );
517 //insert = true; 539 //insert = true;
518 } 540 }
519 //addressAdd->setId( ); 541 //addressAdd->setId( );
520 if ( insert ) 542 if ( insert )
521 addressee.insertAddress( *addressAdd ); 543 addressee.insertAddress( *addressAdd );
522 // ++++++++++++++++++++++ end of address 544 // ++++++++++++++++++++++ end of address
523 KABC::Address addressMail; 545 KABC::Address addressMail;
524 addressAdd = &addressMail; 546 addressAdd = &addressMail;
525 insert = false; 547 insert = false;
526 phoneS = QString::fromUcs2( aItem->GetMailingAddressCountry().GetBuffer()); 548 phoneS = QString::fromUcs2( aItem->GetMailingAddressCountry().GetBuffer());
549 phoneS.replace( QRegExp("\\r"), "");
527 if ( ! phoneS.isEmpty()) { 550 if ( ! phoneS.isEmpty()) {
528 addressAdd->setCountry(phoneS ); 551 addressAdd->setCountry(phoneS );
529 insert = true; 552 insert = true;
530 } 553 }
531 phoneS = QString::fromUcs2( aItem->GetMailingAddressState().GetBuffer()); 554 phoneS = QString::fromUcs2( aItem->GetMailingAddressState().GetBuffer());
555 phoneS.replace( QRegExp("\\r"), "");
532 if ( ! phoneS.isEmpty()) { 556 if ( ! phoneS.isEmpty()) {
533 addressAdd->setRegion(phoneS ); 557 addressAdd->setRegion(phoneS );
534 insert = true; 558 insert = true;
535 } 559 }
536 phoneS = QString::fromUcs2( aItem->GetMailingAddressCity().GetBuffer()); 560 phoneS = QString::fromUcs2( aItem->GetMailingAddressCity().GetBuffer());
561 phoneS.replace( QRegExp("\\r"), "");
537 if ( ! phoneS.isEmpty()) { 562 if ( ! phoneS.isEmpty()) {
538 addressAdd->setLocality(phoneS ); 563 addressAdd->setLocality(phoneS );
539 insert = true; 564 insert = true;
540 } 565 }
541 phoneS = QString::fromUcs2( aItem->GetMailingAddressPostalCode().GetBuffer()); 566 phoneS = QString::fromUcs2( aItem->GetMailingAddressPostalCode().GetBuffer());
567 phoneS.replace( QRegExp("\\r"), "");
542 if ( ! phoneS.isEmpty()) { 568 if ( ! phoneS.isEmpty()) {
543 addressAdd->setPostalCode(phoneS ); 569 addressAdd->setPostalCode(phoneS );
544 insert = true; 570 insert = true;
545 } 571 }
546 phoneS = QString::fromUcs2( aItem->GetMailingAddressPostOfficeBox().GetBuffer()); 572 phoneS = QString::fromUcs2( aItem->GetMailingAddressPostOfficeBox().GetBuffer());
573 phoneS.replace( QRegExp("\\r"), "");
547 if ( ! phoneS.isEmpty()) { 574 if ( ! phoneS.isEmpty()) {
548 addressAdd->setPostOfficeBox(phoneS ); 575 addressAdd->setPostOfficeBox(phoneS );
549 insert = true; 576 insert = true;
550 } 577 }
551 phoneS = QString::fromUcs2( aItem->GetMailingAddressStreet().GetBuffer()); 578 phoneS = QString::fromUcs2( aItem->GetMailingAddressStreet().GetBuffer());
579 phoneS.replace( QRegExp("\\r"), "");
552 if ( ! phoneS.isEmpty()) { 580 if ( ! phoneS.isEmpty()) {
553 addressAdd->setStreet(phoneS ); 581 addressAdd->setStreet(phoneS );
554 insert = true; 582 insert = true;
555 } 583 }
556 phoneS = QString::fromUcs2( aItem->GetMailingAddress().GetBuffer()); 584 phoneS = QString::fromUcs2( aItem->GetMailingAddress().GetBuffer());
585 phoneS.replace( QRegExp("\\r"), "");
557 if ( ! phoneS.isEmpty()) { 586 if ( ! phoneS.isEmpty()) {
558 // redundant ! addressAdd->setExtended(phoneS ); 587 // redundant ! addressAdd->setExtended(phoneS );
559 // insert = true; 588 // insert = true;
560 } 589 }
561 addressAdd->setType( KABC::Address::Postal ); 590 addressAdd->setType( KABC::Address::Postal );
562 if ( insert ) { 591 if ( insert ) {
563 addressee.insertAddress( *addressAdd ); 592 addressee.insertAddress( *addressAdd );
564 } 593 }
565 // the following code is disabled 594 // the following code is disabled
566 // it does not seem to be useful 595 // it does not seem to be useful
567#if 0 596#if 0
568 if ( insert ) { 597 if ( insert ) {
569 addressAdd->setType( KABC::Address::Home ); 598 addressAdd->setType( KABC::Address::Home );
570 if ( addressMail == addressHome ) { 599 if ( addressMail == addressHome ) {
571 addressHome.setType( KABC::Address::Postal+ KABC::Address::Home ); 600 addressHome.setType( KABC::Address::Postal+ KABC::Address::Home );
572 addressee.insertAddress( addressHome ); 601 addressee.insertAddress( addressHome );
573 } else { 602 } else {
574 addressAdd->setType( KABC::Address::Work ); 603 addressAdd->setType( KABC::Address::Work );
575 if ( addressMail == addressWork ){ 604 if ( addressMail == addressWork ){
576 addressWork.setType( KABC::Address::Postal+ KABC::Address::Work ); 605 addressWork.setType( KABC::Address::Postal+ KABC::Address::Work );
577 addressee.insertAddress( addressWork ); 606 addressee.insertAddress( addressWork );
578 607
579 } else { 608 } else {
580 addressAdd->setType( 0 ); 609 addressAdd->setType( 0 );
581 if ( addressOther == addressMail ){ 610 if ( addressOther == addressMail ){
582 addressOther.setType( KABC::Address::Postal ); 611 addressOther.setType( KABC::Address::Postal );
583 addressee.insertAddress( addressOther ); 612 addressee.insertAddress( addressOther );
584 } else { 613 } else {
585 addressee.insertAddress( *addressAdd ); 614 addressee.insertAddress( *addressAdd );
586 } 615 }
587 } 616 }
588 } 617 }
589 } 618 }
590#endif 619#endif
591 // ++++++++++++++++++++++ end of ALL addresses 620 // ++++++++++++++++++++++ end of ALL addresses
592 //GetUserProperties(); 621 //GetUserProperties();
593 tempS = QString::fromUcs2(aItem->GetInternetFreeBusyAddress().GetBuffer()); 622 tempS = QString::fromUcs2(aItem->GetInternetFreeBusyAddress().GetBuffer());
623 phoneS.replace( QRegExp("\\r"), "");
594 if ( !tempS.isEmpty() ) 624 if ( !tempS.isEmpty() )
595 addressee.insertCustom( "KADDRESSBOOK", "X-FreeBusyUrl", tempS ); 625 addressee.insertCustom( "KADDRESSBOOK", "X-FreeBusyUrl", tempS );
596 tempS = QString::fromUcs2(aItem->GetChildren().GetBuffer()); 626 tempS = QString::fromUcs2(aItem->GetChildren().GetBuffer());
597 if ( !tempS.isEmpty() ) 627 if ( !tempS.isEmpty() )
598 addressee.insertCustom( "KADDRESSBOOK", "X-Children", tempS ); 628 addressee.insertCustom( "KADDRESSBOOK", "X-Children", tempS );
599 int gen = aItem->GetGender(); 629 int gen = aItem->GetGender();
600 if ( gen != 0 ) { // 0 undef - 1 female - 2 male 630 if ( gen != 0 ) { // 0 undef - 1 female - 2 male
601 if ( gen == 1 ) 631 if ( gen == 1 )
602 addressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female" ); 632 addressee.insertCustom( "KADDRESSBOOK", "X-Gender", "female" );
603 else 633 else
604 addressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male" ); 634 addressee.insertCustom( "KADDRESSBOOK", "X-Gender", "male" );
605 } 635 }
606 QString additionalInfo; 636 QString additionalInfo;
607 QString tempAdd; 637 QString tempAdd;
608 tempAdd = QString::fromUcs2(aItem->GetLanguage().GetBuffer()); 638 tempAdd = QString::fromUcs2(aItem->GetLanguage().GetBuffer());
609 if ( ! tempAdd.isEmpty() ) { 639 if ( ! tempAdd.isEmpty() ) {
610 additionalInfo += i18n("\nLanguage: "); 640 additionalInfo += i18n("\nLanguage: ");
611 additionalInfo += tempAdd; 641 additionalInfo += tempAdd;
612 } 642 }
613 tempAdd = QString::fromUcs2(aItem->GetHobby().GetBuffer()); 643 tempAdd = QString::fromUcs2(aItem->GetHobby().GetBuffer());
644 phoneS.replace( QRegExp("\\r"), "");
614 if ( ! tempAdd.isEmpty() ) { 645 if ( ! tempAdd.isEmpty() ) {
615 additionalInfo += i18n("\nHobby: "); 646 additionalInfo += i18n("\nHobby: ");
616 additionalInfo += tempAdd;; 647 additionalInfo += tempAdd;;
617 } 648 }
618 tempAdd =QString::fromUcs2(aItem->GetPersonalHomePage().GetBuffer()); 649 tempAdd =QString::fromUcs2(aItem->GetPersonalHomePage().GetBuffer());
650 phoneS.replace( QRegExp("\\r"), "");
619 if ( ! tempAdd.isEmpty() ) { 651 if ( ! tempAdd.isEmpty() ) {
620 additionalInfo += i18n("\nHomepage: "); 652 additionalInfo += i18n("\nHomepage: ");
621 additionalInfo += tempAdd;; 653 additionalInfo += tempAdd;;
622 } 654 }
623 tempAdd = QString::fromUcs2(aItem->GetBillingInformation().GetBuffer()); 655 tempAdd = QString::fromUcs2(aItem->GetBillingInformation().GetBuffer());
656 phoneS.replace( QRegExp("\\r"), "");
624 if ( ! tempAdd.isEmpty() ) { 657 if ( ! tempAdd.isEmpty() ) {
625 additionalInfo += i18n("\nBilling information: "); 658 additionalInfo += i18n("\nBilling information: ");
626 additionalInfo += tempAdd;; 659 additionalInfo += tempAdd;;
627 } 660 }
628 tempAdd = QString::fromUcs2(aItem->GetCustomerID().GetBuffer()); 661 tempAdd = QString::fromUcs2(aItem->GetCustomerID().GetBuffer());
662 phoneS.replace( QRegExp("\\r"), "");
629 if ( ! tempAdd.isEmpty() ) { 663 if ( ! tempAdd.isEmpty() ) {
630 additionalInfo += i18n("\nCustomer ID: "); 664 additionalInfo += i18n("\nCustomer ID: ");
631 additionalInfo += tempAdd;; 665 additionalInfo += tempAdd;;
632 } 666 }
633 tempAdd = QString::fromUcs2(aItem->GetUser1().GetBuffer()); 667 tempAdd = QString::fromUcs2(aItem->GetUser1().GetBuffer());
668 phoneS.replace( QRegExp("\\r"), "");
634 if ( ! tempAdd.isEmpty() ) { 669 if ( ! tempAdd.isEmpty() ) {
635 additionalInfo += i18n("\nUser1: "); 670 additionalInfo += i18n("\nUser1: ");
636 additionalInfo += tempAdd;; 671 additionalInfo += tempAdd;;
637 } 672 }
638 tempAdd = QString::fromUcs2(aItem->GetUser2().GetBuffer()); 673 tempAdd = QString::fromUcs2(aItem->GetUser2().GetBuffer());
674 phoneS.replace( QRegExp("\\r"), "");
639 if ( ! tempAdd.isEmpty() ) { 675 if ( ! tempAdd.isEmpty() ) {
640 additionalInfo += i18n("\nUser2: "); 676 additionalInfo += i18n("\nUser2: ");
641 additionalInfo += tempAdd;; 677 additionalInfo += tempAdd;;
642 } 678 }
643 tempAdd = QString::fromUcs2(aItem->GetUser3().GetBuffer()); 679 tempAdd = QString::fromUcs2(aItem->GetUser3().GetBuffer());
680 phoneS.replace( QRegExp("\\r"), "");
644 if ( ! tempAdd.isEmpty() ) { 681 if ( ! tempAdd.isEmpty() ) {
645 additionalInfo += i18n("\nUser3: "); 682 additionalInfo += i18n("\nUser3: ");
646 additionalInfo += tempAdd;; 683 additionalInfo += tempAdd;;
647 } 684 }
648 tempAdd = QString::fromUcs2(aItem->GetUser4().GetBuffer()); 685 tempAdd = QString::fromUcs2(aItem->GetUser4().GetBuffer());
686 phoneS.replace( QRegExp("\\r"), "");
649 if ( ! tempAdd.isEmpty() ) { 687 if ( ! tempAdd.isEmpty() ) {
650 additionalInfo += i18n("\nUser4: "); 688 additionalInfo += i18n("\nUser4: ");
651 additionalInfo += tempAdd;; 689 additionalInfo += tempAdd;;
652 } 690 }
653 if (!additionalInfo.isEmpty() ) { 691 if (!additionalInfo.isEmpty() ) {
654 tempAdd = notesStr; 692 tempAdd = notesStr;
655 notesStr = "+++++++++++++++++++++++++++\n"; 693 notesStr = "+++++++++++++++++++++++++++\n";
656 notesStr += i18n("Additonal fields created\nby KA/Pi Outlook import:"); 694 notesStr += i18n("Additonal fields created\nby KA/Pi Outlook import:");
657 notesStr += additionalInfo; 695 notesStr += additionalInfo;
658 notesStr += i18n("\nEnd additonal fields created\nby KA/Pi Outlook import!\n"); 696 notesStr += i18n("\nEnd additonal fields created\nby KA/Pi Outlook import!\n");
659 notesStr += "+++++++++++++++++++++++++++\n"; 697 notesStr += "+++++++++++++++++++++++++++\n";
660 notesStr += tempAdd; 698 notesStr += tempAdd;
661 } 699 }
662 addressee.setNote( notesStr ); 700 addressee.setNote( notesStr );
663#if 0 701#if 0
664 // pending 702 // pending
665 - IM address: no clue where to get info about the helper ID 703 - IM address: no clue where to get info about the helper ID
666 -custom fields: difficult to implement - not implemented 704 -custom fields: difficult to implement - not implemented
667 -keys: makes no sense 705 -keys: makes no sense
668#endif 706#endif
669 707
670 if ( addAddressee( addressee )) 708 if ( addAddressee( addressee ))
671 ++importedItems; 709 ++importedItems;
672} 710}
673void KAImportOLdialog::slotCancel() 711void KAImportOLdialog::slotCancel()
674{ 712{
675 reject(); 713 reject();
676} 714}
677 715
678bool KAImportOLdialog::addAddressee( KABC::Addressee a ) 716bool KAImportOLdialog::addAddressee( KABC::Addressee a )
679{ 717{
680 bool add = true; 718 bool add = true;
681 KABC::Addressee::List::Iterator it; 719 KABC::Addressee::List::Iterator it;
682 for ( it = mAList.begin(); it != mAList.end(); ++it ) { 720 for ( it = mAList.begin(); it != mAList.end(); ++it ) {
683 if ( (*it).uid() == a.uid() ) { 721 if ( (*it).uid() == a.uid() ) {
684 add = false; 722 add = false;
685 break; 723 break;
686 } 724 }
687 } 725 }
688 if ( add ) { 726 if ( add ) {
689 if ( mABook->findByUid(a.uid() ).isEmpty()) 727 if ( mABook->findByUid(a.uid() ).isEmpty())
690 mAList.append ( a ); 728 mAList.append ( a );
691 else 729 else
692 add = false; 730 add = false;
693 } 731 }
694 return add; 732 return add;
695} 733}
diff --git a/korganizer/koimportoldialog.cpp b/korganizer/koimportoldialog.cpp
index 0a3c2d5..c0bde0d 100644
--- a/korganizer/koimportoldialog.cpp
+++ b/korganizer/koimportoldialog.cpp
@@ -1,485 +1,486 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qtooltip.h> 24#include <qtooltip.h>
25#include <qframe.h> 25#include <qframe.h>
26#include <qpixmap.h> 26#include <qpixmap.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qprogressbar.h> 28#include <qprogressbar.h>
29#include <qwidgetstack.h> 29#include <qwidgetstack.h>
30#include <qdatetime.h> 30#include <qdatetime.h>
31#include <qdir.h> 31#include <qdir.h>
32#include <qapplication.h> 32#include <qapplication.h>
33#include <qhbox.h> 33#include <qhbox.h>
34#include <qregexp.h>
34#include <qheader.h> 35#include <qheader.h>
35#include <qdatetime.h> 36#include <qdatetime.h>
36#include <qlistview.h> 37#include <qlistview.h>
37 38
38#include <kdebug.h> 39#include <kdebug.h>
39#include <klocale.h> 40#include <klocale.h>
40#include <kstandarddirs.h> 41#include <kstandarddirs.h>
41#include <kmessagebox.h> 42#include <kmessagebox.h>
42#include <kfiledialog.h> 43#include <kfiledialog.h>
43 44
44#include <libkdepim/categoryselectdialog.h> 45#include <libkdepim/categoryselectdialog.h>
45#include <libkdepim/kinputdialog.h> 46#include <libkdepim/kinputdialog.h>
46 47
47#include <libkcal/calendarlocal.h> 48#include <libkcal/calendarlocal.h>
48#include <libkcal/icalformat.h> 49#include <libkcal/icalformat.h>
49#include <kabc/stdaddressbook.h> 50#include <kabc/stdaddressbook.h>
50 51
51#include "koprefs.h" 52#include "koprefs.h"
52#include "koglobals.h" 53#include "koglobals.h"
53 54
54#include "koimportoldialog.h" 55#include "koimportoldialog.h"
55 56
56#include "../outport/msoutl9.h" 57#include "../outport/msoutl9.h"
57#include <ole2.h> 58#include <ole2.h>
58#include <comutil.h> 59#include <comutil.h>
59_Application gOlApp; 60_Application gOlApp;
60 61
61QDateTime mDdate2Qdtr( DATE dt) 62QDateTime mDdate2Qdtr( DATE dt)
62{ 63{
63 COleDateTime odt; 64 COleDateTime odt;
64 SYSTEMTIME st; 65 SYSTEMTIME st;
65 odt = dt; 66 odt = dt;
66 odt.GetAsSystemTime(st); 67 odt.GetAsSystemTime(st);
67 QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) ); 68 QDateTime qdt (QDate(st.wYear, st.wMonth,st.wDay ),QTime( st.wHour, st.wMinute,st.wSecond ) );
68 return qdt; 69 return qdt;
69} 70}
70 71
71class OLEListViewItem : public QCheckListItem 72class OLEListViewItem : public QCheckListItem
72{ 73{
73 public: 74 public:
74 OLEListViewItem( QListView *parent, QString text ) : 75 OLEListViewItem( QListView *parent, QString text ) :
75 QCheckListItem( parent, text, QCheckListItem::CheckBox ) { ; }; 76 QCheckListItem( parent, text, QCheckListItem::CheckBox ) { ; };
76 OLEListViewItem( QListViewItem *after, QString text ) : 77 OLEListViewItem( QListViewItem *after, QString text ) :
77 QCheckListItem( after, text, QCheckListItem::CheckBox ) { ; }; 78 QCheckListItem( after, text, QCheckListItem::CheckBox ) { ; };
78 ~OLEListViewItem() {}; 79 ~OLEListViewItem() {};
79 void setData( DWORD data ) {mData= data; }; 80 void setData( DWORD data ) {mData= data; };
80 DWORD data() { return mData ;}; 81 DWORD data() { return mData ;};
81 private: 82 private:
82 DWORD mData; 83 DWORD mData;
83}; 84};
84 85
85KOImportOLdialog::KOImportOLdialog( const QString &caption, 86KOImportOLdialog::KOImportOLdialog( const QString &caption,
86 Calendar *calendar, QWidget *parent ) : 87 Calendar *calendar, QWidget *parent ) :
87 KDialogBase( Plain, caption, User1 | Close, Ok, 88 KDialogBase( Plain, caption, User1 | Close, Ok,
88 parent, caption, true, false, i18n("Import!") ) 89 parent, caption, true, false, i18n("Import!") )
89{ 90{
90 QHBox * mw = new QHBox( this ); 91 QHBox * mw = new QHBox( this );
91 setMainWidget( mw ); 92 setMainWidget( mw );
92 mListView = new QListView( mw ); 93 mListView = new QListView( mw );
93 mListView->addColumn(i18n("Select Folder to import")); 94 mListView->addColumn(i18n("Select Folder to import"));
94 mListView->addColumn(i18n("Content Type")); 95 mListView->addColumn(i18n("Content Type"));
95 mCalendar = calendar; 96 mCalendar = calendar;
96 connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply())); 97 connect( this, SIGNAL( user1Clicked() ),SLOT ( slotApply()));
97 setupFolderView(); 98 setupFolderView();
98 resize( sizeHint().width()+50, sizeHint().height()+50 ); 99 resize( sizeHint().width()+50, sizeHint().height()+50 );
99} 100}
100 101
101KOImportOLdialog::~KOImportOLdialog() 102KOImportOLdialog::~KOImportOLdialog()
102{ 103{
103 104
104} 105}
105 106
106 107
107void KOImportOLdialog::setupFolderView() 108void KOImportOLdialog::setupFolderView()
108{ 109{
109 SCODE sc = ::OleInitialize(NULL); 110 SCODE sc = ::OleInitialize(NULL);
110 if ( FAILED ( sc ) ) { 111 if ( FAILED ( sc ) ) {
111 KMessageBox::information(this,"OLE initialisation failed"); 112 KMessageBox::information(this,"OLE initialisation failed");
112 return; 113 return;
113 } 114 }
114 115
115 if(!gOlApp.CreateDispatch(_T("Outlook.Application"),NULL)){ 116 if(!gOlApp.CreateDispatch(_T("Outlook.Application"),NULL)){
116 KMessageBox::information(this,"Sorry, cannot access Outlook"); 117 KMessageBox::information(this,"Sorry, cannot access Outlook");
117 return ; 118 return ;
118 } 119 }
119 MAPIFolder mfInbox; 120 MAPIFolder mfInbox;
120 MAPIFolder mfRoot; 121 MAPIFolder mfRoot;
121 CString szName; 122 CString szName;
122 _NameSpace olNS; 123 _NameSpace olNS;
123 olNS = gOlApp.GetNamespace(_T("MAPI")); 124 olNS = gOlApp.GetNamespace(_T("MAPI"));
124 mfInbox = olNS.GetDefaultFolder(6); 125 mfInbox = olNS.GetDefaultFolder(6);
125 mfRoot = mfInbox.GetParent(); 126 mfRoot = mfInbox.GetParent();
126 szName = mfRoot.GetName(); 127 szName = mfRoot.GetName();
127 long iType = mfRoot.GetDefaultItemType(); 128 long iType = mfRoot.GetDefaultItemType();
128 QString mes; 129 QString mes;
129 mes = QString::fromUcs2( szName.GetBuffer() ); 130 mes = QString::fromUcs2( szName.GetBuffer() );
130 OLEListViewItem * root = new OLEListViewItem( mListView, mes ); 131 OLEListViewItem * root = new OLEListViewItem( mListView, mes );
131 mfRoot.m_lpDispatch->AddRef(); 132 mfRoot.m_lpDispatch->AddRef();
132 addFolder( root, mfRoot.m_lpDispatch ); 133 addFolder( root, mfRoot.m_lpDispatch );
133 root->setOpen( true ); 134 root->setOpen( true );
134 mListView->setSortColumn( 0 ); 135 mListView->setSortColumn( 0 );
135 mListView->sort( ); 136 mListView->sort( );
136} 137}
137 138
138 139
139void KOImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent) 140void KOImportOLdialog::addFolder(OLEListViewItem* iParent, LPDISPATCH dispParent)
140{ 141{
141 MAPIFolder mfParent(dispParent), mfChild; 142 MAPIFolder mfParent(dispParent), mfChild;
142 _Folders folders; 143 _Folders folders;
143 _variant_t fndx((long)0); 144 _variant_t fndx((long)0);
144 CString szName; 145 CString szName;
145 long iType; 146 long iType;
146 OLEListViewItem* hChild; 147 OLEListViewItem* hChild;
147 148
148 folders = mfParent.GetFolders(); 149 folders = mfParent.GetFolders();
149 for(int i=1; i <= folders.GetCount(); ++i) 150 for(int i=1; i <= folders.GetCount(); ++i)
150 { 151 {
151 fndx = (long)i; 152 fndx = (long)i;
152 mfChild = folders.Item(fndx.Detach()); 153 mfChild = folders.Item(fndx.Detach());
153 mfChild.m_lpDispatch->AddRef(); 154 mfChild.m_lpDispatch->AddRef();
154 szName = mfChild.GetName(); 155 szName = mfChild.GetName();
155 iType = mfChild.GetDefaultItemType(); 156 iType = mfChild.GetDefaultItemType();
156 hChild = new OLEListViewItem( iParent , QString::fromUcs2( szName.GetBuffer() ) ); 157 hChild = new OLEListViewItem( iParent , QString::fromUcs2( szName.GetBuffer() ) );
157 if ( iType != 1) 158 if ( iType != 1)
158 hChild->setEnabled( false ); 159 hChild->setEnabled( false );
159 QString ts; 160 QString ts;
160 switch( iType ) { 161 switch( iType ) {
161 case 0: 162 case 0:
162 ts = i18n("Mail"); 163 ts = i18n("Mail");
163 break; 164 break;
164 case 1: 165 case 1:
165 ts = i18n("Calendar"); 166 ts = i18n("Calendar");
166 break; 167 break;
167 case 2: 168 case 2:
168 ts = i18n("Contacts"); 169 ts = i18n("Contacts");
169 break; 170 break;
170 case 3: 171 case 3:
171 ts = i18n("Todos"); 172 ts = i18n("Todos");
172 break; 173 break;
173 case 4: 174 case 4:
174 ts = i18n("Journals"); 175 ts = i18n("Journals");
175 break; 176 break;
176 case 5: 177 case 5:
177 ts = i18n("Notes"); 178 ts = i18n("Notes");
178 break; 179 break;
179 default: 180 default:
180 ts = i18n("Unknown"); 181 ts = i18n("Unknown");
181 } 182 }
182 hChild->setText( 1,ts); 183 hChild->setText( 1,ts);
183 hChild->setData( (DWORD) mfChild.m_lpDispatch ); 184 hChild->setData( (DWORD) mfChild.m_lpDispatch );
184 mfChild.m_lpDispatch->AddRef(); 185 mfChild.m_lpDispatch->AddRef();
185 addFolder(hChild, mfChild.m_lpDispatch); 186 addFolder(hChild, mfChild.m_lpDispatch);
186 } 187 }
187} 188}
188 189
189void KOImportOLdialog::slotApply() 190void KOImportOLdialog::slotApply()
190{ 191{
191 importedItems = 0; 192 importedItems = 0;
192 OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild(); 193 OLEListViewItem* child = (OLEListViewItem*) mListView->firstChild();
193 while ( child ) { 194 while ( child ) {
194 if ( child->isOn() ) 195 if ( child->isOn() )
195 readCalendarData( child->data() ); 196 readCalendarData( child->data() );
196 child = (OLEListViewItem*) child->itemBelow(); 197 child = (OLEListViewItem*) child->itemBelow();
197 } 198 }
198 QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems); 199 QString mes = i18n("Importing complete.\n\n%1 items imported.").arg( importedItems);
199 KMessageBox::information(this,mes); 200 KMessageBox::information(this,mes);
200} 201}
201void KOImportOLdialog::readCalendarData( DWORD folder ) 202void KOImportOLdialog::readCalendarData( DWORD folder )
202{ 203{
203 204
204 LPDISPATCH dispItem = (LPDISPATCH)folder; 205 LPDISPATCH dispItem = (LPDISPATCH)folder;
205 dispItem->AddRef(); 206 dispItem->AddRef();
206 MAPIFolder mf(dispItem); 207 MAPIFolder mf(dispItem);
207 mf.m_lpDispatch->AddRef(); 208 mf.m_lpDispatch->AddRef();
208 _Items folderItems; 209 _Items folderItems;
209 _variant_t indx((long)0); 210 _variant_t indx((long)0);
210 LPDISPATCH itm; 211 LPDISPATCH itm;
211 int i; 212 int i;
212 folderItems = mf.GetItems(); 213 folderItems = mf.GetItems();
213 QProgressBar bar( folderItems.GetCount(),0 ); 214 QProgressBar bar( folderItems.GetCount(),0 );
214 bar.setCaption (i18n("Importing - close to abort!") ); 215 bar.setCaption (i18n("Importing - close to abort!") );
215 int h = bar.sizeHint().height() ; 216 int h = bar.sizeHint().height() ;
216 int w = 300; 217 int w = 300;
217 int dw = QApplication::desktop()->width(); 218 int dw = QApplication::desktop()->width();
218 int dh = QApplication::desktop()->height(); 219 int dh = QApplication::desktop()->height();
219 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 220 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
220 bar.show(); 221 bar.show();
221 for(i=1; i <= folderItems.GetCount(); ++i) 222 for(i=1; i <= folderItems.GetCount(); ++i)
222 { 223 {
223 qApp->processEvents(); 224 qApp->processEvents();
224 if ( ! bar.isVisible() ) 225 if ( ! bar.isVisible() )
225 return ; 226 return ;
226 bar.setProgress( i ); 227 bar.setProgress( i );
227 indx = (long)i; 228 indx = (long)i;
228 itm = folderItems.Item(indx.Detach()); 229 itm = folderItems.Item(indx.Detach());
229 _AppointmentItem * pItem = (_AppointmentItem *)&itm; 230 _AppointmentItem * pItem = (_AppointmentItem *)&itm;
230 ol2kopiCalendar( pItem ); 231 ol2kopiCalendar( pItem );
231 itm->Release(); 232 itm->Release();
232 } 233 }
233} 234}
234void KOImportOLdialog::slotOk() 235void KOImportOLdialog::slotOk()
235{ 236{
236 QDialog::accept(); 237 QDialog::accept();
237} 238}
238 239
239void KOImportOLdialog::ol2kopiCalendar( _AppointmentItem * aItem, bool computeRecurrence ) 240void KOImportOLdialog::ol2kopiCalendar( _AppointmentItem * aItem, bool computeRecurrence )
240{ 241{
241 KCal::Event* event = new KCal::Event(); 242 KCal::Event* event = new KCal::Event();
242 if ( aItem->GetAllDayEvent() ){ 243 if ( aItem->GetAllDayEvent() ){
243 event->setDtStart( QDateTime( mDdate2Qdtr( aItem->GetStart()).date(),QTime(0,0,0 ) )); 244 event->setDtStart( QDateTime( mDdate2Qdtr( aItem->GetStart()).date(),QTime(0,0,0 ) ));
244 event->setDtEnd( QDateTime( mDdate2Qdtr( aItem->GetEnd()) .date(),QTime(0,0,0 )).addDays(-1)); 245 event->setDtEnd( QDateTime( mDdate2Qdtr( aItem->GetEnd()) .date(),QTime(0,0,0 )).addDays(-1));
245 event->setFloats( true ); 246 event->setFloats( true );
246 } else { 247 } else {
247 event->setDtStart( mDdate2Qdtr( aItem->GetStart()) ); 248 event->setDtStart( mDdate2Qdtr( aItem->GetStart()) );
248 event->setDtEnd( mDdate2Qdtr( aItem->GetEnd()) ); 249 event->setDtEnd( mDdate2Qdtr( aItem->GetEnd()) );
249 event->setFloats( false ); 250 event->setFloats( false );
250 } 251 }
251 event->setSummary( QString::fromUcs2( aItem->GetSubject().GetBuffer()) ); 252 event->setSummary( QString::fromUcs2( aItem->GetSubject().GetBuffer()) );
252 event->setLocation( QString::fromUcs2( aItem->GetLocation().GetBuffer()) ); 253 event->setLocation( QString::fromUcs2( aItem->GetLocation().GetBuffer()) );
253 event->setDescription( QString::fromUcs2( aItem->GetBody().GetBuffer()) ); 254 event->setDescription( QString::fromUcs2( aItem->GetBody().GetBuffer()).replace( QRegExp("\\r"), "") );
254 QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer()); 255 QString cat = QString::fromUcs2( aItem->GetCategories().GetBuffer());
255 event->setCategories( QStringList::split( ";", cat )); 256 event->setCategories( QStringList::split( ";", cat ));
256 if ( aItem->GetReminderSet() ) { 257 if ( aItem->GetReminderSet() ) {
257 event->clearAlarms(); 258 event->clearAlarms();
258 Alarm* alarm = event->newAlarm(); 259 Alarm* alarm = event->newAlarm();
259 alarm->setStartOffset( -aItem->GetReminderMinutesBeforeStart()*60 ); 260 alarm->setStartOffset( -aItem->GetReminderMinutesBeforeStart()*60 );
260 alarm->setEnabled( true ); 261 alarm->setEnabled( true );
261 if ( aItem->GetReminderPlaySound() ) { 262 if ( aItem->GetReminderPlaySound() ) {
262 alarm->setType( Alarm::Audio ); 263 alarm->setType( Alarm::Audio );
263 alarm->setAudioFile( QString::fromUcs2( aItem->GetReminderSoundFile().GetBuffer())); 264 alarm->setAudioFile( QString::fromUcs2( aItem->GetReminderSoundFile().GetBuffer()));
264 } 265 }
265 else 266 else
266 alarm->setType( Alarm::Display ); 267 alarm->setType( Alarm::Display );
267 alarm->setRepeatCount( aItem->GetReplyTime() ); 268 alarm->setRepeatCount( aItem->GetReplyTime() );
268 } 269 }
269 // OL :pub 0 - pers 1 - priv 2 - conf 3 270 // OL :pub 0 - pers 1 - priv 2 - conf 3
270 // KO : pub 0 - priv 1 - conf 2 271 // KO : pub 0 - priv 1 - conf 2
271 int sec = aItem->GetSensitivity() ; 272 int sec = aItem->GetSensitivity() ;
272 if ( sec > 1 )// mapping pers -> private 273 if ( sec > 1 )// mapping pers -> private
273 --sec; 274 --sec;
274 event->setSecrecy( sec ); 275 event->setSecrecy( sec );
275 if ( aItem->GetBusyStatus() == 0 ) 276 if ( aItem->GetBusyStatus() == 0 )
276 event->setTransparency( Event::Transparent);// OL free 277 event->setTransparency( Event::Transparent);// OL free
277 else 278 else
278 event->setTransparency( Event::Opaque);//OL all other 279 event->setTransparency( Event::Opaque);//OL all other
279 280
280 if ( aItem->GetIsRecurring() && computeRecurrence ) { //recur 281 if ( aItem->GetIsRecurring() && computeRecurrence ) { //recur
281 282
282 RecurrencePattern recpat = aItem->GetRecurrencePattern(); 283 RecurrencePattern recpat = aItem->GetRecurrencePattern();
283 284
284 QDate startDate = mDdate2Qdtr(recpat.GetPatternStartDate()).date(); 285 QDate startDate = mDdate2Qdtr(recpat.GetPatternStartDate()).date();
285 int freq = recpat.GetInterval(); 286 int freq = recpat.GetInterval();
286 287
287 bool hasEndDate = !recpat.GetNoEndDate(); 288 bool hasEndDate = !recpat.GetNoEndDate();
288 QDate endDate = mDdate2Qdtr(recpat.GetPatternEndDate()).date(); 289 QDate endDate = mDdate2Qdtr(recpat.GetPatternEndDate()).date();
289 QBitArray weekDays( 7 ); 290 QBitArray weekDays( 7 );
290 weekDays.fill(false ); 291 weekDays.fill(false );
291 uint weekDaysNum = recpat.GetDayOfWeekMask(); 292 uint weekDaysNum = recpat.GetDayOfWeekMask();
292 int i; 293 int i;
293 int bb = 2; 294 int bb = 2;
294 for( i = 1; i <= 6; ++i ) { 295 for( i = 1; i <= 6; ++i ) {
295 weekDays.setBit( i - 1, ( bb & weekDaysNum )); 296 weekDays.setBit( i - 1, ( bb & weekDaysNum ));
296 bb = 4 << (i-1); 297 bb = 4 << (i-1);
297 //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) ); 298 //qDebug(" %d bit %d ",i-1,weekDays.at(i-1) );
298 } 299 }
299 if ( 1 & weekDaysNum) 300 if ( 1 & weekDaysNum)
300 weekDays.setBit( 6 ); 301 weekDays.setBit( 6 );
301 // int pos = 1;// pending 302 // int pos = 1;// pending
302 303
303 Recurrence *r = event->recurrence(); 304 Recurrence *r = event->recurrence();
304 int rtype = recpat.GetRecurrenceType(); 305 int rtype = recpat.GetRecurrenceType();
305 //recurrence types are: 306 //recurrence types are:
306 /* 307 /*
307 olRecursDaily(0) 308 olRecursDaily(0)
308 olRecursWeekly(1) 309 olRecursWeekly(1)
309 olRecursMonthly(2) 310 olRecursMonthly(2)
310 olRecursMonthNth(3) 311 olRecursMonthNth(3)
311 olRecursYearly(5) 312 olRecursYearly(5)
312 olRecursYearNth(6) 313 olRecursYearNth(6)
313 */ 314 */
314 315
315 int duration = recpat.GetOccurrences(); 316 int duration = recpat.GetOccurrences();
316 if ( !hasEndDate ) 317 if ( !hasEndDate )
317 duration = -1; 318 duration = -1;
318 319
319 //LPDISPATCH RecurrencePattern::GetExceptions() 320 //LPDISPATCH RecurrencePattern::GetExceptions()
320 //long RecurrencePattern::GetMonthOfYear() 321 //long RecurrencePattern::GetMonthOfYear()
321 if ( rtype == 0 ) { 322 if ( rtype == 0 ) {
322 if ( hasEndDate ) r->setDaily( freq, endDate ); 323 if ( hasEndDate ) r->setDaily( freq, endDate );
323 else r->setDaily( freq, duration ); 324 else r->setDaily( freq, duration );
324 } else if ( rtype == 1 ) { 325 } else if ( rtype == 1 ) {
325 if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate ); 326 if ( hasEndDate ) r->setWeekly( freq, weekDays, endDate );
326 else r->setWeekly( freq, weekDays, duration ); 327 else r->setWeekly( freq, weekDays, duration );
327 } else if ( rtype == 2 ) { 328 } else if ( rtype == 2 ) {
328 if ( hasEndDate ) 329 if ( hasEndDate )
329 r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); 330 r->setMonthly( Recurrence::rMonthlyDay, freq, endDate );
330 else 331 else
331 r->setMonthly( Recurrence::rMonthlyDay, freq, duration ); 332 r->setMonthly( Recurrence::rMonthlyDay, freq, duration );
332 //r->addMonthlyDay( startDate.day() ); 333 //r->addMonthlyDay( startDate.day() );
333 r->addMonthlyDay( recpat.GetDayOfMonth() ); 334 r->addMonthlyDay( recpat.GetDayOfMonth() );
334 } else if ( rtype == 3 ) { 335 } else if ( rtype == 3 ) {
335 if ( hasEndDate ) 336 if ( hasEndDate )
336 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); 337 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate );
337 else 338 else
338 r->setMonthly( Recurrence::rMonthlyPos, freq, duration ); 339 r->setMonthly( Recurrence::rMonthlyPos, freq, duration );
339 QBitArray days( 7 ); 340 QBitArray days( 7 );
340 days.fill( false ); 341 days.fill( false );
341 days.setBit( startDate.dayOfWeek() - 1 ); 342 days.setBit( startDate.dayOfWeek() - 1 );
342 int pos = (startDate.day()/7)+1; 343 int pos = (startDate.day()/7)+1;
343 r->addMonthlyPos( pos, days ); 344 r->addMonthlyPos( pos, days );
344 //QString mes = i18n("Importing monthlypos.\n\npos: %1 , day: %2").arg( pos).arg( startDate.dayOfWeek() - 1); 345 //QString mes = i18n("Importing monthlypos.\n\npos: %1 , day: %2").arg( pos).arg( startDate.dayOfWeek() - 1);
345 //KMessageBox::information(this,mes); 346 //KMessageBox::information(this,mes);
346 } else if ( rtype == 5 ) { 347 } else if ( rtype == 5 ) {
347 freq = 1; 348 freq = 1;
348 if ( hasEndDate ) 349 if ( hasEndDate )
349 r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); 350 r->setYearly( Recurrence::rYearlyMonth, freq, endDate );
350 else 351 else
351 r->setYearly( Recurrence::rYearlyMonth, freq, duration ); 352 r->setYearly( Recurrence::rYearlyMonth, freq, duration );
352 r->addYearlyNum( startDate.month() ); 353 r->addYearlyNum( startDate.month() );
353 } else if ( true /*rtype == 6*/ ) { 354 } else if ( true /*rtype == 6*/ ) {
354 // KOganizer cannot handle this in the GUI 355 // KOganizer cannot handle this in the GUI
355 // we are mapping this to monthly - every 12. month 356 // we are mapping this to monthly - every 12. month
356 freq = 12; 357 freq = 12;
357 if ( hasEndDate ) 358 if ( hasEndDate )
358 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); 359 r->setMonthly( Recurrence::rMonthlyPos, freq, endDate );
359 else 360 else
360 r->setMonthly( Recurrence::rMonthlyPos, freq, duration ); 361 r->setMonthly( Recurrence::rMonthlyPos, freq, duration );
361 QBitArray days( 7 ); 362 QBitArray days( 7 );
362 days.fill( false ); 363 days.fill( false );
363 days.setBit( startDate.dayOfWeek() - 1 ); 364 days.setBit( startDate.dayOfWeek() - 1 );
364 int pos = (startDate.day()/7)+1; 365 int pos = (startDate.day()/7)+1;
365 r->addMonthlyPos( pos, days ); 366 r->addMonthlyPos( pos, days );
366 } 367 }
367 // recurrence exceptions 368 // recurrence exceptions
368 LPDISPATCH dispItem = recpat.GetExceptions(); 369 LPDISPATCH dispItem = recpat.GetExceptions();
369 dispItem->AddRef(); 370 dispItem->AddRef();
370 Exceptions ex(dispItem); 371 Exceptions ex(dispItem);
371 _variant_t indx((long)0); 372 _variant_t indx((long)0);
372 LPDISPATCH itm; 373 LPDISPATCH itm;
373 for(i=1; i <= ex.GetCount(); ++i) { 374 for(i=1; i <= ex.GetCount(); ++i) {
374 indx = (long)i; 375 indx = (long)i;
375 itm = ex.Item( indx.Detach() ); 376 itm = ex.Item( indx.Detach() );
376 ::Exception * pItem = (::Exception *)&itm; 377 ::Exception * pItem = (::Exception *)&itm;
377 event->addExDate( QDateTime( mDdate2Qdtr( pItem->GetOriginalDate())).date() ); 378 event->addExDate( QDateTime( mDdate2Qdtr( pItem->GetOriginalDate())).date() );
378 if ( !pItem->GetDeleted() ) { 379 if ( !pItem->GetDeleted() ) {
379 LPDISPATCH appIt = pItem->GetAppointmentItem(); 380 LPDISPATCH appIt = pItem->GetAppointmentItem();
380 _AppointmentItem * paItem = (_AppointmentItem *)&appIt; 381 _AppointmentItem * paItem = (_AppointmentItem *)&appIt;
381 ol2kopiCalendar( paItem, false ); 382 ol2kopiCalendar( paItem, false );
382 } 383 }
383 itm->Release(); 384 itm->Release();
384 } 385 }
385 } 386 }
386 // recurrence ENTE 387 // recurrence ENTE
387 event->setOrganizer( QString::fromUcs2( aItem->GetOrganizer().GetBuffer())); 388 event->setOrganizer( QString::fromUcs2( aItem->GetOrganizer().GetBuffer()));
388 389
389 //GetOptionalAttendees() 390 //GetOptionalAttendees()
390 //GetRequiredAttendees() 391 //GetRequiredAttendees()
391 LPDISPATCH dispItem = aItem->GetRecipients(); 392 LPDISPATCH dispItem = aItem->GetRecipients();
392 dispItem->AddRef(); 393 dispItem->AddRef();
393 _Folders mf(dispItem); 394 _Folders mf(dispItem);
394 mf.m_lpDispatch->AddRef(); 395 mf.m_lpDispatch->AddRef();
395 _variant_t indx((long)0); 396 _variant_t indx((long)0);
396 LPDISPATCH itm; 397 LPDISPATCH itm;
397 int i; 398 int i;
398 QString optAtt = QString::fromUcs2( aItem->GetOptionalAttendees().GetBuffer()); 399 QString optAtt = QString::fromUcs2( aItem->GetOptionalAttendees().GetBuffer());
399 QString reqAtt = QString::fromUcs2( aItem->GetRequiredAttendees().GetBuffer()); 400 QString reqAtt = QString::fromUcs2( aItem->GetRequiredAttendees().GetBuffer());
400 //GetRequiredAttendees() 401 //GetRequiredAttendees()
401 for(i=1; i <= mf.GetCount(); ++i) { 402 for(i=1; i <= mf.GetCount(); ++i) {
402 indx = (long)i; 403 indx = (long)i;
403 itm = mf.Item( indx.Detach() ); 404 itm = mf.Item( indx.Detach() );
404 Recipient * pItem = (Recipient *)&itm; 405 Recipient * pItem = (Recipient *)&itm;
405 406
406 //a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ; 407 //a = new KCal::Attendee( (*it).realName(), (*it).preferredEmail(),false,KCal::Attendee::NeedsAction,KCal::Attendee::ReqParticipant,(*it).uid()) ;
407 QString name = QString::fromUcs2( pItem->GetName().GetBuffer()); 408 QString name = QString::fromUcs2( pItem->GetName().GetBuffer());
408 KCal::Attendee::PartStat stat; 409 KCal::Attendee::PartStat stat;
409 bool rsvp = false; 410 bool rsvp = false;
410 switch ( pItem->GetMeetingResponseStatus() ) { 411 switch ( pItem->GetMeetingResponseStatus() ) {
411 case 0: //not answered 412 case 0: //not answered
412 rsvp = true; 413 rsvp = true;
413 case 5: //not answered 414 case 5: //not answered
414 stat = Attendee::NeedsAction; 415 stat = Attendee::NeedsAction;
415 break; 416 break;
416 case 1: //organizer 417 case 1: //organizer
417 stat = Attendee::Delegated ; 418 stat = Attendee::Delegated ;
418 break; 419 break;
419 case 2: //tentative 420 case 2: //tentative
420 stat = Attendee::Tentative ; 421 stat = Attendee::Tentative ;
421 break; 422 break;
422 case 3: //accepted 423 case 3: //accepted
423 stat = Attendee::Accepted; 424 stat = Attendee::Accepted;
424 break; 425 break;
425 case 4: //declined 426 case 4: //declined
426 stat =Attendee::Declined ; 427 stat =Attendee::Declined ;
427 break; 428 break;
428 default: 429 default:
429 stat = Attendee::NeedsAction ; 430 stat = Attendee::NeedsAction ;
430 431
431 } 432 }
432 KCal::Attendee::Role role; 433 KCal::Attendee::Role role;
433 if ( event->organizer() == name ) 434 if ( event->organizer() == name )
434 role = KCal::Attendee::Chair; 435 role = KCal::Attendee::Chair;
435 else if ( reqAtt.find( name ) >= 0 ) 436 else if ( reqAtt.find( name ) >= 0 )
436 role = KCal::Attendee::ReqParticipant; 437 role = KCal::Attendee::ReqParticipant;
437 else if ( optAtt.find( name ) >= 0 ) 438 else if ( optAtt.find( name ) >= 0 )
438 role = KCal::Attendee::OptParticipant; 439 role = KCal::Attendee::OptParticipant;
439 else 440 else
440 role = KCal::Attendee::NonParticipant; 441 role = KCal::Attendee::NonParticipant;
441 QString mail = QString::fromUcs2(pItem->GetAddress().GetBuffer()); 442 QString mail = QString::fromUcs2(pItem->GetAddress().GetBuffer());
442 if( mail.isEmpty() && name.find("@") > 0 ) { 443 if( mail.isEmpty() && name.find("@") > 0 ) {
443 int kl = name.find("<"); 444 int kl = name.find("<");
444 int gr = name.find(">"); 445 int gr = name.find(">");
445 if ( kl >= 0 && gr >= 0) { 446 if ( kl >= 0 && gr >= 0) {
446 mail = name.mid (kl+1, gr - kl -1); 447 mail = name.mid (kl+1, gr - kl -1);
447 name = name.left( kl ); 448 name = name.left( kl );
448 } 449 }
449 else 450 else
450 mail = name; 451 mail = name;
451 } 452 }
452 mail = mail.stripWhiteSpace(); 453 mail = mail.stripWhiteSpace();
453 454
454 QString uid = getUidByEmail( mail ); 455 QString uid = getUidByEmail( mail );
455 //uid = QString::fromUcs2( pItem->GetEntryID().GetBuffer()); 456 //uid = QString::fromUcs2( pItem->GetEntryID().GetBuffer());
456 KCal::Attendee * a = new KCal::Attendee( name, mail,rsvp,stat,role,uid) ; 457 KCal::Attendee * a = new KCal::Attendee( name, mail,rsvp,stat,role,uid) ;
457 event->addAttendee( a , false ); 458 event->addAttendee( a , false );
458 itm->Release(); 459 itm->Release();
459 } 460 }
460 461
461 462
462 if ( !mCalendar->addEventNoDup( event )) 463 if ( !mCalendar->addEventNoDup( event ))
463 delete event; 464 delete event;
464 else { 465 else {
465 // QString mes = i18n("Importing %1.\n date: %2 date: %3").arg( event->summary()).arg( event->dtStart().toString()).arg( event->dtEnd().toString()); 466 // QString mes = i18n("Importing %1.\n date: %2 date: %3").arg( event->summary()).arg( event->dtStart().toString()).arg( event->dtEnd().toString());
466 //KMessageBox::information(this,mes); 467 //KMessageBox::information(this,mes);
467 ++importedItems; 468 ++importedItems;
468 } 469 }
469} 470}
470void KOImportOLdialog::slotCancel() 471void KOImportOLdialog::slotCancel()
471{ 472{
472 reject(); 473 reject();
473} 474}
474 475
475QString KOImportOLdialog::getUidByEmail( QString email ) 476QString KOImportOLdialog::getUidByEmail( QString email )
476{ 477{
477 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 478 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
478 KABC::AddressBook::Iterator it; 479 KABC::AddressBook::Iterator it;
479 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 480 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
480 QStringList em = (*it).emails(); 481 QStringList em = (*it).emails();
481 if ( em.contains( email )) 482 if ( em.contains( email ))
482 return (*it).uid(); 483 return (*it).uid();
483 } 484 }
484 return ""; 485 return "";
485} 486}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 9e215b9..63484d6 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,1845 +1,1851 @@
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#include "koimportoldialog.h" 69#include "koimportoldialog.h"
70#endif 70#endif
71#include "mainwindow.h" 71#include "mainwindow.h"
72 72
73class KOex2phonePrefs : public QDialog 73class KOex2phonePrefs : public QDialog
74{ 74{
75 public: 75 public:
76 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 76 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
77 QDialog( parent, name, true ) 77 QDialog( parent, name, true )
78 { 78 {
79 setCaption( i18n("Export to phone options") ); 79 setCaption( i18n("Export to phone options") );
80 QVBoxLayout* lay = new QVBoxLayout( this ); 80 QVBoxLayout* lay = new QVBoxLayout( this );
81 lay->setSpacing( 3 ); 81 lay->setSpacing( 3 );
82 lay->setMargin( 3 ); 82 lay->setMargin( 3 );
83 QLabel *lab; 83 QLabel *lab;
84 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 84 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
85 lab->setAlignment (AlignHCenter ); 85 lab->setAlignment (AlignHCenter );
86 QHBox* temphb; 86 QHBox* temphb;
87 temphb = new QHBox( this ); 87 temphb = new QHBox( this );
88 new QLabel( i18n("I/O device: "), temphb ); 88 new QLabel( i18n("I/O device: "), temphb );
89 mPhoneDevice = new QLineEdit( temphb); 89 mPhoneDevice = new QLineEdit( temphb);
90 lay->addWidget( temphb ); 90 lay->addWidget( temphb );
91 temphb = new QHBox( this ); 91 temphb = new QHBox( this );
92 new QLabel( i18n("Connection: "), temphb ); 92 new QLabel( i18n("Connection: "), temphb );
93 mPhoneConnection = new QLineEdit( temphb); 93 mPhoneConnection = new QLineEdit( temphb);
94 lay->addWidget( temphb ); 94 lay->addWidget( temphb );
95 temphb = new QHBox( this ); 95 temphb = new QHBox( this );
96 new QLabel( i18n("Model(opt.): "), temphb ); 96 new QLabel( i18n("Model(opt.): "), temphb );
97 mPhoneModel = new QLineEdit( temphb); 97 mPhoneModel = new QLineEdit( temphb);
98 lay->addWidget( temphb ); 98 lay->addWidget( temphb );
99 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 99 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
100 mWriteBackFuture->setChecked( true ); 100 mWriteBackFuture->setChecked( true );
101 lay->addWidget( mWriteBackFuture ); 101 lay->addWidget( mWriteBackFuture );
102 temphb = new QHBox( this ); 102 temphb = new QHBox( this );
103 new QLabel( i18n("Max. weeks in future: ") , temphb ); 103 new QLabel( i18n("Max. weeks in future: ") , temphb );
104 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 104 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
105 mWriteBackFutureWeeks->setValue( 8 ); 105 mWriteBackFutureWeeks->setValue( 8 );
106 lay->addWidget( temphb ); 106 lay->addWidget( temphb );
107 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 107 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
108 lab->setAlignment (AlignHCenter ); 108 lab->setAlignment (AlignHCenter );
109 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 109 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
110 lay->addWidget( ok ); 110 lay->addWidget( ok );
111 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 111 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
112 lay->addWidget( cancel ); 112 lay->addWidget( cancel );
113 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 113 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
114 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 114 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
115 resize( 220, 240 ); 115 resize( 220, 240 );
116 116
117 } 117 }
118 118
119public: 119public:
120 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 120 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
121 QCheckBox* mWriteBackFuture; 121 QCheckBox* mWriteBackFuture;
122 QSpinBox* mWriteBackFutureWeeks; 122 QSpinBox* mWriteBackFutureWeeks;
123}; 123};
124 124
125int globalFlagBlockStartup; 125int globalFlagBlockStartup;
126MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 126MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
127 QMainWindow( parent, name ) 127 QMainWindow( parent, name )
128{ 128{
129 129
130#ifdef DESKTOP_VERSION 130#ifdef DESKTOP_VERSION
131 setFont( QFont("Arial"), 14 ); 131 setFont( QFont("Arial"), 14 );
132#endif 132#endif
133 mClosed = false; 133 mClosed = false;
134 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 134 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
135 QString confFile = locateLocal("config","korganizerrc"); 135 QString confFile = locateLocal("config","korganizerrc");
136 QFileInfo finf ( confFile ); 136 QFileInfo finf ( confFile );
137 bool showWarning = !finf.exists(); 137 bool showWarning = !finf.exists();
138 setIcon(SmallIcon( "ko24" ) ); 138 setIcon(SmallIcon( "ko24" ) );
139 mBlockAtStartup = true; 139 mBlockAtStartup = true;
140 mFlagKeyPressed = false; 140 mFlagKeyPressed = false;
141 setCaption("KOrganizer/Pi"); 141 setCaption("KOrganizer/Pi");
142 KOPrefs *p = KOPrefs::instance(); 142 KOPrefs *p = KOPrefs::instance();
143 KPimGlobalPrefs::instance()->setGlobalConfig(); 143 KPimGlobalPrefs::instance()->setGlobalConfig();
144 if ( p->mHourSize > 18 ) 144 if ( p->mHourSize > 18 )
145 p->mHourSize = 18; 145 p->mHourSize = 18;
146 QMainWindow::ToolBarDock tbd; 146 QMainWindow::ToolBarDock tbd;
147 if ( p->mToolBarHor ) { 147 if ( p->mToolBarHor ) {
148 if ( p->mToolBarUp ) 148 if ( p->mToolBarUp )
149 tbd = Bottom; 149 tbd = Bottom;
150 else 150 else
151 tbd = Top; 151 tbd = Top;
152 } 152 }
153 else { 153 else {
154 if ( p->mToolBarUp ) 154 if ( p->mToolBarUp )
155 tbd = Right; 155 tbd = Right;
156 else 156 else
157 tbd = Left; 157 tbd = Left;
158 } 158 }
159 if ( KOPrefs::instance()->mUseAppColors ) 159 if ( KOPrefs::instance()->mUseAppColors )
160 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 160 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
161 globalFlagBlockStartup = 1; 161 globalFlagBlockStartup = 1;
162 iconToolBar = new QPEToolBar( this ); 162 iconToolBar = new QPEToolBar( this );
163 addToolBar (iconToolBar , tbd ); 163 addToolBar (iconToolBar , tbd );
164 mCalendarModifiedFlag = false; 164 mCalendarModifiedFlag = false;
165 165
166 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 166 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
167 splash->setAlignment ( AlignCenter ); 167 splash->setAlignment ( AlignCenter );
168 setCentralWidget( splash ); 168 setCentralWidget( splash );
169#ifndef DESKTOP_VERSION 169#ifndef DESKTOP_VERSION
170 showMaximized(); 170 showMaximized();
171#endif 171#endif
172 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 172 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
173 setDefaultPreferences(); 173 setDefaultPreferences();
174 mCalendar = new CalendarLocal(); 174 mCalendar = new CalendarLocal();
175 mView = new CalendarView( mCalendar, this,"mCalendar " ); 175 mView = new CalendarView( mCalendar, this,"mCalendar " );
176 mView->hide(); 176 mView->hide();
177 //mView->resize(splash->size() ); 177 //mView->resize(splash->size() );
178 initActions(); 178 initActions();
179 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 179 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
180 mSyncManager->setBlockSave(false); 180 mSyncManager->setBlockSave(false);
181 mView->setSyncManager(mSyncManager); 181 mView->setSyncManager(mSyncManager);
182#ifndef DESKTOP_VERSION 182#ifndef DESKTOP_VERSION
183 iconToolBar->show(); 183 iconToolBar->show();
184 qApp->processEvents(); 184 qApp->processEvents();
185#endif 185#endif
186 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 186 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
187 int vh = height() ; 187 int vh = height() ;
188 int vw = width(); 188 int vw = width();
189 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 189 //qDebug("Toolbar hei %d ",iconToolBar->height() );
190 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 190 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
191 vh -= iconToolBar->height(); 191 vh -= iconToolBar->height();
192 } else { 192 } else {
193 vw -= iconToolBar->height(); 193 vw -= iconToolBar->height();
194 } 194 }
195 //mView->setMaximumSize( splash->size() ); 195 //mView->setMaximumSize( splash->size() );
196 //mView->resize( splash->size() ); 196 //mView->resize( splash->size() );
197 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 197 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
198 mView->readSettings(); 198 mView->readSettings();
199 bool newFile = false; 199 bool newFile = false;
200 if( !QFile::exists( defaultFileName() ) ) { 200 if( !QFile::exists( defaultFileName() ) ) {
201 QFileInfo finfo ( defaultFileName() ); 201 QFileInfo finfo ( defaultFileName() );
202 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 202 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
203 qDebug("oldfile %s ", oldFile.latin1()); 203 qDebug("oldfile %s ", oldFile.latin1());
204 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"; 204 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";
205 finfo.setFile( oldFile ); 205 finfo.setFile( oldFile );
206 if (finfo.exists() ) { 206 if (finfo.exists() ) {
207 KMessageBox::information( this, message); 207 KMessageBox::information( this, message);
208 mView->openCalendar( oldFile ); 208 mView->openCalendar( oldFile );
209 qApp->processEvents(); 209 qApp->processEvents();
210 } else { 210 } else {
211 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 211 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
212 finfo.setFile( oldFile ); 212 finfo.setFile( oldFile );
213 if (finfo.exists() ) { 213 if (finfo.exists() ) {
214 KMessageBox::information( this, message); 214 KMessageBox::information( this, message);
215 mView->openCalendar( oldFile ); 215 mView->openCalendar( oldFile );
216 qApp->processEvents(); 216 qApp->processEvents();
217 } 217 }
218 } 218 }
219 mView->saveCalendar( defaultFileName() ); 219 mView->saveCalendar( defaultFileName() );
220 newFile = true; 220 newFile = true;
221 } 221 }
222 222
223 QTime neededSaveTime = QDateTime::currentDateTime().time(); 223 QTime neededSaveTime = QDateTime::currentDateTime().time();
224 mView->openCalendar( defaultFileName() ); 224 mView->openCalendar( defaultFileName() );
225 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 225 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
226 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 226 qDebug("KO: Calendar loading time: %d ms",msNeeded );
227 227
228 if ( KOPrefs::instance()->mLanguageChanged ) { 228 if ( KOPrefs::instance()->mLanguageChanged ) {
229 KOPrefs::instance()->setCategoryDefaults(); 229 KOPrefs::instance()->setCategoryDefaults();
230 int count = mView->addCategories(); 230 int count = mView->addCategories();
231 KOPrefs::instance()->mLanguageChanged = false; 231 KOPrefs::instance()->mLanguageChanged = false;
232 } 232 }
233 processIncidenceSelection( 0 ); 233 processIncidenceSelection( 0 );
234 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 234 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
235 SLOT( processIncidenceSelection( Incidence * ) ) ); 235 SLOT( processIncidenceSelection( Incidence * ) ) );
236 connect( mView, SIGNAL( modifiedChanged( bool ) ), 236 connect( mView, SIGNAL( modifiedChanged( bool ) ),
237 SLOT( slotModifiedChanged( bool ) ) ); 237 SLOT( slotModifiedChanged( bool ) ) );
238 238
239 239
240 connect( mView, SIGNAL( tempDisableBR(bool) ), 240 connect( mView, SIGNAL( tempDisableBR(bool) ),
241 SLOT( disableBR(bool) ) ); 241 SLOT( disableBR(bool) ) );
242 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 242 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
243 mView->setModified( false ); 243 mView->setModified( false );
244 mBlockAtStartup = false; 244 mBlockAtStartup = false;
245 mView->setModified( false ); 245 mView->setModified( false );
246 setCentralWidget( mView ); 246 setCentralWidget( mView );
247 globalFlagBlockStartup = 0; 247 globalFlagBlockStartup = 0;
248 mView->show(); 248 mView->show();
249 delete splash; 249 delete splash;
250 if ( newFile ) 250 if ( newFile )
251 mView->updateConfig(); 251 mView->updateConfig();
252 // qApp->processEvents(); 252 // qApp->processEvents();
253 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 253 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
254 //fillSyncMenu(); 254 //fillSyncMenu();
255 255
256 256
257 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 257 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
258 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 258 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
259 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 259 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
260 mSyncManager->setDefaultFileName( defaultFileName()); 260 mSyncManager->setDefaultFileName( defaultFileName());
261 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 261 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
262 mSyncManager->fillSyncMenu(); 262 mSyncManager->fillSyncMenu();
263 263
264 264
265 265
266 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 266 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
267 if ( showWarning ) { 267 if ( showWarning ) {
268 KMessageBox::information( this, 268 KMessageBox::information( this,
269 "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"); 269 "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");
270 qApp->processEvents(); 270 qApp->processEvents();
271 mView->dialogManager()->showSyncOptions(); 271 mView->dialogManager()->showSyncOptions();
272 } 272 }
273 273
274 //US listen for result adressed from Ka/Pi 274 //US listen for result adressed from Ka/Pi
275#ifndef DESKTOP_VERSION 275#ifndef DESKTOP_VERSION
276 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 276 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
277#endif 277#endif
278#ifndef DESKTOP_VERSION 278#ifndef DESKTOP_VERSION
279 infrared = 0; 279 infrared = 0;
280#endif 280#endif
281 281
282 mBRdisabled = false; 282 mBRdisabled = false;
283 toggleBeamReceive(); 283 toggleBeamReceive();
284} 284}
285MainWindow::~MainWindow() 285MainWindow::~MainWindow()
286{ 286{
287 //qDebug("MainWindow::~MainWindow() "); 287 //qDebug("MainWindow::~MainWindow() ");
288 //save toolbar location 288 //save toolbar location
289 delete mCalendar; 289 delete mCalendar;
290 delete mSyncManager; 290 delete mSyncManager;
291#ifndef DESKTOP_VERSION
291 if ( infrared ) 292 if ( infrared )
292 delete infrared; 293 delete infrared;
294#endif
293 295
294 296
295} 297}
296 298
297void MainWindow::disableBR(bool b) 299void MainWindow::disableBR(bool b)
298{ 300{
301#ifndef DESKTOP_VERSION
299 if ( b ) { 302 if ( b ) {
300 if ( infrared ) { 303 if ( infrared ) {
301 toggleBeamReceive(); 304 toggleBeamReceive();
302 mBRdisabled = true; 305 mBRdisabled = true;
303 } 306 }
307 mBRdisabled = true;
304 } else { 308 } else {
305 if ( mBRdisabled ) { 309 if ( mBRdisabled ) {
306 mBRdisabled = false; 310 mBRdisabled = false;
307 toggleBeamReceive(); 311 //makes no sense,because other cal ap is probably running
312 // toggleBeamReceive();
308 } 313 }
309 } 314 }
315#endif
310 316
311} 317}
312bool MainWindow::beamReceiveEnabled() 318bool MainWindow::beamReceiveEnabled()
313{ 319{
314#ifndef DESKTOP_VERSION 320#ifndef DESKTOP_VERSION
315 return ( infrared != 0 ); 321 return ( infrared != 0 );
316#endif 322#endif
317 return false; 323 return false;
318} 324}
319 325
320void MainWindow::toggleBeamReceive() 326void MainWindow::toggleBeamReceive()
321{ 327{
322 if ( mBRdisabled ) 328 if ( mBRdisabled )
323 return; 329 return;
324#ifndef DESKTOP_VERSION 330#ifndef DESKTOP_VERSION
325 if ( infrared ) { 331 if ( infrared ) {
326 qDebug("disable BeamReceive "); 332 qDebug("disable BeamReceive ");
327 delete infrared; 333 delete infrared;
328 infrared = 0; 334 infrared = 0;
329 brAction->setOn(false); 335 brAction->setOn(false);
330 return; 336 return;
331 } 337 }
332 qDebug("enable BeamReceive "); 338 qDebug("enable BeamReceive ");
333 brAction->setOn(true); 339 brAction->setOn(true);
334 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 340 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
335 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 341 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
336#endif 342#endif
337} 343}
338void MainWindow::showMaximized () 344void MainWindow::showMaximized ()
339{ 345{
340#ifndef DESKTOP_VERSION 346#ifndef DESKTOP_VERSION
341 if ( ! globalFlagBlockStartup ) 347 if ( ! globalFlagBlockStartup )
342 if ( mClosed ) 348 if ( mClosed )
343 mView->goToday(); 349 mView->goToday();
344#endif 350#endif
345 QWidget::showMaximized () ; 351 QWidget::showMaximized () ;
346 mClosed = false; 352 mClosed = false;
347} 353}
348void MainWindow::closeEvent( QCloseEvent* ce ) 354void MainWindow::closeEvent( QCloseEvent* ce )
349{ 355{
350 356
351 357
352 358
353 if ( ! KOPrefs::instance()->mAskForQuit ) { 359 if ( ! KOPrefs::instance()->mAskForQuit ) {
354 saveOnClose(); 360 saveOnClose();
355 mClosed = true; 361 mClosed = true;
356 ce->accept(); 362 ce->accept();
357 return; 363 return;
358 364
359 } 365 }
360 366
361 switch( QMessageBox::information( this, "KO/Pi", 367 switch( QMessageBox::information( this, "KO/Pi",
362 i18n("Do you really want\nto close KO/Pi?"), 368 i18n("Do you really want\nto close KO/Pi?"),
363 i18n("Close"), i18n("No"), 369 i18n("Close"), i18n("No"),
364 0, 0 ) ) { 370 0, 0 ) ) {
365 case 0: 371 case 0:
366 saveOnClose(); 372 saveOnClose();
367 mClosed = true; 373 mClosed = true;
368 ce->accept(); 374 ce->accept();
369 break; 375 break;
370 case 1: 376 case 1:
371 ce->ignore(); 377 ce->ignore();
372 break; 378 break;
373 case 2: 379 case 2:
374 380
375 default: 381 default:
376 break; 382 break;
377 } 383 }
378 384
379 385
380} 386}
381 387
382void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 388void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
383{ 389{
384 QDataStream stream( data, IO_ReadOnly ); 390 QDataStream stream( data, IO_ReadOnly );
385 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 391 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
386 //QString datamess; 392 //QString datamess;
387 //qDebug("message "); 393 //qDebug("message ");
388 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 394 qDebug("KO: QCOP message received: %s ", cmsg.data() );
389 395
390 if ( cmsg == "setDocument(QString)" ) { 396 if ( cmsg == "setDocument(QString)" ) {
391 QDataStream stream( data, IO_ReadOnly ); 397 QDataStream stream( data, IO_ReadOnly );
392 QString fileName; 398 QString fileName;
393 stream >> fileName; 399 stream >> fileName;
394 //qDebug("filename %s ", fileName.latin1()); 400 //qDebug("filename %s ", fileName.latin1());
395 showMaximized(); 401 showMaximized();
396 raise(); 402 raise();
397 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 403 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
398 mSyncManager->slotSyncMenu( 1002 ); 404 mSyncManager->slotSyncMenu( 1002 );
399 return; 405 return;
400 } 406 }
401 407
402 if ( cmsg == "-writeFile" ) { 408 if ( cmsg == "-writeFile" ) {
403 // I made from the "-writeFile" an "-writeAlarm" 409 // I made from the "-writeFile" an "-writeAlarm"
404 mView->viewManager()->showWhatsNextView(); 410 mView->viewManager()->showWhatsNextView();
405 mCalendar->checkAlarmForIncidence( 0, true); 411 mCalendar->checkAlarmForIncidence( 0, true);
406 showMaximized(); 412 showMaximized();
407 raise(); 413 raise();
408 return; 414 return;
409 415
410 } 416 }
411 if ( cmsg == "-writeFileSilent" ) { 417 if ( cmsg == "-writeFileSilent" ) {
412 // I made from the "-writeFile" an "-writeAlarm" 418 // I made from the "-writeFile" an "-writeAlarm"
413 // mView->viewManager()->showWhatsNextView(); 419 // mView->viewManager()->showWhatsNextView();
414 mCalendar->checkAlarmForIncidence( 0, true); 420 mCalendar->checkAlarmForIncidence( 0, true);
415 //showMaximized(); 421 //showMaximized();
416 //raise(); 422 //raise();
417 hide(); 423 hide();
418 return; 424 return;
419 } 425 }
420 if ( cmsg == "-newCountdown" ) { 426 if ( cmsg == "-newCountdown" ) {
421 qDebug("newCountdown "); 427 qDebug("newCountdown ");
422 428
423 } 429 }
424 QString msg ; 430 QString msg ;
425 QString allmsg = cmsg; 431 QString allmsg = cmsg;
426 while ( allmsg.length() > 0 ) { 432 while ( allmsg.length() > 0 ) {
427 int nextC = allmsg.find( "-", 1 ); 433 int nextC = allmsg.find( "-", 1 );
428 if ( nextC == -1 ) { 434 if ( nextC == -1 ) {
429 msg = allmsg; 435 msg = allmsg;
430 allmsg = ""; 436 allmsg = "";
431 } else{ 437 } else{
432 msg = allmsg.left( nextC ); 438 msg = allmsg.left( nextC );
433 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 439 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
434 } 440 }
435 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 441 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
436 if ( msg == "-newEvent" ) { 442 if ( msg == "-newEvent" ) {
437 mView->newEvent(); 443 mView->newEvent();
438 } 444 }
439 if ( msg == "-newTodo" ) { 445 if ( msg == "-newTodo" ) {
440 mView->newTodo(); 446 mView->newTodo();
441 447
442 } 448 }
443 if ( msg == "-showWN" ) { 449 if ( msg == "-showWN" ) {
444 mView->viewManager()->showWhatsNextView(); 450 mView->viewManager()->showWhatsNextView();
445 } 451 }
446 if ( msg == "-showTodo" ) { 452 if ( msg == "-showTodo" ) {
447 mView->viewManager()->showTodoView(); 453 mView->viewManager()->showTodoView();
448 } 454 }
449 if ( msg == "-showList" ) { 455 if ( msg == "-showList" ) {
450 mView->viewManager()->showListView(); 456 mView->viewManager()->showListView();
451 } 457 }
452 else if ( msg == "-showDay" ) { 458 else if ( msg == "-showDay" ) {
453 mView->viewManager()->showDayView(); 459 mView->viewManager()->showDayView();
454 } 460 }
455 else if ( msg == "-showWWeek" ) { 461 else if ( msg == "-showWWeek" ) {
456 mView->viewManager()->showWorkWeekView(); 462 mView->viewManager()->showWorkWeekView();
457 } 463 }
458 else if ( msg == "-ringSync" ) { 464 else if ( msg == "-ringSync" ) {
459 mSyncManager->multiSync( false ); 465 mSyncManager->multiSync( false );
460 } 466 }
461 else if ( msg == "-showWeek" ) { 467 else if ( msg == "-showWeek" ) {
462 mView->viewManager()->showWeekView(); 468 mView->viewManager()->showWeekView();
463 } 469 }
464 else if ( msg == "-showTodo" ) { 470 else if ( msg == "-showTodo" ) {
465 mView->viewManager()->showTodoView(); 471 mView->viewManager()->showTodoView();
466 } 472 }
467 else if ( msg == "-showJournal" ) { 473 else if ( msg == "-showJournal" ) {
468 mView->dateNavigator()->selectDates( 1 ); 474 mView->dateNavigator()->selectDates( 1 );
469 mView->dateNavigator()->selectToday(); 475 mView->dateNavigator()->selectToday();
470 mView->viewManager()->showJournalView(); 476 mView->viewManager()->showJournalView();
471 } 477 }
472 else if ( msg == "-showKO" ) { 478 else if ( msg == "-showKO" ) {
473 mView->viewManager()->showNextXView(); 479 mView->viewManager()->showNextXView();
474 } 480 }
475 else if ( msg == "-showWNext" || msg == "nextView()" ) { 481 else if ( msg == "-showWNext" || msg == "nextView()" ) {
476 mView->viewManager()->showWhatsNextView(); 482 mView->viewManager()->showWhatsNextView();
477 } 483 }
478 else if ( msg == "-showNextXView" ) { 484 else if ( msg == "-showNextXView" ) {
479 mView->viewManager()->showNextXView(); 485 mView->viewManager()->showNextXView();
480 } 486 }
481 487
482 488
483 } 489 }
484 490
485 showMaximized(); 491 showMaximized();
486 raise(); 492 raise();
487} 493}
488 494
489QPixmap MainWindow::loadPixmap( QString name ) 495QPixmap MainWindow::loadPixmap( QString name )
490{ 496{
491 return SmallIcon( name ); 497 return SmallIcon( name );
492 498
493} 499}
494void MainWindow::initActions() 500void MainWindow::initActions()
495{ 501{
496 //KOPrefs::instance()->mShowFullMenu 502 //KOPrefs::instance()->mShowFullMenu
497 iconToolBar->clear(); 503 iconToolBar->clear();
498 KOPrefs *p = KOPrefs::instance(); 504 KOPrefs *p = KOPrefs::instance();
499 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 505 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
500 506
501 QPopupMenu *viewMenu = new QPopupMenu( this ); 507 QPopupMenu *viewMenu = new QPopupMenu( this );
502 QPopupMenu *actionMenu = new QPopupMenu( this ); 508 QPopupMenu *actionMenu = new QPopupMenu( this );
503 QPopupMenu *importMenu = new QPopupMenu( this ); 509 QPopupMenu *importMenu = new QPopupMenu( this );
504 selectFilterMenu = new QPopupMenu( this ); 510 selectFilterMenu = new QPopupMenu( this );
505 selectFilterMenu->setCheckable( true ); 511 selectFilterMenu->setCheckable( true );
506 syncMenu = new QPopupMenu( this ); 512 syncMenu = new QPopupMenu( this );
507 configureAgendaMenu = new QPopupMenu( this ); 513 configureAgendaMenu = new QPopupMenu( this );
508 configureToolBarMenu = new QPopupMenu( this ); 514 configureToolBarMenu = new QPopupMenu( this );
509 QPopupMenu *helpMenu = new QPopupMenu( this ); 515 QPopupMenu *helpMenu = new QPopupMenu( this );
510 if ( KOPrefs::instance()->mShowFullMenu ) { 516 if ( KOPrefs::instance()->mShowFullMenu ) {
511 QMenuBar *menuBar1; 517 QMenuBar *menuBar1;
512 menuBar1 = menuBar(); 518 menuBar1 = menuBar();
513 menuBar1->insertItem( i18n("File"), importMenu ); 519 menuBar1->insertItem( i18n("File"), importMenu );
514 menuBar1->insertItem( i18n("View"), viewMenu ); 520 menuBar1->insertItem( i18n("View"), viewMenu );
515 menuBar1->insertItem( i18n("Actions"), actionMenu ); 521 menuBar1->insertItem( i18n("Actions"), actionMenu );
516 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 522 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
517 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 523 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
518 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 524 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
519 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 525 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
520 menuBar1->insertItem( i18n("Help"), helpMenu ); 526 menuBar1->insertItem( i18n("Help"), helpMenu );
521 } else { 527 } else {
522 QPEMenuBar *menuBar1; 528 QPEMenuBar *menuBar1;
523 menuBar1 = new QPEMenuBar( iconToolBar ); 529 menuBar1 = new QPEMenuBar( iconToolBar );
524 QPopupMenu *menuBar = new QPopupMenu( this ); 530 QPopupMenu *menuBar = new QPopupMenu( this );
525 menuBar1->insertItem( i18n("ME"), menuBar); 531 menuBar1->insertItem( i18n("ME"), menuBar);
526 menuBar->insertItem( i18n("File"), importMenu ); 532 menuBar->insertItem( i18n("File"), importMenu );
527 menuBar->insertItem( i18n("View"), viewMenu ); 533 menuBar->insertItem( i18n("View"), viewMenu );
528 menuBar->insertItem( i18n("Actions"), actionMenu ); 534 menuBar->insertItem( i18n("Actions"), actionMenu );
529 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 535 menuBar->insertItem( i18n("Synchronize"), syncMenu );
530 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 536 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
531 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 537 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
532 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 538 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
533 menuBar->insertItem( i18n("Help"), helpMenu ); 539 menuBar->insertItem( i18n("Help"), helpMenu );
534 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 540 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
535 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 541 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
536 } 542 }
537 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 543 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
538 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); 544 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) );
539 545
540 // ****************** 546 // ******************
541 QAction *action; 547 QAction *action;
542 QIconSet icon; 548 QIconSet icon;
543 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 549 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
544 configureToolBarMenu->setCheckable( true ); 550 configureToolBarMenu->setCheckable( true );
545 551
546 QString pathString = ""; 552 QString pathString = "";
547 if ( !p->mToolBarMiniIcons ) { 553 if ( !p->mToolBarMiniIcons ) {
548 if ( QApplication::desktop()->width() < 480 ) 554 if ( QApplication::desktop()->width() < 480 )
549 pathString += "icons16/"; 555 pathString += "icons16/";
550 } else 556 } else
551 pathString += "iconsmini/"; 557 pathString += "iconsmini/";
552 configureAgendaMenu->setCheckable( true ); 558 configureAgendaMenu->setCheckable( true );
553 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); 559 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 );
554 configureAgendaMenu->insertSeparator(); 560 configureAgendaMenu->insertSeparator();
555 configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); 561 configureAgendaMenu->insertItem(i18n("Tiny"), 4 );
556 configureAgendaMenu->insertItem(i18n("Small"), 6 ); 562 configureAgendaMenu->insertItem(i18n("Small"), 6 );
557 configureAgendaMenu->insertItem(i18n("Medium"), 8 ); 563 configureAgendaMenu->insertItem(i18n("Medium"), 8 );
558 configureAgendaMenu->insertItem(i18n("Normal"), 10 ); 564 configureAgendaMenu->insertItem(i18n("Normal"), 10 );
559 configureAgendaMenu->insertItem(i18n("Large"), 12 ); 565 configureAgendaMenu->insertItem(i18n("Large"), 12 );
560 configureAgendaMenu->insertItem(i18n("Big"), 14 ); 566 configureAgendaMenu->insertItem(i18n("Big"), 14 );
561 configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); 567 configureAgendaMenu->insertItem(i18n("Bigger"), 16 );
562 configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); 568 configureAgendaMenu->insertItem(i18n("Biggest"), 18 );
563 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 569 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
564 570
565 icon = loadPixmap( pathString + "configure" ); 571 icon = loadPixmap( pathString + "configure" );
566 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 572 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
567 action->addTo( actionMenu ); 573 action->addTo( actionMenu );
568 connect( action, SIGNAL( activated() ), 574 connect( action, SIGNAL( activated() ),
569 mView, SLOT( edit_options() ) ); 575 mView, SLOT( edit_options() ) );
570 actionMenu->insertSeparator(); 576 actionMenu->insertSeparator();
571 icon = loadPixmap( pathString + "newevent" ); 577 icon = loadPixmap( pathString + "newevent" );
572 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 578 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
573 configureToolBarMenu->insertSeparator(); 579 configureToolBarMenu->insertSeparator();
574 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 580 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
575 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 581 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
576 ne_action->addTo( actionMenu ); 582 ne_action->addTo( actionMenu );
577 connect( ne_action, SIGNAL( activated() ), 583 connect( ne_action, SIGNAL( activated() ),
578 mView, SLOT( newEvent() ) ); 584 mView, SLOT( newEvent() ) );
579 icon = loadPixmap( pathString + "newtodo" ); 585 icon = loadPixmap( pathString + "newtodo" );
580 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 586 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
581 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 587 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
582 nt_action->addTo( actionMenu ); 588 nt_action->addTo( actionMenu );
583 connect( nt_action, SIGNAL( activated() ), 589 connect( nt_action, SIGNAL( activated() ),
584 mView, SLOT( newTodo() ) ); 590 mView, SLOT( newTodo() ) );
585 icon = loadPixmap( pathString + "navi" ); 591 icon = loadPixmap( pathString + "navi" );
586 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 592 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
587 action->addTo( viewMenu ); 593 action->addTo( viewMenu );
588 connect( action, SIGNAL( activated() ), 594 connect( action, SIGNAL( activated() ),
589 mView, SLOT( toggleDateNavigatorWidget() ) ); 595 mView, SLOT( toggleDateNavigatorWidget() ) );
590 icon = loadPixmap( pathString + "filter" ); 596 icon = loadPixmap( pathString + "filter" );
591 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 597 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
592 action->addTo( viewMenu ); 598 action->addTo( viewMenu );
593 connect( action, SIGNAL( activated() ), 599 connect( action, SIGNAL( activated() ),
594 mView, SLOT( toggleFilter() ) ); 600 mView, SLOT( toggleFilter() ) );
595 601
596 602
597 viewMenu->insertSeparator(); 603 viewMenu->insertSeparator();
598 icon = loadPixmap( pathString + "picker" ); 604 icon = loadPixmap( pathString + "picker" );
599 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 605 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
600 action->addTo( viewMenu ); 606 action->addTo( viewMenu );
601 connect( action, SIGNAL( activated() ), 607 connect( action, SIGNAL( activated() ),
602 mView, SLOT( showDatePicker() ) ); 608 mView, SLOT( showDatePicker() ) );
603 action->addTo( iconToolBar ); 609 action->addTo( iconToolBar );
604 viewMenu->insertSeparator(); 610 viewMenu->insertSeparator();
605 icon = loadPixmap( pathString + "list" ); 611 icon = loadPixmap( pathString + "list" );
606 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 612 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
607 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 613 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
608 showlist_action->addTo( viewMenu ); 614 showlist_action->addTo( viewMenu );
609 connect( showlist_action, SIGNAL( activated() ), 615 connect( showlist_action, SIGNAL( activated() ),
610 mView->viewManager(), SLOT( showListView() ) ); 616 mView->viewManager(), SLOT( showListView() ) );
611 617
612 618
613 icon = loadPixmap( pathString + "day" ); 619 icon = loadPixmap( pathString + "day" );
614 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 620 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
615 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 621 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
616 day1_action->addTo( viewMenu ); 622 day1_action->addTo( viewMenu );
617 // action->addTo( toolBar ); 623 // action->addTo( toolBar );
618 connect( day1_action, SIGNAL( activated() ), 624 connect( day1_action, SIGNAL( activated() ),
619 mView->viewManager(), SLOT( showDayView() ) ); 625 mView->viewManager(), SLOT( showDayView() ) );
620 626
621 icon = loadPixmap( pathString + "workweek" ); 627 icon = loadPixmap( pathString + "workweek" );
622 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 628 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
623 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 629 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
624 day5_action->addTo( viewMenu ); 630 day5_action->addTo( viewMenu );
625 connect( day5_action, SIGNAL( activated() ), 631 connect( day5_action, SIGNAL( activated() ),
626 mView->viewManager(), SLOT( showWorkWeekView() ) ); 632 mView->viewManager(), SLOT( showWorkWeekView() ) );
627 633
628 icon = loadPixmap( pathString + "week" ); 634 icon = loadPixmap( pathString + "week" );
629 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 635 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
630 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 636 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
631 day7_action->addTo( viewMenu ); 637 day7_action->addTo( viewMenu );
632 connect( day7_action, SIGNAL( activated() ), 638 connect( day7_action, SIGNAL( activated() ),
633 mView->viewManager(), SLOT( showWeekView() ) ); 639 mView->viewManager(), SLOT( showWeekView() ) );
634 640
635 icon = loadPixmap( pathString + "month" ); 641 icon = loadPixmap( pathString + "month" );
636 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 642 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
637 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 643 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
638 month_action->addTo( viewMenu ); 644 month_action->addTo( viewMenu );
639 connect( month_action, SIGNAL( activated() ), 645 connect( month_action, SIGNAL( activated() ),
640 mView->viewManager(), SLOT( showMonthView() ) ); 646 mView->viewManager(), SLOT( showMonthView() ) );
641 647
642 icon = loadPixmap( pathString + "todo" ); 648 icon = loadPixmap( pathString + "todo" );
643 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 649 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
644 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 650 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
645 todoview_action->addTo( viewMenu ); 651 todoview_action->addTo( viewMenu );
646 connect( todoview_action, SIGNAL( activated() ), 652 connect( todoview_action, SIGNAL( activated() ),
647 mView->viewManager(), SLOT( showTodoView() ) ); 653 mView->viewManager(), SLOT( showTodoView() ) );
648 654
649 icon = loadPixmap( pathString + "journal" ); 655 icon = loadPixmap( pathString + "journal" );
650 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 656 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
651 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 657 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
652 viewjournal_action->addTo( viewMenu ); 658 viewjournal_action->addTo( viewMenu );
653 connect( viewjournal_action, SIGNAL( activated() ), 659 connect( viewjournal_action, SIGNAL( activated() ),
654 mView->viewManager(), SLOT( showJournalView() ) ); 660 mView->viewManager(), SLOT( showJournalView() ) );
655 661
656 icon = loadPixmap( pathString + "xdays" ); 662 icon = loadPixmap( pathString + "xdays" );
657 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 663 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
658 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 664 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
659 xdays_action->addTo( viewMenu ); 665 xdays_action->addTo( viewMenu );
660 connect( xdays_action, SIGNAL( activated() ), 666 connect( xdays_action, SIGNAL( activated() ),
661 mView->viewManager(), SLOT( showNextXView() ) ); 667 mView->viewManager(), SLOT( showNextXView() ) );
662 668
663 icon = loadPixmap( pathString + "whatsnext" ); 669 icon = loadPixmap( pathString + "whatsnext" );
664 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 670 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
665 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 671 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
666 whatsnext_action->addTo( viewMenu ); 672 whatsnext_action->addTo( viewMenu );
667 connect( whatsnext_action, SIGNAL( activated() ), 673 connect( whatsnext_action, SIGNAL( activated() ),
668 mView->viewManager(), SLOT( showWhatsNextView() ) ); 674 mView->viewManager(), SLOT( showWhatsNextView() ) );
669 675
670#if 0 676#if 0
671 action = new QAction( "view_timespan", "Time Span", 0, this ); 677 action = new QAction( "view_timespan", "Time Span", 0, this );
672 action->addTo( viewMenu ); 678 action->addTo( viewMenu );
673 connect( action, SIGNAL( activated() ), 679 connect( action, SIGNAL( activated() ),
674 mView->viewManager(), SLOT( showTimeSpanView() ) ); 680 mView->viewManager(), SLOT( showTimeSpanView() ) );
675#endif 681#endif
676 682
677 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 683 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
678 this ); 684 this );
679 mNewSubTodoAction->addTo( actionMenu ); 685 mNewSubTodoAction->addTo( actionMenu );
680 connect( mNewSubTodoAction, SIGNAL( activated() ), 686 connect( mNewSubTodoAction, SIGNAL( activated() ),
681 mView, SLOT( newSubTodo() ) ); 687 mView, SLOT( newSubTodo() ) );
682 688
683 actionMenu->insertSeparator(); 689 actionMenu->insertSeparator();
684 690
685 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 691 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
686 mShowAction->addTo( actionMenu ); 692 mShowAction->addTo( actionMenu );
687 connect( mShowAction, SIGNAL( activated() ), 693 connect( mShowAction, SIGNAL( activated() ),
688 mView, SLOT( showIncidence() ) ); 694 mView, SLOT( showIncidence() ) );
689 695
690 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 696 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
691 mEditAction->addTo( actionMenu ); 697 mEditAction->addTo( actionMenu );
692 connect( mEditAction, SIGNAL( activated() ), 698 connect( mEditAction, SIGNAL( activated() ),
693 mView, SLOT( editIncidence() ) ); 699 mView, SLOT( editIncidence() ) );
694 700
695 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 701 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
696 mDeleteAction->addTo( actionMenu ); 702 mDeleteAction->addTo( actionMenu );
697 connect( mDeleteAction, SIGNAL( activated() ), 703 connect( mDeleteAction, SIGNAL( activated() ),
698 mView, SLOT( deleteIncidence() ) ); 704 mView, SLOT( deleteIncidence() ) );
699 705
700 706
701 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 707 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
702 mCloneAction->addTo( actionMenu ); 708 mCloneAction->addTo( actionMenu );
703 connect( mCloneAction, SIGNAL( activated() ), 709 connect( mCloneAction, SIGNAL( activated() ),
704 mView, SLOT( cloneIncidence() ) ); 710 mView, SLOT( cloneIncidence() ) );
705 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 711 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
706 mMoveAction->addTo( actionMenu ); 712 mMoveAction->addTo( actionMenu );
707 connect( mMoveAction, SIGNAL( activated() ), 713 connect( mMoveAction, SIGNAL( activated() ),
708 mView, SLOT( moveIncidence() ) ); 714 mView, SLOT( moveIncidence() ) );
709 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 715 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
710 mBeamAction->addTo( actionMenu ); 716 mBeamAction->addTo( actionMenu );
711 connect( mBeamAction, SIGNAL( activated() ), 717 connect( mBeamAction, SIGNAL( activated() ),
712 mView, SLOT( beamIncidence() ) ); 718 mView, SLOT( beamIncidence() ) );
713 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 719 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
714 mCancelAction->addTo( actionMenu ); 720 mCancelAction->addTo( actionMenu );
715 connect( mCancelAction, SIGNAL( activated() ), 721 connect( mCancelAction, SIGNAL( activated() ),
716 mView, SLOT( toggleCancelIncidence() ) ); 722 mView, SLOT( toggleCancelIncidence() ) );
717 723
718 actionMenu->insertSeparator(); 724 actionMenu->insertSeparator();
719 725
720 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 726 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
721 this ); 727 this );
722 action->addTo( actionMenu ); 728 action->addTo( actionMenu );
723 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 729 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
724 730
725 icon = loadPixmap( pathString + "search" ); 731 icon = loadPixmap( pathString + "search" );
726 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 732 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
727 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 733 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
728 search_action->addTo( actionMenu ); 734 search_action->addTo( actionMenu );
729 connect( search_action, SIGNAL( activated() ), 735 connect( search_action, SIGNAL( activated() ),
730 mView->dialogManager(), SLOT( showSearchDialog() ) ); 736 mView->dialogManager(), SLOT( showSearchDialog() ) );
731 737
732 icon = loadPixmap( pathString + "today" ); 738 icon = loadPixmap( pathString + "today" );
733 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 739 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
734 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 740 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
735 today_action->addTo( actionMenu ); 741 today_action->addTo( actionMenu );
736 connect( today_action, SIGNAL( activated() ), 742 connect( today_action, SIGNAL( activated() ),
737 mView, SLOT( goToday() ) ); 743 mView, SLOT( goToday() ) );
738 744
739 if ( KOPrefs::instance()->mShowFullMenu ) { 745 if ( KOPrefs::instance()->mShowFullMenu ) {
740 actionMenu->insertSeparator(); 746 actionMenu->insertSeparator();
741 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 747 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
742 748
743 } 749 }
744 // actionMenu->insertSeparator(); 750 // actionMenu->insertSeparator();
745 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 751 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
746 this ); 752 this );
747 action->addTo( importMenu ); 753 action->addTo( importMenu );
748 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 754 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
749 action = new QAction( "import_quick", i18n("Import last file"), 0, 755 action = new QAction( "import_quick", i18n("Import last file"), 0,
750 this ); 756 this );
751 action->addTo( importMenu ); 757 action->addTo( importMenu );
752 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 758 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
753 importMenu->insertSeparator(); 759 importMenu->insertSeparator();
754 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 760 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
755 this ); 761 this );
756 action->addTo( importMenu ); 762 action->addTo( importMenu );
757 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 763 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
758#ifndef DESKTOP_VERSION 764#ifndef DESKTOP_VERSION
759 importMenu->insertSeparator(); 765 importMenu->insertSeparator();
760 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 766 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
761 this ); 767 this );
762 action->addTo( importMenu ); 768 action->addTo( importMenu );
763 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 769 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
764#else 770#else
765#ifdef _WIN32_ 771#ifdef _WIN32_
766 importMenu->insertSeparator(); 772 importMenu->insertSeparator();
767 action = new QAction( "import_ol", i18n("Import from OL"), 0, 773 action = new QAction( "import_ol", i18n("Import from OL"), 0,
768 this ); 774 this );
769 action->addTo( importMenu ); 775 action->addTo( importMenu );
770 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 776 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
771#endif 777#endif
772#endif 778#endif
773 779
774 importMenu->insertSeparator(); 780 importMenu->insertSeparator();
775 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 781 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
776 this ); 782 this );
777 action->addTo( importMenu ); 783 action->addTo( importMenu );
778 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 784 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
779 785
780 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 786 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
781 this ); 787 this );
782 action->addTo( importMenu ); 788 action->addTo( importMenu );
783 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 789 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
784 790
785 importMenu->insertSeparator(); 791 importMenu->insertSeparator();
786 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 792 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
787 this ); 793 this );
788 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 794 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
789 795
790 796
791 //LR 797 //LR
792 QPopupMenu *ex2phone = new QPopupMenu( this ); 798 QPopupMenu *ex2phone = new QPopupMenu( this );
793 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 799 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
794 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 800 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
795 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 801 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
796 importMenu->insertItem( i18n("Export to phone"), ex2phone ); 802 importMenu->insertItem( i18n("Export to phone"), ex2phone );
797 803
798 importMenu->insertSeparator(); 804 importMenu->insertSeparator();
799 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 805 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
800 this ); 806 this );
801 action->addTo( importMenu ); 807 action->addTo( importMenu );
802 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 808 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
803#ifndef DESKTOP_VERSION 809#ifndef DESKTOP_VERSION
804 importMenu->insertSeparator(); 810 importMenu->insertSeparator();
805 brAction = new QAction( "beam toggle", i18n("Beam receice enabled"), 0, 811 brAction = new QAction( "beam toggle", i18n("Beam receice enabled"), 0,
806 this ); 812 this );
807 brAction->addTo( importMenu ); 813 brAction->addTo( importMenu );
808 brAction->setToggleAction (true ) ; 814 brAction->setToggleAction (true ) ;
809 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 815 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
810 816
811 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 817 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
812 this ); 818 this );
813 action->addTo( importMenu ); 819 action->addTo( importMenu );
814 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 820 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
815 821
816 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 822 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
817 this ); 823 this );
818 action->addTo( importMenu ); 824 action->addTo( importMenu );
819 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 825 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
820#else 826#else
821 importMenu->insertSeparator(); 827 importMenu->insertSeparator();
822 icon = loadPixmap( pathString + "print" ); 828 icon = loadPixmap( pathString + "print" );
823 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 829 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
824 action->addTo( importMenu ); 830 action->addTo( importMenu );
825 connect( action, SIGNAL( activated() ), 831 connect( action, SIGNAL( activated() ),
826 this, SLOT( printCal() ) ); 832 this, SLOT( printCal() ) );
827 833
828 icon = loadPixmap( pathString + "print" ); 834 icon = loadPixmap( pathString + "print" );
829 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 835 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
830 action->addTo( importMenu ); 836 action->addTo( importMenu );
831 connect( action, SIGNAL( activated() ), 837 connect( action, SIGNAL( activated() ),
832 this, SLOT( printSel() ) ); 838 this, SLOT( printSel() ) );
833#endif 839#endif
834 importMenu->insertSeparator(); 840 importMenu->insertSeparator();
835 action = new QAction( "beam all", i18n("Save"), 0, 841 action = new QAction( "beam all", i18n("Save"), 0,
836 this ); 842 this );
837 action->addTo( importMenu ); 843 action->addTo( importMenu );
838 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 844 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
839 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 845 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
840 this ); 846 this );
841 action->addTo( importMenu ); 847 action->addTo( importMenu );
842 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 848 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
843 849
844 //menuBar->insertItem( "Configure",configureMenu ); 850 //menuBar->insertItem( "Configure",configureMenu );
845 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 851 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
846 icon = loadPixmap( "korganizer/korganizer" ); 852 icon = loadPixmap( "korganizer/korganizer" );
847 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 853 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
848 action->addTo( helpMenu ); 854 action->addTo( helpMenu );
849 connect( action, SIGNAL( activated() ), 855 connect( action, SIGNAL( activated() ),
850 SLOT( keyBindings() ) ); 856 SLOT( keyBindings() ) );
851 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 857 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
852 action->addTo( helpMenu ); 858 action->addTo( helpMenu );
853 connect( action, SIGNAL( activated() ), 859 connect( action, SIGNAL( activated() ),
854 SLOT( features() ) ); 860 SLOT( features() ) );
855 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 861 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
856 action->addTo( helpMenu ); 862 action->addTo( helpMenu );
857 connect( action, SIGNAL( activated() ), 863 connect( action, SIGNAL( activated() ),
858 SLOT( aboutAutoSaving() ) ); 864 SLOT( aboutAutoSaving() ) );
859 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 865 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
860 action->addTo( helpMenu ); 866 action->addTo( helpMenu );
861 connect( action, SIGNAL( activated() ), 867 connect( action, SIGNAL( activated() ),
862 SLOT( aboutKnownBugs() ) ); 868 SLOT( aboutKnownBugs() ) );
863 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 869 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
864 action->addTo( helpMenu ); 870 action->addTo( helpMenu );
865 connect( action, SIGNAL( activated() ), 871 connect( action, SIGNAL( activated() ),
866 SLOT( usertrans() ) ); 872 SLOT( usertrans() ) );
867 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 873 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
868 action->addTo( helpMenu ); 874 action->addTo( helpMenu );
869 connect( action, SIGNAL( activated() ), 875 connect( action, SIGNAL( activated() ),
870 SLOT( synchowto() ) ); 876 SLOT( synchowto() ) );
871 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 877 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
872 action->addTo( helpMenu ); 878 action->addTo( helpMenu );
873 connect( action, SIGNAL( activated() ), 879 connect( action, SIGNAL( activated() ),
874 SLOT( whatsNew() ) ); 880 SLOT( whatsNew() ) );
875 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 881 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
876 action->addTo( helpMenu ); 882 action->addTo( helpMenu );
877 connect( action, SIGNAL( activated() ), 883 connect( action, SIGNAL( activated() ),
878 SLOT( faq() ) ); 884 SLOT( faq() ) );
879 885
880 886
881 action = new QAction( "about", i18n("About..."), 0, this ); 887 action = new QAction( "about", i18n("About..."), 0, this );
882 action->addTo( helpMenu ); 888 action->addTo( helpMenu );
883 connect( action, SIGNAL( activated() ), 889 connect( action, SIGNAL( activated() ),
884 SLOT( about() ) ); 890 SLOT( about() ) );
885 action = new QAction( "licence", i18n("Licence..."), 0, this ); 891 action = new QAction( "licence", i18n("Licence..."), 0, this );
886 action->addTo( helpMenu ); 892 action->addTo( helpMenu );
887 connect( action, SIGNAL( activated() ), 893 connect( action, SIGNAL( activated() ),
888 SLOT( licence() ) ); 894 SLOT( licence() ) );
889 //menuBar->insertSeparator(); 895 //menuBar->insertSeparator();
890 896
891 // ****************************************************** 897 // ******************************************************
892 // menubar icons 898 // menubar icons
893 899
894 900
895 iconToolBar->setHorizontalStretchable (true ); 901 iconToolBar->setHorizontalStretchable (true );
896 //menuBar->insertItem( iconToolBar ); 902 //menuBar->insertItem( iconToolBar );
897 //xdays_action 903 //xdays_action
898 if (p-> mShowIconNewEvent) 904 if (p-> mShowIconNewEvent)
899 ne_action->addTo( iconToolBar ); 905 ne_action->addTo( iconToolBar );
900 if (p->mShowIconNewTodo ) 906 if (p->mShowIconNewTodo )
901 nt_action->addTo( iconToolBar ); 907 nt_action->addTo( iconToolBar );
902 if (p-> mShowIconSearch) 908 if (p-> mShowIconSearch)
903 search_action->addTo( iconToolBar ); 909 search_action->addTo( iconToolBar );
904 if (p-> mShowIconNext) 910 if (p-> mShowIconNext)
905 whatsnext_action->addTo( iconToolBar ); 911 whatsnext_action->addTo( iconToolBar );
906 if (p-> mShowIconNextDays) 912 if (p-> mShowIconNextDays)
907 xdays_action->addTo( iconToolBar ); 913 xdays_action->addTo( iconToolBar );
908 if (p-> mShowIconList) 914 if (p-> mShowIconList)
909 showlist_action->addTo( iconToolBar ); 915 showlist_action->addTo( iconToolBar );
910 if (p-> mShowIconDay1) 916 if (p-> mShowIconDay1)
911 day1_action->addTo( iconToolBar ); 917 day1_action->addTo( iconToolBar );
912 if (p-> mShowIconDay5) 918 if (p-> mShowIconDay5)
913 day5_action->addTo( iconToolBar ); 919 day5_action->addTo( iconToolBar );
914 if (p-> mShowIconDay7) 920 if (p-> mShowIconDay7)
915 day7_action->addTo( iconToolBar ); 921 day7_action->addTo( iconToolBar );
916 if (p-> mShowIconMonth) 922 if (p-> mShowIconMonth)
917 month_action->addTo( iconToolBar ); 923 month_action->addTo( iconToolBar );
918 if (p-> mShowIconTodoview) 924 if (p-> mShowIconTodoview)
919 todoview_action->addTo( iconToolBar ); 925 todoview_action->addTo( iconToolBar );
920 if (p-> mShowIconJournal) 926 if (p-> mShowIconJournal)
921 viewjournal_action->addTo( iconToolBar ); 927 viewjournal_action->addTo( iconToolBar );
922 icon = loadPixmap( pathString + "2leftarrowB" ); 928 icon = loadPixmap( pathString + "2leftarrowB" );
923 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 929 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
924 if (p-> mShowIconBackFast) { 930 if (p-> mShowIconBackFast) {
925 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 931 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
926 connect( action, SIGNAL( activated() ), 932 connect( action, SIGNAL( activated() ),
927 mView, SLOT( goPreviousMonth() ) ); 933 mView, SLOT( goPreviousMonth() ) );
928 action->addTo( iconToolBar ); 934 action->addTo( iconToolBar );
929 } 935 }
930 icon = loadPixmap( pathString + "1leftarrowB" ); 936 icon = loadPixmap( pathString + "1leftarrowB" );
931 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 937 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
932 if (p-> mShowIconBack) { 938 if (p-> mShowIconBack) {
933 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 939 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
934 connect( action, SIGNAL( activated() ), 940 connect( action, SIGNAL( activated() ),
935 mView, SLOT( goPrevious() ) ); 941 mView, SLOT( goPrevious() ) );
936 action->addTo( iconToolBar ); 942 action->addTo( iconToolBar );
937 } 943 }
938 if (p-> mShowIconToday) 944 if (p-> mShowIconToday)
939 today_action->addTo( iconToolBar ); 945 today_action->addTo( iconToolBar );
940 icon = loadPixmap( pathString + "1rightarrowB" ); 946 icon = loadPixmap( pathString + "1rightarrowB" );
941 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 947 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
942 if (p-> mShowIconForward) { 948 if (p-> mShowIconForward) {
943 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 949 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
944 connect( action, SIGNAL( activated() ), 950 connect( action, SIGNAL( activated() ),
945 mView, SLOT( goNext() ) ); 951 mView, SLOT( goNext() ) );
946 action->addTo( iconToolBar ); 952 action->addTo( iconToolBar );
947 } 953 }
948 icon = loadPixmap( pathString + "2rightarrowB" ); 954 icon = loadPixmap( pathString + "2rightarrowB" );
949 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 955 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
950 if (p-> mShowIconForwardFast) { 956 if (p-> mShowIconForwardFast) {
951 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 957 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
952 connect( action, SIGNAL( activated() ), 958 connect( action, SIGNAL( activated() ),
953 mView, SLOT( goNextMonth() ) ); 959 mView, SLOT( goNextMonth() ) );
954 action->addTo( iconToolBar ); 960 action->addTo( iconToolBar );
955 } 961 }
956 962
957 963
958 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 964 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
959 965
960 if (p-> mShowIconNewEvent) 966 if (p-> mShowIconNewEvent)
961 configureToolBarMenu->setItemChecked( 10, true ); 967 configureToolBarMenu->setItemChecked( 10, true );
962 if (p->mShowIconNewTodo ) 968 if (p->mShowIconNewTodo )
963 configureToolBarMenu->setItemChecked( 20, true ); 969 configureToolBarMenu->setItemChecked( 20, true );
964 if (p-> mShowIconSearch) 970 if (p-> mShowIconSearch)
965 configureToolBarMenu->setItemChecked( 120, true ); 971 configureToolBarMenu->setItemChecked( 120, true );
966 if (p-> mShowIconList) 972 if (p-> mShowIconList)
967 configureToolBarMenu->setItemChecked( 30, true ); 973 configureToolBarMenu->setItemChecked( 30, true );
968 if (p-> mShowIconDay1) 974 if (p-> mShowIconDay1)
969 configureToolBarMenu->setItemChecked( 40, true ); 975 configureToolBarMenu->setItemChecked( 40, true );
970 if (p-> mShowIconDay5) 976 if (p-> mShowIconDay5)
971 configureToolBarMenu->setItemChecked( 50, true ); 977 configureToolBarMenu->setItemChecked( 50, true );
972 if (p-> mShowIconDay7) 978 if (p-> mShowIconDay7)
973 configureToolBarMenu->setItemChecked( 60, true ); 979 configureToolBarMenu->setItemChecked( 60, true );
974 if (p-> mShowIconMonth) 980 if (p-> mShowIconMonth)
975 configureToolBarMenu->setItemChecked( 70, true ); 981 configureToolBarMenu->setItemChecked( 70, true );
976 if (p-> mShowIconTodoview) 982 if (p-> mShowIconTodoview)
977 configureToolBarMenu->setItemChecked( 80, true ); 983 configureToolBarMenu->setItemChecked( 80, true );
978 if (p-> mShowIconBackFast) 984 if (p-> mShowIconBackFast)
979 configureToolBarMenu->setItemChecked( 200, true ); 985 configureToolBarMenu->setItemChecked( 200, true );
980 if (p-> mShowIconBack) 986 if (p-> mShowIconBack)
981 configureToolBarMenu->setItemChecked( 210, true ); 987 configureToolBarMenu->setItemChecked( 210, true );
982 if (p-> mShowIconToday) 988 if (p-> mShowIconToday)
983 configureToolBarMenu->setItemChecked( 130, true ); 989 configureToolBarMenu->setItemChecked( 130, true );
984 if (p-> mShowIconForward) 990 if (p-> mShowIconForward)
985 configureToolBarMenu->setItemChecked( 220, true ); 991 configureToolBarMenu->setItemChecked( 220, true );
986 if (p-> mShowIconForwardFast) 992 if (p-> mShowIconForwardFast)
987 configureToolBarMenu->setItemChecked( 230, true ); 993 configureToolBarMenu->setItemChecked( 230, true );
988 if (p-> mShowIconNextDays) 994 if (p-> mShowIconNextDays)
989 configureToolBarMenu->setItemChecked( 100, true ); 995 configureToolBarMenu->setItemChecked( 100, true );
990 if (p-> mShowIconNext) 996 if (p-> mShowIconNext)
991 configureToolBarMenu->setItemChecked( 110, true ); 997 configureToolBarMenu->setItemChecked( 110, true );
992 if (p-> mShowIconJournal) 998 if (p-> mShowIconJournal)
993 configureToolBarMenu->setItemChecked( 90, true ); 999 configureToolBarMenu->setItemChecked( 90, true );
994 if (p-> mShowIconWhatsThis) 1000 if (p-> mShowIconWhatsThis)
995 configureToolBarMenu->setItemChecked( 300, true ); 1001 configureToolBarMenu->setItemChecked( 300, true );
996 1002
997 QLabel* dummy = new QLabel( iconToolBar ); 1003 QLabel* dummy = new QLabel( iconToolBar );
998 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1004 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
999 if (!p-> mShowIconStretch) 1005 if (!p-> mShowIconStretch)
1000 iconToolBar->setStretchableWidget ( dummy ) ; 1006 iconToolBar->setStretchableWidget ( dummy ) ;
1001 else 1007 else
1002 configureToolBarMenu->setItemChecked( 5, true ); 1008 configureToolBarMenu->setItemChecked( 5, true );
1003 if (p-> mShowIconWhatsThis) 1009 if (p-> mShowIconWhatsThis)
1004 QWhatsThis::whatsThisButton ( iconToolBar ); 1010 QWhatsThis::whatsThisButton ( iconToolBar );
1005 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1011 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1006 configureAgenda( p->mHourSize ); 1012 configureAgenda( p->mHourSize );
1007 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1013 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1008} 1014}
1009 1015
1010void MainWindow::exportToPhone( int mode ) 1016void MainWindow::exportToPhone( int mode )
1011{ 1017{
1012 1018
1013 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1019 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1014 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1020 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1015 KOex2phonePrefs ex2phone; 1021 KOex2phonePrefs ex2phone;
1016 1022
1017 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1023 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1018 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1024 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1019 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1025 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1020 if ( mode == 1 ) 1026 if ( mode == 1 )
1021 ex2phone.setCaption(i18n("Export complete calendar")); 1027 ex2phone.setCaption(i18n("Export complete calendar"));
1022 if ( mode == 2 ) 1028 if ( mode == 2 )
1023 ex2phone.setCaption(i18n("Export filtered calendar")); 1029 ex2phone.setCaption(i18n("Export filtered calendar"));
1024 1030
1025 if ( !ex2phone.exec() ) { 1031 if ( !ex2phone.exec() ) {
1026 return; 1032 return;
1027 } 1033 }
1028 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1034 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1029 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1035 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1030 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1036 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1031 1037
1032 int inFuture = 0; 1038 int inFuture = 0;
1033 if ( ex2phone.mWriteBackFuture->isChecked() ) 1039 if ( ex2phone.mWriteBackFuture->isChecked() )
1034 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1040 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1035 QPtrList<Incidence> delSel; 1041 QPtrList<Incidence> delSel;
1036 if ( mode == 1 ) 1042 if ( mode == 1 )
1037 delSel = mCalendar->rawIncidences(); 1043 delSel = mCalendar->rawIncidences();
1038 if ( mode == 2 ) 1044 if ( mode == 2 )
1039 delSel = mCalendar->incidences(); 1045 delSel = mCalendar->incidences();
1040 CalendarLocal* cal = new CalendarLocal(); 1046 CalendarLocal* cal = new CalendarLocal();
1041 cal->setLocalTime(); 1047 cal->setLocalTime();
1042 Incidence *incidence = delSel.first(); 1048 Incidence *incidence = delSel.first();
1043 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1049 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1044 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1050 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1045 while ( incidence ) { 1051 while ( incidence ) {
1046 if ( incidence->type() != "Journal" ) { 1052 if ( incidence->type() != "Journal" ) {
1047 bool add = true; 1053 bool add = true;
1048 if ( inFuture ) { 1054 if ( inFuture ) {
1049 QDateTime dt; 1055 QDateTime dt;
1050 if ( incidence->type() == "Todo" ) { 1056 if ( incidence->type() == "Todo" ) {
1051 Todo * t = (Todo*)incidence; 1057 Todo * t = (Todo*)incidence;
1052 if ( t->hasDueDate() ) 1058 if ( t->hasDueDate() )
1053 dt = t->dtDue(); 1059 dt = t->dtDue();
1054 else 1060 else
1055 dt = cur.addSecs( 62 ); 1061 dt = cur.addSecs( 62 );
1056 } 1062 }
1057 else { 1063 else {
1058 bool ok; 1064 bool ok;
1059 dt = incidence->getNextOccurence( cur, &ok ); 1065 dt = incidence->getNextOccurence( cur, &ok );
1060 if ( !ok ) 1066 if ( !ok )
1061 dt = cur.addSecs( -62 ); 1067 dt = cur.addSecs( -62 );
1062 } 1068 }
1063 if ( dt < cur || dt > end ) { 1069 if ( dt < cur || dt > end ) {
1064 add = false; 1070 add = false;
1065 } 1071 }
1066 } 1072 }
1067 if ( add ) { 1073 if ( add ) {
1068 Incidence *in = incidence->clone(); 1074 Incidence *in = incidence->clone();
1069 cal->addIncidence( in ); 1075 cal->addIncidence( in );
1070 } 1076 }
1071 } 1077 }
1072 incidence = delSel.next(); 1078 incidence = delSel.next();
1073 } 1079 }
1074 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1080 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1075 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1081 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1076 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1082 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1077 1083
1078 setCaption( i18n("Writing to phone...")); 1084 setCaption( i18n("Writing to phone..."));
1079 if ( PhoneFormat::writeToPhone( cal ) ) 1085 if ( PhoneFormat::writeToPhone( cal ) )
1080 setCaption( i18n("Export to phone successful!")); 1086 setCaption( i18n("Export to phone successful!"));
1081 else 1087 else
1082 setCaption( i18n("Error exporting to phone!")); 1088 setCaption( i18n("Error exporting to phone!"));
1083 delete cal; 1089 delete cal;
1084} 1090}
1085 1091
1086 1092
1087void MainWindow::setDefaultPreferences() 1093void MainWindow::setDefaultPreferences()
1088{ 1094{
1089 KOPrefs *p = KOPrefs::instance(); 1095 KOPrefs *p = KOPrefs::instance();
1090 1096
1091 p->mCompactDialogs = true; 1097 p->mCompactDialogs = true;
1092 p->mConfirm = true; 1098 p->mConfirm = true;
1093 // p->mEnableQuickTodo = false; 1099 // p->mEnableQuickTodo = false;
1094 1100
1095} 1101}
1096 1102
1097QString MainWindow::resourcePath() 1103QString MainWindow::resourcePath()
1098{ 1104{
1099 return KGlobal::iconLoader()->iconPath(); 1105 return KGlobal::iconLoader()->iconPath();
1100} 1106}
1101 1107
1102void MainWindow::displayText( QString text ,QString cap ) 1108void MainWindow::displayText( QString text ,QString cap )
1103{ 1109{
1104 QDialog dia( this, "name", true ); ; 1110 QDialog dia( this, "name", true ); ;
1105 dia.setCaption( cap ); 1111 dia.setCaption( cap );
1106 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1112 QVBoxLayout* lay = new QVBoxLayout( &dia );
1107 lay->setSpacing( 3 ); 1113 lay->setSpacing( 3 );
1108 lay->setMargin( 3 ); 1114 lay->setMargin( 3 );
1109 QTextBrowser tb ( &dia ); 1115 QTextBrowser tb ( &dia );
1110 lay->addWidget( &tb ); 1116 lay->addWidget( &tb );
1111 tb.setText( text ); 1117 tb.setText( text );
1112#ifdef DESKTOP_VERSION 1118#ifdef DESKTOP_VERSION
1113 dia.resize( 640, 480); 1119 dia.resize( 640, 480);
1114#else 1120#else
1115 dia.showMaximized(); 1121 dia.showMaximized();
1116#endif 1122#endif
1117 dia.exec(); 1123 dia.exec();
1118} 1124}
1119void MainWindow::displayFile( QString fn, QString cap ) 1125void MainWindow::displayFile( QString fn, QString cap )
1120{ 1126{
1121 QString fileName = resourcePath() + fn; 1127 QString fileName = resourcePath() + fn;
1122 QString text; 1128 QString text;
1123 QFile file( fileName ); 1129 QFile file( fileName );
1124 if (!file.open( IO_ReadOnly ) ) { 1130 if (!file.open( IO_ReadOnly ) ) {
1125 return ; 1131 return ;
1126 1132
1127 } 1133 }
1128 QTextStream ts( &file ); 1134 QTextStream ts( &file );
1129 text = ts.read(); 1135 text = ts.read();
1130 file.close(); 1136 file.close();
1131 displayText( text, cap); 1137 displayText( text, cap);
1132} 1138}
1133void MainWindow::features() 1139void MainWindow::features()
1134{ 1140{
1135 1141
1136 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); 1142 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") );
1137} 1143}
1138 1144
1139void MainWindow::usertrans() 1145void MainWindow::usertrans()
1140{ 1146{
1141 1147
1142 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); 1148 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") );
1143} 1149}
1144 1150
1145void MainWindow::synchowto() 1151void MainWindow::synchowto()
1146{ 1152{
1147 1153
1148 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1154 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1149} 1155}
1150void MainWindow::faq() 1156void MainWindow::faq()
1151{ 1157{
1152 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); 1158 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") );
1153 1159
1154} 1160}
1155void MainWindow::whatsNew() 1161void MainWindow::whatsNew()
1156{ 1162{
1157 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1163 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1158 1164
1159} 1165}
1160void MainWindow::licence() 1166void MainWindow::licence()
1161{ 1167{
1162 KApplication::showLicence(); 1168 KApplication::showLicence();
1163 1169
1164} 1170}
1165void MainWindow::about() 1171void MainWindow::about()
1166{ 1172{
1167 QString version; 1173 QString version;
1168#include <../version> 1174#include <../version>
1169 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1175 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1170 i18n("KOrganizer/Platform-independent\n") + 1176 i18n("KOrganizer/Platform-independent\n") +
1171 "(KO/Pi) " + version + " - " + 1177 "(KO/Pi) " + version + " - " +
1172 1178
1173#ifdef DESKTOP_VERSION 1179#ifdef DESKTOP_VERSION
1174 i18n("Desktop Edition\n") + 1180 i18n("Desktop Edition\n") +
1175#else 1181#else
1176 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + 1182 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") +
1177#endif 1183#endif
1178 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") ); 1184 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") );
1179} 1185}
1180void MainWindow::keyBindings() 1186void MainWindow::keyBindings()
1181{ 1187{
1182 QString cap = i18n("Key bindings KOrganizer/Pi"); 1188 QString cap = i18n("Key bindings KOrganizer/Pi");
1183 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1189 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1184 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1190 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1185 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1191 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1186 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1192 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1187 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1193 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1188 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1194 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1189 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1195 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1190 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1196 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1191 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1197 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1192 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1198 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1193 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1199 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1194 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1200 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1195 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1201 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1196 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1202 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1197 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1203 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1198 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1204 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1199 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1205 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1200 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1206 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1201 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1207 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1202 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1208 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1203 i18n("<p><h3>In agenda view:</h3></p>\n") + 1209 i18n("<p><h3>In agenda view:</h3></p>\n") +
1204 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1210 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1205 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1211 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1206 i18n("<p><h3>In todo view:</h3></p>\n") + 1212 i18n("<p><h3>In todo view:</h3></p>\n") +
1207 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1213 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1208 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1214 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1209 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1215 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1210 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1216 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1211 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1217 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1212 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1218 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1213 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1219 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1214 i18n("<p><h3>In list view:</h3></p>\n") + 1220 i18n("<p><h3>In list view:</h3></p>\n") +
1215 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1221 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1216 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1222 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1217 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1223 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1218 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1224 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1219 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1225 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1220 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1226 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1221 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1227 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1222 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1228 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1223 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1229 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1224 i18n("<p><b>E</b>: Edit item</p>\n") + 1230 i18n("<p><b>E</b>: Edit item</p>\n") +
1225 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1231 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1226 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1232 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1227 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1233 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1228 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1234 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1229 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1235 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1230 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1236 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1231 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1237 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1232 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1238 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1233 i18n("<p><b>White</b>: Item readonly</p>\n"); 1239 i18n("<p><b>White</b>: Item readonly</p>\n");
1234 displayText( text, cap); 1240 displayText( text, cap);
1235 1241
1236} 1242}
1237void MainWindow::aboutAutoSaving() 1243void MainWindow::aboutAutoSaving()
1238{ 1244{
1239 QMessageBox* msg; 1245 QMessageBox* msg;
1240 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), 1246 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"),
1241 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) 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"), QMessageBox::NoIcon, 1247 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) 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"), QMessageBox::NoIcon,
1242 QMessageBox::Ok, 1248 QMessageBox::Ok,
1243 QMessageBox::NoButton, 1249 QMessageBox::NoButton,
1244 QMessageBox::NoButton); 1250 QMessageBox::NoButton);
1245 msg->exec(); 1251 msg->exec();
1246 delete msg; 1252 delete msg;
1247 1253
1248 1254
1249} 1255}
1250void MainWindow::aboutKnownBugs() 1256void MainWindow::aboutKnownBugs()
1251{ 1257{
1252 QMessageBox* msg; 1258 QMessageBox* msg;
1253 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1259 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1254 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")+ 1260 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")+
1255 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1261 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1256 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1262 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1257 i18n("\nor report them in the bugtracker on\n") + 1263 i18n("\nor report them in the bugtracker on\n") +
1258 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1264 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1259 QMessageBox::NoIcon, 1265 QMessageBox::NoIcon,
1260 QMessageBox::Ok, 1266 QMessageBox::Ok,
1261 QMessageBox::NoButton, 1267 QMessageBox::NoButton,
1262 QMessageBox::NoButton); 1268 QMessageBox::NoButton);
1263 msg->exec(); 1269 msg->exec();
1264 delete msg; 1270 delete msg;
1265 1271
1266} 1272}
1267 1273
1268QString MainWindow::defaultFileName() 1274QString MainWindow::defaultFileName()
1269{ 1275{
1270 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1276 return locateLocal( "data", "korganizer/mycalendar.ics" );
1271} 1277}
1272QString MainWindow::syncFileName() 1278QString MainWindow::syncFileName()
1273{ 1279{
1274#ifdef DESKTOP_VERSION 1280#ifdef DESKTOP_VERSION
1275 return locateLocal( "tmp", "synccalendar.ics" ); 1281 return locateLocal( "tmp", "synccalendar.ics" );
1276#else 1282#else
1277 return QString( "/tmp/synccalendar.ics" ); 1283 return QString( "/tmp/synccalendar.ics" );
1278#endif 1284#endif
1279} 1285}
1280 1286
1281void MainWindow::processIncidenceSelection( Incidence *incidence ) 1287void MainWindow::processIncidenceSelection( Incidence *incidence )
1282{ 1288{
1283 if ( !incidence ) { 1289 if ( !incidence ) {
1284 enableIncidenceActions( false ); 1290 enableIncidenceActions( false );
1285 1291
1286 mNewSubTodoAction->setEnabled( false ); 1292 mNewSubTodoAction->setEnabled( false );
1287 setCaptionToDates(); 1293 setCaptionToDates();
1288 return; 1294 return;
1289 1295
1290 } 1296 }
1291 1297
1292 //KGlobal::locale()->formatDateTime(nextA, true); 1298 //KGlobal::locale()->formatDateTime(nextA, true);
1293 QString startString = ""; 1299 QString startString = "";
1294 if ( incidence->type() != "Todo" ) { 1300 if ( incidence->type() != "Todo" ) {
1295 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1301 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1296 if ( incidence->doesFloat() ) { 1302 if ( incidence->doesFloat() ) {
1297 startString += ": "+incidence->dtStartDateStr( true ); 1303 startString += ": "+incidence->dtStartDateStr( true );
1298 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1304 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1299 1305
1300 } else { 1306 } else {
1301 startString = ": "+incidence->dtStartStr(true); 1307 startString = ": "+incidence->dtStartStr(true);
1302 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1308 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1303 1309
1304 } 1310 }
1305 1311
1306 } else { 1312 } else {
1307 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1313 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1308 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1314 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1309 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1315 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1310 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1316 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1311 } 1317 }
1312 1318
1313 } 1319 }
1314 else 1320 else
1315 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1321 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1316 if ( !incidence->location().isEmpty() ) 1322 if ( !incidence->location().isEmpty() )
1317 startString += " (" +incidence->location()+")"; 1323 startString += " (" +incidence->location()+")";
1318 setCaption( incidence->summary()+startString); 1324 setCaption( incidence->summary()+startString);
1319 1325
1320 enableIncidenceActions( true ); 1326 enableIncidenceActions( true );
1321 1327
1322 if ( incidence->type() == "Event" ) { 1328 if ( incidence->type() == "Event" ) {
1323 mShowAction->setText( i18n("Show Event...") ); 1329 mShowAction->setText( i18n("Show Event...") );
1324 mEditAction->setText( i18n("Edit Event...") ); 1330 mEditAction->setText( i18n("Edit Event...") );
1325 mDeleteAction->setText( i18n("Delete Event...") ); 1331 mDeleteAction->setText( i18n("Delete Event...") );
1326 1332
1327 mNewSubTodoAction->setEnabled( false ); 1333 mNewSubTodoAction->setEnabled( false );
1328 } else if ( incidence->type() == "Todo" ) { 1334 } else if ( incidence->type() == "Todo" ) {
1329 mShowAction->setText( i18n("Show Todo...") ); 1335 mShowAction->setText( i18n("Show Todo...") );
1330 mEditAction->setText( i18n("Edit Todo...") ); 1336 mEditAction->setText( i18n("Edit Todo...") );
1331 mDeleteAction->setText( i18n("Delete Todo...") ); 1337 mDeleteAction->setText( i18n("Delete Todo...") );
1332 1338
1333 mNewSubTodoAction->setEnabled( true ); 1339 mNewSubTodoAction->setEnabled( true );
1334 } else { 1340 } else {
1335 mShowAction->setText( i18n("Show...") ); 1341 mShowAction->setText( i18n("Show...") );
1336 mShowAction->setText( i18n("Edit...") ); 1342 mShowAction->setText( i18n("Edit...") );
1337 mShowAction->setText( i18n("Delete...") ); 1343 mShowAction->setText( i18n("Delete...") );
1338 1344
1339 mNewSubTodoAction->setEnabled( false ); 1345 mNewSubTodoAction->setEnabled( false );
1340 } 1346 }
1341} 1347}
1342 1348
1343void MainWindow::enableIncidenceActions( bool enabled ) 1349void MainWindow::enableIncidenceActions( bool enabled )
1344{ 1350{
1345 mShowAction->setEnabled( enabled ); 1351 mShowAction->setEnabled( enabled );
1346 mEditAction->setEnabled( enabled ); 1352 mEditAction->setEnabled( enabled );
1347 mDeleteAction->setEnabled( enabled ); 1353 mDeleteAction->setEnabled( enabled );
1348 1354
1349 mCloneAction->setEnabled( enabled ); 1355 mCloneAction->setEnabled( enabled );
1350 mMoveAction->setEnabled( enabled ); 1356 mMoveAction->setEnabled( enabled );
1351 mBeamAction->setEnabled( enabled ); 1357 mBeamAction->setEnabled( enabled );
1352 mCancelAction->setEnabled( enabled ); 1358 mCancelAction->setEnabled( enabled );
1353} 1359}
1354 1360
1355void MainWindow::importOL() 1361void MainWindow::importOL()
1356{ 1362{
1357#ifdef _WIN32_ 1363#ifdef _WIN32_
1358 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1364 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1359 id->exec(); 1365 id->exec();
1360 delete id; 1366 delete id;
1361 mView->updateView(); 1367 mView->updateView();
1362#endif 1368#endif
1363} 1369}
1364void MainWindow::importBday() 1370void MainWindow::importBday()
1365{ 1371{
1366 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1372 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1367 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1373 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1368 i18n("Import!"), i18n("Cancel"), 0, 1374 i18n("Import!"), i18n("Cancel"), 0,
1369 0, 1 ); 1375 0, 1 );
1370 if ( result == 0 ) { 1376 if ( result == 0 ) {
1371 mView->importBday(); 1377 mView->importBday();
1372 1378
1373 } 1379 }
1374 1380
1375 1381
1376} 1382}
1377void MainWindow::importQtopia() 1383void MainWindow::importQtopia()
1378{ 1384{
1379#ifndef DESKTOP_VERSION 1385#ifndef DESKTOP_VERSION
1380 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1386 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1381 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"), 1387 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"),
1382 i18n("Import!"), i18n("Cancel"), 0, 1388 i18n("Import!"), i18n("Cancel"), 0,
1383 0, 1 ); 1389 0, 1 );
1384 if ( result == 0 ) { 1390 if ( result == 0 ) {
1385 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1391 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1386 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1392 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1387 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1393 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1388 mView->importQtopia( categories, datebook, todolist ); 1394 mView->importQtopia( categories, datebook, todolist );
1389 } 1395 }
1390#else 1396#else
1391 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1397 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1392 i18n("Not supported \non desktop!\n"), 1398 i18n("Not supported \non desktop!\n"),
1393 i18n("Ok"), i18n("Cancel"), 0, 1399 i18n("Ok"), i18n("Cancel"), 0,
1394 0, 1 ); 1400 0, 1 );
1395 1401
1396#endif 1402#endif
1397} 1403}
1398 1404
1399void MainWindow::saveOnClose() 1405void MainWindow::saveOnClose()
1400{ 1406{
1401 KOPrefs *p = KOPrefs::instance(); 1407 KOPrefs *p = KOPrefs::instance();
1402 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1408 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1403 p->mToolBarUp = iconToolBar->x() > width()/2 || 1409 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1404 iconToolBar->y() > height()/2; 1410 iconToolBar->y() > height()/2;
1405 mView->writeSettings(); 1411 mView->writeSettings();
1406 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1412 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1407 save(); 1413 save();
1408} 1414}
1409void MainWindow::slotModifiedChanged( bool changed ) 1415void MainWindow::slotModifiedChanged( bool changed )
1410{ 1416{
1411 if ( mBlockAtStartup ) 1417 if ( mBlockAtStartup )
1412 return; 1418 return;
1413 int msec; 1419 int msec;
1414 // we store the changes after 1 minute, 1420 // we store the changes after 1 minute,
1415 // and for safety reasons after 10 minutes again 1421 // and for safety reasons after 10 minutes again
1416 if ( !mSyncManager->blockSave() ) 1422 if ( !mSyncManager->blockSave() )
1417 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1423 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1418 else 1424 else
1419 msec = 1000 * 600; 1425 msec = 1000 * 600;
1420 mSaveTimer.start( msec, true ); // 1 minute 1426 mSaveTimer.start( msec, true ); // 1 minute
1421 qDebug("KO: Saving File in %d secs!", msec/1000); 1427 qDebug("KO: Saving File in %d secs!", msec/1000);
1422 mCalendarModifiedFlag = true; 1428 mCalendarModifiedFlag = true;
1423} 1429}
1424void MainWindow::save() 1430void MainWindow::save()
1425{ 1431{
1426 if ( mSyncManager->blockSave() ) 1432 if ( mSyncManager->blockSave() )
1427 return; 1433 return;
1428 mSyncManager->setBlockSave(true); 1434 mSyncManager->setBlockSave(true);
1429 if ( mView->checkFileVersion( defaultFileName()) ) { 1435 if ( mView->checkFileVersion( defaultFileName()) ) {
1430 1436
1431 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1437 QTime neededSaveTime = QDateTime::currentDateTime().time();
1432 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1438 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1433 qDebug("KO: Start saving data to file!"); 1439 qDebug("KO: Start saving data to file!");
1434 mView->saveCalendar( defaultFileName() ); 1440 mView->saveCalendar( defaultFileName() );
1435 1441
1436 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1442 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1437 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1443 qDebug("KO: Needed %d ms for saving.",msNeeded );
1438 QString savemes; 1444 QString savemes;
1439 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1445 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1440 setCaption(savemes); 1446 setCaption(savemes);
1441 } else 1447 } else
1442 setCaption(i18n("Saving cancelled!")); 1448 setCaption(i18n("Saving cancelled!"));
1443 mCalendarModifiedFlag = false; 1449 mCalendarModifiedFlag = false;
1444 mSyncManager->setBlockSave( false ); 1450 mSyncManager->setBlockSave( false );
1445} 1451}
1446 1452
1447void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1453void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1448{ 1454{
1449 if ( !e->isAutoRepeat() ) { 1455 if ( !e->isAutoRepeat() ) {
1450 mFlagKeyPressed = false; 1456 mFlagKeyPressed = false;
1451 } 1457 }
1452} 1458}
1453void MainWindow::keyPressEvent ( QKeyEvent * e ) 1459void MainWindow::keyPressEvent ( QKeyEvent * e )
1454{ 1460{
1455 qApp->processEvents(); 1461 qApp->processEvents();
1456 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1462 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1457 e->ignore(); 1463 e->ignore();
1458 // qDebug(" ignore %d",e->isAutoRepeat() ); 1464 // qDebug(" ignore %d",e->isAutoRepeat() );
1459 return; 1465 return;
1460 } 1466 }
1461 if (! e->isAutoRepeat() ) 1467 if (! e->isAutoRepeat() )
1462 mFlagKeyPressed = true; 1468 mFlagKeyPressed = true;
1463 KOPrefs *p = KOPrefs::instance(); 1469 KOPrefs *p = KOPrefs::instance();
1464 bool showSelectedDates = false; 1470 bool showSelectedDates = false;
1465 int size; 1471 int size;
1466 int pro = 0; 1472 int pro = 0;
1467 //qDebug("MainWindow::keyPressEvent "); 1473 //qDebug("MainWindow::keyPressEvent ");
1468 switch ( e->key() ) { 1474 switch ( e->key() ) {
1469 case Qt::Key_Right: 1475 case Qt::Key_Right:
1470 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1476 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1471 mView->goNextMonth(); 1477 mView->goNextMonth();
1472 else 1478 else
1473 mView->goNext(); 1479 mView->goNext();
1474 showSelectedDates = true; 1480 showSelectedDates = true;
1475 break; 1481 break;
1476 case Qt::Key_Left: 1482 case Qt::Key_Left:
1477 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1483 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1478 mView->goPreviousMonth(); 1484 mView->goPreviousMonth();
1479 else 1485 else
1480 mView->goPrevious(); 1486 mView->goPrevious();
1481 showSelectedDates = true; 1487 showSelectedDates = true;
1482 break; 1488 break;
1483 case Qt::Key_Down: 1489 case Qt::Key_Down:
1484 mView->viewManager()->agendaView()->scrollOneHourDown(); 1490 mView->viewManager()->agendaView()->scrollOneHourDown();
1485 break; 1491 break;
1486 case Qt::Key_Up: 1492 case Qt::Key_Up:
1487 mView->viewManager()->agendaView()->scrollOneHourUp(); 1493 mView->viewManager()->agendaView()->scrollOneHourUp();
1488 break; 1494 break;
1489 case Qt::Key_I: 1495 case Qt::Key_I:
1490 mView->showIncidence(); 1496 mView->showIncidence();
1491 break; 1497 break;
1492 case Qt::Key_Delete: 1498 case Qt::Key_Delete:
1493 case Qt::Key_Backspace: 1499 case Qt::Key_Backspace:
1494 mView->deleteIncidence(); 1500 mView->deleteIncidence();
1495 break; 1501 break;
1496 case Qt::Key_D: 1502 case Qt::Key_D:
1497 mView->viewManager()->showDayView(); 1503 mView->viewManager()->showDayView();
1498 showSelectedDates = true; 1504 showSelectedDates = true;
1499 break; 1505 break;
1500 case Qt::Key_O: 1506 case Qt::Key_O:
1501 mView->toggleFilerEnabled( ); 1507 mView->toggleFilerEnabled( );
1502 break; 1508 break;
1503 case Qt::Key_0: 1509 case Qt::Key_0:
1504 case Qt::Key_1: 1510 case Qt::Key_1:
1505 case Qt::Key_2: 1511 case Qt::Key_2:
1506 case Qt::Key_3: 1512 case Qt::Key_3:
1507 case Qt::Key_4: 1513 case Qt::Key_4:
1508 case Qt::Key_5: 1514 case Qt::Key_5:
1509 case Qt::Key_6: 1515 case Qt::Key_6:
1510 case Qt::Key_7: 1516 case Qt::Key_7:
1511 case Qt::Key_8: 1517 case Qt::Key_8:
1512 case Qt::Key_9: 1518 case Qt::Key_9:
1513 pro = e->key()-48; 1519 pro = e->key()-48;
1514 if ( pro == 0 ) 1520 if ( pro == 0 )
1515 pro = 10; 1521 pro = 10;
1516 if ( e->state() == Qt::ControlButton) 1522 if ( e->state() == Qt::ControlButton)
1517 pro += 10; 1523 pro += 10;
1518 break; 1524 break;
1519 case Qt::Key_M: 1525 case Qt::Key_M:
1520 mView->viewManager()->showMonthView(); 1526 mView->viewManager()->showMonthView();
1521 showSelectedDates = true; 1527 showSelectedDates = true;
1522 break; 1528 break;
1523 case Qt::Key_Insert: 1529 case Qt::Key_Insert:
1524 mView->newEvent(); 1530 mView->newEvent();
1525 break; 1531 break;
1526 case Qt::Key_S : 1532 case Qt::Key_S :
1527 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1533 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1528 mView->newSubTodo(); 1534 mView->newSubTodo();
1529 else 1535 else
1530 mView->dialogManager()->showSearchDialog(); 1536 mView->dialogManager()->showSearchDialog();
1531 break; 1537 break;
1532 case Qt::Key_Y : 1538 case Qt::Key_Y :
1533 case Qt::Key_Z : 1539 case Qt::Key_Z :
1534 mView->viewManager()->showWorkWeekView(); 1540 mView->viewManager()->showWorkWeekView();
1535 showSelectedDates = true; 1541 showSelectedDates = true;
1536 break; 1542 break;
1537 case Qt::Key_U : 1543 case Qt::Key_U :
1538 mView->viewManager()->showWeekView(); 1544 mView->viewManager()->showWeekView();
1539 showSelectedDates = true; 1545 showSelectedDates = true;
1540 break; 1546 break;
1541 case Qt::Key_H : 1547 case Qt::Key_H :
1542 keyBindings(); 1548 keyBindings();
1543 break; 1549 break;
1544 case Qt::Key_W: 1550 case Qt::Key_W:
1545 mView->viewManager()->showWhatsNextView(); 1551 mView->viewManager()->showWhatsNextView();
1546 break; 1552 break;
1547 case Qt::Key_L: 1553 case Qt::Key_L:
1548 mView->viewManager()->showListView(); 1554 mView->viewManager()->showListView();
1549 break; 1555 break;
1550 case Qt::Key_N: 1556 case Qt::Key_N:
1551 mView->viewManager()->showNextXView(); 1557 mView->viewManager()->showNextXView();
1552 showSelectedDates = true; 1558 showSelectedDates = true;
1553 break; 1559 break;
1554 case Qt::Key_V: 1560 case Qt::Key_V:
1555 mView->viewManager()->showTodoView(); 1561 mView->viewManager()->showTodoView();
1556 break; 1562 break;
1557 case Qt::Key_C: 1563 case Qt::Key_C:
1558 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1564 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1559 break; 1565 break;
1560 case Qt::Key_P: 1566 case Qt::Key_P:
1561 mView->showDatePicker( ); 1567 mView->showDatePicker( );
1562 break; 1568 break;
1563 case Qt::Key_F: 1569 case Qt::Key_F:
1564 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1570 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1565 mView->editFilters(); 1571 mView->editFilters();
1566 else 1572 else
1567 mView->toggleFilter(); 1573 mView->toggleFilter();
1568 break; 1574 break;
1569 case Qt::Key_X: 1575 case Qt::Key_X:
1570 mView->toggleDateNavigatorWidget(); 1576 mView->toggleDateNavigatorWidget();
1571 break; 1577 break;
1572 case Qt::Key_Space: 1578 case Qt::Key_Space:
1573 mView->toggleExpand(); 1579 mView->toggleExpand();
1574 break; 1580 break;
1575 case Qt::Key_A: 1581 case Qt::Key_A:
1576 mView->toggleAllDaySize(); 1582 mView->toggleAllDaySize();
1577 break; 1583 break;
1578 case Qt::Key_T: 1584 case Qt::Key_T:
1579 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1585 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1580 mView->newTodo(); 1586 mView->newTodo();
1581 else { 1587 else {
1582 mView->goToday(); 1588 mView->goToday();
1583 showSelectedDates = true; 1589 showSelectedDates = true;
1584 } 1590 }
1585 break; 1591 break;
1586 case Qt::Key_J: 1592 case Qt::Key_J:
1587 mView->viewManager()->showJournalView(); 1593 mView->viewManager()->showJournalView();
1588 break; 1594 break;
1589 case Qt::Key_B: 1595 case Qt::Key_B:
1590 mView->editIncidenceDescription();; 1596 mView->editIncidenceDescription();;
1591 break; 1597 break;
1592 // case Qt::Key_Return: 1598 // case Qt::Key_Return:
1593 case Qt::Key_E: 1599 case Qt::Key_E:
1594 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1600 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1595 mView->newEvent(); 1601 mView->newEvent();
1596 else 1602 else
1597 mView->editIncidence(); 1603 mView->editIncidence();
1598 break; 1604 break;
1599 case Qt::Key_Plus: 1605 case Qt::Key_Plus:
1600 size = p->mHourSize +2; 1606 size = p->mHourSize +2;
1601 if ( size <= 18 ) 1607 if ( size <= 18 )
1602 configureAgenda( size ); 1608 configureAgenda( size );
1603 break; 1609 break;
1604 case Qt::Key_Minus: 1610 case Qt::Key_Minus:
1605 size = p->mHourSize - 2; 1611 size = p->mHourSize - 2;
1606 if ( size >= 4 ) 1612 if ( size >= 4 )
1607 configureAgenda( size ); 1613 configureAgenda( size );
1608 break; 1614 break;
1609 1615
1610 1616
1611 default: 1617 default:
1612 e->ignore(); 1618 e->ignore();
1613 } 1619 }
1614 if ( pro > 0 ) { 1620 if ( pro > 0 ) {
1615 mView->selectFilter( pro-1 ); 1621 mView->selectFilter( pro-1 );
1616 } 1622 }
1617 if ( showSelectedDates ) { 1623 if ( showSelectedDates ) {
1618 ;// setCaptionToDates(); 1624 ;// setCaptionToDates();
1619 } 1625 }
1620 1626
1621} 1627}
1622 1628
1623void MainWindow::fillFilterMenu() 1629void MainWindow::fillFilterMenu()
1624{ 1630{
1625 selectFilterMenu->clear(); 1631 selectFilterMenu->clear();
1626 bool disable = false; 1632 bool disable = false;
1627 if ( mView->filterView()->filtersEnabled() ) { 1633 if ( mView->filterView()->filtersEnabled() ) {
1628 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); 1634 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 );
1629 } 1635 }
1630 else { 1636 else {
1631 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); 1637 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 );
1632 disable = true; 1638 disable = true;
1633 } 1639 }
1634 selectFilterMenu->insertSeparator(); 1640 selectFilterMenu->insertSeparator();
1635 QPtrList<CalFilter> fili = mView->filters(); 1641 QPtrList<CalFilter> fili = mView->filters();
1636 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1642 CalFilter *curfilter = mView->filterView()->selectedFilter();
1637 CalFilter *filter = fili.first(); 1643 CalFilter *filter = fili.first();
1638 int iii = 1; 1644 int iii = 1;
1639 while(filter) { 1645 while(filter) {
1640 selectFilterMenu->insertItem( filter->name(), iii ); 1646 selectFilterMenu->insertItem( filter->name(), iii );
1641 if ( filter == curfilter) 1647 if ( filter == curfilter)
1642 selectFilterMenu->setItemChecked( iii, true ); 1648 selectFilterMenu->setItemChecked( iii, true );
1643 if ( disable ) 1649 if ( disable )
1644 selectFilterMenu->setItemEnabled( iii, false ); 1650 selectFilterMenu->setItemEnabled( iii, false );
1645 filter = fili.next(); 1651 filter = fili.next();
1646 ++iii; 1652 ++iii;
1647 } 1653 }
1648} 1654}
1649void MainWindow::selectFilter( int fil ) 1655void MainWindow::selectFilter( int fil )
1650{ 1656{
1651 if ( fil == 0 ) { 1657 if ( fil == 0 ) {
1652 mView->toggleFilerEnabled( ); 1658 mView->toggleFilerEnabled( );
1653 } else { 1659 } else {
1654 mView->selectFilter( fil-1 ); 1660 mView->selectFilter( fil-1 );
1655 } 1661 }
1656} 1662}
1657void MainWindow::configureToolBar( int item ) 1663void MainWindow::configureToolBar( int item )
1658{ 1664{
1659 1665
1660 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1666 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1661 KOPrefs *p = KOPrefs::instance(); 1667 KOPrefs *p = KOPrefs::instance();
1662 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1668 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1663 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1669 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1664 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1670 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1665 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1671 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1666 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1672 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1667 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1673 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1668 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1674 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1669 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1675 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1670 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1676 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1671 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1677 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1672 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1678 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1673 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1679 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1674 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1680 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1675 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 1681 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1676 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 1682 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1677 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1683 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1678 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1684 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1679 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1685 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1680 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1686 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1681 // initActions(); 1687 // initActions();
1682} 1688}
1683 1689
1684void MainWindow::setCaptionToDates() 1690void MainWindow::setCaptionToDates()
1685{ 1691{
1686 QString selDates; 1692 QString selDates;
1687 selDates = KGlobal::locale()->formatDate(mView->startDate(), true); 1693 selDates = KGlobal::locale()->formatDate(mView->startDate(), true);
1688 if (mView->startDate() < mView->endDate() ) 1694 if (mView->startDate() < mView->endDate() )
1689 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1695 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1690 setCaption( i18n("Dates: ") + selDates ); 1696 setCaption( i18n("Dates: ") + selDates );
1691 1697
1692} 1698}
1693// parameter item == 0: reinit 1699// parameter item == 0: reinit
1694void MainWindow::configureAgenda( int item ) 1700void MainWindow::configureAgenda( int item )
1695{ 1701{
1696 1702
1697 KOPrefs *p = KOPrefs::instance(); 1703 KOPrefs *p = KOPrefs::instance();
1698 1704
1699 int i; 1705 int i;
1700 if ( item == 1 ) { 1706 if ( item == 1 ) {
1701 mView->toggleAllDaySize(); 1707 mView->toggleAllDaySize();
1702 return; 1708 return;
1703 } 1709 }
1704 // do not allow 4 for widgets higher than 480 1710 // do not allow 4 for widgets higher than 480
1705 // if ( QApplication::desktop()->height() > 480 ) { 1711 // if ( QApplication::desktop()->height() > 480 ) {
1706// if ( item == 4 ) 1712// if ( item == 4 )
1707// item = 6; 1713// item = 6;
1708// } 1714// }
1709 for ( i = 4; i <= 18; i= i+2 ) 1715 for ( i = 4; i <= 18; i= i+2 )
1710 configureAgendaMenu->setItemChecked( i, false ); 1716 configureAgendaMenu->setItemChecked( i, false );
1711 configureAgendaMenu->setItemChecked( item, true ); 1717 configureAgendaMenu->setItemChecked( item, true );
1712 if ( p->mHourSize == item ) 1718 if ( p->mHourSize == item )
1713 return; 1719 return;
1714 p->mHourSize=item; 1720 p->mHourSize=item;
1715 mView->viewManager()->agendaView()->updateConfig(); 1721 mView->viewManager()->agendaView()->updateConfig();
1716} 1722}
1717 1723
1718void MainWindow::saveCalendar() 1724void MainWindow::saveCalendar()
1719{ 1725{
1720 QString fn = KOPrefs::instance()->mLastSaveFile; 1726 QString fn = KOPrefs::instance()->mLastSaveFile;
1721 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 1727 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
1722 1728
1723 if ( fn == "" ) 1729 if ( fn == "" )
1724 return; 1730 return;
1725 QFileInfo info; 1731 QFileInfo info;
1726 info.setFile( fn ); 1732 info.setFile( fn );
1727 QString mes; 1733 QString mes;
1728 bool createbup = true; 1734 bool createbup = true;
1729 if ( info. exists() ) { 1735 if ( info. exists() ) {
1730 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 1736 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
1731 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1737 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1732 i18n("Overwrite!"), i18n("Cancel"), 0, 1738 i18n("Overwrite!"), i18n("Cancel"), 0,
1733 0, 1 ); 1739 0, 1 );
1734 if ( result != 0 ) { 1740 if ( result != 0 ) {
1735 createbup = false; 1741 createbup = false;
1736 } 1742 }
1737 } 1743 }
1738 if ( createbup ) { 1744 if ( createbup ) {
1739 mView->saveCalendar( fn ); 1745 mView->saveCalendar( fn );
1740 mes = i18n("KO/Pi:Saved %1").arg(fn); 1746 mes = i18n("KO/Pi:Saved %1").arg(fn);
1741 KOPrefs::instance()->mLastSaveFile = fn; 1747 KOPrefs::instance()->mLastSaveFile = fn;
1742 setCaption(mes); 1748 setCaption(mes);
1743 } 1749 }
1744} 1750}
1745void MainWindow::loadCalendar() 1751void MainWindow::loadCalendar()
1746{ 1752{
1747 1753
1748 QString fn = KOPrefs::instance()->mLastLoadFile; 1754 QString fn = KOPrefs::instance()->mLastLoadFile;
1749 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 1755 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
1750 1756
1751 if ( fn == "" ) 1757 if ( fn == "" )
1752 return; 1758 return;
1753 QFileInfo info; 1759 QFileInfo info;
1754 info.setFile( fn ); 1760 info.setFile( fn );
1755 QString mess; 1761 QString mess;
1756 bool loadbup = true; 1762 bool loadbup = true;
1757 if ( info. exists() ) { 1763 if ( info. exists() ) {
1758 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1764 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1759 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 1765 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
1760 mess, 1766 mess,
1761 i18n("Load!"), i18n("Cancel"), 0, 1767 i18n("Load!"), i18n("Cancel"), 0,
1762 0, 1 ); 1768 0, 1 );
1763 if ( result != 0 ) { 1769 if ( result != 0 ) {
1764 loadbup = false; 1770 loadbup = false;
1765 } 1771 }
1766 } else { 1772 } else {
1767 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1773 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1768 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 1774 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
1769 0, 1 ); 1775 0, 1 );
1770 1776
1771 return; 1777 return;
1772 } 1778 }
1773 if ( loadbup ) { 1779 if ( loadbup ) {
1774 mView->openCalendar( fn ); 1780 mView->openCalendar( fn );
1775 KOPrefs::instance()->mLastLoadFile = fn; 1781 KOPrefs::instance()->mLastLoadFile = fn;
1776 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 1782 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
1777 setCaption(mess); 1783 setCaption(mess);
1778 } 1784 }
1779 1785
1780} 1786}
1781void MainWindow::quickImportIcal() 1787void MainWindow::quickImportIcal()
1782{ 1788{
1783 importFile( KOPrefs::instance()->mLastImportFile, false ); 1789 importFile( KOPrefs::instance()->mLastImportFile, false );
1784} 1790}
1785void MainWindow::importFile( QString fn, bool quick ) 1791void MainWindow::importFile( QString fn, bool quick )
1786{ 1792{
1787 QFileInfo info; 1793 QFileInfo info;
1788 info.setFile( fn ); 1794 info.setFile( fn );
1789 QString mess; 1795 QString mess;
1790 bool loadbup = true; 1796 bool loadbup = true;
1791 if ( !info. exists() ) { 1797 if ( !info. exists() ) {
1792 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 1798 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
1793 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1799 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1794 mess ); 1800 mess );
1795 return; 1801 return;
1796 } 1802 }
1797 int result = 0; 1803 int result = 0;
1798 if ( !quick ) { 1804 if ( !quick ) {
1799 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 )); 1805 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 ));
1800 result = QMessageBox::warning( this, "KO/Pi: Warning!", 1806 result = QMessageBox::warning( this, "KO/Pi: Warning!",
1801 mess, 1807 mess,
1802 "Import", "Cancel", 0, 1808 "Import", "Cancel", 0,
1803 0, 1 ); 1809 0, 1 );
1804 } 1810 }
1805 if ( result == 0 ) { 1811 if ( result == 0 ) {
1806 if ( mView->openCalendar( fn, true )) { 1812 if ( mView->openCalendar( fn, true )) {
1807 KOPrefs::instance()->mLastImportFile = fn; 1813 KOPrefs::instance()->mLastImportFile = fn;
1808 setCaption(i18n("Imported file successfully")); 1814 setCaption(i18n("Imported file successfully"));
1809 } else { 1815 } else {
1810 setCaption(i18n("Error importing file")); 1816 setCaption(i18n("Error importing file"));
1811 } 1817 }
1812 } 1818 }
1813} 1819}
1814 1820
1815void MainWindow::importIcal() 1821void MainWindow::importIcal()
1816{ 1822{
1817 1823
1818 QString fn =KOPrefs::instance()->mLastImportFile; 1824 QString fn =KOPrefs::instance()->mLastImportFile;
1819 1825
1820 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 1826 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
1821 if ( fn == "" ) 1827 if ( fn == "" )
1822 return; 1828 return;
1823 importFile( fn, true ); 1829 importFile( fn, true );
1824 1830
1825} 1831}
1826 1832
1827void MainWindow::exportVCalendar() 1833void MainWindow::exportVCalendar()
1828{ 1834{
1829 QString fn = KOPrefs::instance()->mLastVcalFile; 1835 QString fn = KOPrefs::instance()->mLastVcalFile;
1830 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 1836 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
1831 if ( fn == "" ) 1837 if ( fn == "" )
1832 return; 1838 return;
1833 QFileInfo info; 1839 QFileInfo info;
1834 info.setFile( fn ); 1840 info.setFile( fn );
1835 QString mes; 1841 QString mes;
1836 bool createbup = true; 1842 bool createbup = true;
1837 if ( info. exists() ) { 1843 if ( info. exists() ) {
1838 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 1844 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
1839 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1845 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1840 i18n("Overwrite!"), i18n("Cancel"), 0, 1846 i18n("Overwrite!"), i18n("Cancel"), 0,
1841 0, 1 ); 1847 0, 1 );
1842 if ( result != 0 ) { 1848 if ( result != 0 ) {
1843 createbup = false; 1849 createbup = false;
1844 } 1850 }
1845 } 1851 }