summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp1
-rw-r--r--korganizer/mainwindow.cpp4
2 files changed, 4 insertions, 1 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 3ab06c4..2e408b7 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,1360 +1,1361 @@
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} 316}
317 317
318KABCore::~KABCore() 318KABCore::~KABCore()
319{ 319{
320 // save(); 320 // save();
321 //saveSettings(); 321 //saveSettings();
322 //KABPrefs::instance()->writeConfig(); 322 //KABPrefs::instance()->writeConfig();
323 delete AddresseeConfig::instance(); 323 delete AddresseeConfig::instance();
324 mAddressBook = 0; 324 mAddressBook = 0;
325 KABC::StdAddressBook::close(); 325 KABC::StdAddressBook::close();
326 326
327 delete syncManager; 327 delete syncManager;
328 328
329} 329}
330 330
331void KABCore::recieve( QString fn ) 331void KABCore::recieve( QString fn )
332{ 332{
333 //qDebug("KABCore::recieve "); 333 //qDebug("KABCore::recieve ");
334 int count = mAddressBook->importFromFile( fn, true ); 334 int count = mAddressBook->importFromFile( fn, true );
335 mViewManager->refreshView(); 335 mViewManager->refreshView();
336 message(i18n("%1 contact(s) received!").arg( count )); 336 message(i18n("%1 contact(s) received!").arg( count ));
337 topLevelWidget()->showMaximized();
337 topLevelWidget()->raise(); 338 topLevelWidget()->raise();
338} 339}
339void KABCore::restoreSettings() 340void KABCore::restoreSettings()
340{ 341{
341 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 342 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
342 343
343 bool state; 344 bool state;
344 345
345 if (mMultipleViewsAtOnce) 346 if (mMultipleViewsAtOnce)
346 state = KABPrefs::instance()->mDetailsPageVisible; 347 state = KABPrefs::instance()->mDetailsPageVisible;
347 else 348 else
348 state = false; 349 state = false;
349 350
350 mActionDetails->setChecked( state ); 351 mActionDetails->setChecked( state );
351 setDetailsVisible( state ); 352 setDetailsVisible( state );
352 353
353 state = KABPrefs::instance()->mJumpButtonBarVisible; 354 state = KABPrefs::instance()->mJumpButtonBarVisible;
354 355
355 mActionJumpBar->setChecked( state ); 356 mActionJumpBar->setChecked( state );
356 setJumpButtonBarVisible( state ); 357 setJumpButtonBarVisible( state );
357/*US 358/*US
358 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 359 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
359 if ( splitterSize.count() == 0 ) { 360 if ( splitterSize.count() == 0 ) {
360 splitterSize.append( width() / 2 ); 361 splitterSize.append( width() / 2 );
361 splitterSize.append( width() / 2 ); 362 splitterSize.append( width() / 2 );
362 } 363 }
363 mMiniSplitter->setSizes( splitterSize ); 364 mMiniSplitter->setSizes( splitterSize );
364 if ( mExtensionBarSplitter ) { 365 if ( mExtensionBarSplitter ) {
365 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 366 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
366 if ( splitterSize.count() == 0 ) { 367 if ( splitterSize.count() == 0 ) {
367 splitterSize.append( width() / 2 ); 368 splitterSize.append( width() / 2 );
368 splitterSize.append( width() / 2 ); 369 splitterSize.append( width() / 2 );
369 } 370 }
370 mExtensionBarSplitter->setSizes( splitterSize ); 371 mExtensionBarSplitter->setSizes( splitterSize );
371 372
372 } 373 }
373*/ 374*/
374 mViewManager->restoreSettings(); 375 mViewManager->restoreSettings();
375 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 376 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
376 mExtensionManager->restoreSettings(); 377 mExtensionManager->restoreSettings();
377#ifdef DESKTOP_VERSION 378#ifdef DESKTOP_VERSION
378 int wid = width(); 379 int wid = width();
379 if ( wid < 10 ) 380 if ( wid < 10 )
380 wid = 400; 381 wid = 400;
381#else 382#else
382 int wid = QApplication::desktop()->width(); 383 int wid = QApplication::desktop()->width();
383 if ( wid < 640 ) 384 if ( wid < 640 )
384 wid = QApplication::desktop()->height(); 385 wid = QApplication::desktop()->height();
385#endif 386#endif
386 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 387 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
387 if ( true /*splitterSize.count() == 0*/ ) { 388 if ( true /*splitterSize.count() == 0*/ ) {
388 splitterSize.append( wid / 2 ); 389 splitterSize.append( wid / 2 );
389 splitterSize.append( wid / 2 ); 390 splitterSize.append( wid / 2 );
390 } 391 }
391 mMiniSplitter->setSizes( splitterSize ); 392 mMiniSplitter->setSizes( splitterSize );
392 if ( mExtensionBarSplitter ) { 393 if ( mExtensionBarSplitter ) {
393 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 394 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
394 if ( true /*splitterSize.count() == 0*/ ) { 395 if ( true /*splitterSize.count() == 0*/ ) {
395 splitterSize.append( wid / 2 ); 396 splitterSize.append( wid / 2 );
396 splitterSize.append( wid / 2 ); 397 splitterSize.append( wid / 2 );
397 } 398 }
398 mExtensionBarSplitter->setSizes( splitterSize ); 399 mExtensionBarSplitter->setSizes( splitterSize );
399 400
400 } 401 }
401 402
402 403
403} 404}
404 405
405void KABCore::saveSettings() 406void KABCore::saveSettings()
406{ 407{
407 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 408 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
408 if ( mExtensionBarSplitter ) 409 if ( mExtensionBarSplitter )
409 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 410 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
410 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 411 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
411 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 412 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
412#ifndef KAB_EMBEDDED 413#ifndef KAB_EMBEDDED
413 414
414 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 415 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
415 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 416 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
416#endif //KAB_EMBEDDED 417#endif //KAB_EMBEDDED
417 mExtensionManager->saveSettings(); 418 mExtensionManager->saveSettings();
418 mViewManager->saveSettings(); 419 mViewManager->saveSettings();
419 420
420 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 421 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
421} 422}
422 423
423KABC::AddressBook *KABCore::addressBook() const 424KABC::AddressBook *KABCore::addressBook() const
424{ 425{
425 return mAddressBook; 426 return mAddressBook;
426} 427}
427 428
428KConfig *KABCore::config() 429KConfig *KABCore::config()
429{ 430{
430#ifndef KAB_EMBEDDED 431#ifndef KAB_EMBEDDED
431 return KABPrefs::instance()->config(); 432 return KABPrefs::instance()->config();
432#else //KAB_EMBEDDED 433#else //KAB_EMBEDDED
433 return KABPrefs::instance()->getConfig(); 434 return KABPrefs::instance()->getConfig();
434#endif //KAB_EMBEDDED 435#endif //KAB_EMBEDDED
435} 436}
436 437
437KActionCollection *KABCore::actionCollection() const 438KActionCollection *KABCore::actionCollection() const
438{ 439{
439 return mGUIClient->actionCollection(); 440 return mGUIClient->actionCollection();
440} 441}
441 442
442KABC::Field *KABCore::currentSearchField() const 443KABC::Field *KABCore::currentSearchField() const
443{ 444{
444 if (mIncSearchWidget) 445 if (mIncSearchWidget)
445 return mIncSearchWidget->currentField(); 446 return mIncSearchWidget->currentField();
446 else 447 else
447 return 0; 448 return 0;
448} 449}
449 450
450QStringList KABCore::selectedUIDs() const 451QStringList KABCore::selectedUIDs() const
451{ 452{
452 return mViewManager->selectedUids(); 453 return mViewManager->selectedUids();
453} 454}
454 455
455KABC::Resource *KABCore::requestResource( QWidget *parent ) 456KABC::Resource *KABCore::requestResource( QWidget *parent )
456{ 457{
457 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 458 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
458 459
459 QPtrList<KRES::Resource> kresResources; 460 QPtrList<KRES::Resource> kresResources;
460 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 461 QPtrListIterator<KABC::Resource> resIt( kabcResources );
461 KABC::Resource *resource; 462 KABC::Resource *resource;
462 while ( ( resource = resIt.current() ) != 0 ) { 463 while ( ( resource = resIt.current() ) != 0 ) {
463 ++resIt; 464 ++resIt;
464 if ( !resource->readOnly() ) { 465 if ( !resource->readOnly() ) {
465 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 466 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
466 if ( res ) 467 if ( res )
467 kresResources.append( res ); 468 kresResources.append( res );
468 } 469 }
469 } 470 }
470 471
471 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 472 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
472 return static_cast<KABC::Resource*>( res ); 473 return static_cast<KABC::Resource*>( res );
473} 474}
474 475
475#ifndef KAB_EMBEDDED 476#ifndef KAB_EMBEDDED
476KAboutData *KABCore::createAboutData() 477KAboutData *KABCore::createAboutData()
477#else //KAB_EMBEDDED 478#else //KAB_EMBEDDED
478void KABCore::createAboutData() 479void KABCore::createAboutData()
479#endif //KAB_EMBEDDED 480#endif //KAB_EMBEDDED
480{ 481{
481#ifndef KAB_EMBEDDED 482#ifndef KAB_EMBEDDED
482 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 483 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
483 "3.1", I18N_NOOP( "The KDE Address Book" ), 484 "3.1", I18N_NOOP( "The KDE Address Book" ),
484 KAboutData::License_GPL_V2, 485 KAboutData::License_GPL_V2,
485 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 486 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
486 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 487 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
487 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 488 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
488 about->addAuthor( "Cornelius Schumacher", 489 about->addAuthor( "Cornelius Schumacher",
489 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 490 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
490 "schumacher@kde.org" ); 491 "schumacher@kde.org" );
491 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 492 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
492 "mpilone@slac.com" ); 493 "mpilone@slac.com" );
493 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 494 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
494 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 495 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
495 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 496 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
496 "michel@klaralvdalens-datakonsult.se" ); 497 "michel@klaralvdalens-datakonsult.se" );
497 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 498 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
498 "hansen@kde.org" ); 499 "hansen@kde.org" );
499 500
500 return about; 501 return about;
501#endif //KAB_EMBEDDED 502#endif //KAB_EMBEDDED
502 503
503 QString version; 504 QString version;
504#include <../version> 505#include <../version>
505 QMessageBox::about( this, "About KAddressbook/Pi", 506 QMessageBox::about( this, "About KAddressbook/Pi",
506 "KAddressbook/Platform-independent\n" 507 "KAddressbook/Platform-independent\n"
507 "(KA/Pi) " +version + " - " + 508 "(KA/Pi) " +version + " - " +
508#ifdef DESKTOP_VERSION 509#ifdef DESKTOP_VERSION
509 "Desktop Edition\n" 510 "Desktop Edition\n"
510#else 511#else
511 "PDA-Edition\n" 512 "PDA-Edition\n"
512 "for: Zaurus 5500 / 7x0 / 8x0\n" 513 "for: Zaurus 5500 / 7x0 / 8x0\n"
513#endif 514#endif
514 515
515 "(c) 2004 Ulf Schenk\n" 516 "(c) 2004 Ulf Schenk\n"
516 "(c) 2004 Lutz Rogowski\n" 517 "(c) 2004 Lutz Rogowski\n"
517 "(c) 1997-2003, The KDE PIM Team\n" 518 "(c) 1997-2003, The KDE PIM Team\n"
518 "Tobias Koenig Current maintainer\ntokoe@kde.org\n" 519 "Tobias Koenig Current maintainer\ntokoe@kde.org\n"
519 "Don Sanders Original author\n" 520 "Don Sanders Original author\n"
520 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" 521 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n"
521 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" 522 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n"
522 "Greg Stern DCOP interface\n" 523 "Greg Stern DCOP interface\n"
523 "Mark Westcot Contact pinning\n" 524 "Mark Westcot Contact pinning\n"
524 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 525 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
525 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" 526 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n"
526#ifdef _WIN32_ 527#ifdef _WIN32_
527 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" 528 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n"
528#endif 529#endif
529 ); 530 );
530} 531}
531 532
532void KABCore::setContactSelected( const QString &uid ) 533void KABCore::setContactSelected( const QString &uid )
533{ 534{
534 KABC::Addressee addr = mAddressBook->findByUid( uid ); 535 KABC::Addressee addr = mAddressBook->findByUid( uid );
535 if ( !mDetails->isHidden() ) 536 if ( !mDetails->isHidden() )
536 mDetails->setAddressee( addr ); 537 mDetails->setAddressee( addr );
537 538
538 if ( !addr.isEmpty() ) { 539 if ( !addr.isEmpty() ) {
539 emit contactSelected( addr.formattedName() ); 540 emit contactSelected( addr.formattedName() );
540 KABC::Picture pic = addr.photo(); 541 KABC::Picture pic = addr.photo();
541 if ( pic.isIntern() ) { 542 if ( pic.isIntern() ) {
542//US emit contactSelected( pic.data() ); 543//US emit contactSelected( pic.data() );
543//US instead use: 544//US instead use:
544 QPixmap px; 545 QPixmap px;
545 if (pic.data().isNull() != true) 546 if (pic.data().isNull() != true)
546 { 547 {
547 px.convertFromImage(pic.data()); 548 px.convertFromImage(pic.data());
548 } 549 }
549 550
550 emit contactSelected( px ); 551 emit contactSelected( px );
551 } 552 }
552 } 553 }
553 554
554 555
555 mExtensionManager->setSelectionChanged(); 556 mExtensionManager->setSelectionChanged();
556 557
557 // update the actions 558 // update the actions
558 bool selected = !uid.isEmpty(); 559 bool selected = !uid.isEmpty();
559 560
560 if ( mReadWrite ) { 561 if ( mReadWrite ) {
561 mActionCut->setEnabled( selected ); 562 mActionCut->setEnabled( selected );
562 mActionPaste->setEnabled( selected ); 563 mActionPaste->setEnabled( selected );
563 } 564 }
564 565
565 mActionCopy->setEnabled( selected ); 566 mActionCopy->setEnabled( selected );
566 mActionDelete->setEnabled( selected ); 567 mActionDelete->setEnabled( selected );
567 mActionEditAddressee->setEnabled( selected ); 568 mActionEditAddressee->setEnabled( selected );
568 mActionMail->setEnabled( selected ); 569 mActionMail->setEnabled( selected );
569 mActionMailVCard->setEnabled( selected ); 570 mActionMailVCard->setEnabled( selected );
570 //if (mActionBeam) 571 //if (mActionBeam)
571 //mActionBeam->setEnabled( selected ); 572 //mActionBeam->setEnabled( selected );
572 573
573 if (mActionBeamVCard) 574 if (mActionBeamVCard)
574 mActionBeamVCard->setEnabled( selected ); 575 mActionBeamVCard->setEnabled( selected );
575 576
576 mActionExport2phone->setEnabled( selected ); 577 mActionExport2phone->setEnabled( selected );
577 mActionWhoAmI->setEnabled( selected ); 578 mActionWhoAmI->setEnabled( selected );
578 mActionCategories->setEnabled( selected ); 579 mActionCategories->setEnabled( selected );
579} 580}
580 581
581void KABCore::sendMail() 582void KABCore::sendMail()
582{ 583{
583 sendMail( mViewManager->selectedEmails().join( ", " ) ); 584 sendMail( mViewManager->selectedEmails().join( ", " ) );
584} 585}
585 586
586void KABCore::sendMail( const QString& emaillist ) 587void KABCore::sendMail( const QString& emaillist )
587{ 588{
588 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " 589 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
589 if (emaillist.contains(",") > 0) 590 if (emaillist.contains(",") > 0)
590 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); 591 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
591 else 592 else
592 ExternalAppHandler::instance()->mailToOneContact( emaillist ); 593 ExternalAppHandler::instance()->mailToOneContact( emaillist );
593} 594}
594 595
595 596
596 597
597void KABCore::mailVCard() 598void KABCore::mailVCard()
598{ 599{
599 QStringList uids = mViewManager->selectedUids(); 600 QStringList uids = mViewManager->selectedUids();
600 if ( !uids.isEmpty() ) 601 if ( !uids.isEmpty() )
601 mailVCard( uids ); 602 mailVCard( uids );
602} 603}
603 604
604void KABCore::mailVCard( const QStringList& uids ) 605void KABCore::mailVCard( const QStringList& uids )
605{ 606{
606 QStringList urls; 607 QStringList urls;
607 608
608// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 609// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
609 610
610 QString dirName = "/tmp/" + KApplication::randomString( 8 ); 611 QString dirName = "/tmp/" + KApplication::randomString( 8 );
611 612
612 613
613 614
614 QDir().mkdir( dirName, true ); 615 QDir().mkdir( dirName, true );
615 616
616 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 617 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
617 KABC::Addressee a = mAddressBook->findByUid( *it ); 618 KABC::Addressee a = mAddressBook->findByUid( *it );
618 619
619 if ( a.isEmpty() ) 620 if ( a.isEmpty() )
620 continue; 621 continue;
621 622
622 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 623 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
623 624
624 QString fileName = dirName + "/" + name; 625 QString fileName = dirName + "/" + name;
625 626
626 QFile outFile(fileName); 627 QFile outFile(fileName);
627 628
628 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 629 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
629 KABC::VCardConverter converter; 630 KABC::VCardConverter converter;
630 QString vcard; 631 QString vcard;
631 632
632 converter.addresseeToVCard( a, vcard ); 633 converter.addresseeToVCard( a, vcard );
633 634
634 QTextStream t( &outFile ); // use a text stream 635 QTextStream t( &outFile ); // use a text stream
635 t.setEncoding( QTextStream::UnicodeUTF8 ); 636 t.setEncoding( QTextStream::UnicodeUTF8 );
636 t << vcard; 637 t << vcard;
637 638
638 outFile.close(); 639 outFile.close();
639 640
640 urls.append( fileName ); 641 urls.append( fileName );
641 } 642 }
642 } 643 }
643 644
644 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 645 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
645 646
646 647
647/*US 648/*US
648 kapp->invokeMailer( QString::null, QString::null, QString::null, 649 kapp->invokeMailer( QString::null, QString::null, QString::null,
649 QString::null, // subject 650 QString::null, // subject
650 QString::null, // body 651 QString::null, // body
651 QString::null, 652 QString::null,
652 urls ); // attachments 653 urls ); // attachments
653*/ 654*/
654 655
655} 656}
656 657
657/** 658/**
658 Beams the "WhoAmI contact. 659 Beams the "WhoAmI contact.
659*/ 660*/
660void KABCore::beamMySelf() 661void KABCore::beamMySelf()
661{ 662{
662 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 663 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
663 if (!a.isEmpty()) 664 if (!a.isEmpty())
664 { 665 {
665 QStringList uids; 666 QStringList uids;
666 uids << a.uid(); 667 uids << a.uid();
667 668
668 beamVCard(uids); 669 beamVCard(uids);
669 } else { 670 } else {
670 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 671 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
671 672
672 673
673 } 674 }
674} 675}
675 676
676void KABCore::export2phone() 677void KABCore::export2phone()
677{ 678{
678 679
679 KAex2phonePrefs ex2phone; 680 KAex2phonePrefs ex2phone;
680 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 681 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
681 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 682 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
682 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 683 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
683 684
684 if ( !ex2phone.exec() ) { 685 if ( !ex2phone.exec() ) {
685 return; 686 return;
686 } 687 }
687 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 688 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
688 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 689 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
689 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 690 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
690 691
691 692
692 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 693 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
693 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 694 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
694 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 695 KPimGlobalPrefs::instance()->mEx2PhoneModel );
695 696
696 QStringList uids = mViewManager->selectedUids(); 697 QStringList uids = mViewManager->selectedUids();
697 if ( uids.isEmpty() ) 698 if ( uids.isEmpty() )
698 return; 699 return;
699 700
700 QString fileName = getPhoneFile(); 701 QString fileName = getPhoneFile();
701 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) 702 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
702 return; 703 return;
703 704
704 message(i18n("Exporting to phone...")); 705 message(i18n("Exporting to phone..."));
705 QTimer::singleShot( 1, this , SLOT ( writeToPhone())); 706 QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
706 707
707} 708}
708QString KABCore::getPhoneFile() 709QString KABCore::getPhoneFile()
709{ 710{
710#ifdef _WIN32_ 711#ifdef _WIN32_
711 return locateLocal("tmp", "phonefile.vcf"); 712 return locateLocal("tmp", "phonefile.vcf");
712#else 713#else
713 return "/tmp/phonefile.vcf"; 714 return "/tmp/phonefile.vcf";
714#endif 715#endif
715 716
716} 717}
717void KABCore::writeToPhone( ) 718void KABCore::writeToPhone( )
718{ 719{
719 if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) 720 if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
720 message(i18n("Export to phone finished!")); 721 message(i18n("Export to phone finished!"));
721 else 722 else
722 qDebug(i18n("Error exporting to phone")); 723 qDebug(i18n("Error exporting to phone"));
723} 724}
724void KABCore::beamVCard() 725void KABCore::beamVCard()
725{ 726{
726 QStringList uids = mViewManager->selectedUids(); 727 QStringList uids = mViewManager->selectedUids();
727 if ( !uids.isEmpty() ) 728 if ( !uids.isEmpty() )
728 beamVCard( uids ); 729 beamVCard( uids );
729} 730}
730 731
731 732
732void KABCore::beamVCard(const QStringList& uids) 733void KABCore::beamVCard(const QStringList& uids)
733{ 734{
734/*US 735/*US
735 QString beamFilename; 736 QString beamFilename;
736 Opie::OPimContact c; 737 Opie::OPimContact c;
737 if ( actionPersonal->isOn() ) { 738 if ( actionPersonal->isOn() ) {
738 beamFilename = addressbookPersonalVCardName(); 739 beamFilename = addressbookPersonalVCardName();
739 if ( !QFile::exists( beamFilename ) ) 740 if ( !QFile::exists( beamFilename ) )
740 return; // can't beam a non-existent file 741 return; // can't beam a non-existent file
741 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 742 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
742 beamFilename ); 743 beamFilename );
743 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 744 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
744 Opie::OPimContactAccess::List allList = access->allRecords(); 745 Opie::OPimContactAccess::List allList = access->allRecords();
745 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first 746 Opie::OPimContactAccess::List::Iterator it = allList.begin(); // Just take first
746 c = *it; 747 c = *it;
747 748
748 delete access; 749 delete access;
749 } else { 750 } else {
750 unlink( beamfile ); // delete if exists 751 unlink( beamfile ); // delete if exists
751 mkdir("/tmp/obex/", 0755); 752 mkdir("/tmp/obex/", 0755);
752 c = m_abView -> currentEntry(); 753 c = m_abView -> currentEntry();
753 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null, 754 Opie::OPimContactAccessBackend* vcard_backend = new Opie::OPimContactAccessBackend_VCard( QString::null,
754 beamfile ); 755 beamfile );
755 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true ); 756 Opie::OPimContactAccess* access = new Opie::OPimContactAccess ( "addressbook", QString::null , vcard_backend, true );
756 access->add( c ); 757 access->add( c );
757 access->save(); 758 access->save();
758 delete access; 759 delete access;
759 760
760 beamFilename = beamfile; 761 beamFilename = beamfile;
761 } 762 }
762 763
763 owarn << "Beaming: " << beamFilename << oendl; 764 owarn << "Beaming: " << beamFilename << oendl;
764*/ 765*/
765 766
766#if 0 767#if 0
767 QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 768 QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
768 769
769 QString dirName = tmpdir + "/" + KApplication::randomString( 8 ); 770 QString dirName = tmpdir + "/" + KApplication::randomString( 8 );
770 771
771 QString name = "contact.vcf"; 772 QString name = "contact.vcf";
772 773
773 QString fileName = dirName + "/" + name; 774 QString fileName = dirName + "/" + name;
774#endif 775#endif
775 // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory 776 // LR: we should use the /tmp dir, because: /tmp = RAM, (HOME)/kdepim = flash memory
776 // 777 //
777 QString fileName = "/tmp/kapibeamfile.vcf"; 778 QString fileName = "/tmp/kapibeamfile.vcf";
778 779
779 780
780 //QDir().mkdir( dirName, true ); 781 //QDir().mkdir( dirName, true );
781 782
782 783
783 KABC::VCardConverter converter; 784 KABC::VCardConverter converter;
784 QString description; 785 QString description;
785 QString datastream; 786 QString datastream;
786 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 787 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
787 KABC::Addressee a = mAddressBook->findByUid( *it ); 788 KABC::Addressee a = mAddressBook->findByUid( *it );
788 789
789 if ( a.isEmpty() ) 790 if ( a.isEmpty() )
790 continue; 791 continue;
791 792
792 if (description.isEmpty()) 793 if (description.isEmpty())
793 description = a.formattedName(); 794 description = a.formattedName();
794 795
795 QString vcard; 796 QString vcard;
796 converter.addresseeToVCard( a, vcard ); 797 converter.addresseeToVCard( a, vcard );
797 int start = 0; 798 int start = 0;
798 int next; 799 int next;
799 while ( (next = vcard.find("TYPE=", start) )>= 0 ) { 800 while ( (next = vcard.find("TYPE=", start) )>= 0 ) {
800 int semi = vcard.find(";", next); 801 int semi = vcard.find(";", next);
801 int dopp = vcard.find(":", next); 802 int dopp = vcard.find(":", next);
802 int sep; 803 int sep;
803 if ( semi < dopp && semi >= 0 ) 804 if ( semi < dopp && semi >= 0 )
804 sep = semi ; 805 sep = semi ;
805 else 806 else
806 sep = dopp; 807 sep = dopp;
807 datastream +=vcard.mid( start, next - start); 808 datastream +=vcard.mid( start, next - start);
808 datastream +=vcard.mid( next+5,sep -next -5 ).upper(); 809 datastream +=vcard.mid( next+5,sep -next -5 ).upper();
809 start = sep; 810 start = sep;
810 } 811 }
811 datastream += vcard.mid( start,vcard.length() ); 812 datastream += vcard.mid( start,vcard.length() );
812 } 813 }
813#ifndef DESKTOP_VERSION 814#ifndef DESKTOP_VERSION
814 QFile outFile(fileName); 815 QFile outFile(fileName);
815 if ( outFile.open(IO_WriteOnly) ) { 816 if ( outFile.open(IO_WriteOnly) ) {
816 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); 817 datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" );
817 QTextStream t( &outFile ); // use a text stream 818 QTextStream t( &outFile ); // use a text stream
818 //t.setEncoding( QTextStream::UnicodeUTF8 ); 819 //t.setEncoding( QTextStream::UnicodeUTF8 );
819 t.setEncoding( QTextStream::Latin1 ); 820 t.setEncoding( QTextStream::Latin1 );
820 t <<datastream.latin1(); 821 t <<datastream.latin1();
821 outFile.close(); 822 outFile.close();
822 Ir *ir = new Ir( this ); 823 Ir *ir = new Ir( this );
823 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) ); 824 connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
824 ir->send( fileName, description, "text/x-vCard" ); 825 ir->send( fileName, description, "text/x-vCard" );
825 } else { 826 } else {
826 qDebug("Error open temp beam file "); 827 qDebug("Error open temp beam file ");
827 return; 828 return;
828 } 829 }
829#endif 830#endif
830 831
831} 832}
832 833
833void KABCore::beamDone( Ir *ir ) 834void KABCore::beamDone( Ir *ir )
834{ 835{
835#ifndef DESKTOP_VERSION 836#ifndef DESKTOP_VERSION
836 delete ir; 837 delete ir;
837#endif 838#endif
838 topLevelWidget()->raise(); 839 topLevelWidget()->raise();
839 message( i18n("Beaming finished!") ); 840 message( i18n("Beaming finished!") );
840} 841}
841 842
842 843
843void KABCore::browse( const QString& url ) 844void KABCore::browse( const QString& url )
844{ 845{
845#ifndef KAB_EMBEDDED 846#ifndef KAB_EMBEDDED
846 kapp->invokeBrowser( url ); 847 kapp->invokeBrowser( url );
847#else //KAB_EMBEDDED 848#else //KAB_EMBEDDED
848 qDebug("KABCore::browse must be fixed"); 849 qDebug("KABCore::browse must be fixed");
849#endif //KAB_EMBEDDED 850#endif //KAB_EMBEDDED
850} 851}
851 852
852void KABCore::selectAllContacts() 853void KABCore::selectAllContacts()
853{ 854{
854 mViewManager->setSelected( QString::null, true ); 855 mViewManager->setSelected( QString::null, true );
855} 856}
856 857
857void KABCore::deleteContacts() 858void KABCore::deleteContacts()
858{ 859{
859 QStringList uidList = mViewManager->selectedUids(); 860 QStringList uidList = mViewManager->selectedUids();
860 deleteContacts( uidList ); 861 deleteContacts( uidList );
861} 862}
862 863
863void KABCore::deleteContacts( const QStringList &uids ) 864void KABCore::deleteContacts( const QStringList &uids )
864{ 865{
865 if ( uids.count() > 0 ) { 866 if ( uids.count() > 0 ) {
866 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids ); 867 PwDeleteCommand *command = new PwDeleteCommand( mAddressBook, uids );
867 UndoStack::instance()->push( command ); 868 UndoStack::instance()->push( command );
868 RedoStack::instance()->clear(); 869 RedoStack::instance()->clear();
869 870
870 // now if we deleted anything, refresh 871 // now if we deleted anything, refresh
871 setContactSelected( QString::null ); 872 setContactSelected( QString::null );
872 setModified( true ); 873 setModified( true );
873 } 874 }
874} 875}
875 876
876void KABCore::copyContacts() 877void KABCore::copyContacts()
877{ 878{
878 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 879 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
879 880
880 QString clipText = AddresseeUtil::addresseesToClipboard( addrList ); 881 QString clipText = AddresseeUtil::addresseesToClipboard( addrList );
881 882
882 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl; 883 kdDebug(5720) << "KABCore::copyContacts: " << clipText << endl;
883 884
884 QClipboard *cb = QApplication::clipboard(); 885 QClipboard *cb = QApplication::clipboard();
885 cb->setText( clipText ); 886 cb->setText( clipText );
886} 887}
887 888
888void KABCore::cutContacts() 889void KABCore::cutContacts()
889{ 890{
890 QStringList uidList = mViewManager->selectedUids(); 891 QStringList uidList = mViewManager->selectedUids();
891 892
892//US if ( uidList.size() > 0 ) { 893//US if ( uidList.size() > 0 ) {
893 if ( uidList.count() > 0 ) { 894 if ( uidList.count() > 0 ) {
894 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList ); 895 PwCutCommand *command = new PwCutCommand( mAddressBook, uidList );
895 UndoStack::instance()->push( command ); 896 UndoStack::instance()->push( command );
896 RedoStack::instance()->clear(); 897 RedoStack::instance()->clear();
897 898
898 setModified( true ); 899 setModified( true );
899 } 900 }
900} 901}
901 902
902void KABCore::pasteContacts() 903void KABCore::pasteContacts()
903{ 904{
904 QClipboard *cb = QApplication::clipboard(); 905 QClipboard *cb = QApplication::clipboard();
905 906
906 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() ); 907 KABC::Addressee::List list = AddresseeUtil::clipboardToAddressees( cb->text() );
907 908
908 pasteContacts( list ); 909 pasteContacts( list );
909} 910}
910 911
911void KABCore::pasteContacts( KABC::Addressee::List &list ) 912void KABCore::pasteContacts( KABC::Addressee::List &list )
912{ 913{
913 KABC::Resource *resource = requestResource( this ); 914 KABC::Resource *resource = requestResource( this );
914 KABC::Addressee::List::Iterator it; 915 KABC::Addressee::List::Iterator it;
915 for ( it = list.begin(); it != list.end(); ++it ) 916 for ( it = list.begin(); it != list.end(); ++it )
916 (*it).setResource( resource ); 917 (*it).setResource( resource );
917 918
918 PwPasteCommand *command = new PwPasteCommand( this, list ); 919 PwPasteCommand *command = new PwPasteCommand( this, list );
919 UndoStack::instance()->push( command ); 920 UndoStack::instance()->push( command );
920 RedoStack::instance()->clear(); 921 RedoStack::instance()->clear();
921 922
922 setModified( true ); 923 setModified( true );
923} 924}
924 925
925void KABCore::setWhoAmI() 926void KABCore::setWhoAmI()
926{ 927{
927 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 928 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
928 929
929 if ( addrList.count() > 1 ) { 930 if ( addrList.count() > 1 ) {
930 KMessageBox::sorry( this, i18n( "Please select only one contact." ) ); 931 KMessageBox::sorry( this, i18n( "Please select only one contact." ) );
931 return; 932 return;
932 } 933 }
933 934
934 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) ); 935 QString text( i18n( "<qt>Do you really want to use <b>%1</b> as your new personal contact?</qt>" ) );
935 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes ) 936 if ( KMessageBox::questionYesNo( this, text.arg( addrList[ 0 ].assembledName() ) ) == KMessageBox::Yes )
936 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] ); 937 static_cast<KABC::StdAddressBook*>( KABC::StdAddressBook::self() )->setWhoAmI( addrList[ 0 ] );
937} 938}
938 939
939void KABCore::setCategories() 940void KABCore::setCategories()
940{ 941{
941 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true ); 942 KPIM::CategorySelectDialog dlg( KABPrefs::instance(), this, "", true );
942 if ( !dlg.exec() ) 943 if ( !dlg.exec() )
943 return; 944 return;
944 945
945 bool merge = false; 946 bool merge = false;
946 QString msg = i18n( "Merge with existing categories?" ); 947 QString msg = i18n( "Merge with existing categories?" );
947 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes ) 948 if ( KMessageBox::questionYesNo( this, msg ) == KMessageBox::Yes )
948 merge = true; 949 merge = true;
949 950
950 QStringList categories = dlg.selectedCategories(); 951 QStringList categories = dlg.selectedCategories();
951 952
952 QStringList uids = mViewManager->selectedUids(); 953 QStringList uids = mViewManager->selectedUids();
953 QStringList::Iterator it; 954 QStringList::Iterator it;
954 for ( it = uids.begin(); it != uids.end(); ++it ) { 955 for ( it = uids.begin(); it != uids.end(); ++it ) {
955 KABC::Addressee addr = mAddressBook->findByUid( *it ); 956 KABC::Addressee addr = mAddressBook->findByUid( *it );
956 if ( !addr.isEmpty() ) { 957 if ( !addr.isEmpty() ) {
957 if ( !merge ) 958 if ( !merge )
958 addr.setCategories( categories ); 959 addr.setCategories( categories );
959 else { 960 else {
960 QStringList addrCategories = addr.categories(); 961 QStringList addrCategories = addr.categories();
961 QStringList::Iterator catIt; 962 QStringList::Iterator catIt;
962 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { 963 for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) {
963 if ( !addrCategories.contains( *catIt ) ) 964 if ( !addrCategories.contains( *catIt ) )
964 addrCategories.append( *catIt ); 965 addrCategories.append( *catIt );
965 } 966 }
966 addr.setCategories( addrCategories ); 967 addr.setCategories( addrCategories );
967 } 968 }
968 969
969 mAddressBook->insertAddressee( addr ); 970 mAddressBook->insertAddressee( addr );
970 } 971 }
971 } 972 }
972 973
973 if ( uids.count() > 0 ) 974 if ( uids.count() > 0 )
974 setModified( true ); 975 setModified( true );
975} 976}
976 977
977void KABCore::setSearchFields( const KABC::Field::List &fields ) 978void KABCore::setSearchFields( const KABC::Field::List &fields )
978{ 979{
979 mIncSearchWidget->setFields( fields ); 980 mIncSearchWidget->setFields( fields );
980} 981}
981 982
982void KABCore::incrementalSearch( const QString& text ) 983void KABCore::incrementalSearch( const QString& text )
983{ 984{
984 mViewManager->doSearch( text, mIncSearchWidget->currentField() ); 985 mViewManager->doSearch( text, mIncSearchWidget->currentField() );
985} 986}
986 987
987void KABCore::setModified() 988void KABCore::setModified()
988{ 989{
989 setModified( true ); 990 setModified( true );
990} 991}
991 992
992void KABCore::setModifiedWOrefresh() 993void KABCore::setModifiedWOrefresh()
993{ 994{
994 // qDebug("KABCore::setModifiedWOrefresh() "); 995 // qDebug("KABCore::setModifiedWOrefresh() ");
995 mModified = true; 996 mModified = true;
996 mActionSave->setEnabled( mModified ); 997 mActionSave->setEnabled( mModified );
997#ifdef DESKTOP_VERSION 998#ifdef DESKTOP_VERSION
998 mDetails->refreshView(); 999 mDetails->refreshView();
999#endif 1000#endif
1000 1001
1001} 1002}
1002void KABCore::setModified( bool modified ) 1003void KABCore::setModified( bool modified )
1003{ 1004{
1004 mModified = modified; 1005 mModified = modified;
1005 mActionSave->setEnabled( mModified ); 1006 mActionSave->setEnabled( mModified );
1006 1007
1007 if ( modified ) 1008 if ( modified )
1008 mJumpButtonBar->recreateButtons(); 1009 mJumpButtonBar->recreateButtons();
1009 1010
1010 mViewManager->refreshView(); 1011 mViewManager->refreshView();
1011 mDetails->refreshView(); 1012 mDetails->refreshView();
1012 1013
1013} 1014}
1014 1015
1015bool KABCore::modified() const 1016bool KABCore::modified() const
1016{ 1017{
1017 return mModified; 1018 return mModified;
1018} 1019}
1019 1020
1020void KABCore::contactModified( const KABC::Addressee &addr ) 1021void KABCore::contactModified( const KABC::Addressee &addr )
1021{ 1022{
1022 1023
1023 Command *command = 0; 1024 Command *command = 0;
1024 QString uid; 1025 QString uid;
1025 1026
1026 // check if it exists already 1027 // check if it exists already
1027 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() ); 1028 KABC::Addressee origAddr = mAddressBook->findByUid( addr.uid() );
1028 if ( origAddr.isEmpty() ) 1029 if ( origAddr.isEmpty() )
1029 command = new PwNewCommand( mAddressBook, addr ); 1030 command = new PwNewCommand( mAddressBook, addr );
1030 else { 1031 else {
1031 command = new PwEditCommand( mAddressBook, origAddr, addr ); 1032 command = new PwEditCommand( mAddressBook, origAddr, addr );
1032 uid = addr.uid(); 1033 uid = addr.uid();
1033 } 1034 }
1034 1035
1035 UndoStack::instance()->push( command ); 1036 UndoStack::instance()->push( command );
1036 RedoStack::instance()->clear(); 1037 RedoStack::instance()->clear();
1037 1038
1038 setModified( true ); 1039 setModified( true );
1039} 1040}
1040 1041
1041void KABCore::newContact() 1042void KABCore::newContact()
1042{ 1043{
1043 1044
1044 1045
1045 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources(); 1046 QPtrList<KABC::Resource> kabcResources = mAddressBook->resources();
1046 1047
1047 QPtrList<KRES::Resource> kresResources; 1048 QPtrList<KRES::Resource> kresResources;
1048 QPtrListIterator<KABC::Resource> it( kabcResources ); 1049 QPtrListIterator<KABC::Resource> it( kabcResources );
1049 KABC::Resource *resource; 1050 KABC::Resource *resource;
1050 while ( ( resource = it.current() ) != 0 ) { 1051 while ( ( resource = it.current() ) != 0 ) {
1051 ++it; 1052 ++it;
1052 if ( !resource->readOnly() ) { 1053 if ( !resource->readOnly() ) {
1053 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 1054 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
1054 if ( res ) 1055 if ( res )
1055 kresResources.append( res ); 1056 kresResources.append( res );
1056 } 1057 }
1057 } 1058 }
1058 1059
1059 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this ); 1060 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, this );
1060 resource = static_cast<KABC::Resource*>( res ); 1061 resource = static_cast<KABC::Resource*>( res );
1061 1062
1062 if ( resource ) { 1063 if ( resource ) {
1063 KABC::Addressee addr; 1064 KABC::Addressee addr;
1064 addr.setResource( resource ); 1065 addr.setResource( resource );
1065 mEditorDialog->setAddressee( addr ); 1066 mEditorDialog->setAddressee( addr );
1066 KApplication::execDialog ( mEditorDialog ); 1067 KApplication::execDialog ( mEditorDialog );
1067 1068
1068 } else 1069 } else
1069 return; 1070 return;
1070 1071
1071 // mEditorDict.insert( dialog->addressee().uid(), dialog ); 1072 // mEditorDict.insert( dialog->addressee().uid(), dialog );
1072 1073
1073 1074
1074} 1075}
1075 1076
1076void KABCore::addEmail( QString aStr ) 1077void KABCore::addEmail( QString aStr )
1077{ 1078{
1078#ifndef KAB_EMBEDDED 1079#ifndef KAB_EMBEDDED
1079 QString fullName, email; 1080 QString fullName, email;
1080 1081
1081 KABC::Addressee::parseEmailAddress( aStr, fullName, email ); 1082 KABC::Addressee::parseEmailAddress( aStr, fullName, email );
1082 1083
1083 // Try to lookup the addressee matching the email address 1084 // Try to lookup the addressee matching the email address
1084 bool found = false; 1085 bool found = false;
1085 QStringList emailList; 1086 QStringList emailList;
1086 KABC::AddressBook::Iterator it; 1087 KABC::AddressBook::Iterator it;
1087 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) { 1088 for ( it = mAddressBook->begin(); !found && (it != mAddressBook->end()); ++it ) {
1088 emailList = (*it).emails(); 1089 emailList = (*it).emails();
1089 if ( emailList.contains( email ) > 0 ) { 1090 if ( emailList.contains( email ) > 0 ) {
1090 found = true; 1091 found = true;
1091 (*it).setNameFromString( fullName ); 1092 (*it).setNameFromString( fullName );
1092 editContact( (*it).uid() ); 1093 editContact( (*it).uid() );
1093 } 1094 }
1094 } 1095 }
1095 1096
1096 if ( !found ) { 1097 if ( !found ) {
1097 KABC::Addressee addr; 1098 KABC::Addressee addr;
1098 addr.setNameFromString( fullName ); 1099 addr.setNameFromString( fullName );
1099 addr.insertEmail( email, true ); 1100 addr.insertEmail( email, true );
1100 1101
1101 mAddressBook->insertAddressee( addr ); 1102 mAddressBook->insertAddressee( addr );
1102 mViewManager->refreshView( addr.uid() ); 1103 mViewManager->refreshView( addr.uid() );
1103 editContact( addr.uid() ); 1104 editContact( addr.uid() );
1104 } 1105 }
1105#else //KAB_EMBEDDED 1106#else //KAB_EMBEDDED
1106 qDebug("KABCore::addEmail finsih method"); 1107 qDebug("KABCore::addEmail finsih method");
1107#endif //KAB_EMBEDDED 1108#endif //KAB_EMBEDDED
1108} 1109}
1109 1110
1110void KABCore::importVCard( const KURL &url, bool showPreview ) 1111void KABCore::importVCard( const KURL &url, bool showPreview )
1111{ 1112{
1112 mXXPortManager->importVCard( url, showPreview ); 1113 mXXPortManager->importVCard( url, showPreview );
1113} 1114}
1114void KABCore::importFromOL() 1115void KABCore::importFromOL()
1115{ 1116{
1116#ifdef _WIN32_ 1117#ifdef _WIN32_
1117 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this ); 1118 KAImportOLdialog* idgl = new KAImportOLdialog( i18n("Import Contacts from OL"), mAddressBook, this );
1118 idgl->exec(); 1119 idgl->exec();
1119 KABC::Addressee::List list = idgl->getAddressList(); 1120 KABC::Addressee::List list = idgl->getAddressList();
1120 if ( list.count() > 0 ) { 1121 if ( list.count() > 0 ) {
1121 KABC::Addressee::List listNew; 1122 KABC::Addressee::List listNew;
1122 KABC::Addressee::List listExisting; 1123 KABC::Addressee::List listExisting;
1123 KABC::Addressee::List::Iterator it; 1124 KABC::Addressee::List::Iterator it;
1124 KABC::AddressBook::Iterator iter; 1125 KABC::AddressBook::Iterator iter;
1125 for ( it = list.begin(); it != list.end(); ++it ) { 1126 for ( it = list.begin(); it != list.end(); ++it ) {
1126 if ( mAddressBook->findByUid((*it).uid() ).isEmpty()) 1127 if ( mAddressBook->findByUid((*it).uid() ).isEmpty())
1127 listNew.append( (*it) ); 1128 listNew.append( (*it) );
1128 else 1129 else
1129 listExisting.append( (*it) ); 1130 listExisting.append( (*it) );
1130 } 1131 }
1131 if ( listExisting.count() > 0 ) 1132 if ( listExisting.count() > 0 )
1132 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() )); 1133 KMessageBox::information( this, i18n("%1 contacts not added to addressbook\nbecause they were already in the addressbook!").arg( listExisting.count() ));
1133 if ( listNew.count() > 0 ) { 1134 if ( listNew.count() > 0 ) {
1134 pasteWithNewUid = false; 1135 pasteWithNewUid = false;
1135 pasteContacts( listNew ); 1136 pasteContacts( listNew );
1136 pasteWithNewUid = true; 1137 pasteWithNewUid = true;
1137 } 1138 }
1138 } 1139 }
1139 delete idgl; 1140 delete idgl;
1140#endif 1141#endif
1141} 1142}
1142 1143
1143void KABCore::importVCard( const QString &vCard, bool showPreview ) 1144void KABCore::importVCard( const QString &vCard, bool showPreview )
1144{ 1145{
1145 mXXPortManager->importVCard( vCard, showPreview ); 1146 mXXPortManager->importVCard( vCard, showPreview );
1146} 1147}
1147 1148
1148//US added a second method without defaultparameter 1149//US added a second method without defaultparameter
1149void KABCore::editContact2() { 1150void KABCore::editContact2() {
1150 editContact( QString::null ); 1151 editContact( QString::null );
1151} 1152}
1152 1153
1153void KABCore::editContact( const QString &uid ) 1154void KABCore::editContact( const QString &uid )
1154{ 1155{
1155 1156
1156 if ( mExtensionManager->isQuickEditVisible() ) 1157 if ( mExtensionManager->isQuickEditVisible() )
1157 return; 1158 return;
1158 1159
1159 // First, locate the contact entry 1160 // First, locate the contact entry
1160 QString localUID = uid; 1161 QString localUID = uid;
1161 if ( localUID.isNull() ) { 1162 if ( localUID.isNull() ) {
1162 QStringList uidList = mViewManager->selectedUids(); 1163 QStringList uidList = mViewManager->selectedUids();
1163 if ( uidList.count() > 0 ) 1164 if ( uidList.count() > 0 )
1164 localUID = *( uidList.at( 0 ) ); 1165 localUID = *( uidList.at( 0 ) );
1165 } 1166 }
1166 1167
1167 KABC::Addressee addr = mAddressBook->findByUid( localUID ); 1168 KABC::Addressee addr = mAddressBook->findByUid( localUID );
1168 if ( !addr.isEmpty() ) { 1169 if ( !addr.isEmpty() ) {
1169 mEditorDialog->setAddressee( addr ); 1170 mEditorDialog->setAddressee( addr );
1170 KApplication::execDialog ( mEditorDialog ); 1171 KApplication::execDialog ( mEditorDialog );
1171 } 1172 }
1172} 1173}
1173 1174
1174/** 1175/**
1175 Shows or edits the detail view for the given uid. If the uid is QString::null, 1176 Shows or edits the detail view for the given uid. If the uid is QString::null,
1176 the method will try to find a selected addressee in the view. 1177 the method will try to find a selected addressee in the view.
1177 */ 1178 */
1178void KABCore::executeContact( const QString &uid /*US = QString::null*/ ) 1179void KABCore::executeContact( const QString &uid /*US = QString::null*/ )
1179{ 1180{
1180 if ( mMultipleViewsAtOnce ) 1181 if ( mMultipleViewsAtOnce )
1181 { 1182 {
1182 editContact( uid ); 1183 editContact( uid );
1183 } 1184 }
1184 else 1185 else
1185 { 1186 {
1186 setDetailsVisible( true ); 1187 setDetailsVisible( true );
1187 mActionDetails->setChecked(true); 1188 mActionDetails->setChecked(true);
1188 } 1189 }
1189 1190
1190} 1191}
1191 1192
1192void KABCore::save() 1193void KABCore::save()
1193{ 1194{
1194 if (syncManager->blockSave()) 1195 if (syncManager->blockSave())
1195 return; 1196 return;
1196 if ( !mModified ) 1197 if ( !mModified )
1197 return; 1198 return;
1198 1199
1199 syncManager->setBlockSave(true); 1200 syncManager->setBlockSave(true);
1200 QString text = i18n( "There was an error while attempting to save\n the " 1201 QString text = i18n( "There was an error while attempting to save\n the "
1201 "address book. Please check that some \nother application is " 1202 "address book. Please check that some \nother application is "
1202 "not using it. " ); 1203 "not using it. " );
1203 message(i18n("Saving addressbook ... ")); 1204 message(i18n("Saving addressbook ... "));
1204#ifndef KAB_EMBEDDED 1205#ifndef KAB_EMBEDDED
1205 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); 1206 KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook );
1206 if ( !b || !b->save() ) { 1207 if ( !b || !b->save() ) {
1207 KMessageBox::error( this, text, i18n( "Unable to Save" ) ); 1208 KMessageBox::error( this, text, i18n( "Unable to Save" ) );
1208 } 1209 }
1209#else //KAB_EMBEDDED 1210#else //KAB_EMBEDDED
1210 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); 1211 KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook );
1211 if ( !b || !b->save() ) { 1212 if ( !b || !b->save() ) {
1212 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); 1213 QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok"));
1213 } 1214 }
1214#endif //KAB_EMBEDDED 1215#endif //KAB_EMBEDDED
1215 1216
1216 message(i18n("Addressbook saved!")); 1217 message(i18n("Addressbook saved!"));
1217 setModified( false ); 1218 setModified( false );
1218 syncManager->setBlockSave(false); 1219 syncManager->setBlockSave(false);
1219} 1220}
1220 1221
1221 1222
1222void KABCore::undo() 1223void KABCore::undo()
1223{ 1224{
1224 UndoStack::instance()->undo(); 1225 UndoStack::instance()->undo();
1225 1226
1226 // Refresh the view 1227 // Refresh the view
1227 mViewManager->refreshView(); 1228 mViewManager->refreshView();
1228} 1229}
1229 1230
1230void KABCore::redo() 1231void KABCore::redo()
1231{ 1232{
1232 RedoStack::instance()->redo(); 1233 RedoStack::instance()->redo();
1233 1234
1234 // Refresh the view 1235 // Refresh the view
1235 mViewManager->refreshView(); 1236 mViewManager->refreshView();
1236} 1237}
1237 1238
1238void KABCore::setJumpButtonBarVisible( bool visible ) 1239void KABCore::setJumpButtonBarVisible( bool visible )
1239{ 1240{
1240 if (mMultipleViewsAtOnce) 1241 if (mMultipleViewsAtOnce)
1241 { 1242 {
1242 if ( visible ) 1243 if ( visible )
1243 mJumpButtonBar->show(); 1244 mJumpButtonBar->show();
1244 else 1245 else
1245 mJumpButtonBar->hide(); 1246 mJumpButtonBar->hide();
1246 } 1247 }
1247 else 1248 else
1248 { 1249 {
1249 // show the jumpbar only if "the details are hidden" == "viewmanager are shown" 1250 // show the jumpbar only if "the details are hidden" == "viewmanager are shown"
1250 if (mViewManager->isVisible()) 1251 if (mViewManager->isVisible())
1251 { 1252 {
1252 if ( visible ) 1253 if ( visible )
1253 mJumpButtonBar->show(); 1254 mJumpButtonBar->show();
1254 else 1255 else
1255 mJumpButtonBar->hide(); 1256 mJumpButtonBar->hide();
1256 } 1257 }
1257 else 1258 else
1258 { 1259 {
1259 mJumpButtonBar->hide(); 1260 mJumpButtonBar->hide();
1260 } 1261 }
1261 } 1262 }
1262} 1263}
1263 1264
1264 1265
1265void KABCore::setDetailsToState() 1266void KABCore::setDetailsToState()
1266{ 1267{
1267 setDetailsVisible( mActionDetails->isChecked() ); 1268 setDetailsVisible( mActionDetails->isChecked() );
1268} 1269}
1269 1270
1270 1271
1271 1272
1272void KABCore::setDetailsVisible( bool visible ) 1273void KABCore::setDetailsVisible( bool visible )
1273{ 1274{
1274 if (visible && mDetails->isHidden()) 1275 if (visible && mDetails->isHidden())
1275 { 1276 {
1276 KABC::Addressee::List addrList = mViewManager->selectedAddressees(); 1277 KABC::Addressee::List addrList = mViewManager->selectedAddressees();
1277 if ( addrList.count() > 0 ) 1278 if ( addrList.count() > 0 )
1278 mDetails->setAddressee( addrList[ 0 ] ); 1279 mDetails->setAddressee( addrList[ 0 ] );
1279 } 1280 }
1280 1281
1281 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between 1282 // mMultipleViewsAtOnce=false: mDetails is always visible. But we switch between
1282 // the listview and the detailview. We do that by changing the splitbar size. 1283 // the listview and the detailview. We do that by changing the splitbar size.
1283 if (mMultipleViewsAtOnce) 1284 if (mMultipleViewsAtOnce)
1284 { 1285 {
1285 if ( visible ) 1286 if ( visible )
1286 mDetails->show(); 1287 mDetails->show();
1287 else 1288 else
1288 mDetails->hide(); 1289 mDetails->hide();
1289 } 1290 }
1290 else 1291 else
1291 { 1292 {
1292 if ( visible ) { 1293 if ( visible ) {
1293 mViewManager->hide(); 1294 mViewManager->hide();
1294 mDetails->show(); 1295 mDetails->show();
1295 } 1296 }
1296 else { 1297 else {
1297 mViewManager->show(); 1298 mViewManager->show();
1298 mDetails->hide(); 1299 mDetails->hide();
1299 } 1300 }
1300 setJumpButtonBarVisible( !visible ); 1301 setJumpButtonBarVisible( !visible );
1301 } 1302 }
1302 1303
1303} 1304}
1304 1305
1305void KABCore::extensionChanged( int id ) 1306void KABCore::extensionChanged( int id )
1306{ 1307{
1307 //change the details view only for non desktop systems 1308 //change the details view only for non desktop systems
1308#ifndef DESKTOP_VERSION 1309#ifndef DESKTOP_VERSION
1309 1310
1310 if (id == 0) 1311 if (id == 0)
1311 { 1312 {
1312 //the user disabled the extension. 1313 //the user disabled the extension.
1313 1314
1314 if (mMultipleViewsAtOnce) 1315 if (mMultipleViewsAtOnce)
1315 { // enable detailsview again 1316 { // enable detailsview again
1316 setDetailsVisible( true ); 1317 setDetailsVisible( true );
1317 mActionDetails->setChecked( true ); 1318 mActionDetails->setChecked( true );
1318 } 1319 }
1319 else 1320 else
1320 { //go back to the listview 1321 { //go back to the listview
1321 setDetailsVisible( false ); 1322 setDetailsVisible( false );
1322 mActionDetails->setChecked( false ); 1323 mActionDetails->setChecked( false );
1323 mActionDetails->setEnabled(true); 1324 mActionDetails->setEnabled(true);
1324 } 1325 }
1325 1326
1326 } 1327 }
1327 else 1328 else
1328 { 1329 {
1329 //the user enabled the extension. 1330 //the user enabled the extension.
1330 setDetailsVisible( false ); 1331 setDetailsVisible( false );
1331 mActionDetails->setChecked( false ); 1332 mActionDetails->setChecked( false );
1332 1333
1333 if (!mMultipleViewsAtOnce) 1334 if (!mMultipleViewsAtOnce)
1334 { 1335 {
1335 mActionDetails->setEnabled(false); 1336 mActionDetails->setEnabled(false);
1336 } 1337 }
1337 1338
1338 mExtensionManager->setSelectionChanged(); 1339 mExtensionManager->setSelectionChanged();
1339 1340
1340 } 1341 }
1341 1342
1342#endif// DESKTOP_VERSION 1343#endif// DESKTOP_VERSION
1343 1344
1344} 1345}
1345 1346
1346 1347
1347void KABCore::extensionModified( const KABC::Addressee::List &list ) 1348void KABCore::extensionModified( const KABC::Addressee::List &list )
1348{ 1349{
1349 1350
1350 if ( list.count() != 0 ) { 1351 if ( list.count() != 0 ) {
1351 KABC::Addressee::List::ConstIterator it; 1352 KABC::Addressee::List::ConstIterator it;
1352 for ( it = list.begin(); it != list.end(); ++it ) 1353 for ( it = list.begin(); it != list.end(); ++it )
1353 mAddressBook->insertAddressee( *it ); 1354 mAddressBook->insertAddressee( *it );
1354 if ( list.count() > 1 ) 1355 if ( list.count() > 1 )
1355 setModified(); 1356 setModified();
1356 else 1357 else
1357 setModifiedWOrefresh(); 1358 setModifiedWOrefresh();
1358 } 1359 }
1359 if ( list.count() == 0 ) 1360 if ( list.count() == 0 )
1360 mViewManager->refreshView(); 1361 mViewManager->refreshView();
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 58d8d34..30c0d2f 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,1366 +1,1368 @@
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( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 240 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
241 mView->setModified( false ); 241 mView->setModified( false );
242 mBlockAtStartup = false; 242 mBlockAtStartup = false;
243 mView->setModified( false ); 243 mView->setModified( false );
244 setCentralWidget( mView ); 244 setCentralWidget( mView );
245 globalFlagBlockStartup = 0; 245 globalFlagBlockStartup = 0;
246 mView->show(); 246 mView->show();
247 delete splash; 247 delete splash;
248 if ( newFile ) 248 if ( newFile )
249 mView->updateConfig(); 249 mView->updateConfig();
250 // qApp->processEvents(); 250 // qApp->processEvents();
251 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 251 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
252 //fillSyncMenu(); 252 //fillSyncMenu();
253 253
254 254
255 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 255 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
256 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 256 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
257 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 257 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
258 mSyncManager->setDefaultFileName( defaultFileName()); 258 mSyncManager->setDefaultFileName( defaultFileName());
259 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 259 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
260 mSyncManager->fillSyncMenu(); 260 mSyncManager->fillSyncMenu();
261 261
262 262
263 263
264 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 264 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
265 if ( showWarning ) { 265 if ( showWarning ) {
266 KMessageBox::information( this, 266 KMessageBox::information( this,
267 "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"); 267 "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");
268 qApp->processEvents(); 268 qApp->processEvents();
269 mView->dialogManager()->showSyncOptions(); 269 mView->dialogManager()->showSyncOptions();
270 } 270 }
271 271
272 //US listen for result adressed from Ka/Pi 272 //US listen for result adressed from Ka/Pi
273#ifndef DESKTOP_VERSION 273#ifndef DESKTOP_VERSION
274 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 274 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
275#endif 275#endif
276} 276}
277MainWindow::~MainWindow() 277MainWindow::~MainWindow()
278{ 278{
279 //qDebug("MainWindow::~MainWindow() "); 279 //qDebug("MainWindow::~MainWindow() ");
280 //save toolbar location 280 //save toolbar location
281 delete mCalendar; 281 delete mCalendar;
282 delete mSyncManager; 282 delete mSyncManager;
283 283
284 284
285} 285}
286void MainWindow::showMaximized () 286void MainWindow::showMaximized ()
287{ 287{
288#ifndef DESKTOP_VERSION 288#ifndef DESKTOP_VERSION
289 if ( ! globalFlagBlockStartup ) 289 if ( ! globalFlagBlockStartup )
290 if ( mClosed ) 290 if ( mClosed )
291 mView->goToday(); 291 mView->goToday();
292#endif 292#endif
293 QWidget::showMaximized () ; 293 QWidget::showMaximized () ;
294 mClosed = false; 294 mClosed = false;
295} 295}
296void MainWindow::closeEvent( QCloseEvent* ce ) 296void MainWindow::closeEvent( QCloseEvent* ce )
297{ 297{
298 298
299 299
300 300
301 if ( ! KOPrefs::instance()->mAskForQuit ) { 301 if ( ! KOPrefs::instance()->mAskForQuit ) {
302 saveOnClose(); 302 saveOnClose();
303 mClosed = true; 303 mClosed = true;
304 ce->accept(); 304 ce->accept();
305 return; 305 return;
306 306
307 } 307 }
308 308
309 switch( QMessageBox::information( this, "KO/Pi", 309 switch( QMessageBox::information( this, "KO/Pi",
310 i18n("Do you really want\nto close KO/Pi?"), 310 i18n("Do you really want\nto close KO/Pi?"),
311 i18n("Close"), i18n("No"), 311 i18n("Close"), i18n("No"),
312 0, 0 ) ) { 312 0, 0 ) ) {
313 case 0: 313 case 0:
314 saveOnClose(); 314 saveOnClose();
315 mClosed = true; 315 mClosed = true;
316 ce->accept(); 316 ce->accept();
317 break; 317 break;
318 case 1: 318 case 1:
319 ce->ignore(); 319 ce->ignore();
320 break; 320 break;
321 case 2: 321 case 2:
322 322
323 default: 323 default:
324 break; 324 break;
325 } 325 }
326 326
327 327
328} 328}
329 329
330void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 330void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
331{ 331{
332 QDataStream stream( data, IO_ReadOnly ); 332 QDataStream stream( data, IO_ReadOnly );
333 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 333 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
334 //QString datamess; 334 //QString datamess;
335 //qDebug("message "); 335 //qDebug("message ");
336 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 336 qDebug("KO: QCOP message received: %s ", cmsg.data() );
337 337
338 if ( cmsg == "setDocument(QString)" ) { 338 if ( cmsg == "setDocument(QString)" ) {
339 QDataStream stream( data, IO_ReadOnly ); 339 QDataStream stream( data, IO_ReadOnly );
340 QString fileName; 340 QString fileName;
341 stream >> fileName; 341 stream >> fileName;
342 qDebug("filename %s ", fileName.latin1()); 342 //qDebug("filename %s ", fileName.latin1());
343 showMaximized();
344 raise();
343 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 345 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
344 mSyncManager->slotSyncMenu( 1002 ); 346 mSyncManager->slotSyncMenu( 1002 );
345 return; 347 return;
346 } 348 }
347 349
348 if ( cmsg == "-writeFile" ) { 350 if ( cmsg == "-writeFile" ) {
349 // I made from the "-writeFile" an "-writeAlarm" 351 // I made from the "-writeFile" an "-writeAlarm"
350 mView->viewManager()->showWhatsNextView(); 352 mView->viewManager()->showWhatsNextView();
351 mCalendar->checkAlarmForIncidence( 0, true); 353 mCalendar->checkAlarmForIncidence( 0, true);
352 showMaximized(); 354 showMaximized();
353 raise(); 355 raise();
354 return; 356 return;
355 357
356 } 358 }
357 if ( cmsg == "-writeFileSilent" ) { 359 if ( cmsg == "-writeFileSilent" ) {
358 // I made from the "-writeFile" an "-writeAlarm" 360 // I made from the "-writeFile" an "-writeAlarm"
359 // mView->viewManager()->showWhatsNextView(); 361 // mView->viewManager()->showWhatsNextView();
360 mCalendar->checkAlarmForIncidence( 0, true); 362 mCalendar->checkAlarmForIncidence( 0, true);
361 //showMaximized(); 363 //showMaximized();
362 //raise(); 364 //raise();
363 hide(); 365 hide();
364 return; 366 return;
365 } 367 }
366 if ( cmsg == "-newCountdown" ) { 368 if ( cmsg == "-newCountdown" ) {
367 qDebug("newCountdown "); 369 qDebug("newCountdown ");
368 370
369 } 371 }
370 QString msg ; 372 QString msg ;
371 QString allmsg = cmsg; 373 QString allmsg = cmsg;
372 while ( allmsg.length() > 0 ) { 374 while ( allmsg.length() > 0 ) {
373 int nextC = allmsg.find( "-", 1 ); 375 int nextC = allmsg.find( "-", 1 );
374 if ( nextC == -1 ) { 376 if ( nextC == -1 ) {
375 msg = allmsg; 377 msg = allmsg;
376 allmsg = ""; 378 allmsg = "";
377 } else{ 379 } else{
378 msg = allmsg.left( nextC ); 380 msg = allmsg.left( nextC );
379 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 381 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
380 } 382 }
381 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 383 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
382 if ( msg == "-newEvent" ) { 384 if ( msg == "-newEvent" ) {
383 mView->newEvent(); 385 mView->newEvent();
384 } 386 }
385 if ( msg == "-newTodo" ) { 387 if ( msg == "-newTodo" ) {
386 mView->newTodo(); 388 mView->newTodo();
387 389
388 } 390 }
389 if ( msg == "-showWN" ) { 391 if ( msg == "-showWN" ) {
390 mView->viewManager()->showWhatsNextView(); 392 mView->viewManager()->showWhatsNextView();
391 } 393 }
392 if ( msg == "-showTodo" ) { 394 if ( msg == "-showTodo" ) {
393 mView->viewManager()->showTodoView(); 395 mView->viewManager()->showTodoView();
394 } 396 }
395 if ( msg == "-showList" ) { 397 if ( msg == "-showList" ) {
396 mView->viewManager()->showListView(); 398 mView->viewManager()->showListView();
397 } 399 }
398 else if ( msg == "-showDay" ) { 400 else if ( msg == "-showDay" ) {
399 mView->viewManager()->showDayView(); 401 mView->viewManager()->showDayView();
400 } 402 }
401 else if ( msg == "-showWWeek" ) { 403 else if ( msg == "-showWWeek" ) {
402 mView->viewManager()->showWorkWeekView(); 404 mView->viewManager()->showWorkWeekView();
403 } 405 }
404 else if ( msg == "-ringSync" ) { 406 else if ( msg == "-ringSync" ) {
405 mSyncManager->multiSync( false ); 407 mSyncManager->multiSync( false );
406 } 408 }
407 else if ( msg == "-showWeek" ) { 409 else if ( msg == "-showWeek" ) {
408 mView->viewManager()->showWeekView(); 410 mView->viewManager()->showWeekView();
409 } 411 }
410 else if ( msg == "-showTodo" ) { 412 else if ( msg == "-showTodo" ) {
411 mView->viewManager()->showTodoView(); 413 mView->viewManager()->showTodoView();
412 } 414 }
413 else if ( msg == "-showJournal" ) { 415 else if ( msg == "-showJournal" ) {
414 mView->dateNavigator()->selectDates( 1 ); 416 mView->dateNavigator()->selectDates( 1 );
415 mView->dateNavigator()->selectToday(); 417 mView->dateNavigator()->selectToday();
416 mView->viewManager()->showJournalView(); 418 mView->viewManager()->showJournalView();
417 } 419 }
418 else if ( msg == "-showKO" ) { 420 else if ( msg == "-showKO" ) {
419 mView->viewManager()->showNextXView(); 421 mView->viewManager()->showNextXView();
420 } 422 }
421 else if ( msg == "-showWNext" || msg == "nextView()" ) { 423 else if ( msg == "-showWNext" || msg == "nextView()" ) {
422 mView->viewManager()->showWhatsNextView(); 424 mView->viewManager()->showWhatsNextView();
423 } 425 }
424 else if ( msg == "-showNextXView" ) { 426 else if ( msg == "-showNextXView" ) {
425 mView->viewManager()->showNextXView(); 427 mView->viewManager()->showNextXView();
426 } 428 }
427 429
428 430
429 } 431 }
430 432
431 showMaximized(); 433 showMaximized();
432 raise(); 434 raise();
433} 435}
434 436
435QPixmap MainWindow::loadPixmap( QString name ) 437QPixmap MainWindow::loadPixmap( QString name )
436{ 438{
437 return SmallIcon( name ); 439 return SmallIcon( name );
438 440
439} 441}
440void MainWindow::initActions() 442void MainWindow::initActions()
441{ 443{
442 //KOPrefs::instance()->mShowFullMenu 444 //KOPrefs::instance()->mShowFullMenu
443 iconToolBar->clear(); 445 iconToolBar->clear();
444 KOPrefs *p = KOPrefs::instance(); 446 KOPrefs *p = KOPrefs::instance();
445 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 447 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
446 448
447 QPopupMenu *viewMenu = new QPopupMenu( this ); 449 QPopupMenu *viewMenu = new QPopupMenu( this );
448 QPopupMenu *actionMenu = new QPopupMenu( this ); 450 QPopupMenu *actionMenu = new QPopupMenu( this );
449 QPopupMenu *importMenu = new QPopupMenu( this ); 451 QPopupMenu *importMenu = new QPopupMenu( this );
450 selectFilterMenu = new QPopupMenu( this ); 452 selectFilterMenu = new QPopupMenu( this );
451 selectFilterMenu->setCheckable( true ); 453 selectFilterMenu->setCheckable( true );
452 syncMenu = new QPopupMenu( this ); 454 syncMenu = new QPopupMenu( this );
453 configureAgendaMenu = new QPopupMenu( this ); 455 configureAgendaMenu = new QPopupMenu( this );
454 configureToolBarMenu = new QPopupMenu( this ); 456 configureToolBarMenu = new QPopupMenu( this );
455 QPopupMenu *helpMenu = new QPopupMenu( this ); 457 QPopupMenu *helpMenu = new QPopupMenu( this );
456 if ( KOPrefs::instance()->mShowFullMenu ) { 458 if ( KOPrefs::instance()->mShowFullMenu ) {
457 QMenuBar *menuBar1; 459 QMenuBar *menuBar1;
458 menuBar1 = menuBar(); 460 menuBar1 = menuBar();
459 menuBar1->insertItem( i18n("File"), importMenu ); 461 menuBar1->insertItem( i18n("File"), importMenu );
460 menuBar1->insertItem( i18n("View"), viewMenu ); 462 menuBar1->insertItem( i18n("View"), viewMenu );
461 menuBar1->insertItem( i18n("Actions"), actionMenu ); 463 menuBar1->insertItem( i18n("Actions"), actionMenu );
462 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 464 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
463 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 465 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
464 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 466 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
465 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 467 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
466 menuBar1->insertItem( i18n("Help"), helpMenu ); 468 menuBar1->insertItem( i18n("Help"), helpMenu );
467 } else { 469 } else {
468 QPEMenuBar *menuBar1; 470 QPEMenuBar *menuBar1;
469 menuBar1 = new QPEMenuBar( iconToolBar ); 471 menuBar1 = new QPEMenuBar( iconToolBar );
470 QPopupMenu *menuBar = new QPopupMenu( this ); 472 QPopupMenu *menuBar = new QPopupMenu( this );
471 menuBar1->insertItem( i18n("ME"), menuBar); 473 menuBar1->insertItem( i18n("ME"), menuBar);
472 menuBar->insertItem( i18n("File"), importMenu ); 474 menuBar->insertItem( i18n("File"), importMenu );
473 menuBar->insertItem( i18n("View"), viewMenu ); 475 menuBar->insertItem( i18n("View"), viewMenu );
474 menuBar->insertItem( i18n("Actions"), actionMenu ); 476 menuBar->insertItem( i18n("Actions"), actionMenu );
475 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 477 menuBar->insertItem( i18n("Synchronize"), syncMenu );
476 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 478 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
477 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 479 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
478 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 480 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
479 menuBar->insertItem( i18n("Help"), helpMenu ); 481 menuBar->insertItem( i18n("Help"), helpMenu );
480 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 482 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
481 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 483 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
482 } 484 }
483 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 485 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
484 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); 486 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) );
485 487
486 // ****************** 488 // ******************
487 QAction *action; 489 QAction *action;
488 QIconSet icon; 490 QIconSet icon;
489 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 491 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
490 configureToolBarMenu->setCheckable( true ); 492 configureToolBarMenu->setCheckable( true );
491 493
492 QString pathString = ""; 494 QString pathString = "";
493 if ( !p->mToolBarMiniIcons ) { 495 if ( !p->mToolBarMiniIcons ) {
494 if ( QApplication::desktop()->width() < 480 ) 496 if ( QApplication::desktop()->width() < 480 )
495 pathString += "icons16/"; 497 pathString += "icons16/";
496 } else 498 } else
497 pathString += "iconsmini/"; 499 pathString += "iconsmini/";
498 configureAgendaMenu->setCheckable( true ); 500 configureAgendaMenu->setCheckable( true );
499 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); 501 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 );
500 configureAgendaMenu->insertSeparator(); 502 configureAgendaMenu->insertSeparator();
501 configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); 503 configureAgendaMenu->insertItem(i18n("Tiny"), 4 );
502 configureAgendaMenu->insertItem(i18n("Small"), 6 ); 504 configureAgendaMenu->insertItem(i18n("Small"), 6 );
503 configureAgendaMenu->insertItem(i18n("Medium"), 8 ); 505 configureAgendaMenu->insertItem(i18n("Medium"), 8 );
504 configureAgendaMenu->insertItem(i18n("Normal"), 10 ); 506 configureAgendaMenu->insertItem(i18n("Normal"), 10 );
505 configureAgendaMenu->insertItem(i18n("Large"), 12 ); 507 configureAgendaMenu->insertItem(i18n("Large"), 12 );
506 configureAgendaMenu->insertItem(i18n("Big"), 14 ); 508 configureAgendaMenu->insertItem(i18n("Big"), 14 );
507 configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); 509 configureAgendaMenu->insertItem(i18n("Bigger"), 16 );
508 configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); 510 configureAgendaMenu->insertItem(i18n("Biggest"), 18 );
509 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 511 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
510 512
511 icon = loadPixmap( pathString + "configure" ); 513 icon = loadPixmap( pathString + "configure" );
512 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 514 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
513 action->addTo( actionMenu ); 515 action->addTo( actionMenu );
514 connect( action, SIGNAL( activated() ), 516 connect( action, SIGNAL( activated() ),
515 mView, SLOT( edit_options() ) ); 517 mView, SLOT( edit_options() ) );
516 actionMenu->insertSeparator(); 518 actionMenu->insertSeparator();
517 icon = loadPixmap( pathString + "newevent" ); 519 icon = loadPixmap( pathString + "newevent" );
518 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 520 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
519 configureToolBarMenu->insertSeparator(); 521 configureToolBarMenu->insertSeparator();
520 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 522 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
521 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 523 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
522 ne_action->addTo( actionMenu ); 524 ne_action->addTo( actionMenu );
523 connect( ne_action, SIGNAL( activated() ), 525 connect( ne_action, SIGNAL( activated() ),
524 mView, SLOT( newEvent() ) ); 526 mView, SLOT( newEvent() ) );
525 icon = loadPixmap( pathString + "newtodo" ); 527 icon = loadPixmap( pathString + "newtodo" );
526 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 528 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
527 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 529 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
528 nt_action->addTo( actionMenu ); 530 nt_action->addTo( actionMenu );
529 connect( nt_action, SIGNAL( activated() ), 531 connect( nt_action, SIGNAL( activated() ),
530 mView, SLOT( newTodo() ) ); 532 mView, SLOT( newTodo() ) );
531 icon = loadPixmap( pathString + "navi" ); 533 icon = loadPixmap( pathString + "navi" );
532 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 534 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
533 action->addTo( viewMenu ); 535 action->addTo( viewMenu );
534 connect( action, SIGNAL( activated() ), 536 connect( action, SIGNAL( activated() ),
535 mView, SLOT( toggleDateNavigatorWidget() ) ); 537 mView, SLOT( toggleDateNavigatorWidget() ) );
536 icon = loadPixmap( pathString + "filter" ); 538 icon = loadPixmap( pathString + "filter" );
537 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 539 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
538 action->addTo( viewMenu ); 540 action->addTo( viewMenu );
539 connect( action, SIGNAL( activated() ), 541 connect( action, SIGNAL( activated() ),
540 mView, SLOT( toggleFilter() ) ); 542 mView, SLOT( toggleFilter() ) );
541 543
542 544
543 viewMenu->insertSeparator(); 545 viewMenu->insertSeparator();
544 icon = loadPixmap( pathString + "picker" ); 546 icon = loadPixmap( pathString + "picker" );
545 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 547 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
546 action->addTo( viewMenu ); 548 action->addTo( viewMenu );
547 connect( action, SIGNAL( activated() ), 549 connect( action, SIGNAL( activated() ),
548 mView, SLOT( showDatePicker() ) ); 550 mView, SLOT( showDatePicker() ) );
549 action->addTo( iconToolBar ); 551 action->addTo( iconToolBar );
550 viewMenu->insertSeparator(); 552 viewMenu->insertSeparator();
551 icon = loadPixmap( pathString + "list" ); 553 icon = loadPixmap( pathString + "list" );
552 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 554 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
553 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 555 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
554 showlist_action->addTo( viewMenu ); 556 showlist_action->addTo( viewMenu );
555 connect( showlist_action, SIGNAL( activated() ), 557 connect( showlist_action, SIGNAL( activated() ),
556 mView->viewManager(), SLOT( showListView() ) ); 558 mView->viewManager(), SLOT( showListView() ) );
557 559
558 560
559 icon = loadPixmap( pathString + "day" ); 561 icon = loadPixmap( pathString + "day" );
560 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 562 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
561 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 563 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
562 day1_action->addTo( viewMenu ); 564 day1_action->addTo( viewMenu );
563 // action->addTo( toolBar ); 565 // action->addTo( toolBar );
564 connect( day1_action, SIGNAL( activated() ), 566 connect( day1_action, SIGNAL( activated() ),
565 mView->viewManager(), SLOT( showDayView() ) ); 567 mView->viewManager(), SLOT( showDayView() ) );
566 568
567 icon = loadPixmap( pathString + "workweek" ); 569 icon = loadPixmap( pathString + "workweek" );
568 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 570 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
569 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 571 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
570 day5_action->addTo( viewMenu ); 572 day5_action->addTo( viewMenu );
571 connect( day5_action, SIGNAL( activated() ), 573 connect( day5_action, SIGNAL( activated() ),
572 mView->viewManager(), SLOT( showWorkWeekView() ) ); 574 mView->viewManager(), SLOT( showWorkWeekView() ) );
573 575
574 icon = loadPixmap( pathString + "week" ); 576 icon = loadPixmap( pathString + "week" );
575 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 577 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
576 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 578 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
577 day7_action->addTo( viewMenu ); 579 day7_action->addTo( viewMenu );
578 connect( day7_action, SIGNAL( activated() ), 580 connect( day7_action, SIGNAL( activated() ),
579 mView->viewManager(), SLOT( showWeekView() ) ); 581 mView->viewManager(), SLOT( showWeekView() ) );
580 582
581 icon = loadPixmap( pathString + "month" ); 583 icon = loadPixmap( pathString + "month" );
582 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 584 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
583 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 585 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
584 month_action->addTo( viewMenu ); 586 month_action->addTo( viewMenu );
585 connect( month_action, SIGNAL( activated() ), 587 connect( month_action, SIGNAL( activated() ),
586 mView->viewManager(), SLOT( showMonthView() ) ); 588 mView->viewManager(), SLOT( showMonthView() ) );
587 589
588 icon = loadPixmap( pathString + "todo" ); 590 icon = loadPixmap( pathString + "todo" );
589 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 591 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
590 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 592 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
591 todoview_action->addTo( viewMenu ); 593 todoview_action->addTo( viewMenu );
592 connect( todoview_action, SIGNAL( activated() ), 594 connect( todoview_action, SIGNAL( activated() ),
593 mView->viewManager(), SLOT( showTodoView() ) ); 595 mView->viewManager(), SLOT( showTodoView() ) );
594 596
595 icon = loadPixmap( pathString + "journal" ); 597 icon = loadPixmap( pathString + "journal" );
596 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 598 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
597 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 599 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
598 viewjournal_action->addTo( viewMenu ); 600 viewjournal_action->addTo( viewMenu );
599 connect( viewjournal_action, SIGNAL( activated() ), 601 connect( viewjournal_action, SIGNAL( activated() ),
600 mView->viewManager(), SLOT( showJournalView() ) ); 602 mView->viewManager(), SLOT( showJournalView() ) );
601 603
602 icon = loadPixmap( pathString + "xdays" ); 604 icon = loadPixmap( pathString + "xdays" );
603 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 605 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
604 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 606 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
605 xdays_action->addTo( viewMenu ); 607 xdays_action->addTo( viewMenu );
606 connect( xdays_action, SIGNAL( activated() ), 608 connect( xdays_action, SIGNAL( activated() ),
607 mView->viewManager(), SLOT( showNextXView() ) ); 609 mView->viewManager(), SLOT( showNextXView() ) );
608 610
609 icon = loadPixmap( pathString + "whatsnext" ); 611 icon = loadPixmap( pathString + "whatsnext" );
610 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 612 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
611 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 613 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
612 whatsnext_action->addTo( viewMenu ); 614 whatsnext_action->addTo( viewMenu );
613 connect( whatsnext_action, SIGNAL( activated() ), 615 connect( whatsnext_action, SIGNAL( activated() ),
614 mView->viewManager(), SLOT( showWhatsNextView() ) ); 616 mView->viewManager(), SLOT( showWhatsNextView() ) );
615 617
616#if 0 618#if 0
617 action = new QAction( "view_timespan", "Time Span", 0, this ); 619 action = new QAction( "view_timespan", "Time Span", 0, this );
618 action->addTo( viewMenu ); 620 action->addTo( viewMenu );
619 connect( action, SIGNAL( activated() ), 621 connect( action, SIGNAL( activated() ),
620 mView->viewManager(), SLOT( showTimeSpanView() ) ); 622 mView->viewManager(), SLOT( showTimeSpanView() ) );
621#endif 623#endif
622 624
623 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 625 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
624 this ); 626 this );
625 mNewSubTodoAction->addTo( actionMenu ); 627 mNewSubTodoAction->addTo( actionMenu );
626 connect( mNewSubTodoAction, SIGNAL( activated() ), 628 connect( mNewSubTodoAction, SIGNAL( activated() ),
627 mView, SLOT( newSubTodo() ) ); 629 mView, SLOT( newSubTodo() ) );
628 630
629 actionMenu->insertSeparator(); 631 actionMenu->insertSeparator();
630 632
631 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 633 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
632 mShowAction->addTo( actionMenu ); 634 mShowAction->addTo( actionMenu );
633 connect( mShowAction, SIGNAL( activated() ), 635 connect( mShowAction, SIGNAL( activated() ),
634 mView, SLOT( showIncidence() ) ); 636 mView, SLOT( showIncidence() ) );
635 637
636 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 638 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
637 mEditAction->addTo( actionMenu ); 639 mEditAction->addTo( actionMenu );
638 connect( mEditAction, SIGNAL( activated() ), 640 connect( mEditAction, SIGNAL( activated() ),
639 mView, SLOT( editIncidence() ) ); 641 mView, SLOT( editIncidence() ) );
640 642
641 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 643 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
642 mDeleteAction->addTo( actionMenu ); 644 mDeleteAction->addTo( actionMenu );
643 connect( mDeleteAction, SIGNAL( activated() ), 645 connect( mDeleteAction, SIGNAL( activated() ),
644 mView, SLOT( deleteIncidence() ) ); 646 mView, SLOT( deleteIncidence() ) );
645 647
646 648
647 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 649 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
648 mCloneAction->addTo( actionMenu ); 650 mCloneAction->addTo( actionMenu );
649 connect( mCloneAction, SIGNAL( activated() ), 651 connect( mCloneAction, SIGNAL( activated() ),
650 mView, SLOT( cloneIncidence() ) ); 652 mView, SLOT( cloneIncidence() ) );
651 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 653 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
652 mMoveAction->addTo( actionMenu ); 654 mMoveAction->addTo( actionMenu );
653 connect( mMoveAction, SIGNAL( activated() ), 655 connect( mMoveAction, SIGNAL( activated() ),
654 mView, SLOT( moveIncidence() ) ); 656 mView, SLOT( moveIncidence() ) );
655 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 657 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
656 mBeamAction->addTo( actionMenu ); 658 mBeamAction->addTo( actionMenu );
657 connect( mBeamAction, SIGNAL( activated() ), 659 connect( mBeamAction, SIGNAL( activated() ),
658 mView, SLOT( beamIncidence() ) ); 660 mView, SLOT( beamIncidence() ) );
659 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 661 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
660 mCancelAction->addTo( actionMenu ); 662 mCancelAction->addTo( actionMenu );
661 connect( mCancelAction, SIGNAL( activated() ), 663 connect( mCancelAction, SIGNAL( activated() ),
662 mView, SLOT( toggleCancelIncidence() ) ); 664 mView, SLOT( toggleCancelIncidence() ) );
663 665
664 actionMenu->insertSeparator(); 666 actionMenu->insertSeparator();
665 667
666 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 668 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
667 this ); 669 this );
668 action->addTo( actionMenu ); 670 action->addTo( actionMenu );
669 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 671 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
670 672
671 icon = loadPixmap( pathString + "search" ); 673 icon = loadPixmap( pathString + "search" );
672 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 674 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
673 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 675 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
674 search_action->addTo( actionMenu ); 676 search_action->addTo( actionMenu );
675 connect( search_action, SIGNAL( activated() ), 677 connect( search_action, SIGNAL( activated() ),
676 mView->dialogManager(), SLOT( showSearchDialog() ) ); 678 mView->dialogManager(), SLOT( showSearchDialog() ) );
677 679
678 icon = loadPixmap( pathString + "today" ); 680 icon = loadPixmap( pathString + "today" );
679 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 681 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
680 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 682 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
681 today_action->addTo( actionMenu ); 683 today_action->addTo( actionMenu );
682 connect( today_action, SIGNAL( activated() ), 684 connect( today_action, SIGNAL( activated() ),
683 mView, SLOT( goToday() ) ); 685 mView, SLOT( goToday() ) );
684 686
685 if ( KOPrefs::instance()->mShowFullMenu ) { 687 if ( KOPrefs::instance()->mShowFullMenu ) {
686 actionMenu->insertSeparator(); 688 actionMenu->insertSeparator();
687 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 689 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
688 690
689 } 691 }
690 // actionMenu->insertSeparator(); 692 // actionMenu->insertSeparator();
691 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 693 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
692 this ); 694 this );
693 action->addTo( importMenu ); 695 action->addTo( importMenu );
694 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 696 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
695 action = new QAction( "import_quick", i18n("Import last file"), 0, 697 action = new QAction( "import_quick", i18n("Import last file"), 0,
696 this ); 698 this );
697 action->addTo( importMenu ); 699 action->addTo( importMenu );
698 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 700 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
699 importMenu->insertSeparator(); 701 importMenu->insertSeparator();
700 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 702 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
701 this ); 703 this );
702 action->addTo( importMenu ); 704 action->addTo( importMenu );
703 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 705 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
704#ifndef DESKTOP_VERSION 706#ifndef DESKTOP_VERSION
705 importMenu->insertSeparator(); 707 importMenu->insertSeparator();
706 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 708 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
707 this ); 709 this );
708 action->addTo( importMenu ); 710 action->addTo( importMenu );
709 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 711 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
710#else 712#else
711#ifdef _WIN32_ 713#ifdef _WIN32_
712 importMenu->insertSeparator(); 714 importMenu->insertSeparator();
713 action = new QAction( "import_ol", i18n("Import from OL"), 0, 715 action = new QAction( "import_ol", i18n("Import from OL"), 0,
714 this ); 716 this );
715 action->addTo( importMenu ); 717 action->addTo( importMenu );
716 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 718 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
717#endif 719#endif
718#endif 720#endif
719 721
720 importMenu->insertSeparator(); 722 importMenu->insertSeparator();
721 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 723 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
722 this ); 724 this );
723 action->addTo( importMenu ); 725 action->addTo( importMenu );
724 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 726 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
725 727
726 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 728 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
727 this ); 729 this );
728 action->addTo( importMenu ); 730 action->addTo( importMenu );
729 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 731 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
730 732
731 importMenu->insertSeparator(); 733 importMenu->insertSeparator();
732 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 734 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
733 this ); 735 this );
734 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 736 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
735 737
736 738
737 //LR 739 //LR
738 QPopupMenu *ex2phone = new QPopupMenu( this ); 740 QPopupMenu *ex2phone = new QPopupMenu( this );
739 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 741 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
740 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 742 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
741 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 743 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
742 importMenu->insertItem( i18n("Export to phone"), ex2phone ); 744 importMenu->insertItem( i18n("Export to phone"), ex2phone );
743 745
744 importMenu->insertSeparator(); 746 importMenu->insertSeparator();
745 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 747 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
746 this ); 748 this );
747 action->addTo( importMenu ); 749 action->addTo( importMenu );
748 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 750 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
749#ifndef DESKTOP_VERSION 751#ifndef DESKTOP_VERSION
750 importMenu->insertSeparator(); 752 importMenu->insertSeparator();
751 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 753 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
752 this ); 754 this );
753 action->addTo( importMenu ); 755 action->addTo( importMenu );
754 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 756 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
755 757
756 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 758 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
757 this ); 759 this );
758 action->addTo( importMenu ); 760 action->addTo( importMenu );
759 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 761 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
760#else 762#else
761 importMenu->insertSeparator(); 763 importMenu->insertSeparator();
762 icon = loadPixmap( pathString + "print" ); 764 icon = loadPixmap( pathString + "print" );
763 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 765 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
764 action->addTo( importMenu ); 766 action->addTo( importMenu );
765 connect( action, SIGNAL( activated() ), 767 connect( action, SIGNAL( activated() ),
766 this, SLOT( printCal() ) ); 768 this, SLOT( printCal() ) );
767 769
768 icon = loadPixmap( pathString + "print" ); 770 icon = loadPixmap( pathString + "print" );
769 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 771 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
770 action->addTo( importMenu ); 772 action->addTo( importMenu );
771 connect( action, SIGNAL( activated() ), 773 connect( action, SIGNAL( activated() ),
772 this, SLOT( printSel() ) ); 774 this, SLOT( printSel() ) );
773#endif 775#endif
774 importMenu->insertSeparator(); 776 importMenu->insertSeparator();
775 action = new QAction( "beam all", i18n("Save"), 0, 777 action = new QAction( "beam all", i18n("Save"), 0,
776 this ); 778 this );
777 action->addTo( importMenu ); 779 action->addTo( importMenu );
778 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 780 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
779 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 781 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
780 this ); 782 this );
781 action->addTo( importMenu ); 783 action->addTo( importMenu );
782 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 784 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
783 785
784 //menuBar->insertItem( "Configure",configureMenu ); 786 //menuBar->insertItem( "Configure",configureMenu );
785 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 787 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
786 icon = loadPixmap( "korganizer/korganizer" ); 788 icon = loadPixmap( "korganizer/korganizer" );
787 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 789 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
788 action->addTo( helpMenu ); 790 action->addTo( helpMenu );
789 connect( action, SIGNAL( activated() ), 791 connect( action, SIGNAL( activated() ),
790 SLOT( keyBindings() ) ); 792 SLOT( keyBindings() ) );
791 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 793 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
792 action->addTo( helpMenu ); 794 action->addTo( helpMenu );
793 connect( action, SIGNAL( activated() ), 795 connect( action, SIGNAL( activated() ),
794 SLOT( features() ) ); 796 SLOT( features() ) );
795 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 797 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
796 action->addTo( helpMenu ); 798 action->addTo( helpMenu );
797 connect( action, SIGNAL( activated() ), 799 connect( action, SIGNAL( activated() ),
798 SLOT( aboutAutoSaving() ) ); 800 SLOT( aboutAutoSaving() ) );
799 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 801 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
800 action->addTo( helpMenu ); 802 action->addTo( helpMenu );
801 connect( action, SIGNAL( activated() ), 803 connect( action, SIGNAL( activated() ),
802 SLOT( aboutKnownBugs() ) ); 804 SLOT( aboutKnownBugs() ) );
803 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 805 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
804 action->addTo( helpMenu ); 806 action->addTo( helpMenu );
805 connect( action, SIGNAL( activated() ), 807 connect( action, SIGNAL( activated() ),
806 SLOT( usertrans() ) ); 808 SLOT( usertrans() ) );
807 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 809 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
808 action->addTo( helpMenu ); 810 action->addTo( helpMenu );
809 connect( action, SIGNAL( activated() ), 811 connect( action, SIGNAL( activated() ),
810 SLOT( synchowto() ) ); 812 SLOT( synchowto() ) );
811 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 813 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
812 action->addTo( helpMenu ); 814 action->addTo( helpMenu );
813 connect( action, SIGNAL( activated() ), 815 connect( action, SIGNAL( activated() ),
814 SLOT( whatsNew() ) ); 816 SLOT( whatsNew() ) );
815 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 817 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
816 action->addTo( helpMenu ); 818 action->addTo( helpMenu );
817 connect( action, SIGNAL( activated() ), 819 connect( action, SIGNAL( activated() ),
818 SLOT( faq() ) ); 820 SLOT( faq() ) );
819 821
820 822
821 action = new QAction( "about", i18n("About..."), 0, this ); 823 action = new QAction( "about", i18n("About..."), 0, this );
822 action->addTo( helpMenu ); 824 action->addTo( helpMenu );
823 connect( action, SIGNAL( activated() ), 825 connect( action, SIGNAL( activated() ),
824 SLOT( about() ) ); 826 SLOT( about() ) );
825 action = new QAction( "licence", i18n("Licence..."), 0, this ); 827 action = new QAction( "licence", i18n("Licence..."), 0, this );
826 action->addTo( helpMenu ); 828 action->addTo( helpMenu );
827 connect( action, SIGNAL( activated() ), 829 connect( action, SIGNAL( activated() ),
828 SLOT( licence() ) ); 830 SLOT( licence() ) );
829 //menuBar->insertSeparator(); 831 //menuBar->insertSeparator();
830 832
831 // ****************************************************** 833 // ******************************************************
832 // menubar icons 834 // menubar icons
833 835
834 836
835 iconToolBar->setHorizontalStretchable (true ); 837 iconToolBar->setHorizontalStretchable (true );
836 //menuBar->insertItem( iconToolBar ); 838 //menuBar->insertItem( iconToolBar );
837 //xdays_action 839 //xdays_action
838 if (p-> mShowIconNewEvent) 840 if (p-> mShowIconNewEvent)
839 ne_action->addTo( iconToolBar ); 841 ne_action->addTo( iconToolBar );
840 if (p->mShowIconNewTodo ) 842 if (p->mShowIconNewTodo )
841 nt_action->addTo( iconToolBar ); 843 nt_action->addTo( iconToolBar );
842 if (p-> mShowIconSearch) 844 if (p-> mShowIconSearch)
843 search_action->addTo( iconToolBar ); 845 search_action->addTo( iconToolBar );
844 if (p-> mShowIconNext) 846 if (p-> mShowIconNext)
845 whatsnext_action->addTo( iconToolBar ); 847 whatsnext_action->addTo( iconToolBar );
846 if (p-> mShowIconNextDays) 848 if (p-> mShowIconNextDays)
847 xdays_action->addTo( iconToolBar ); 849 xdays_action->addTo( iconToolBar );
848 if (p-> mShowIconList) 850 if (p-> mShowIconList)
849 showlist_action->addTo( iconToolBar ); 851 showlist_action->addTo( iconToolBar );
850 if (p-> mShowIconDay1) 852 if (p-> mShowIconDay1)
851 day1_action->addTo( iconToolBar ); 853 day1_action->addTo( iconToolBar );
852 if (p-> mShowIconDay5) 854 if (p-> mShowIconDay5)
853 day5_action->addTo( iconToolBar ); 855 day5_action->addTo( iconToolBar );
854 if (p-> mShowIconDay7) 856 if (p-> mShowIconDay7)
855 day7_action->addTo( iconToolBar ); 857 day7_action->addTo( iconToolBar );
856 if (p-> mShowIconMonth) 858 if (p-> mShowIconMonth)
857 month_action->addTo( iconToolBar ); 859 month_action->addTo( iconToolBar );
858 if (p-> mShowIconTodoview) 860 if (p-> mShowIconTodoview)
859 todoview_action->addTo( iconToolBar ); 861 todoview_action->addTo( iconToolBar );
860 if (p-> mShowIconJournal) 862 if (p-> mShowIconJournal)
861 viewjournal_action->addTo( iconToolBar ); 863 viewjournal_action->addTo( iconToolBar );
862 icon = loadPixmap( pathString + "2leftarrowB" ); 864 icon = loadPixmap( pathString + "2leftarrowB" );
863 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 865 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
864 if (p-> mShowIconBackFast) { 866 if (p-> mShowIconBackFast) {
865 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 867 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
866 connect( action, SIGNAL( activated() ), 868 connect( action, SIGNAL( activated() ),
867 mView, SLOT( goPreviousMonth() ) ); 869 mView, SLOT( goPreviousMonth() ) );
868 action->addTo( iconToolBar ); 870 action->addTo( iconToolBar );
869 } 871 }
870 icon = loadPixmap( pathString + "1leftarrowB" ); 872 icon = loadPixmap( pathString + "1leftarrowB" );
871 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 873 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
872 if (p-> mShowIconBack) { 874 if (p-> mShowIconBack) {
873 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 875 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
874 connect( action, SIGNAL( activated() ), 876 connect( action, SIGNAL( activated() ),
875 mView, SLOT( goPrevious() ) ); 877 mView, SLOT( goPrevious() ) );
876 action->addTo( iconToolBar ); 878 action->addTo( iconToolBar );
877 } 879 }
878 if (p-> mShowIconToday) 880 if (p-> mShowIconToday)
879 today_action->addTo( iconToolBar ); 881 today_action->addTo( iconToolBar );
880 icon = loadPixmap( pathString + "1rightarrowB" ); 882 icon = loadPixmap( pathString + "1rightarrowB" );
881 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 883 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
882 if (p-> mShowIconForward) { 884 if (p-> mShowIconForward) {
883 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 885 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
884 connect( action, SIGNAL( activated() ), 886 connect( action, SIGNAL( activated() ),
885 mView, SLOT( goNext() ) ); 887 mView, SLOT( goNext() ) );
886 action->addTo( iconToolBar ); 888 action->addTo( iconToolBar );
887 } 889 }
888 icon = loadPixmap( pathString + "2rightarrowB" ); 890 icon = loadPixmap( pathString + "2rightarrowB" );
889 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 891 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
890 if (p-> mShowIconForwardFast) { 892 if (p-> mShowIconForwardFast) {
891 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 893 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
892 connect( action, SIGNAL( activated() ), 894 connect( action, SIGNAL( activated() ),
893 mView, SLOT( goNextMonth() ) ); 895 mView, SLOT( goNextMonth() ) );
894 action->addTo( iconToolBar ); 896 action->addTo( iconToolBar );
895 } 897 }
896 898
897 899
898 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 900 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
899 901
900 if (p-> mShowIconNewEvent) 902 if (p-> mShowIconNewEvent)
901 configureToolBarMenu->setItemChecked( 10, true ); 903 configureToolBarMenu->setItemChecked( 10, true );
902 if (p->mShowIconNewTodo ) 904 if (p->mShowIconNewTodo )
903 configureToolBarMenu->setItemChecked( 20, true ); 905 configureToolBarMenu->setItemChecked( 20, true );
904 if (p-> mShowIconSearch) 906 if (p-> mShowIconSearch)
905 configureToolBarMenu->setItemChecked( 120, true ); 907 configureToolBarMenu->setItemChecked( 120, true );
906 if (p-> mShowIconList) 908 if (p-> mShowIconList)
907 configureToolBarMenu->setItemChecked( 30, true ); 909 configureToolBarMenu->setItemChecked( 30, true );
908 if (p-> mShowIconDay1) 910 if (p-> mShowIconDay1)
909 configureToolBarMenu->setItemChecked( 40, true ); 911 configureToolBarMenu->setItemChecked( 40, true );
910 if (p-> mShowIconDay5) 912 if (p-> mShowIconDay5)
911 configureToolBarMenu->setItemChecked( 50, true ); 913 configureToolBarMenu->setItemChecked( 50, true );
912 if (p-> mShowIconDay7) 914 if (p-> mShowIconDay7)
913 configureToolBarMenu->setItemChecked( 60, true ); 915 configureToolBarMenu->setItemChecked( 60, true );
914 if (p-> mShowIconMonth) 916 if (p-> mShowIconMonth)
915 configureToolBarMenu->setItemChecked( 70, true ); 917 configureToolBarMenu->setItemChecked( 70, true );
916 if (p-> mShowIconTodoview) 918 if (p-> mShowIconTodoview)
917 configureToolBarMenu->setItemChecked( 80, true ); 919 configureToolBarMenu->setItemChecked( 80, true );
918 if (p-> mShowIconBackFast) 920 if (p-> mShowIconBackFast)
919 configureToolBarMenu->setItemChecked( 200, true ); 921 configureToolBarMenu->setItemChecked( 200, true );
920 if (p-> mShowIconBack) 922 if (p-> mShowIconBack)
921 configureToolBarMenu->setItemChecked( 210, true ); 923 configureToolBarMenu->setItemChecked( 210, true );
922 if (p-> mShowIconToday) 924 if (p-> mShowIconToday)
923 configureToolBarMenu->setItemChecked( 130, true ); 925 configureToolBarMenu->setItemChecked( 130, true );
924 if (p-> mShowIconForward) 926 if (p-> mShowIconForward)
925 configureToolBarMenu->setItemChecked( 220, true ); 927 configureToolBarMenu->setItemChecked( 220, true );
926 if (p-> mShowIconForwardFast) 928 if (p-> mShowIconForwardFast)
927 configureToolBarMenu->setItemChecked( 230, true ); 929 configureToolBarMenu->setItemChecked( 230, true );
928 if (p-> mShowIconNextDays) 930 if (p-> mShowIconNextDays)
929 configureToolBarMenu->setItemChecked( 100, true ); 931 configureToolBarMenu->setItemChecked( 100, true );
930 if (p-> mShowIconNext) 932 if (p-> mShowIconNext)
931 configureToolBarMenu->setItemChecked( 110, true ); 933 configureToolBarMenu->setItemChecked( 110, true );
932 if (p-> mShowIconJournal) 934 if (p-> mShowIconJournal)
933 configureToolBarMenu->setItemChecked( 90, true ); 935 configureToolBarMenu->setItemChecked( 90, true );
934 if (p-> mShowIconWhatsThis) 936 if (p-> mShowIconWhatsThis)
935 configureToolBarMenu->setItemChecked( 300, true ); 937 configureToolBarMenu->setItemChecked( 300, true );
936 938
937 QLabel* dummy = new QLabel( iconToolBar ); 939 QLabel* dummy = new QLabel( iconToolBar );
938 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 940 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
939 if (!p-> mShowIconStretch) 941 if (!p-> mShowIconStretch)
940 iconToolBar->setStretchableWidget ( dummy ) ; 942 iconToolBar->setStretchableWidget ( dummy ) ;
941 else 943 else
942 configureToolBarMenu->setItemChecked( 5, true ); 944 configureToolBarMenu->setItemChecked( 5, true );
943 if (p-> mShowIconWhatsThis) 945 if (p-> mShowIconWhatsThis)
944 QWhatsThis::whatsThisButton ( iconToolBar ); 946 QWhatsThis::whatsThisButton ( iconToolBar );
945 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 947 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
946 configureAgenda( p->mHourSize ); 948 configureAgenda( p->mHourSize );
947 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 949 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
948} 950}
949 951
950void MainWindow::exportToPhone( int mode ) 952void MainWindow::exportToPhone( int mode )
951{ 953{
952 954
953 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 955 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
954 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 956 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
955 KOex2phonePrefs ex2phone; 957 KOex2phonePrefs ex2phone;
956 958
957 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 959 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
958 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 960 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
959 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 961 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
960 if ( mode == 1 ) 962 if ( mode == 1 )
961 ex2phone.setCaption(i18n("Export complete calendar")); 963 ex2phone.setCaption(i18n("Export complete calendar"));
962 if ( mode == 2 ) 964 if ( mode == 2 )
963 ex2phone.setCaption(i18n("Export filtered calendar")); 965 ex2phone.setCaption(i18n("Export filtered calendar"));
964 966
965 if ( !ex2phone.exec() ) { 967 if ( !ex2phone.exec() ) {
966 return; 968 return;
967 } 969 }
968 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 970 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
969 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 971 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
970 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 972 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
971 973
972 int inFuture = 0; 974 int inFuture = 0;
973 if ( ex2phone.mWriteBackFuture->isChecked() ) 975 if ( ex2phone.mWriteBackFuture->isChecked() )
974 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 976 inFuture = ex2phone.mWriteBackFutureWeeks->value();
975 QPtrList<Incidence> delSel; 977 QPtrList<Incidence> delSel;
976 if ( mode == 1 ) 978 if ( mode == 1 )
977 delSel = mCalendar->rawIncidences(); 979 delSel = mCalendar->rawIncidences();
978 if ( mode == 2 ) 980 if ( mode == 2 )
979 delSel = mCalendar->incidences(); 981 delSel = mCalendar->incidences();
980 CalendarLocal* cal = new CalendarLocal(); 982 CalendarLocal* cal = new CalendarLocal();
981 cal->setLocalTime(); 983 cal->setLocalTime();
982 Incidence *incidence = delSel.first(); 984 Incidence *incidence = delSel.first();
983 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 985 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
984 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 986 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
985 while ( incidence ) { 987 while ( incidence ) {
986 if ( incidence->type() != "Journal" ) { 988 if ( incidence->type() != "Journal" ) {
987 bool add = true; 989 bool add = true;
988 if ( inFuture ) { 990 if ( inFuture ) {
989 QDateTime dt; 991 QDateTime dt;
990 if ( incidence->type() == "Todo" ) { 992 if ( incidence->type() == "Todo" ) {
991 Todo * t = (Todo*)incidence; 993 Todo * t = (Todo*)incidence;
992 if ( t->hasDueDate() ) 994 if ( t->hasDueDate() )
993 dt = t->dtDue(); 995 dt = t->dtDue();
994 else 996 else
995 dt = cur.addSecs( 62 ); 997 dt = cur.addSecs( 62 );
996 } 998 }
997 else { 999 else {
998 bool ok; 1000 bool ok;
999 dt = incidence->getNextOccurence( cur, &ok ); 1001 dt = incidence->getNextOccurence( cur, &ok );
1000 if ( !ok ) 1002 if ( !ok )
1001 dt = cur.addSecs( -62 ); 1003 dt = cur.addSecs( -62 );
1002 } 1004 }
1003 if ( dt < cur || dt > end ) { 1005 if ( dt < cur || dt > end ) {
1004 add = false; 1006 add = false;
1005 } 1007 }
1006 } 1008 }
1007 if ( add ) { 1009 if ( add ) {
1008 Incidence *in = incidence->clone(); 1010 Incidence *in = incidence->clone();
1009 cal->addIncidence( in ); 1011 cal->addIncidence( in );
1010 } 1012 }
1011 } 1013 }
1012 incidence = delSel.next(); 1014 incidence = delSel.next();
1013 } 1015 }
1014 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1016 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1015 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1017 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1016 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1018 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1017 1019
1018 setCaption( i18n("Writing to phone...")); 1020 setCaption( i18n("Writing to phone..."));
1019 if ( PhoneFormat::writeToPhone( cal ) ) 1021 if ( PhoneFormat::writeToPhone( cal ) )
1020 setCaption( i18n("Export to phone successful!")); 1022 setCaption( i18n("Export to phone successful!"));
1021 else 1023 else
1022 setCaption( i18n("Error exporting to phone!")); 1024 setCaption( i18n("Error exporting to phone!"));
1023 delete cal; 1025 delete cal;
1024} 1026}
1025 1027
1026 1028
1027void MainWindow::setDefaultPreferences() 1029void MainWindow::setDefaultPreferences()
1028{ 1030{
1029 KOPrefs *p = KOPrefs::instance(); 1031 KOPrefs *p = KOPrefs::instance();
1030 1032
1031 p->mCompactDialogs = true; 1033 p->mCompactDialogs = true;
1032 p->mConfirm = true; 1034 p->mConfirm = true;
1033 // p->mEnableQuickTodo = false; 1035 // p->mEnableQuickTodo = false;
1034 1036
1035} 1037}
1036 1038
1037QString MainWindow::resourcePath() 1039QString MainWindow::resourcePath()
1038{ 1040{
1039 return KGlobal::iconLoader()->iconPath(); 1041 return KGlobal::iconLoader()->iconPath();
1040} 1042}
1041 1043
1042void MainWindow::displayText( QString text ,QString cap ) 1044void MainWindow::displayText( QString text ,QString cap )
1043{ 1045{
1044 QDialog dia( this, "name", true ); ; 1046 QDialog dia( this, "name", true ); ;
1045 dia.setCaption( cap ); 1047 dia.setCaption( cap );
1046 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1048 QVBoxLayout* lay = new QVBoxLayout( &dia );
1047 lay->setSpacing( 3 ); 1049 lay->setSpacing( 3 );
1048 lay->setMargin( 3 ); 1050 lay->setMargin( 3 );
1049 QTextBrowser tb ( &dia ); 1051 QTextBrowser tb ( &dia );
1050 lay->addWidget( &tb ); 1052 lay->addWidget( &tb );
1051 tb.setText( text ); 1053 tb.setText( text );
1052#ifdef DESKTOP_VERSION 1054#ifdef DESKTOP_VERSION
1053 dia.resize( 640, 480); 1055 dia.resize( 640, 480);
1054#else 1056#else
1055 dia.showMaximized(); 1057 dia.showMaximized();
1056#endif 1058#endif
1057 dia.exec(); 1059 dia.exec();
1058} 1060}
1059void MainWindow::displayFile( QString fn, QString cap ) 1061void MainWindow::displayFile( QString fn, QString cap )
1060{ 1062{
1061 QString fileName = resourcePath() + fn; 1063 QString fileName = resourcePath() + fn;
1062 QString text; 1064 QString text;
1063 QFile file( fileName ); 1065 QFile file( fileName );
1064 if (!file.open( IO_ReadOnly ) ) { 1066 if (!file.open( IO_ReadOnly ) ) {
1065 return ; 1067 return ;
1066 1068
1067 } 1069 }
1068 QTextStream ts( &file ); 1070 QTextStream ts( &file );
1069 text = ts.read(); 1071 text = ts.read();
1070 file.close(); 1072 file.close();
1071 displayText( text, cap); 1073 displayText( text, cap);
1072} 1074}
1073void MainWindow::features() 1075void MainWindow::features()
1074{ 1076{
1075 1077
1076 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); 1078 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") );
1077} 1079}
1078 1080
1079void MainWindow::usertrans() 1081void MainWindow::usertrans()
1080{ 1082{
1081 1083
1082 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); 1084 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") );
1083} 1085}
1084 1086
1085void MainWindow::synchowto() 1087void MainWindow::synchowto()
1086{ 1088{
1087 1089
1088 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1090 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1089} 1091}
1090void MainWindow::faq() 1092void MainWindow::faq()
1091{ 1093{
1092 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); 1094 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") );
1093 1095
1094} 1096}
1095void MainWindow::whatsNew() 1097void MainWindow::whatsNew()
1096{ 1098{
1097 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1099 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1098 1100
1099} 1101}
1100void MainWindow::licence() 1102void MainWindow::licence()
1101{ 1103{
1102 KApplication::showLicence(); 1104 KApplication::showLicence();
1103 1105
1104} 1106}
1105void MainWindow::about() 1107void MainWindow::about()
1106{ 1108{
1107 QString version; 1109 QString version;
1108#include <../version> 1110#include <../version>
1109 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1111 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1110 i18n("KOrganizer/Platform-independent\n") + 1112 i18n("KOrganizer/Platform-independent\n") +
1111 "(KO/Pi) " + version + " - " + 1113 "(KO/Pi) " + version + " - " +
1112 1114
1113#ifdef DESKTOP_VERSION 1115#ifdef DESKTOP_VERSION
1114 i18n("Desktop Edition\n") + 1116 i18n("Desktop Edition\n") +
1115#else 1117#else
1116 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + 1118 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") +
1117#endif 1119#endif
1118 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") ); 1120 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") );
1119} 1121}
1120void MainWindow::keyBindings() 1122void MainWindow::keyBindings()
1121{ 1123{
1122 QString cap = i18n("Key bindings KOrganizer/Pi"); 1124 QString cap = i18n("Key bindings KOrganizer/Pi");
1123 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1125 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1124 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1126 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1125 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1127 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1126 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1128 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1127 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1129 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1128 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1130 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1129 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1131 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1130 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1132 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1131 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1133 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1132 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1134 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1133 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1135 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1134 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1136 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1135 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1137 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1136 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1138 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1137 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1139 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1138 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1140 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1139 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1141 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1140 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1142 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1141 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1143 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1142 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1144 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1143 i18n("<p><h3>In agenda view:</h3></p>\n") + 1145 i18n("<p><h3>In agenda view:</h3></p>\n") +
1144 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1146 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1145 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1147 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1146 i18n("<p><h3>In todo view:</h3></p>\n") + 1148 i18n("<p><h3>In todo view:</h3></p>\n") +
1147 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1149 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1148 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1150 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1149 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1151 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1150 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1152 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1151 i18n("<p><h3>In list view:</h3></p>\n") + 1153 i18n("<p><h3>In list view:</h3></p>\n") +
1152 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1154 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1153 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1155 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1154 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1156 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1155 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1157 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1156 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1158 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1157 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1159 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1158 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1160 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1159 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1161 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1160 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1162 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1161 i18n("<p><b>E</b>: Edit item</p>\n") + 1163 i18n("<p><b>E</b>: Edit item</p>\n") +
1162 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1164 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1163 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1165 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1164 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1166 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1165 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1167 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1166 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1168 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1167 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1169 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1168 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1170 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1169 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1171 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1170 i18n("<p><b>White</b>: Item readonly</p>\n"); 1172 i18n("<p><b>White</b>: Item readonly</p>\n");
1171 displayText( text, cap); 1173 displayText( text, cap);
1172 1174
1173} 1175}
1174void MainWindow::aboutAutoSaving() 1176void MainWindow::aboutAutoSaving()
1175{ 1177{
1176 QMessageBox* msg; 1178 QMessageBox* msg;
1177 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), 1179 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"),
1178 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, 1180 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,
1179 QMessageBox::Ok, 1181 QMessageBox::Ok,
1180 QMessageBox::NoButton, 1182 QMessageBox::NoButton,
1181 QMessageBox::NoButton); 1183 QMessageBox::NoButton);
1182 msg->exec(); 1184 msg->exec();
1183 delete msg; 1185 delete msg;
1184 1186
1185 1187
1186} 1188}
1187void MainWindow::aboutKnownBugs() 1189void MainWindow::aboutKnownBugs()
1188{ 1190{
1189 QMessageBox* msg; 1191 QMessageBox* msg;
1190 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1192 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1191 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")+ 1193 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")+
1192 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1194 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1193 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1195 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1194 i18n("\nor report them in the bugtracker on\n") + 1196 i18n("\nor report them in the bugtracker on\n") +
1195 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1197 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1196 QMessageBox::NoIcon, 1198 QMessageBox::NoIcon,
1197 QMessageBox::Ok, 1199 QMessageBox::Ok,
1198 QMessageBox::NoButton, 1200 QMessageBox::NoButton,
1199 QMessageBox::NoButton); 1201 QMessageBox::NoButton);
1200 msg->exec(); 1202 msg->exec();
1201 delete msg; 1203 delete msg;
1202 1204
1203} 1205}
1204 1206
1205QString MainWindow::defaultFileName() 1207QString MainWindow::defaultFileName()
1206{ 1208{
1207 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1209 return locateLocal( "data", "korganizer/mycalendar.ics" );
1208} 1210}
1209QString MainWindow::syncFileName() 1211QString MainWindow::syncFileName()
1210{ 1212{
1211#ifdef _WIN32_ 1213#ifdef _WIN32_
1212 return locateLocal( "tmp", "synccalendar.ics" ); 1214 return locateLocal( "tmp", "synccalendar.ics" );
1213#else 1215#else
1214 return QString( "/tmp/kopitempfile.ics" ); 1216 return QString( "/tmp/kopitempfile.ics" );
1215#endif 1217#endif
1216} 1218}
1217 1219
1218void MainWindow::processIncidenceSelection( Incidence *incidence ) 1220void MainWindow::processIncidenceSelection( Incidence *incidence )
1219{ 1221{
1220 if ( !incidence ) { 1222 if ( !incidence ) {
1221 enableIncidenceActions( false ); 1223 enableIncidenceActions( false );
1222 1224
1223 mNewSubTodoAction->setEnabled( false ); 1225 mNewSubTodoAction->setEnabled( false );
1224 setCaptionToDates(); 1226 setCaptionToDates();
1225 return; 1227 return;
1226 1228
1227 } 1229 }
1228 1230
1229 //KGlobal::locale()->formatDateTime(nextA, true); 1231 //KGlobal::locale()->formatDateTime(nextA, true);
1230 QString startString = ""; 1232 QString startString = "";
1231 if ( incidence->type() != "Todo" ) { 1233 if ( incidence->type() != "Todo" ) {
1232 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1234 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1233 if ( incidence->doesFloat() ) { 1235 if ( incidence->doesFloat() ) {
1234 startString += ": "+incidence->dtStartDateStr( true ); 1236 startString += ": "+incidence->dtStartDateStr( true );
1235 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1237 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1236 1238
1237 } else { 1239 } else {
1238 startString = ": "+incidence->dtStartStr(true); 1240 startString = ": "+incidence->dtStartStr(true);
1239 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1241 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1240 1242
1241 } 1243 }
1242 1244
1243 } else { 1245 } else {
1244 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1246 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1245 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1247 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1246 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1248 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1247 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1249 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1248 } 1250 }
1249 1251
1250 } 1252 }
1251 else 1253 else
1252 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1254 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1253 if ( !incidence->location().isEmpty() ) 1255 if ( !incidence->location().isEmpty() )
1254 startString += " (" +incidence->location()+")"; 1256 startString += " (" +incidence->location()+")";
1255 setCaption( incidence->summary()+startString); 1257 setCaption( incidence->summary()+startString);
1256 1258
1257 enableIncidenceActions( true ); 1259 enableIncidenceActions( true );
1258 1260
1259 if ( incidence->type() == "Event" ) { 1261 if ( incidence->type() == "Event" ) {
1260 mShowAction->setText( i18n("Show Event...") ); 1262 mShowAction->setText( i18n("Show Event...") );
1261 mEditAction->setText( i18n("Edit Event...") ); 1263 mEditAction->setText( i18n("Edit Event...") );
1262 mDeleteAction->setText( i18n("Delete Event...") ); 1264 mDeleteAction->setText( i18n("Delete Event...") );
1263 1265
1264 mNewSubTodoAction->setEnabled( false ); 1266 mNewSubTodoAction->setEnabled( false );
1265 } else if ( incidence->type() == "Todo" ) { 1267 } else if ( incidence->type() == "Todo" ) {
1266 mShowAction->setText( i18n("Show Todo...") ); 1268 mShowAction->setText( i18n("Show Todo...") );
1267 mEditAction->setText( i18n("Edit Todo...") ); 1269 mEditAction->setText( i18n("Edit Todo...") );
1268 mDeleteAction->setText( i18n("Delete Todo...") ); 1270 mDeleteAction->setText( i18n("Delete Todo...") );
1269 1271
1270 mNewSubTodoAction->setEnabled( true ); 1272 mNewSubTodoAction->setEnabled( true );
1271 } else { 1273 } else {
1272 mShowAction->setText( i18n("Show...") ); 1274 mShowAction->setText( i18n("Show...") );
1273 mShowAction->setText( i18n("Edit...") ); 1275 mShowAction->setText( i18n("Edit...") );
1274 mShowAction->setText( i18n("Delete...") ); 1276 mShowAction->setText( i18n("Delete...") );
1275 1277
1276 mNewSubTodoAction->setEnabled( false ); 1278 mNewSubTodoAction->setEnabled( false );
1277 } 1279 }
1278} 1280}
1279 1281
1280void MainWindow::enableIncidenceActions( bool enabled ) 1282void MainWindow::enableIncidenceActions( bool enabled )
1281{ 1283{
1282 mShowAction->setEnabled( enabled ); 1284 mShowAction->setEnabled( enabled );
1283 mEditAction->setEnabled( enabled ); 1285 mEditAction->setEnabled( enabled );
1284 mDeleteAction->setEnabled( enabled ); 1286 mDeleteAction->setEnabled( enabled );
1285 1287
1286 mCloneAction->setEnabled( enabled ); 1288 mCloneAction->setEnabled( enabled );
1287 mMoveAction->setEnabled( enabled ); 1289 mMoveAction->setEnabled( enabled );
1288 mBeamAction->setEnabled( enabled ); 1290 mBeamAction->setEnabled( enabled );
1289 mCancelAction->setEnabled( enabled ); 1291 mCancelAction->setEnabled( enabled );
1290} 1292}
1291 1293
1292void MainWindow::importOL() 1294void MainWindow::importOL()
1293{ 1295{
1294#ifdef _WIN32_ 1296#ifdef _WIN32_
1295 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1297 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1296 id->exec(); 1298 id->exec();
1297 delete id; 1299 delete id;
1298 mView->updateView(); 1300 mView->updateView();
1299#endif 1301#endif
1300} 1302}
1301void MainWindow::importBday() 1303void MainWindow::importBday()
1302{ 1304{
1303 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1305 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1304 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1306 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1305 i18n("Import!"), i18n("Cancel"), 0, 1307 i18n("Import!"), i18n("Cancel"), 0,
1306 0, 1 ); 1308 0, 1 );
1307 if ( result == 0 ) { 1309 if ( result == 0 ) {
1308 mView->importBday(); 1310 mView->importBday();
1309 1311
1310 } 1312 }
1311 1313
1312 1314
1313} 1315}
1314void MainWindow::importQtopia() 1316void MainWindow::importQtopia()
1315{ 1317{
1316#ifndef DESKTOP_VERSION 1318#ifndef DESKTOP_VERSION
1317 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1319 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1318 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"), 1320 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"),
1319 i18n("Import!"), i18n("Cancel"), 0, 1321 i18n("Import!"), i18n("Cancel"), 0,
1320 0, 1 ); 1322 0, 1 );
1321 if ( result == 0 ) { 1323 if ( result == 0 ) {
1322 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1324 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1323 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1325 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1324 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1326 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1325 mView->importQtopia( categories, datebook, todolist ); 1327 mView->importQtopia( categories, datebook, todolist );
1326 } 1328 }
1327#else 1329#else
1328 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1330 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1329 i18n("Not supported \non desktop!\n"), 1331 i18n("Not supported \non desktop!\n"),
1330 i18n("Ok"), i18n("Cancel"), 0, 1332 i18n("Ok"), i18n("Cancel"), 0,
1331 0, 1 ); 1333 0, 1 );
1332 1334
1333#endif 1335#endif
1334} 1336}
1335 1337
1336void MainWindow::saveOnClose() 1338void MainWindow::saveOnClose()
1337{ 1339{
1338 KOPrefs *p = KOPrefs::instance(); 1340 KOPrefs *p = KOPrefs::instance();
1339 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1341 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1340 p->mToolBarUp = iconToolBar->x() > width()/2 || 1342 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1341 iconToolBar->y() > height()/2; 1343 iconToolBar->y() > height()/2;
1342 mView->writeSettings(); 1344 mView->writeSettings();
1343 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1345 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1344 save(); 1346 save();
1345} 1347}
1346void MainWindow::slotModifiedChanged( bool changed ) 1348void MainWindow::slotModifiedChanged( bool changed )
1347{ 1349{
1348 if ( mBlockAtStartup ) 1350 if ( mBlockAtStartup )
1349 return; 1351 return;
1350 int msec; 1352 int msec;
1351 // we store the changes after 1 minute, 1353 // we store the changes after 1 minute,
1352 // and for safety reasons after 10 minutes again 1354 // and for safety reasons after 10 minutes again
1353 if ( !mSyncManager->blockSave() ) 1355 if ( !mSyncManager->blockSave() )
1354 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1356 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1355 else 1357 else
1356 msec = 1000 * 600; 1358 msec = 1000 * 600;
1357 mSaveTimer.start( msec, true ); // 1 minute 1359 mSaveTimer.start( msec, true ); // 1 minute
1358 qDebug("KO: Saving File in %d secs!", msec/1000); 1360 qDebug("KO: Saving File in %d secs!", msec/1000);
1359 mCalendarModifiedFlag = true; 1361 mCalendarModifiedFlag = true;
1360} 1362}
1361void MainWindow::save() 1363void MainWindow::save()
1362{ 1364{
1363 if ( mSyncManager->blockSave() ) 1365 if ( mSyncManager->blockSave() )
1364 return; 1366 return;
1365 mSyncManager->setBlockSave(true); 1367 mSyncManager->setBlockSave(true);
1366 if ( mView->checkFileVersion( defaultFileName()) ) { 1368 if ( mView->checkFileVersion( defaultFileName()) ) {