summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-14 19:29:13 (UTC)
committer zautrix <zautrix>2004-10-14 19:29:13 (UTC)
commit5fc6dcc1e688d7c68789847d224a39703acad68d (patch) (unidiff)
tree58cc64e6118e82b827a1a460f199e0c823b307e1
parentde9086e84ab6ae88e4c05a015ce053f195733875 (diff)
downloadkdepimpi-5fc6dcc1e688d7c68789847d224a39703acad68d.zip
kdepimpi-5fc6dcc1e688d7c68789847d224a39703acad68d.tar.gz
kdepimpi-5fc6dcc1e688d7c68789847d224a39703acad68d.tar.bz2
receive IR fix
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,848 +1,849 @@
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");
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 58d8d34..30c0d2f 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,854 +1,856 @@
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)