summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp1
-rw-r--r--korganizer/mainwindow.cpp4
2 files changed, 4 insertions, 1 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 3ab06c4..2e408b7 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -145,384 +145,385 @@ $Id$
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
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 58d8d34..30c0d2f 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -150,385 +150,387 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
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() ),