summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-07 20:33:23 (UTC)
committer zautrix <zautrix>2004-09-07 20:33:23 (UTC)
commit64a8ef1629f523df3006de5cb2b9882a50d96a05 (patch) (unidiff)
treeb931dc5397b4eec926603080b20eddda131999ff
parent9d5c8750ae671e73ec8ebc0a71f30fd30680f2c0 (diff)
downloadkdepimpi-64a8ef1629f523df3006de5cb2b9882a50d96a05.zip
kdepimpi-64a8ef1629f523df3006de5cb2b9882a50d96a05.tar.gz
kdepimpi-64a8ef1629f523df3006de5cb2b9882a50d96a05.tar.bz2
Fixed Kopi-Kapi external app communication
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressbook.cpp2
-rw-r--r--kabc/stdaddressbook.cpp14
-rw-r--r--kaddressbook/kabcore.cpp19
-rw-r--r--korganizer/koeventviewer.cpp50
-rw-r--r--korganizer/mainwindow.cpp2
-rw-r--r--libkdepim/externalapphandler.cpp2
6 files changed, 68 insertions, 21 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp
index c61b387..47d298a 100644
--- a/kabc/addressbook.cpp
+++ b/kabc/addressbook.cpp
@@ -238,385 +238,385 @@ void AddressBook::init(const QString &config, const QString &family )
238 d->mConfig = new KConfig( locateLocal("config", config) ); 238 d->mConfig = new KConfig( locateLocal("config", config) );
239// qDebug("AddressBook::init 1 config=%s",config.latin1() ); 239// qDebug("AddressBook::init 1 config=%s",config.latin1() );
240 } 240 }
241 else { 241 else {
242 d->mConfig = 0; 242 d->mConfig = 0;
243// qDebug("AddressBook::init 1 config=0"); 243// qDebug("AddressBook::init 1 config=0");
244 } 244 }
245 245
246//US d->mErrorHandler = 0; 246//US d->mErrorHandler = 0;
247 d->mManager = new KRES::Manager<Resource>( family, false ); 247 d->mManager = new KRES::Manager<Resource>( family, false );
248 d->mManager->readConfig( d->mConfig ); 248 d->mManager->readConfig( d->mConfig );
249} 249}
250 250
251AddressBook::~AddressBook() 251AddressBook::~AddressBook()
252{ 252{
253 delete d->mConfig; d->mConfig = 0; 253 delete d->mConfig; d->mConfig = 0;
254 delete d->mManager; d->mManager = 0; 254 delete d->mManager; d->mManager = 0;
255//US delete d->mErrorHandler; d->mErrorHandler = 0; 255//US delete d->mErrorHandler; d->mErrorHandler = 0;
256 delete d; d = 0; 256 delete d; d = 0;
257} 257}
258 258
259bool AddressBook::load() 259bool AddressBook::load()
260{ 260{
261 261
262 262
263 clear(); 263 clear();
264 264
265 KRES::Manager<Resource>::ActiveIterator it; 265 KRES::Manager<Resource>::ActiveIterator it;
266 bool ok = true; 266 bool ok = true;
267 for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) 267 for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it )
268 if ( !(*it)->load() ) { 268 if ( !(*it)->load() ) {
269 error( i18n("Unable to load resource '%1'").arg( (*it)->resourceName() ) ); 269 error( i18n("Unable to load resource '%1'").arg( (*it)->resourceName() ) );
270 ok = false; 270 ok = false;
271 } 271 }
272 272
273 // mark all addressees as unchanged 273 // mark all addressees as unchanged
274 Addressee::List::Iterator addrIt; 274 Addressee::List::Iterator addrIt;
275 for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt ) 275 for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt )
276 (*addrIt).setChanged( false ); 276 (*addrIt).setChanged( false );
277 277
278 return ok; 278 return ok;
279} 279}
280 280
281bool AddressBook::save( Ticket *ticket ) 281bool AddressBook::save( Ticket *ticket )
282{ 282{
283 kdDebug(5700) << "AddressBook::save()"<< endl; 283 kdDebug(5700) << "AddressBook::save()"<< endl;
284 284
285 if ( ticket->resource() ) { 285 if ( ticket->resource() ) {
286 deleteRemovedAddressees(); 286 deleteRemovedAddressees();
287 287
288 return ticket->resource()->save( ticket ); 288 return ticket->resource()->save( ticket );
289 } 289 }
290 290
291 return false; 291 return false;
292} 292}
293 293
294AddressBook::Iterator AddressBook::begin() 294AddressBook::Iterator AddressBook::begin()
295{ 295{
296 Iterator it = Iterator(); 296 Iterator it = Iterator();
297 it.d->mIt = d->mAddressees.begin(); 297 it.d->mIt = d->mAddressees.begin();
298 return it; 298 return it;
299} 299}
300 300
301AddressBook::ConstIterator AddressBook::begin() const 301AddressBook::ConstIterator AddressBook::begin() const
302{ 302{
303 ConstIterator it = ConstIterator(); 303 ConstIterator it = ConstIterator();
304 it.d->mIt = d->mAddressees.begin(); 304 it.d->mIt = d->mAddressees.begin();
305 return it; 305 return it;
306} 306}
307 307
308AddressBook::Iterator AddressBook::end() 308AddressBook::Iterator AddressBook::end()
309{ 309{
310 Iterator it = Iterator(); 310 Iterator it = Iterator();
311 it.d->mIt = d->mAddressees.end(); 311 it.d->mIt = d->mAddressees.end();
312 return it; 312 return it;
313} 313}
314 314
315AddressBook::ConstIterator AddressBook::end() const 315AddressBook::ConstIterator AddressBook::end() const
316{ 316{
317 ConstIterator it = ConstIterator(); 317 ConstIterator it = ConstIterator();
318 it.d->mIt = d->mAddressees.end(); 318 it.d->mIt = d->mAddressees.end();
319 return it; 319 return it;
320} 320}
321 321
322void AddressBook::clear() 322void AddressBook::clear()
323{ 323{
324 d->mAddressees.clear(); 324 d->mAddressees.clear();
325} 325}
326 326
327Ticket *AddressBook::requestSaveTicket( Resource *resource ) 327Ticket *AddressBook::requestSaveTicket( Resource *resource )
328{ 328{
329 kdDebug(5700) << "AddressBook::requestSaveTicket()" << endl; 329 kdDebug(5700) << "AddressBook::requestSaveTicket()" << endl;
330 330
331 if ( !resource ) 331 if ( !resource )
332 { 332 {
333 qDebug("AddressBook::requestSaveTicket no resource" ); 333 qDebug("AddressBook::requestSaveTicket no resource" );
334 resource = standardResource(); 334 resource = standardResource();
335 } 335 }
336 336
337 KRES::Manager<Resource>::ActiveIterator it; 337 KRES::Manager<Resource>::ActiveIterator it;
338 for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { 338 for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) {
339 if ( (*it) == resource ) { 339 if ( (*it) == resource ) {
340 if ( (*it)->readOnly() || !(*it)->isOpen() ) 340 if ( (*it)->readOnly() || !(*it)->isOpen() )
341 return 0; 341 return 0;
342 else 342 else
343 return (*it)->requestSaveTicket(); 343 return (*it)->requestSaveTicket();
344 } 344 }
345 } 345 }
346 346
347 return 0; 347 return 0;
348} 348}
349 349
350void AddressBook::insertAddressee( const Addressee &a ) 350void AddressBook::insertAddressee( const Addressee &a )
351{ 351{
352 Addressee::List::Iterator it; 352 Addressee::List::Iterator it;
353 for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { 353 for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) {
354 if ( a.uid() == (*it).uid() ) { 354 if ( a.uid() == (*it).uid() ) {
355 bool changed = false; 355 bool changed = false;
356 Addressee addr = a; 356 Addressee addr = a;
357 if ( addr != (*it) ) 357 if ( addr != (*it) )
358 changed = true; 358 changed = true;
359 359
360 (*it) = a; 360 (*it) = a;
361 if ( (*it).resource() == 0 ) 361 if ( (*it).resource() == 0 )
362 (*it).setResource( standardResource() ); 362 (*it).setResource( standardResource() );
363 363
364 if ( changed ) { 364 if ( changed ) {
365 (*it).setRevision( QDateTime::currentDateTime() ); 365 (*it).setRevision( QDateTime::currentDateTime() );
366 (*it).setChanged( true ); 366 (*it).setChanged( true );
367 } 367 }
368 368
369 return; 369 return;
370 } 370 }
371 } 371 }
372 d->mAddressees.append( a ); 372 d->mAddressees.append( a );
373 Addressee& addr = d->mAddressees.last(); 373 Addressee& addr = d->mAddressees.last();
374 if ( addr.resource() == 0 ) 374 if ( addr.resource() == 0 )
375 addr.setResource( standardResource() ); 375 addr.setResource( standardResource() );
376 376
377 addr.setChanged( true ); 377 addr.setChanged( true );
378} 378}
379 379
380void AddressBook::removeAddressee( const Addressee &a ) 380void AddressBook::removeAddressee( const Addressee &a )
381{ 381{
382 Iterator it; 382 Iterator it;
383 for ( it = begin(); it != end(); ++it ) { 383 for ( it = begin(); it != end(); ++it ) {
384 if ( a.uid() == (*it).uid() ) { 384 if ( a.uid() == (*it).uid() ) {
385 removeAddressee( it ); 385 removeAddressee( it );
386 return; 386 return;
387 } 387 }
388 } 388 }
389} 389}
390 390
391void AddressBook::removeAddressee( const Iterator &it ) 391void AddressBook::removeAddressee( const Iterator &it )
392{ 392{
393 d->mRemovedAddressees.append( (*it) ); 393 d->mRemovedAddressees.append( (*it) );
394 d->mAddressees.remove( it.d->mIt ); 394 d->mAddressees.remove( it.d->mIt );
395} 395}
396 396
397AddressBook::Iterator AddressBook::find( const Addressee &a ) 397AddressBook::Iterator AddressBook::find( const Addressee &a )
398{ 398{
399 Iterator it; 399 Iterator it;
400 for ( it = begin(); it != end(); ++it ) { 400 for ( it = begin(); it != end(); ++it ) {
401 if ( a.uid() == (*it).uid() ) { 401 if ( a.uid() == (*it).uid() ) {
402 return it; 402 return it;
403 } 403 }
404 } 404 }
405 return end(); 405 return end();
406} 406}
407 407
408Addressee AddressBook::findByUid( const QString &uid ) 408Addressee AddressBook::findByUid( const QString &uid )
409{ 409{
410 Iterator it; 410 Iterator it;
411 for ( it = begin(); it != end(); ++it ) { 411 for ( it = begin(); it != end(); ++it ) {
412 if ( uid == (*it).uid() ) { 412 if ( uid == (*it).uid() ) {
413 return *it; 413 return *it;
414 } 414 }
415 } 415 }
416 return Addressee(); 416 return Addressee();
417} 417}
418 418
419Addressee::List AddressBook::allAddressees() 419Addressee::List AddressBook::allAddressees()
420{ 420{
421 return d->mAddressees; 421 return d->mAddressees;
422} 422}
423 423
424Addressee::List AddressBook::findByName( const QString &name ) 424Addressee::List AddressBook::findByName( const QString &name )
425{ 425{
426 Addressee::List results; 426 Addressee::List results;
427 427
428 Iterator it; 428 Iterator it;
429 for ( it = begin(); it != end(); ++it ) { 429 for ( it = begin(); it != end(); ++it ) {
430 if ( name == (*it).name() ) { 430 if ( name == (*it).realName() ) {
431 results.append( *it ); 431 results.append( *it );
432 } 432 }
433 } 433 }
434 434
435 return results; 435 return results;
436} 436}
437 437
438Addressee::List AddressBook::findByEmail( const QString &email ) 438Addressee::List AddressBook::findByEmail( const QString &email )
439{ 439{
440 Addressee::List results; 440 Addressee::List results;
441 QStringList mailList; 441 QStringList mailList;
442 442
443 Iterator it; 443 Iterator it;
444 for ( it = begin(); it != end(); ++it ) { 444 for ( it = begin(); it != end(); ++it ) {
445 mailList = (*it).emails(); 445 mailList = (*it).emails();
446 for ( QStringList::Iterator ite = mailList.begin(); ite != mailList.end(); ++ite ) { 446 for ( QStringList::Iterator ite = mailList.begin(); ite != mailList.end(); ++ite ) {
447 if ( email == (*ite) ) { 447 if ( email == (*ite) ) {
448 results.append( *it ); 448 results.append( *it );
449 } 449 }
450 } 450 }
451 } 451 }
452 452
453 return results; 453 return results;
454} 454}
455 455
456Addressee::List AddressBook::findByCategory( const QString &category ) 456Addressee::List AddressBook::findByCategory( const QString &category )
457{ 457{
458 Addressee::List results; 458 Addressee::List results;
459 459
460 Iterator it; 460 Iterator it;
461 for ( it = begin(); it != end(); ++it ) { 461 for ( it = begin(); it != end(); ++it ) {
462 if ( (*it).hasCategory( category) ) { 462 if ( (*it).hasCategory( category) ) {
463 results.append( *it ); 463 results.append( *it );
464 } 464 }
465 } 465 }
466 466
467 return results; 467 return results;
468} 468}
469 469
470void AddressBook::dump() const 470void AddressBook::dump() const
471{ 471{
472 kdDebug(5700) << "AddressBook::dump() --- begin ---" << endl; 472 kdDebug(5700) << "AddressBook::dump() --- begin ---" << endl;
473 473
474 ConstIterator it; 474 ConstIterator it;
475 for( it = begin(); it != end(); ++it ) { 475 for( it = begin(); it != end(); ++it ) {
476 (*it).dump(); 476 (*it).dump();
477 } 477 }
478 478
479 kdDebug(5700) << "AddressBook::dump() --- end ---" << endl; 479 kdDebug(5700) << "AddressBook::dump() --- end ---" << endl;
480} 480}
481 481
482QString AddressBook::identifier() 482QString AddressBook::identifier()
483{ 483{
484 QStringList identifier; 484 QStringList identifier;
485 485
486 486
487 KRES::Manager<Resource>::ActiveIterator it; 487 KRES::Manager<Resource>::ActiveIterator it;
488 for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { 488 for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) {
489 if ( !(*it)->identifier().isEmpty() ) 489 if ( !(*it)->identifier().isEmpty() )
490 identifier.append( (*it)->identifier() ); 490 identifier.append( (*it)->identifier() );
491 } 491 }
492 492
493 return identifier.join( ":" ); 493 return identifier.join( ":" );
494} 494}
495 495
496Field::List AddressBook::fields( int category ) 496Field::List AddressBook::fields( int category )
497{ 497{
498 if ( d->mAllFields.isEmpty() ) { 498 if ( d->mAllFields.isEmpty() ) {
499 d->mAllFields = Field::allFields(); 499 d->mAllFields = Field::allFields();
500 } 500 }
501 501
502 if ( category == Field::All ) return d->mAllFields; 502 if ( category == Field::All ) return d->mAllFields;
503 503
504 Field::List result; 504 Field::List result;
505 Field::List::ConstIterator it; 505 Field::List::ConstIterator it;
506 for( it = d->mAllFields.begin(); it != d->mAllFields.end(); ++it ) { 506 for( it = d->mAllFields.begin(); it != d->mAllFields.end(); ++it ) {
507 if ( (*it)->category() & category ) result.append( *it ); 507 if ( (*it)->category() & category ) result.append( *it );
508 } 508 }
509 509
510 return result; 510 return result;
511} 511}
512 512
513bool AddressBook::addCustomField( const QString &label, int category, 513bool AddressBook::addCustomField( const QString &label, int category,
514 const QString &key, const QString &app ) 514 const QString &key, const QString &app )
515{ 515{
516 if ( d->mAllFields.isEmpty() ) { 516 if ( d->mAllFields.isEmpty() ) {
517 d->mAllFields = Field::allFields(); 517 d->mAllFields = Field::allFields();
518 } 518 }
519//US QString a = app.isNull() ? KGlobal::instance()->instanceName() : app; 519//US QString a = app.isNull() ? KGlobal::instance()->instanceName() : app;
520 QString a = app.isNull() ? KGlobal::getAppName() : app; 520 QString a = app.isNull() ? KGlobal::getAppName() : app;
521 521
522 QString k = key.isNull() ? label : key; 522 QString k = key.isNull() ? label : key;
523 523
524 Field *field = Field::createCustomField( label, category, k, a ); 524 Field *field = Field::createCustomField( label, category, k, a );
525 525
526 if ( !field ) return false; 526 if ( !field ) return false;
527 527
528 d->mAllFields.append( field ); 528 d->mAllFields.append( field );
529 529
530 return true; 530 return true;
531} 531}
532 532
533QDataStream &KABC::operator<<( QDataStream &s, const AddressBook &ab ) 533QDataStream &KABC::operator<<( QDataStream &s, const AddressBook &ab )
534{ 534{
535 if (!ab.d) return s; 535 if (!ab.d) return s;
536 536
537 return s << ab.d->mAddressees; 537 return s << ab.d->mAddressees;
538} 538}
539 539
540QDataStream &KABC::operator>>( QDataStream &s, AddressBook &ab ) 540QDataStream &KABC::operator>>( QDataStream &s, AddressBook &ab )
541{ 541{
542 if (!ab.d) return s; 542 if (!ab.d) return s;
543 543
544 s >> ab.d->mAddressees; 544 s >> ab.d->mAddressees;
545 545
546 return s; 546 return s;
547} 547}
548 548
549bool AddressBook::addResource( Resource *resource ) 549bool AddressBook::addResource( Resource *resource )
550{ 550{
551 if ( !resource->open() ) { 551 if ( !resource->open() ) {
552 kdDebug(5700) << "AddressBook::addResource(): can't add resource" << endl; 552 kdDebug(5700) << "AddressBook::addResource(): can't add resource" << endl;
553 return false; 553 return false;
554 } 554 }
555 555
556 resource->setAddressBook( this ); 556 resource->setAddressBook( this );
557 557
558 d->mManager->add( resource ); 558 d->mManager->add( resource );
559 return true; 559 return true;
560} 560}
561 561
562bool AddressBook::removeResource( Resource *resource ) 562bool AddressBook::removeResource( Resource *resource )
563{ 563{
564 resource->close(); 564 resource->close();
565 565
566 if ( resource == standardResource() ) 566 if ( resource == standardResource() )
567 d->mManager->setStandardResource( 0 ); 567 d->mManager->setStandardResource( 0 );
568 568
569 resource->setAddressBook( 0 ); 569 resource->setAddressBook( 0 );
570 570
571 d->mManager->remove( resource ); 571 d->mManager->remove( resource );
572 return true; 572 return true;
573} 573}
574 574
575QPtrList<Resource> AddressBook::resources() 575QPtrList<Resource> AddressBook::resources()
576{ 576{
577 QPtrList<Resource> list; 577 QPtrList<Resource> list;
578 578
579// qDebug("AddressBook::resources() 1"); 579// qDebug("AddressBook::resources() 1");
580 580
581 KRES::Manager<Resource>::ActiveIterator it; 581 KRES::Manager<Resource>::ActiveIterator it;
582 for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) 582 for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it )
583 list.append( *it ); 583 list.append( *it );
584 584
585 return list; 585 return list;
586} 586}
587 587
588/*US 588/*US
589void AddressBook::setErrorHandler( ErrorHandler *handler ) 589void AddressBook::setErrorHandler( ErrorHandler *handler )
590{ 590{
591 delete d->mErrorHandler; 591 delete d->mErrorHandler;
592 d->mErrorHandler = handler; 592 d->mErrorHandler = handler;
593} 593}
594*/ 594*/
595 595
596void AddressBook::error( const QString& msg ) 596void AddressBook::error( const QString& msg )
597{ 597{
598/*US 598/*US
599 if ( !d->mErrorHandler ) // create default error handler 599 if ( !d->mErrorHandler ) // create default error handler
600 d->mErrorHandler = new ConsoleErrorHandler; 600 d->mErrorHandler = new ConsoleErrorHandler;
601 601
602 if ( d->mErrorHandler ) 602 if ( d->mErrorHandler )
603 d->mErrorHandler->error( msg ); 603 d->mErrorHandler->error( msg );
604 else 604 else
605 kdError(5700) << "no error handler defined" << endl; 605 kdError(5700) << "no error handler defined" << endl;
606*/ 606*/
607 kdDebug(5700) << "msg" << endl; 607 kdDebug(5700) << "msg" << endl;
608 qDebug(msg); 608 qDebug(msg);
609} 609}
610 610
611void AddressBook::deleteRemovedAddressees() 611void AddressBook::deleteRemovedAddressees()
612{ 612{
613 Addressee::List::Iterator it; 613 Addressee::List::Iterator it;
614 for ( it = d->mRemovedAddressees.begin(); it != d->mRemovedAddressees.end(); ++it ) { 614 for ( it = d->mRemovedAddressees.begin(); it != d->mRemovedAddressees.end(); ++it ) {
615 Resource *resource = (*it).resource(); 615 Resource *resource = (*it).resource();
616 if ( resource && !resource->readOnly() && resource->isOpen() ) 616 if ( resource && !resource->readOnly() && resource->isOpen() )
617 resource->removeAddressee( *it ); 617 resource->removeAddressee( *it );
618 } 618 }
619 619
620 d->mRemovedAddressees.clear(); 620 d->mRemovedAddressees.clear();
621} 621}
622 622
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp
index 760820e..9f38f08 100644
--- a/kabc/stdaddressbook.cpp
+++ b/kabc/stdaddressbook.cpp
@@ -1,226 +1,236 @@
1/* 1/*
2 This file is part of libkabc. 2 This file is part of libkabc.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library 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 GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21/* 21/*
22Enhanced Version of the file for platform independent KDE tools. 22Enhanced Version of the file for platform independent KDE tools.
23Copyright (c) 2004 Ulf Schenk 23Copyright (c) 2004 Ulf Schenk
24 24
25$Id$ 25$Id$
26*/ 26*/
27 27
28#include <qdir.h> 28#include <qdir.h>
29#include "resource.h" 29#include "resource.h"
30#include <kresources/manager.h> 30#include <kresources/manager.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <klocale.h> 32#include <klocale.h>
33#include <kstaticdeleter.h> 33#include <kstaticdeleter.h>
34#include <kstandarddirs.h> 34#include <kstandarddirs.h>
35 35
36#include "stdaddressbook.h" 36#include "stdaddressbook.h"
37 37
38using namespace KABC; 38using namespace KABC;
39 39
40StdAddressBook *StdAddressBook::mSelf = 0; 40StdAddressBook *StdAddressBook::mSelf = 0;
41bool StdAddressBook::mAutomaticSave = true; 41bool StdAddressBook::mAutomaticSave = true;
42 42
43static KStaticDeleter<StdAddressBook> addressBookDeleter; 43static KStaticDeleter<StdAddressBook> addressBookDeleter;
44 44
45QString StdAddressBook::fileName() 45QString StdAddressBook::fileName()
46{ 46{
47 return locateLocal( "data", "kabc/std.vcf" ); 47 return locateLocal( "data", "kabc/std.vcf" );
48} 48}
49 49
50QString StdAddressBook::directoryName() 50QString StdAddressBook::directoryName()
51{ 51{
52 return locateLocal( "data", "kabc/stdvcf" ); 52 return locateLocal( "data", "kabc/stdvcf" );
53} 53}
54 54
55void StdAddressBook::handleCrash() 55void StdAddressBook::handleCrash()
56{ 56{
57 StdAddressBook::self()->cleanUp(); 57 StdAddressBook::self()->cleanUp();
58} 58}
59 59
60StdAddressBook *StdAddressBook::self() 60StdAddressBook *StdAddressBook::self()
61{ 61{
62 62
63 if ( !mSelf ) 63 if ( !mSelf )
64 { 64 {
65 QString appdir = StdAddressBook::setTempAppDir(); 65 QString appdir = StdAddressBook::setTempAppDir();
66 66 qDebug("****************************************************** ");
67 kdDebug(5700) << "StdAddressBook::self()" << endl; 67 qDebug("****************************************************** ");
68 qDebug("****************************************************** ");
69 qDebug("****************************************************** ");
70 qDebug("****************************************************** ");
68// US im am not sure why I have to use the other format here?? 71// US im am not sure why I have to use the other format here??
69#ifdef KAB_EMBEDDED 72#ifdef KAB_EMBEDDED
70 mSelf = addressBookDeleter.setObject( new StdAddressBook ); 73 mSelf = addressBookDeleter.setObject( new StdAddressBook );
71#else //KAB_EMBEDDED 74#else //KAB_EMBEDDED
72 addressBookDeleter.setObject( mSelf, new StdAddressBook ); 75 addressBookDeleter.setObject( mSelf, new StdAddressBook );
73#endif //KAB_EMBEDDED 76#endif //KAB_EMBEDDED
74 KStandardDirs::setAppDir( appdir ); 77 KStandardDirs::setAppDir( appdir );
75 } 78 }
76 79
77 return mSelf; 80 return mSelf;
78} 81}
79 82
80QString StdAddressBook::setTempAppDir() 83QString StdAddressBook::setTempAppDir()
81{ 84{
82 QString appDIR = KStandardDirs::appDir(); 85 QString appDIR = KStandardDirs::appDir();
83#ifdef DESKTOP_VERSION 86#ifdef DESKTOP_VERSION
84 QString appdir = QDir::homeDirPath(); 87 QString appdir = QDir::homeDirPath();
85 if ( appdir.right(1) == "\\" || appdir.right(1) == "/" ) 88 if ( appdir.right(1) == "\\" || appdir.right(1) == "/" )
86 appdir += "kaddressbook/"; 89 appdir += "kaddressbook/";
87 else 90 else
88 appdir += "/kaddressbook/"; 91 appdir += "/kaddressbook/";
89 KStandardDirs::setAppDir( QDir::convertSeparators( appdir )); 92 KStandardDirs::setAppDir( QDir::convertSeparators( appdir ));
90#else 93#else
91 QString appdir = QDir::homeDirPath() + "/kdepim/apps/kaddressbook"; 94 QString appdir = QDir::homeDirPath() + "/kdepim/apps/kaddressbook";
92 95
93 KStandardDirs::setAppDir( appdir ); 96 KStandardDirs::setAppDir( appdir );
94#endif 97#endif
95 98
96 return appDIR; 99 return appDIR;
97} 100}
98StdAddressBook *StdAddressBook::self( bool onlyFastResources ) 101StdAddressBook *StdAddressBook::self( bool onlyFastResources )
99{ 102{
100 103
101 if ( !mSelf ) 104 if ( !mSelf )
102 { 105 {
106 qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
107 qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
108 qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
109 qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
110 qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
111 qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
112 qDebug("++++++++++++++++++++++++++++++++++++++++++++++++ ");
103 QString appdir =StdAddressBook::setTempAppDir(); 113 QString appdir =StdAddressBook::setTempAppDir();
104#ifdef KAB_EMBEDDED 114#ifdef KAB_EMBEDDED
105 mSelf = addressBookDeleter.setObject( new StdAddressBook( onlyFastResources ) ); 115 mSelf = addressBookDeleter.setObject( new StdAddressBook( onlyFastResources ) );
106#else //KAB_EMBEDDED 116#else //KAB_EMBEDDED
107 addressBookDeleter.setObject( mSelf, new StdAddressBook( onlyFastResources ) ); 117 addressBookDeleter.setObject( mSelf, new StdAddressBook( onlyFastResources ) );
108#endif //KAB_EMBEDDED 118#endif //KAB_EMBEDDED
109 KStandardDirs::setAppDir( appdir ); 119 KStandardDirs::setAppDir( appdir );
110 } 120 }
111 return mSelf; 121 return mSelf;
112} 122}
113 123
114StdAddressBook::StdAddressBook() 124StdAddressBook::StdAddressBook()
115 : AddressBook( "kabcrc" ) 125 : AddressBook( "kabcrc" )
116{ 126{
117 127
118 init( false ); 128 init( false );
119} 129}
120 130
121StdAddressBook::StdAddressBook( bool onlyFastResources ) 131StdAddressBook::StdAddressBook( bool onlyFastResources )
122 : AddressBook( "kabcrc" ) 132 : AddressBook( "kabcrc" )
123{ 133{
124 134
125 init( onlyFastResources ); 135 init( onlyFastResources );
126} 136}
127 137
128StdAddressBook::~StdAddressBook() 138StdAddressBook::~StdAddressBook()
129{ 139{
130 if ( mAutomaticSave ) 140 if ( mAutomaticSave )
131 save(); 141 save();
132} 142}
133 143
134void StdAddressBook::init( bool ) 144void StdAddressBook::init( bool )
135{ 145{
136 KRES::Manager<Resource> *manager = resourceManager(); 146 KRES::Manager<Resource> *manager = resourceManager();
137 KRES::Manager<Resource>::ActiveIterator it; 147 KRES::Manager<Resource>::ActiveIterator it;
138 148
139 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { 149 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) {
140 (*it)->setAddressBook( this ); 150 (*it)->setAddressBook( this );
141 if ( !(*it)->open() ) 151 if ( !(*it)->open() )
142 error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) ); 152 error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) );
143 } 153 }
144 154
145 Resource *res = standardResource(); 155 Resource *res = standardResource();
146 if ( !res ) { 156 if ( !res ) {
147 res = manager->createResource( "file" ); 157 res = manager->createResource( "file" );
148 if ( res ) 158 if ( res )
149 { 159 {
150 addResource( res ); 160 addResource( res );
151 } 161 }
152 else 162 else
153 qDebug(" No resource available!!!"); 163 qDebug(" No resource available!!!");
154 } 164 }
155 165
156 setStandardResource( res ); 166 setStandardResource( res );
157 manager->writeConfig(); 167 manager->writeConfig();
158 168
159 load(); 169 load();
160} 170}
161 171
162bool StdAddressBook::save() 172bool StdAddressBook::save()
163{ 173{
164 kdDebug(5700) << "StdAddressBook::save()" << endl; 174 kdDebug(5700) << "StdAddressBook::save()" << endl;
165 175
166 bool ok = true; 176 bool ok = true;
167 AddressBook *ab = self(); 177 AddressBook *ab = self();
168 178
169 ab->deleteRemovedAddressees(); 179 ab->deleteRemovedAddressees();
170 180
171 KRES::Manager<Resource>::ActiveIterator it; 181 KRES::Manager<Resource>::ActiveIterator it;
172 KRES::Manager<Resource> *manager = ab->resourceManager(); 182 KRES::Manager<Resource> *manager = ab->resourceManager();
173 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { 183 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) {
174 if ( !(*it)->readOnly() && (*it)->isOpen() ) { 184 if ( !(*it)->readOnly() && (*it)->isOpen() ) {
175 Ticket *ticket = ab->requestSaveTicket( *it ); 185 Ticket *ticket = ab->requestSaveTicket( *it );
176// qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); 186// qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() );
177 if ( !ticket ) { 187 if ( !ticket ) {
178 ab->error( i18n( "Unable to save to resource '%1'. It is locked." ) 188 ab->error( i18n( "Unable to save to resource '%1'. It is locked." )
179 .arg( (*it)->resourceName() ) ); 189 .arg( (*it)->resourceName() ) );
180 return false; 190 return false;
181 } 191 }
182 192
183 if ( !ab->save( ticket ) ) 193 if ( !ab->save( ticket ) )
184 ok = false; 194 ok = false;
185 } 195 }
186 } 196 }
187 197
188 return ok; 198 return ok;
189} 199}
190 200
191void StdAddressBook::close() 201void StdAddressBook::close()
192{ 202{
193//US destructObject is not defined on my system???. Is setObject(0) the same ??? 203//US destructObject is not defined on my system???. Is setObject(0) the same ???
194//US addressBookDeleter.destructObject(); 204//US addressBookDeleter.destructObject();
195 addressBookDeleter.setObject(0); 205 addressBookDeleter.setObject(0);
196 206
197} 207}
198 208
199void StdAddressBook::setAutomaticSave( bool enable ) 209void StdAddressBook::setAutomaticSave( bool enable )
200{ 210{
201 mAutomaticSave = enable; 211 mAutomaticSave = enable;
202} 212}
203 213
204bool StdAddressBook::automaticSave() 214bool StdAddressBook::automaticSave()
205{ 215{
206 return mAutomaticSave; 216 return mAutomaticSave;
207} 217}
208 218
209// should get const for 4.X 219// should get const for 4.X
210Addressee StdAddressBook::whoAmI() 220Addressee StdAddressBook::whoAmI()
211{ 221{
212//US KConfig config( "kabcrc" ); 222//US KConfig config( "kabcrc" );
213 KConfig config( locateLocal("config", "kabcrc") ); 223 KConfig config( locateLocal("config", "kabcrc") );
214 config.setGroup( "General" ); 224 config.setGroup( "General" );
215 225
216 return findByUid( config.readEntry( "WhoAmI" ) ); 226 return findByUid( config.readEntry( "WhoAmI" ) );
217} 227}
218 228
219void StdAddressBook::setWhoAmI( const Addressee &addr ) 229void StdAddressBook::setWhoAmI( const Addressee &addr )
220{ 230{
221//US KConfig config( "kabcrc" ); 231//US KConfig config( "kabcrc" );
222 KConfig config( locateLocal("config", "kabcrc") ); 232 KConfig config( locateLocal("config", "kabcrc") );
223 config.setGroup( "General" ); 233 config.setGroup( "General" );
224 234
225 config.writeEntry( "WhoAmI", addr.uid() ); 235 config.writeEntry( "WhoAmI", addr.uid() );
226} 236}
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 4299ebd..2f9f1df 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1852,267 +1852,270 @@ void KABCore::addActionsManually()
1852 fileMenu->insertItem( "&Import", ImportMenu ); 1852 fileMenu->insertItem( "&Import", ImportMenu );
1853 fileMenu->insertItem( "&Emport", ExportMenu ); 1853 fileMenu->insertItem( "&Emport", ExportMenu );
1854 fileMenu->insertSeparator(); 1854 fileMenu->insertSeparator();
1855 mActionMailVCard->plug( fileMenu ); 1855 mActionMailVCard->plug( fileMenu );
1856#ifndef DESKTOP_VERSION 1856#ifndef DESKTOP_VERSION
1857 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); 1857 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
1858 if ( Ir::supported() ) mActionBeam->plug(fileMenu ); 1858 if ( Ir::supported() ) mActionBeam->plug(fileMenu );
1859#endif 1859#endif
1860 fileMenu->insertSeparator(); 1860 fileMenu->insertSeparator();
1861 mActionQuit->plug( fileMenu ); 1861 mActionQuit->plug( fileMenu );
1862#ifdef _WIN32_ 1862#ifdef _WIN32_
1863 mActionImportOL->plug( ImportMenu ); 1863 mActionImportOL->plug( ImportMenu );
1864#endif 1864#endif
1865 // edit menu 1865 // edit menu
1866 mActionUndo->plug( editMenu ); 1866 mActionUndo->plug( editMenu );
1867 mActionRedo->plug( editMenu ); 1867 mActionRedo->plug( editMenu );
1868 editMenu->insertSeparator(); 1868 editMenu->insertSeparator();
1869 mActionCut->plug( editMenu ); 1869 mActionCut->plug( editMenu );
1870 mActionCopy->plug( editMenu ); 1870 mActionCopy->plug( editMenu );
1871 mActionPaste->plug( editMenu ); 1871 mActionPaste->plug( editMenu );
1872 mActionDelete->plug( editMenu ); 1872 mActionDelete->plug( editMenu );
1873 editMenu->insertSeparator(); 1873 editMenu->insertSeparator();
1874 mActionSelectAll->plug( editMenu ); 1874 mActionSelectAll->plug( editMenu );
1875 1875
1876 mActionRemoveVoice->plug( changeMenu ); 1876 mActionRemoveVoice->plug( changeMenu );
1877 // settings menu 1877 // settings menu
1878//US special menuentry to configure the addressbook resources. On KDE 1878//US special menuentry to configure the addressbook resources. On KDE
1879// you do that through the control center !!! 1879// you do that through the control center !!!
1880 mActionConfigResources->plug( settingsMenu ); 1880 mActionConfigResources->plug( settingsMenu );
1881 settingsMenu->insertSeparator(); 1881 settingsMenu->insertSeparator();
1882 1882
1883 mActionConfigKAddressbook->plug( settingsMenu ); 1883 mActionConfigKAddressbook->plug( settingsMenu );
1884 1884
1885 if ( mIsPart ) { 1885 if ( mIsPart ) {
1886 mActionConfigShortcuts->plug( settingsMenu ); 1886 mActionConfigShortcuts->plug( settingsMenu );
1887 mActionConfigureToolbars->plug( settingsMenu ); 1887 mActionConfigureToolbars->plug( settingsMenu );
1888 1888
1889 } else { 1889 } else {
1890 mActionKeyBindings->plug( settingsMenu ); 1890 mActionKeyBindings->plug( settingsMenu );
1891 } 1891 }
1892 1892
1893 settingsMenu->insertSeparator(); 1893 settingsMenu->insertSeparator();
1894 1894
1895 mActionJumpBar->plug( settingsMenu ); 1895 mActionJumpBar->plug( settingsMenu );
1896 mActionDetails->plug( settingsMenu ); 1896 mActionDetails->plug( settingsMenu );
1897 if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 1897 if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
1898 mActionDetails->plug( tb ); 1898 mActionDetails->plug( tb );
1899 settingsMenu->insertSeparator(); 1899 settingsMenu->insertSeparator();
1900 1900
1901 mActionWhoAmI->plug( settingsMenu ); 1901 mActionWhoAmI->plug( settingsMenu );
1902 mActionCategories->plug( settingsMenu ); 1902 mActionCategories->plug( settingsMenu );
1903 1903
1904 mActionLicence->plug( helpMenu ); 1904 mActionLicence->plug( helpMenu );
1905 mActionFaq->plug( helpMenu ); 1905 mActionFaq->plug( helpMenu );
1906 mActionAboutKAddressbook->plug( helpMenu ); 1906 mActionAboutKAddressbook->plug( helpMenu );
1907 1907
1908 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 1908 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
1909 1909
1910 mActionSave->plug( tb ); 1910 mActionSave->plug( tb );
1911 mViewManager->getFilterAction()->plug ( tb); 1911 mViewManager->getFilterAction()->plug ( tb);
1912 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { 1912 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
1913 mActionUndo->plug( tb ); 1913 mActionUndo->plug( tb );
1914 mActionDelete->plug( tb ); 1914 mActionDelete->plug( tb );
1915 mActionRedo->plug( tb ); 1915 mActionRedo->plug( tb );
1916 } 1916 }
1917 } 1917 }
1918 //mActionQuit->plug ( tb ); 1918 //mActionQuit->plug ( tb );
1919 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 1919 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
1920 1920
1921 //US link the searchwidget first to this. 1921 //US link the searchwidget first to this.
1922 // The real linkage to the toolbar happens later. 1922 // The real linkage to the toolbar happens later.
1923//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 1923//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
1924//US tb->insertItem( mIncSearchWidget ); 1924//US tb->insertItem( mIncSearchWidget );
1925/*US 1925/*US
1926 mIncSearchWidget = new IncSearchWidget( tb ); 1926 mIncSearchWidget = new IncSearchWidget( tb );
1927 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 1927 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
1928 SLOT( incrementalSearch( const QString& ) ) ); 1928 SLOT( incrementalSearch( const QString& ) ) );
1929 1929
1930 mJumpButtonBar = new JumpButtonBar( this, this ); 1930 mJumpButtonBar = new JumpButtonBar( this, this );
1931 1931
1932//US topLayout->addWidget( mJumpButtonBar ); 1932//US topLayout->addWidget( mJumpButtonBar );
1933 this->layout()->add( mJumpButtonBar ); 1933 this->layout()->add( mJumpButtonBar );
1934*/ 1934*/
1935 1935
1936#endif //KAB_EMBEDDED 1936#endif //KAB_EMBEDDED
1937} 1937}
1938void KABCore::showLicence() 1938void KABCore::showLicence()
1939{ 1939{
1940 KApplication::showLicence(); 1940 KApplication::showLicence();
1941} 1941}
1942void KABCore::removeVoice() 1942void KABCore::removeVoice()
1943{ 1943{
1944 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) 1944 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
1945 return; 1945 return;
1946 KABC::Addressee::List list = mViewManager->selectedAddressees(); 1946 KABC::Addressee::List list = mViewManager->selectedAddressees();
1947 KABC::Addressee::List::Iterator it; 1947 KABC::Addressee::List::Iterator it;
1948 for ( it = list.begin(); it != list.end(); ++it ) { 1948 for ( it = list.begin(); it != list.end(); ++it ) {
1949 PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); 1949 PhoneNumber::List phoneNumbers = (*it).phoneNumbers();
1950 PhoneNumber::List::Iterator phoneIt; 1950 PhoneNumber::List::Iterator phoneIt;
1951 bool found = false; 1951 bool found = false;
1952 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { 1952 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) {
1953 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found 1953 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
1954 if ((*phoneIt).type() - PhoneNumber::Voice ) { 1954 if ((*phoneIt).type() - PhoneNumber::Voice ) {
1955 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); 1955 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
1956 (*it).insertPhoneNumber( (*phoneIt) ); 1956 (*it).insertPhoneNumber( (*phoneIt) );
1957 found = true; 1957 found = true;
1958 } 1958 }
1959 } 1959 }
1960 1960
1961 } 1961 }
1962 if ( found ) 1962 if ( found )
1963 contactModified((*it) ); 1963 contactModified((*it) );
1964 } 1964 }
1965} 1965}
1966 1966
1967 1967
1968 1968
1969void KABCore::clipboardDataChanged() 1969void KABCore::clipboardDataChanged()
1970{ 1970{
1971 1971
1972 if ( mReadWrite ) 1972 if ( mReadWrite )
1973 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 1973 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
1974 1974
1975} 1975}
1976 1976
1977void KABCore::updateActionMenu() 1977void KABCore::updateActionMenu()
1978{ 1978{
1979 UndoStack *undo = UndoStack::instance(); 1979 UndoStack *undo = UndoStack::instance();
1980 RedoStack *redo = RedoStack::instance(); 1980 RedoStack *redo = RedoStack::instance();
1981 1981
1982 if ( undo->isEmpty() ) 1982 if ( undo->isEmpty() )
1983 mActionUndo->setText( i18n( "Undo" ) ); 1983 mActionUndo->setText( i18n( "Undo" ) );
1984 else 1984 else
1985 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 1985 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
1986 1986
1987 mActionUndo->setEnabled( !undo->isEmpty() ); 1987 mActionUndo->setEnabled( !undo->isEmpty() );
1988 1988
1989 if ( !redo->top() ) 1989 if ( !redo->top() )
1990 mActionRedo->setText( i18n( "Redo" ) ); 1990 mActionRedo->setText( i18n( "Redo" ) );
1991 else 1991 else
1992 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 1992 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
1993 1993
1994 mActionRedo->setEnabled( !redo->isEmpty() ); 1994 mActionRedo->setEnabled( !redo->isEmpty() );
1995} 1995}
1996 1996
1997void KABCore::configureKeyBindings() 1997void KABCore::configureKeyBindings()
1998{ 1998{
1999#ifndef KAB_EMBEDDED 1999#ifndef KAB_EMBEDDED
2000 KKeyDialog::configure( actionCollection(), true ); 2000 KKeyDialog::configure( actionCollection(), true );
2001#else //KAB_EMBEDDED 2001#else //KAB_EMBEDDED
2002 qDebug("KABCore::configureKeyBindings() not implemented"); 2002 qDebug("KABCore::configureKeyBindings() not implemented");
2003#endif //KAB_EMBEDDED 2003#endif //KAB_EMBEDDED
2004} 2004}
2005 2005
2006#ifdef KAB_EMBEDDED 2006#ifdef KAB_EMBEDDED
2007void KABCore::configureResources() 2007void KABCore::configureResources()
2008{ 2008{
2009 KRES::KCMKResources dlg( this, "" , 0 ); 2009 KRES::KCMKResources dlg( this, "" , 0 );
2010 2010
2011 if ( !dlg.exec() ) 2011 if ( !dlg.exec() )
2012 return; 2012 return;
2013 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2013 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2014} 2014}
2015#endif //KAB_EMBEDDED 2015#endif //KAB_EMBEDDED
2016 2016
2017 2017
2018/* this method will be called through the QCop interface from Ko/Pi to select addresses 2018/* this method will be called through the QCop interface from Ko/Pi to select addresses
2019 * for the attendees list of an event. 2019 * for the attendees list of an event.
2020 */ 2020 */
2021void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2021void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2022{ 2022{
2023 QStringList nameList; 2023 QStringList nameList;
2024 QStringList emailList; 2024 QStringList emailList;
2025 QStringList uidList; 2025 QStringList uidList;
2026 2026
2027 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2027 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2028 uint i=0; 2028 uint i=0;
2029 for (i=0; i < list.count(); i++) 2029 for (i=0; i < list.count(); i++)
2030 { 2030 {
2031 nameList.append(list[i].realName()); 2031 nameList.append(list[i].realName());
2032 emailList.append(list[i].preferredEmail()); 2032 emailList.append(list[i].preferredEmail());
2033 uidList.append(list[i].uid()); 2033 uidList.append(list[i].uid());
2034 } 2034 }
2035 2035
2036 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2036 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
2037 2037
2038} 2038}
2039 2039
2040/* this method will be called through the QCop interface from other apps to show details of a contact. 2040/* this method will be called through the QCop interface from other apps to show details of a contact.
2041 */ 2041 */
2042void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2042void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2043{ 2043{
2044// qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2044 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2045 2045
2046 QString foundUid = QString::null; 2046 QString foundUid = QString::null;
2047 if (uid.isEmpty()) 2047 if (uid.isEmpty())
2048 { 2048 {
2049 //find the uid of the person first 2049 //find the uid of the person first
2050 Addressee::List namelist; 2050 Addressee::List namelist;
2051 Addressee::List emaillist; 2051 Addressee::List emaillist;
2052 2052
2053 if (!name.isEmpty()) 2053 if (!name.isEmpty())
2054 namelist = mAddressBook->findByName( name ); 2054 namelist = mAddressBook->findByName( name );
2055 2055
2056 if (!email.isEmpty()) 2056 if (!email.isEmpty())
2057 emaillist = mAddressBook->findByEmail( email ); 2057 emaillist = mAddressBook->findByEmail( email );
2058 2058 qDebug("count %d %d ", namelist.count(),emaillist.count() );
2059 //check if we have a match in Namelist and Emaillist 2059 //check if we have a match in Namelist and Emaillist
2060 if ((namelist.count() == 0) && (emaillist.count() > 0)) 2060 if ((namelist.count() == 0) && (emaillist.count() > 0)) {
2061 foundUid == emaillist[0].uid(); 2061 foundUid = emaillist[0].uid();
2062 }
2062 else if ((namelist.count() > 0) && (emaillist.count() == 0)) 2063 else if ((namelist.count() > 0) && (emaillist.count() == 0))
2063 foundUid == namelist[0].uid(); 2064 foundUid = namelist[0].uid();
2064 else 2065 else
2065 { 2066 {
2066 for (int i = 0; i < namelist.count(); i++) 2067 for (int i = 0; i < namelist.count(); i++)
2067 { 2068 {
2068 for (int j = 0; j < emaillist.count(); j++) 2069 for (int j = 0; j < emaillist.count(); j++)
2069 { 2070 {
2070 if (namelist[i] == emaillist[j]) 2071 if (namelist[i] == emaillist[j])
2071 { 2072 {
2072 foundUid == namelist[i].uid(); 2073 foundUid = namelist[i].uid();
2073 } 2074 }
2074 } 2075 }
2075 } 2076 }
2076 } 2077 }
2077 } 2078 }
2078 else 2079 else
2079 { 2080 {
2080 foundUid = uid; 2081 foundUid = uid;
2081 } 2082 }
2082 2083
2083 if (!foundUid.isEmpty()) 2084 if (!foundUid.isEmpty())
2084 { 2085 {
2086
2085 // raise Ka/Pi if it is in the background 2087 // raise Ka/Pi if it is in the background
2086#ifndef DESKTOP_VERSION 2088#ifndef DESKTOP_VERSION
2087#ifndef KORG_NODCOP 2089#ifndef KORG_NODCOP
2088 QCopEnvelope e("QPE/Application/kapi", "raise()"); 2090 //QCopEnvelope e("QPE/Application/kapi", "raise()");
2089#endif 2091#endif
2090#endif 2092#endif
2091 2093
2092 mMainWindow->showMaximized(); 2094 mMainWindow->showMaximized();
2095 mMainWindow-> raise();
2093 2096
2094 mViewManager->setSelected( "", false); 2097 mViewManager->setSelected( "", false);
2095 mViewManager->refreshView( "" ); 2098 mViewManager->refreshView( "" );
2096 mViewManager->setSelected( foundUid, true ); 2099 mViewManager->setSelected( foundUid, true );
2097 mViewManager->refreshView( foundUid ); 2100 mViewManager->refreshView( foundUid );
2098 2101
2099 if ( !mMultipleViewsAtOnce ) 2102 if ( !mMultipleViewsAtOnce )
2100 { 2103 {
2101 setDetailsVisible( true ); 2104 setDetailsVisible( true );
2102 mActionDetails->setChecked(true); 2105 mActionDetails->setChecked(true);
2103 } 2106 }
2104 } 2107 }
2105} 2108}
2106 2109
2107 2110
2108void KABCore::faq() 2111void KABCore::faq()
2109{ 2112{
2110 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); 2113 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" );
2111} 2114}
2112 2115
2113 2116
2114 2117
2115 2118
2116#ifndef KAB_EMBEDDED 2119#ifndef KAB_EMBEDDED
2117#include "kabcore.moc" 2120#include "kabcore.moc"
2118#endif //KAB_EMBEDDED 2121#endif //KAB_EMBEDDED
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 1f69700..0866939 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -1,541 +1,575 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <qcstring.h> 20#include <qcstring.h>
21#include <qwhatsthis.h> 21#include <qwhatsthis.h>
22#include <qdialog.h> 22#include <qdialog.h>
23#include <qapplication.h> 23#include <qapplication.h>
24#include <qlabel.h> 24#include <qlabel.h>
25#include <qlayout.h> 25#include <qlayout.h>
26 26
27#include <klocale.h> 27#include <klocale.h>
28#include <kapplication.h> 28#include <kapplication.h>
29#include <libkcal/event.h> 29#include <libkcal/event.h>
30#include <libkcal/todo.h> 30#include <libkcal/todo.h>
31#include <kdebug.h> 31#include <kdebug.h>
32#include <kiconloader.h> 32#include <kiconloader.h>
33#include <krun.h> 33#include <krun.h>
34#include <kglobal.h> 34#include <kglobal.h>
35#include <kprocess.h> 35#include <kprocess.h>
36#include "koprefs.h" 36#include "koprefs.h"
37 37
38#include <libkdepim/addresseeview.h> 38#include <libkdepim/addresseeview.h>
39#include <kabc/stdaddressbook.h> 39#include <kabc/stdaddressbook.h>
40 40
41#ifndef KORG_NODCOP 41#ifndef KORG_NODCOP
42#include <dcopclient.h> 42#include <dcopclient.h>
43#include "korganizer.h" 43#include "korganizer.h"
44#include "koprefs.h" 44#include "koprefs.h"
45#include "actionmanager.h" 45#include "actionmanager.h"
46#endif 46#endif
47 47
48#include "koeventviewer.h" 48#include "koeventviewer.h"
49#ifndef KORG_NOKABC 49#ifndef KORG_NOKABC
50#include <kabc/stdaddressbook.h> 50#include <kabc/stdaddressbook.h>
51#define size count 51#define size count
52#endif 52#endif
53#ifndef DESKTOP_VERSION 53
54#ifdef DESKTOP_VERSION
55#include <kabc/addresseedialog.h>
56#else //DESKTOP_VERSION
57#include <externalapphandler.h>
54#include <qtopia/qcopenvelope_qws.h> 58#include <qtopia/qcopenvelope_qws.h>
55#endif 59#endif //DESKTOP_VERSION
56 60
57KOEventViewer::KOEventViewer(QWidget *parent,const char *name) 61KOEventViewer::KOEventViewer(QWidget *parent,const char *name)
58 : QTextBrowser(parent,name) 62 : QTextBrowser(parent,name)
59{ 63{
60 mSyncMode = false; 64 mSyncMode = false;
61 mColorMode = 0; 65 mColorMode = 0;
62} 66}
63 67
64KOEventViewer::~KOEventViewer() 68KOEventViewer::~KOEventViewer()
65{ 69{
66} 70}
67 71
68void KOEventViewer::setSource(const QString& n) 72void KOEventViewer::setSource(const QString& n)
69{ 73{
70 74
71 if ( n.left(3) == "uid" ) { 75 if ( n.left(3) == "uid" )
76#ifdef DESKTOP_VERSION
77 {
72 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); 78 KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
73 KABC::AddressBook::Iterator it; 79 KABC::AddressBook::Iterator it;
74 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { 80 for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
75 // LR I do not understand, why the uid string is different on zaurus and desktop 81 // LR I do not understand, why the uid string is different on zaurus and desktop
76#ifdef DESKTOP_VERSION
77 QString uid = "uid://"+(*it).uid(); 82 QString uid = "uid://"+(*it).uid();
78#else 83
79 QString uid = "uid:"+(*it).uid();
80#endif
81 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); 84 //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1());
82 if (n == uid ) { 85 if (n == uid ) {
83 //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); 86 //qDebug("found %s ",(*it).mobileHomePhone().latin1() );
84 QDialog dia( this,"dia123", true ); 87 QDialog dia( this,"dia123", true );
85 dia.setCaption( i18n("Details of attendee") ); 88 dia.setCaption( i18n("Details of attendee") );
86 QVBoxLayout lay ( &dia ); 89 QVBoxLayout lay ( &dia );
87 KPIM::AddresseeView av ( &dia ); 90 KPIM::AddresseeView av ( &dia );
88 av.setAddressee( (*it) ); 91 av.setAddressee( (*it) );
89 lay.addWidget( &av ); 92 lay.addWidget( &av );
90 if ( QApplication::desktop()->width() < 480 ) 93 if ( QApplication::desktop()->width() < 480 )
91 dia.resize( 220, 240); 94 dia.resize( 220, 240);
92 else { 95 else {
93 dia.resize( 400,400); 96 dia.resize( 400,400);
94 97
95 } 98 }
96 dia.exec(); 99 dia.exec();
97 break; 100 break;
98 } 101 }
99 } 102 }
100 return; 103 return;
101 } 104 }
105#else
106 {
107 QPtrList<Attendee> attendees = mCurrentIncidence->attendees();
108 if (attendees.count()) {
109 Attendee *a;
110 for(a=attendees.first();a;a=attendees.next()) {
111 if ( "uid:"+a->uid() == n ) {
112 bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), "");
113 return;
114 }
115 }
116 }
117 return;
118 }
119 //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/);
120 // the result should now arrive through method insertAttendees
121 //QString uid = "uid:"+(*it).uid();
122#endif
102 if ( n.left(6) == "mailto" ) { 123 if ( n.left(6) == "mailto" ) {
103 // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); 124 // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1());
104#ifndef DESKTOP_VERSION 125#ifndef DESKTOP_VERSION
105 QCopEnvelope e("QPE/Application/kmpi", "newMail(QString)" ); 126 QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" );
106 e << n.mid(7); 127 e << n.mid(7);
107#endif 128#endif
108 129
109 } 130 }
110 131
111 132
112#ifndef KORG_NODCOP 133#ifndef KORG_NODCOP
113 kdDebug() << "KOEventViewer::setSource(): " << n << endl; 134 kdDebug() << "KOEventViewer::setSource(): " << n << endl;
114 QString tmpStr; 135 QString tmpStr;
115 if (n.startsWith("mailto:")) { 136 if (n.startsWith("mailto:")) {
116 KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); 137 KApplication::kApplication()->invokeMailer(n.mid(7),QString::null);
117 //emit showIncidence(n); 138 //emit showIncidence(n);
118 return; 139 return;
119 } else if (n.startsWith("uid:")) { 140 } else if (n.startsWith("uid:")) {
120 DCOPClient *client = KApplication::kApplication()->dcopClient(); 141 DCOPClient *client = KApplication::kApplication()->dcopClient();
121 const QByteArray noParamData; 142 const QByteArray noParamData;
122 const QByteArray paramData; 143 const QByteArray paramData;
123 QByteArray replyData; 144 QByteArray replyData;
124 QCString replyTypeStr; 145 QCString replyTypeStr;
125#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) 146#define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData))
126 bool foundAbbrowser = PING_ABBROWSER; 147 bool foundAbbrowser = PING_ABBROWSER;
127 148
128 if (foundAbbrowser) { 149 if (foundAbbrowser) {
129 //KAddressbook is already running, so just DCOP to it to bring up the contact editor 150 //KAddressbook is already running, so just DCOP to it to bring up the contact editor
130 //client->send("kaddressbook","KAddressBookIface", 151 //client->send("kaddressbook","KAddressBookIface",
131 QDataStream arg(paramData, IO_WriteOnly); 152 QDataStream arg(paramData, IO_WriteOnly);
132 arg << n.mid(6); 153 arg << n.mid(6);
133 client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); 154 client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData);
134 return; 155 return;
135 } else { 156 } else {
136 /* 157 /*
137 KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. 158 KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater.
138 We start it without its main interface 159 We start it without its main interface
139 */ 160 */
140 KIconLoader* iconLoader = new KIconLoader(); 161 KIconLoader* iconLoader = new KIconLoader();
141 QString iconPath = iconLoader->iconPath("go",KIcon::Small); 162 QString iconPath = iconLoader->iconPath("go",KIcon::Small);
142 ActionManager::setStartedKAddressBook(true); 163 ActionManager::setStartedKAddressBook(true);
143 tmpStr = "kaddressbook --editor-only --uid "; 164 tmpStr = "kaddressbook --editor-only --uid ";
144 tmpStr += KProcess::quote(n.mid(6)); 165 tmpStr += KProcess::quote(n.mid(6));
145 KRun::runCommand(tmpStr,"KAddressBook",iconPath); 166 KRun::runCommand(tmpStr,"KAddressBook",iconPath);
146 return; 167 return;
147 } 168 }
148 } else { 169 } else {
149 //QTextBrowser::setSource(n); 170 //QTextBrowser::setSource(n);
150 } 171 }
151#endif 172#endif
152} 173}
153 174
154void KOEventViewer::addTag(const QString & tag,const QString & text) 175void KOEventViewer::addTag(const QString & tag,const QString & text)
155{ 176{
156 int number=text.contains("\n"); 177 int number=text.contains("\n");
157 QString str = "<" + tag + ">"; 178 QString str = "<" + tag + ">";
158 QString tmpText=text; 179 QString tmpText=text;
159 QString tmpStr=str; 180 QString tmpStr=str;
160 if(number !=-1) 181 if(number !=-1)
161 { 182 {
162 if (number > 0) { 183 if (number > 0) {
163 int pos=0; 184 int pos=0;
164 QString tmp; 185 QString tmp;
165 for(int i=0;i<=number;i++) { 186 for(int i=0;i<=number;i++) {
166 pos=tmpText.find("\n"); 187 pos=tmpText.find("\n");
167 tmp=tmpText.left(pos); 188 tmp=tmpText.left(pos);
168 tmpText=tmpText.right(tmpText.length()-pos-1); 189 tmpText=tmpText.right(tmpText.length()-pos-1);
169 tmpStr+=tmp+"<br>"; 190 tmpStr+=tmp+"<br>";
170 } 191 }
171 } 192 }
172 else tmpStr += tmpText; 193 else tmpStr += tmpText;
173 tmpStr+="</" + tag + ">"; 194 tmpStr+="</" + tag + ">";
174 mText.append(tmpStr); 195 mText.append(tmpStr);
175 } 196 }
176 else 197 else
177 { 198 {
178 str += text + "</" + tag + ">"; 199 str += text + "</" + tag + ">";
179 mText.append(str); 200 mText.append(str);
180 } 201 }
181} 202}
182 203
183void KOEventViewer::setColorMode( int m ) 204void KOEventViewer::setColorMode( int m )
184{ 205{
185 mColorMode = m; 206 mColorMode = m;
186} 207}
187void KOEventViewer::appendEvent(Event *event, int mode ) 208void KOEventViewer::appendEvent(Event *event, int mode )
188{ 209{
189 mMailSubject = ""; 210 mMailSubject = "";
190 mCurrentIncidence = event; 211 mCurrentIncidence = event;
191 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 212 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
192 topLevelWidget()->setCaption(i18n("Event Viewer")); 213 topLevelWidget()->setCaption(i18n("Event Viewer"));
193 if ( mode == 0 ) { 214 if ( mode == 0 ) {
194 addTag("h2",event->summary()); 215 addTag("h2",event->summary());
195 } 216 }
196 else { 217 else {
197 if ( mColorMode == 1 ) { 218 if ( mColorMode == 1 ) {
198 mText +="<font color=\"#00A000\">"; 219 mText +="<font color=\"#00A000\">";
199 } 220 }
200 if ( mColorMode == 2 ) { 221 if ( mColorMode == 2 ) {
201 mText +="<font color=\"#C00000\">"; 222 mText +="<font color=\"#C00000\">";
202 } 223 }
203 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 224 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
204 if ( mode == 1 ) { 225 if ( mode == 1 ) {
205 addTag("h2",i18n( "Local: " ) +event->summary()); 226 addTag("h2",i18n( "Local: " ) +event->summary());
206 } else { 227 } else {
207 addTag("h2",i18n( "Remote: " ) +event->summary()); 228 addTag("h2",i18n( "Remote: " ) +event->summary());
208 } 229 }
209 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 230 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
210 if ( mColorMode ) 231 if ( mColorMode )
211 mText += "</font>"; 232 mText += "</font>";
212 } 233 }
213 mMailSubject += i18n( "Meeting " )+ event->summary(); 234 mMailSubject += i18n( "Meeting " )+ event->summary();
214 if (event->cancelled ()) { 235 if (event->cancelled ()) {
215 mText +="<font color=\"#B00000\">"; 236 mText +="<font color=\"#B00000\">";
216 addTag("i",i18n("This event has been cancelled!")); 237 addTag("i",i18n("This event has been cancelled!"));
217 mText.append("<br>"); 238 mText.append("<br>");
218 mText += "</font>"; 239 mText += "</font>";
219 mMailSubject += i18n("(cancelled)"); 240 mMailSubject += i18n("(cancelled)");
220 } 241 }
221 if (!event->location().isEmpty()) { 242 if (!event->location().isEmpty()) {
222 addTag("b",i18n("Location: ")); 243 addTag("b",i18n("Location: "));
223 mText.append(event->location()+"<br>"); 244 mText.append(event->location()+"<br>");
224 mMailSubject += i18n(" at ") + event->location(); 245 mMailSubject += i18n(" at ") + event->location();
225 } 246 }
226 if (event->doesFloat()) { 247 if (event->doesFloat()) {
227 if (event->isMultiDay()) { 248 if (event->isMultiDay()) {
228 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") 249 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
229 .arg(event->dtStartDateStr(shortDate)) 250 .arg(event->dtStartDateStr(shortDate))
230 .arg(event->dtEndDateStr(shortDate))); 251 .arg(event->dtEndDateStr(shortDate)));
231 } else { 252 } else {
232 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); 253 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate )));
233 } 254 }
234 } else { 255 } else {
235 if (event->isMultiDay()) { 256 if (event->isMultiDay()) {
236 mText.append(i18n("<p><b>From:</b> %1</p> ") 257 mText.append(i18n("<p><b>From:</b> %1</p> ")
237 .arg(event->dtStartStr( shortDate))); 258 .arg(event->dtStartStr( shortDate)));
238 mText.append(i18n("<p><b>To:</b> %1</p>") 259 mText.append(i18n("<p><b>To:</b> %1</p>")
239 .arg(event->dtEndStr(shortDate))); 260 .arg(event->dtEndStr(shortDate)));
240 } else { 261 } else {
241 mText.append(i18n("<p><b>On:</b> %1</p> ") 262 mText.append(i18n("<p><b>On:</b> %1</p> ")
242 .arg(event->dtStartDateStr( shortDate ))); 263 .arg(event->dtStartDateStr( shortDate )));
243 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") 264 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>")
244 .arg(event->dtStartTimeStr()) 265 .arg(event->dtStartTimeStr())
245 .arg(event->dtEndTimeStr())); 266 .arg(event->dtEndTimeStr()));
246 } 267 }
247 } 268 }
248 269
249 if (event->recurrence()->doesRecur()) { 270 if (event->recurrence()->doesRecur()) {
250 271
251 QString recurText = event->recurrence()->recurrenceText(); 272 QString recurText = event->recurrence()->recurrenceText();
252 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 273 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
253 bool last; 274 bool last;
254 QDate start = QDate::currentDate(); 275 QDate start = QDate::currentDate();
255 QDate next; 276 QDate next;
256 next = event->recurrence()->getPreviousDate( start , &last ); 277 next = event->recurrence()->getPreviousDate( start , &last );
257 if ( !last ) { 278 if ( !last ) {
258 next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); 279 next = event->recurrence()->getNextDate( start.addDays( - 1 ) );
259 addTag("p",i18n("<b>Next recurrence is on:</b>") ); 280 addTag("p",i18n("<b>Next recurrence is on:</b>") );
260 addTag("p", KGlobal::locale()->formatDate( next, shortDate )); 281 addTag("p", KGlobal::locale()->formatDate( next, shortDate ));
261 QDateTime nextdt = QDateTime( next, event->dtStart().time()); 282 QDateTime nextdt = QDateTime( next, event->dtStart().time());
262 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( nextdt, true ); 283 mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( nextdt, true );
263 284
264 } else { 285 } else {
265 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 286 addTag("p",i18n("<b>Last recurrence was on:</b>") );
266 addTag("p", KGlobal::locale()->formatDate( next, shortDate )); 287 addTag("p", KGlobal::locale()->formatDate( next, shortDate ));
267 } 288 }
268 } else { 289 } else {
269 mMailSubject += i18n(" - " )+event->dtStartStr( true ); 290 mMailSubject += i18n(" - " )+event->dtStartStr( true );
270 291
271 } 292 }
272 293
273 294
274 if (event->isAlarmEnabled()) { 295 if (event->isAlarmEnabled()) {
275 Alarm *alarm =event->alarms().first() ; 296 Alarm *alarm =event->alarms().first() ;
276 QDateTime t = alarm->time(); 297 QDateTime t = alarm->time();
277 int min = t.secsTo( event->dtStart() )/60; 298 int min = t.secsTo( event->dtStart() )/60;
278 QString s =i18n("( %1 min before )").arg( min ); 299 QString s =i18n("( %1 min before )").arg( min );
279 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 300 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
280 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 301 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
281 //addTag("p",s); 302 //addTag("p",s);
282 } 303 }
283 304
284 addTag("b",i18n("Access: ")); 305 addTag("b",i18n("Access: "));
285 mText.append(event->secrecyStr()+"<br>"); 306 mText.append(event->secrecyStr()+"<br>");
286 if (!event->description().isEmpty()) { 307 if (!event->description().isEmpty()) {
287 addTag("p",i18n("<b>Details: </b>")); 308 addTag("p",i18n("<b>Details: </b>"));
288 addTag("p",event->description()); 309 addTag("p",event->description());
289 } 310 }
290 311
291 formatCategories(event); 312 formatCategories(event);
292 313
293 formatReadOnly(event); 314 formatReadOnly(event);
294 formatAttendees(event); 315 formatAttendees(event);
295 316
296 setText(mText); 317 setText(mText);
297 //QWhatsThis::add(this,mText); 318 //QWhatsThis::add(this,mText);
298 319
299} 320}
300 321
301void KOEventViewer::appendTodo(Todo *event, int mode ) 322void KOEventViewer::appendTodo(Todo *event, int mode )
302{ 323{
303 mMailSubject = ""; 324 mMailSubject = "";
304 mCurrentIncidence = event; 325 mCurrentIncidence = event;
305 topLevelWidget()->setCaption(i18n("Todo Viewer")); 326 topLevelWidget()->setCaption(i18n("Todo Viewer"));
306 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 327 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
307 if (mode == 0 ) 328 if (mode == 0 )
308 addTag("h2",event->summary()); 329 addTag("h2",event->summary());
309 else { 330 else {
310 if ( mColorMode == 1 ) { 331 if ( mColorMode == 1 ) {
311 mText +="<font color=\"#00A000\">"; 332 mText +="<font color=\"#00A000\">";
312 } 333 }
313 if ( mColorMode == 2 ) { 334 if ( mColorMode == 2 ) {
314 mText +="<font color=\"#B00000\">"; 335 mText +="<font color=\"#B00000\">";
315 } 336 }
316 if ( mode == 1 ) { 337 if ( mode == 1 ) {
317 addTag("h2",i18n( "Local: " ) +event->summary()); 338 addTag("h2",i18n( "Local: " ) +event->summary());
318 } else { 339 } else {
319 addTag("h2",i18n( "Remote: " ) +event->summary()); 340 addTag("h2",i18n( "Remote: " ) +event->summary());
320 } 341 }
321 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 342 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
322 if ( mColorMode ) 343 if ( mColorMode )
323 mText += "</font>"; 344 mText += "</font>";
324 } 345 }
325 mMailSubject += i18n( "Todo " )+ event->summary(); 346 mMailSubject += i18n( "Todo " )+ event->summary();
326 if (event->cancelled ()) { 347 if (event->cancelled ()) {
327 mText +="<font color=\"#B00000\">"; 348 mText +="<font color=\"#B00000\">";
328 addTag("i",i18n("This todo has been cancelled!")); 349 addTag("i",i18n("This todo has been cancelled!"));
329 mText.append("<br>"); 350 mText.append("<br>");
330 mText += "</font>"; 351 mText += "</font>";
331 mMailSubject += i18n("(cancelled)"); 352 mMailSubject += i18n("(cancelled)");
332 } 353 }
333 354
334 if (!event->location().isEmpty()) { 355 if (!event->location().isEmpty()) {
335 addTag("b",i18n("Location: ")); 356 addTag("b",i18n("Location: "));
336 mText.append(event->location()+"<br>"); 357 mText.append(event->location()+"<br>");
337 mMailSubject += i18n(" at ") + event->location(); 358 mMailSubject += i18n(" at ") + event->location();
338 } 359 }
339 if (event->hasDueDate()) { 360 if (event->hasDueDate()) {
340 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); 361 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer)));
341 mMailSubject += i18n(" - " )+event->dtDueStr( true ); 362 mMailSubject += i18n(" - " )+event->dtDueStr( true );
342 } 363 }
343 addTag("b",i18n("Access: ")); 364 addTag("b",i18n("Access: "));
344 mText.append(event->secrecyStr()+"<br>"); 365 mText.append(event->secrecyStr()+"<br>");
345 if (!event->description().isEmpty()) { 366 if (!event->description().isEmpty()) {
346 addTag("p",i18n("<b>Details: </b>")); 367 addTag("p",i18n("<b>Details: </b>"));
347 addTag("p",event->description()); 368 addTag("p",event->description());
348 } 369 }
349 370
350 formatCategories(event); 371 formatCategories(event);
351 372
352 mText.append(i18n("<p><b>Priority:</b> %2</p>") 373 mText.append(i18n("<p><b>Priority:</b> %2</p>")
353 .arg(QString::number(event->priority()))); 374 .arg(QString::number(event->priority())));
354 375
355 mText.append(i18n("<p><i>%1 % completed</i></p>") 376 mText.append(i18n("<p><i>%1 % completed</i></p>")
356 .arg(event->percentComplete())); 377 .arg(event->percentComplete()));
357 378
358 formatReadOnly(event); 379 formatReadOnly(event);
359 formatAttendees(event); 380 formatAttendees(event);
360 381
361 setText(mText); 382 setText(mText);
362} 383}
363 384
364void KOEventViewer::formatCategories(Incidence *event) 385void KOEventViewer::formatCategories(Incidence *event)
365{ 386{
366 if (!event->categoriesStr().isEmpty()) { 387 if (!event->categoriesStr().isEmpty()) {
367 if (event->categories().count() == 1) { 388 if (event->categories().count() == 1) {
368 addTag("h3",i18n("Category")); 389 addTag("h3",i18n("Category"));
369 } else { 390 } else {
370 addTag("h3",i18n("Categories")); 391 addTag("h3",i18n("Categories"));
371 } 392 }
372 addTag("p",event->categoriesStr()); 393 addTag("p",event->categoriesStr());
373 } 394 }
374} 395}
375void KOEventViewer::formatAttendees(Incidence *event) 396void KOEventViewer::formatAttendees(Incidence *event)
376{ 397{
377 QPtrList<Attendee> attendees = event->attendees(); 398 QPtrList<Attendee> attendees = event->attendees();
378 if (attendees.count()) { 399 if (attendees.count()) {
379 400
380 401
381 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); 402 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
382 addTag("h3",i18n("Organizer")); 403 addTag("h3",i18n("Organizer"));
383 mText.append("<ul><li>"); 404 mText.append("<ul><li>");
384#ifndef KORG_NOKABC 405#ifndef KORG_NOKABC
385 406
407#ifdef DESKTOP_VERSION
386 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 408 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
387 KABC::Addressee::List addressList; 409 KABC::Addressee::List addressList;
388 addressList = add_book->findByEmail(event->organizer()); 410 addressList = add_book->findByEmail(event->organizer());
389 KABC::Addressee o = addressList.first(); 411 KABC::Addressee o = addressList.first();
390 if (!o.isEmpty() && addressList.size()<2) { 412 if (!o.isEmpty() && addressList.size()<2) {
391 mText += "<a href=\"uid:" + o.uid() + "\">"; 413 mText += "<a href=\"uid:" + o.uid() + "\">";
392 mText += o.formattedName(); 414 mText += o.formattedName();
393 mText += "</a>\n"; 415 mText += "</a>\n";
394 } else { 416 } else {
395 mText.append(event->organizer()); 417 mText.append(event->organizer());
396 } 418 }
419#else //DESKTOP_VERSION
420 mText.append(event->organizer());
421#endif //DESKTOP_VERSION
422
423
397#else 424#else
398 mText.append(event->organizer()); 425 mText.append(event->organizer());
399#endif 426#endif
400 427
401 if (iconPath) { 428 if (iconPath) {
402 mText += " <a href=\"mailto:" + event->organizer() + "\">"; 429 mText += " <a href=\"mailto:" + event->organizer() + "\">";
403 mText += "<IMG src=\"" + iconPath + "\">"; 430 mText += "<IMG src=\"" + iconPath + "\">";
404 mText += "</a>\n"; 431 mText += "</a>\n";
405 } 432 }
406 mText.append("</li></ul>"); 433 mText.append("</li></ul>");
407 434
408 addTag("h3",i18n("Attendees")); 435 addTag("h3",i18n("Attendees"));
409 Attendee *a; 436 Attendee *a;
410 mText.append("<ul>"); 437 mText.append("<ul>");
411 for(a=attendees.first();a;a=attendees.next()) { 438 for(a=attendees.first();a;a=attendees.next()) {
412#ifndef KORG_NOKABC 439#ifndef KORG_NOKABC
440#ifdef DESKTOP_VERSION
413 if (a->name().isEmpty()) { 441 if (a->name().isEmpty()) {
414 addressList = add_book->findByEmail(a->email()); 442 addressList = add_book->findByEmail(a->email());
415 KABC::Addressee o = addressList.first(); 443 KABC::Addressee o = addressList.first();
416 if (!o.isEmpty() && addressList.size()<2) { 444 if (!o.isEmpty() && addressList.size()<2) {
417 mText += "<a href=\"uid:" + o.uid() + "\">"; 445 mText += "<a href=\"uid:" + o.uid() + "\">";
418 mText += o.formattedName(); 446 mText += o.formattedName();
419 mText += "</a>\n"; 447 mText += "</a>\n";
420 } else { 448 } else {
421 mText += "<li>"; 449 mText += "<li>";
422 mText.append(a->email()); 450 mText.append(a->email());
423 mText += "\n"; 451 mText += "\n";
424 } 452 }
425 } else { 453 } else {
426 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 454 mText += "<li><a href=\"uid:" + a->uid() + "\">";
427 if (!a->name().isEmpty()) mText += a->name(); 455 if (!a->name().isEmpty()) mText += a->name();
428 else mText += a->email(); 456 else mText += a->email();
429 mText += "</a>\n"; 457 mText += "</a>\n";
430 } 458 }
459#else //DESKTOP_VERSION
460 mText += "<li><a href=\"uid:" + a->uid() + "\">";
461 if (!a->name().isEmpty()) mText += a->name();
462 else mText += a->email();
463 mText += "</a>\n";
464#endif //DESKTOP_VERSION
431#else 465#else
432 //qDebug("nokabc "); 466 //qDebug("nokabc ");
433 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 467 mText += "<li><a href=\"uid:" + a->uid() + "\">";
434 if (!a->name().isEmpty()) mText += a->name(); 468 if (!a->name().isEmpty()) mText += a->name();
435 else mText += a->email(); 469 else mText += a->email();
436 mText += "</a>\n"; 470 mText += "</a>\n";
437#endif 471#endif
438 472
439 473
440 if (!a->email().isEmpty()) { 474 if (!a->email().isEmpty()) {
441 if (iconPath) { 475 if (iconPath) {
442 mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; 476 mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">";
443 mText += "<IMG src=\"" + iconPath + "\">"; 477 mText += "<IMG src=\"" + iconPath + "\">";
444 mText += "</a>\n"; 478 mText += "</a>\n";
445 } 479 }
446 } 480 }
447 if (a->status() != Attendee::NeedsAction ) 481 if (a->status() != Attendee::NeedsAction )
448 mText +="[" + a->statusStr() + "] "; 482 mText +="[" + a->statusStr() + "] ";
449 if (a->role() == Attendee::Chair ) 483 if (a->role() == Attendee::Chair )
450 mText +="(" + a->roleStr().left(1) + ".)"; 484 mText +="(" + a->roleStr().left(1) + ".)";
451 } 485 }
452 mText.append("</li></ul>"); 486 mText.append("</li></ul>");
453 } 487 }
454 488
455} 489}
456void KOEventViewer::appendJournal(Journal *jour, int mode ) 490void KOEventViewer::appendJournal(Journal *jour, int mode )
457{ 491{
458 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 492 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
459 if (mode == 0 ) 493 if (mode == 0 )
460 addTag("h2",i18n("Journal from: ")); 494 addTag("h2",i18n("Journal from: "));
461 else { 495 else {
462 if ( mode == 1 ) { 496 if ( mode == 1 ) {
463 addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); 497 addTag("h2",i18n( "Local: " ) +i18n("Journal from: "));
464 } else { 498 } else {
465 addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); 499 addTag("h2",i18n( "Remote: " ) +i18n("Journal from: "));
466 } 500 }
467 addTag("h3",i18n( "Last modified " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); 501 addTag("h3",i18n( "Last modified " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) );
468 } 502 }
469 topLevelWidget()->setCaption("Journal Viewer"); 503 topLevelWidget()->setCaption("Journal Viewer");
470 mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); 504 mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer)));
471 if (!jour->description().isEmpty()) { 505 if (!jour->description().isEmpty()) {
472 addTag("p",jour->description()); 506 addTag("p",jour->description());
473 } 507 }
474 setText(mText); 508 setText(mText);
475} 509}
476 510
477void KOEventViewer::formatReadOnly(Incidence *event) 511void KOEventViewer::formatReadOnly(Incidence *event)
478{ 512{
479 if (event->isReadOnly()) { 513 if (event->isReadOnly()) {
480 addTag("p","<em>(" + i18n("read-only") + ")</em>"); 514 addTag("p","<em>(" + i18n("read-only") + ")</em>");
481 } 515 }
482} 516}
483void KOEventViewer::setSyncMode( bool b ) 517void KOEventViewer::setSyncMode( bool b )
484{ 518{
485 mSyncMode = b; 519 mSyncMode = b;
486} 520}
487 521
488 522
489void KOEventViewer::setTodo(Todo *event, bool clearV ) 523void KOEventViewer::setTodo(Todo *event, bool clearV )
490{ 524{
491 if ( clearV ) 525 if ( clearV )
492 clearEvents(); 526 clearEvents();
493 if ( mSyncMode ) { 527 if ( mSyncMode ) {
494 if ( clearV ) 528 if ( clearV )
495 appendTodo(event,1 ); 529 appendTodo(event,1 );
496 else 530 else
497 appendTodo(event,2); 531 appendTodo(event,2);
498 } else 532 } else
499 appendTodo(event); 533 appendTodo(event);
500} 534}
501void KOEventViewer::setJournal(Journal *event, bool clearV ) 535void KOEventViewer::setJournal(Journal *event, bool clearV )
502{ 536{
503 if ( clearV ) 537 if ( clearV )
504 clearEvents(); 538 clearEvents();
505 if ( mSyncMode ) { 539 if ( mSyncMode ) {
506 if ( clearV ) 540 if ( clearV )
507 appendJournal(event, 1); 541 appendJournal(event, 1);
508 else 542 else
509 appendJournal(event, 2); 543 appendJournal(event, 2);
510 } else 544 } else
511 appendJournal(event); 545 appendJournal(event);
512} 546}
513 547
514void KOEventViewer::setEvent(Event *event) 548void KOEventViewer::setEvent(Event *event)
515{ 549{
516 clearEvents(); 550 clearEvents();
517 if ( mSyncMode ) 551 if ( mSyncMode )
518 appendEvent(event, 1); 552 appendEvent(event, 1);
519 else 553 else
520 appendEvent(event); 554 appendEvent(event);
521} 555}
522 556
523void KOEventViewer::addEvent(Event *event) 557void KOEventViewer::addEvent(Event *event)
524{ 558{
525 if ( mSyncMode ) 559 if ( mSyncMode )
526 appendEvent(event, 2); 560 appendEvent(event, 2);
527 else 561 else
528 appendEvent(event); 562 appendEvent(event);
529} 563}
530 564
531void KOEventViewer::clearEvents(bool now) 565void KOEventViewer::clearEvents(bool now)
532{ 566{
533 mText = ""; 567 mText = "";
534 if (now) setText(mText); 568 if (now) setText(mText);
535} 569}
536 570
537void KOEventViewer::addText(QString text) 571void KOEventViewer::addText(QString text)
538{ 572{
539 mText.append(text); 573 mText.append(text);
540 setText(mText); 574 setText(mText);
541} 575}
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index d4fadcb..7978b46 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -13,385 +13,387 @@
13#include <qlabel.h> 13#include <qlabel.h>
14#include <qmap.h> 14#include <qmap.h>
15#include <qwmatrix.h> 15#include <qwmatrix.h>
16#include <qtextbrowser.h> 16#include <qtextbrowser.h>
17#include <qtextstream.h> 17#include <qtextstream.h>
18#ifndef DESKTOP_VERSION 18#ifndef DESKTOP_VERSION
19#include <qpe/global.h> 19#include <qpe/global.h>
20#include <qpe/qpemenubar.h> 20#include <qpe/qpemenubar.h>
21#include <qpe/qpetoolbar.h> 21#include <qpe/qpetoolbar.h>
22#include <qpe/resource.h> 22#include <qpe/resource.h>
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24#include <qtopia/alarmserver.h> 24#include <qtopia/alarmserver.h>
25#include <qtopia/qcopenvelope_qws.h> 25#include <qtopia/qcopenvelope_qws.h>
26#else 26#else
27#include <qmenubar.h> 27#include <qmenubar.h>
28#include <qtoolbar.h> 28#include <qtoolbar.h>
29#include <qapplication.h> 29#include <qapplication.h>
30//#include <resource.h> 30//#include <resource.h>
31 31
32#endif 32#endif
33#include <libkcal/calendarlocal.h> 33#include <libkcal/calendarlocal.h>
34#include <libkcal/todo.h> 34#include <libkcal/todo.h>
35#include <libkdepim/ksyncprofile.h> 35#include <libkdepim/ksyncprofile.h>
36#include <libkdepim/kincidenceformatter.h> 36#include <libkdepim/kincidenceformatter.h>
37 37
38#include "calendarview.h" 38#include "calendarview.h"
39#include "koviewmanager.h" 39#include "koviewmanager.h"
40#include "datenavigator.h" 40#include "datenavigator.h"
41#include "koagendaview.h" 41#include "koagendaview.h"
42#include "koagenda.h" 42#include "koagenda.h"
43#include "kodialogmanager.h" 43#include "kodialogmanager.h"
44#include "kdialogbase.h" 44#include "kdialogbase.h"
45#include "kapplication.h" 45#include "kapplication.h"
46#include "kofilterview.h" 46#include "kofilterview.h"
47#include "kstandarddirs.h" 47#include "kstandarddirs.h"
48#include "koprefs.h" 48#include "koprefs.h"
49#include "kfiledialog.h" 49#include "kfiledialog.h"
50#include "koglobals.h" 50#include "koglobals.h"
51#include "kglobal.h" 51#include "kglobal.h"
52#include "klocale.h" 52#include "klocale.h"
53#include "kconfig.h" 53#include "kconfig.h"
54#include "simplealarmclient.h" 54#include "simplealarmclient.h"
55#include "externalapphandler.h" 55#include "externalapphandler.h"
56 56
57using namespace KCal; 57using namespace KCal;
58#ifndef _WIN32_ 58#ifndef _WIN32_
59#include <unistd.h> 59#include <unistd.h>
60#else 60#else
61#include "koimportoldialog.h" 61#include "koimportoldialog.h"
62#endif 62#endif
63#include "mainwindow.h" 63#include "mainwindow.h"
64 64
65int globalFlagBlockStartup; 65int globalFlagBlockStartup;
66MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 66MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
67 QMainWindow( parent, name ) 67 QMainWindow( parent, name )
68{ 68{
69 69
70#ifdef DESKTOP_VERSION 70#ifdef DESKTOP_VERSION
71 setFont( QFont("Arial"), 14 ); 71 setFont( QFont("Arial"), 14 );
72#endif 72#endif
73 73
74 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 74 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
75 QString confFile = locateLocal("config","korganizerrc"); 75 QString confFile = locateLocal("config","korganizerrc");
76 QFileInfo finf ( confFile ); 76 QFileInfo finf ( confFile );
77 bool showWarning = !finf.exists(); 77 bool showWarning = !finf.exists();
78 setIcon(SmallIcon( "ko24" ) ); 78 setIcon(SmallIcon( "ko24" ) );
79 mBlockAtStartup = true; 79 mBlockAtStartup = true;
80 mFlagKeyPressed = false; 80 mFlagKeyPressed = false;
81 setCaption("KOrganizer/Pi"); 81 setCaption("KOrganizer/Pi");
82 KOPrefs *p = KOPrefs::instance(); 82 KOPrefs *p = KOPrefs::instance();
83 // if ( QApplication::desktop()->height() > 480 ) { 83 // if ( QApplication::desktop()->height() > 480 ) {
84// if ( p->mHourSize == 4 ) 84// if ( p->mHourSize == 4 )
85// p->mHourSize = 6; 85// p->mHourSize = 6;
86// } 86// }
87 if ( p->mHourSize > 18 ) 87 if ( p->mHourSize > 18 )
88 p->mHourSize = 18; 88 p->mHourSize = 18;
89 QMainWindow::ToolBarDock tbd; 89 QMainWindow::ToolBarDock tbd;
90 if ( p->mToolBarHor ) { 90 if ( p->mToolBarHor ) {
91 if ( p->mToolBarUp ) 91 if ( p->mToolBarUp )
92 tbd = Bottom; 92 tbd = Bottom;
93 else 93 else
94 tbd = Top; 94 tbd = Top;
95 } 95 }
96 else { 96 else {
97 if ( p->mToolBarUp ) 97 if ( p->mToolBarUp )
98 tbd = Right; 98 tbd = Right;
99 else 99 else
100 tbd = Left; 100 tbd = Left;
101 } 101 }
102 if ( KOPrefs::instance()->mUseAppColors ) 102 if ( KOPrefs::instance()->mUseAppColors )
103 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 103 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
104 globalFlagBlockStartup = 1; 104 globalFlagBlockStartup = 1;
105 iconToolBar = new QPEToolBar( this ); 105 iconToolBar = new QPEToolBar( this );
106 addToolBar (iconToolBar , tbd ); 106 addToolBar (iconToolBar , tbd );
107 mBlockSaveFlag = false; 107 mBlockSaveFlag = false;
108 mCalendarModifiedFlag = false; 108 mCalendarModifiedFlag = false;
109 109
110 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 110 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
111 splash->setAlignment ( AlignCenter ); 111 splash->setAlignment ( AlignCenter );
112 setCentralWidget( splash ); 112 setCentralWidget( splash );
113#ifndef DESKTOP_VERSION 113#ifndef DESKTOP_VERSION
114 showMaximized(); 114 showMaximized();
115#endif 115#endif
116 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 116 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
117 setDefaultPreferences(); 117 setDefaultPreferences();
118 mCalendar = new CalendarLocal(); 118 mCalendar = new CalendarLocal();
119 mView = new CalendarView( mCalendar, this,"mCalendar " ); 119 mView = new CalendarView( mCalendar, this,"mCalendar " );
120 mView->hide(); 120 mView->hide();
121 //mView->resize(splash->size() ); 121 //mView->resize(splash->size() );
122 initActions(); 122 initActions();
123#ifndef DESKTOP_VERSION 123#ifndef DESKTOP_VERSION
124 iconToolBar->show(); 124 iconToolBar->show();
125 qApp->processEvents(); 125 qApp->processEvents();
126#endif 126#endif
127 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 127 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
128 int vh = height() ; 128 int vh = height() ;
129 int vw = width(); 129 int vw = width();
130 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 130 //qDebug("Toolbar hei %d ",iconToolBar->height() );
131 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 131 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
132 vh -= iconToolBar->height(); 132 vh -= iconToolBar->height();
133 } else { 133 } else {
134 vw -= iconToolBar->height(); 134 vw -= iconToolBar->height();
135 } 135 }
136 //mView->setMaximumSize( splash->size() ); 136 //mView->setMaximumSize( splash->size() );
137 //mView->resize( splash->size() ); 137 //mView->resize( splash->size() );
138 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 138 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
139 mView->readSettings(); 139 mView->readSettings();
140 bool oldOpened = false; 140 bool oldOpened = false;
141 bool newFile = false; 141 bool newFile = false;
142 if( !QFile::exists( defaultFileName() ) ) { 142 if( !QFile::exists( defaultFileName() ) ) {
143 QFileInfo finfo ( defaultFileName() ); 143 QFileInfo finfo ( defaultFileName() );
144 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 144 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
145 qDebug("oldfile %s ", oldFile.latin1()); 145 qDebug("oldfile %s ", oldFile.latin1());
146 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"; 146 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";
147 finfo.setFile( oldFile ); 147 finfo.setFile( oldFile );
148 if (finfo.exists() ) { 148 if (finfo.exists() ) {
149 KMessageBox::information( this, message); 149 KMessageBox::information( this, message);
150 mView->openCalendar( oldFile ); 150 mView->openCalendar( oldFile );
151 qApp->processEvents(); 151 qApp->processEvents();
152 } else { 152 } else {
153 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 153 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
154 finfo.setFile( oldFile ); 154 finfo.setFile( oldFile );
155 if (finfo.exists() ) { 155 if (finfo.exists() ) {
156 KMessageBox::information( this, message); 156 KMessageBox::information( this, message);
157 mView->openCalendar( oldFile ); 157 mView->openCalendar( oldFile );
158 qApp->processEvents(); 158 qApp->processEvents();
159 } 159 }
160 } 160 }
161 mView->saveCalendar( defaultFileName() ); 161 mView->saveCalendar( defaultFileName() );
162 newFile = true; 162 newFile = true;
163 } 163 }
164 164
165 QTime neededSaveTime = QDateTime::currentDateTime().time(); 165 QTime neededSaveTime = QDateTime::currentDateTime().time();
166 if ( ! oldOpened ) 166 if ( ! oldOpened )
167 mView->openCalendar( defaultFileName() ); 167 mView->openCalendar( defaultFileName() );
168 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 168 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
169 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 169 qDebug("KO: Calendar loading time: %d ms",msNeeded );
170 170
171 if ( KOPrefs::instance()->mLanguageChanged ) { 171 if ( KOPrefs::instance()->mLanguageChanged ) {
172 KOPrefs::instance()->setCategoryDefaults(); 172 KOPrefs::instance()->setCategoryDefaults();
173 int count = mView->addCategories(); 173 int count = mView->addCategories();
174 KOPrefs::instance()->mLanguageChanged = false; 174 KOPrefs::instance()->mLanguageChanged = false;
175 } 175 }
176 processIncidenceSelection( 0 ); 176 processIncidenceSelection( 0 );
177 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 177 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
178 SLOT( processIncidenceSelection( Incidence * ) ) ); 178 SLOT( processIncidenceSelection( Incidence * ) ) );
179 connect( mView, SIGNAL( modifiedChanged( bool ) ), 179 connect( mView, SIGNAL( modifiedChanged( bool ) ),
180 SLOT( slotModifiedChanged( bool ) ) ); 180 SLOT( slotModifiedChanged( bool ) ) );
181 181
182 182
183 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 183 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
184 mView->setModified( false ); 184 mView->setModified( false );
185 mBlockAtStartup = false; 185 mBlockAtStartup = false;
186 mView->setModified( false ); 186 mView->setModified( false );
187 setCentralWidget( mView ); 187 setCentralWidget( mView );
188 globalFlagBlockStartup = 0; 188 globalFlagBlockStartup = 0;
189 mView->show(); 189 mView->show();
190 delete splash; 190 delete splash;
191 if ( newFile ) 191 if ( newFile )
192 mView->updateConfig(); 192 mView->updateConfig();
193 // qApp->processEvents(); 193 // qApp->processEvents();
194 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 194 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
195 fillSyncMenu(); 195 fillSyncMenu();
196 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 196 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
197 if ( showWarning ) { 197 if ( showWarning ) {
198 KMessageBox::information( this, 198 KMessageBox::information( this,
199 "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"); 199 "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");
200 qApp->processEvents(); 200 qApp->processEvents();
201 mView->dialogManager()->showSyncOptions(); 201 mView->dialogManager()->showSyncOptions();
202 } 202 }
203 203
204 //US listen for result adressed from Ka/Pi 204 //US listen for result adressed from Ka/Pi
205#ifndef DESKTOP_VERSION
205 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 206 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
207#endif
206} 208}
207MainWindow::~MainWindow() 209MainWindow::~MainWindow()
208{ 210{
209 //qDebug("MainWindow::~MainWindow() "); 211 //qDebug("MainWindow::~MainWindow() ");
210 //save toolbar location 212 //save toolbar location
211 213
212 delete mCalendar; 214 delete mCalendar;
213 delete KOPrefs::instance(); 215 delete KOPrefs::instance();
214 delete KIncidenceFormatter::instance(); 216 delete KIncidenceFormatter::instance();
215 217
216 218
217} 219}
218void MainWindow::showMaximized () 220void MainWindow::showMaximized ()
219{ 221{
220#ifndef DESKTOP_VERSION 222#ifndef DESKTOP_VERSION
221 if ( ! globalFlagBlockStartup ) 223 if ( ! globalFlagBlockStartup )
222 mView->goToday(); 224 mView->goToday();
223#endif 225#endif
224 QWidget::showMaximized () ; 226 QWidget::showMaximized () ;
225} 227}
226void MainWindow::closeEvent( QCloseEvent* ce ) 228void MainWindow::closeEvent( QCloseEvent* ce )
227{ 229{
228 230
229 231
230 232
231 if ( ! KOPrefs::instance()->mAskForQuit ) { 233 if ( ! KOPrefs::instance()->mAskForQuit ) {
232 saveOnClose(); 234 saveOnClose();
233 ce->accept(); 235 ce->accept();
234 return; 236 return;
235 237
236 } 238 }
237 239
238 switch( QMessageBox::information( this, "KO/Pi", 240 switch( QMessageBox::information( this, "KO/Pi",
239 i18n("Do you really want\nto close KO/Pi?"), 241 i18n("Do you really want\nto close KO/Pi?"),
240 i18n("Close"), i18n("No"), 242 i18n("Close"), i18n("No"),
241 0, 0 ) ) { 243 0, 0 ) ) {
242 case 0: 244 case 0:
243 saveOnClose(); 245 saveOnClose();
244 ce->accept(); 246 ce->accept();
245 break; 247 break;
246 case 1: 248 case 1:
247 ce->ignore(); 249 ce->ignore();
248 break; 250 break;
249 case 2: 251 case 2:
250 252
251 default: 253 default:
252 break; 254 break;
253 } 255 }
254 256
255 257
256} 258}
257 259
258void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 260void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
259{ 261{
260 QDataStream stream( data, IO_ReadOnly ); 262 QDataStream stream( data, IO_ReadOnly );
261 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 263 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
262 //QString datamess; 264 //QString datamess;
263 //qDebug("message "); 265 //qDebug("message ");
264 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 266 qDebug("KO: QCOP message received: %s ", cmsg.data() );
265 267
266 if ( cmsg == "-writeFile" ) { 268 if ( cmsg == "-writeFile" ) {
267 // I made from the "-writeFile" an "-writeAlarm" 269 // I made from the "-writeFile" an "-writeAlarm"
268 mView->viewManager()->showWhatsNextView(); 270 mView->viewManager()->showWhatsNextView();
269 mCalendar->checkAlarmForIncidence( 0, true); 271 mCalendar->checkAlarmForIncidence( 0, true);
270 showMaximized(); 272 showMaximized();
271 raise(); 273 raise();
272 return; 274 return;
273 } 275 }
274 276
275 if ( cmsg == "-writeFile" ) { 277 if ( cmsg == "-writeFile" ) {
276 // I made from the "-writeFile" an "-writeAlarm" 278 // I made from the "-writeFile" an "-writeAlarm"
277 mView->viewManager()->showWhatsNextView(); 279 mView->viewManager()->showWhatsNextView();
278 mCalendar->checkAlarmForIncidence( 0, true); 280 mCalendar->checkAlarmForIncidence( 0, true);
279 showMaximized(); 281 showMaximized();
280 raise(); 282 raise();
281 return; 283 return;
282 284
283 } 285 }
284 if ( cmsg == "-writeFileSilent" ) { 286 if ( cmsg == "-writeFileSilent" ) {
285 // I made from the "-writeFile" an "-writeAlarm" 287 // I made from the "-writeFile" an "-writeAlarm"
286 // mView->viewManager()->showWhatsNextView(); 288 // mView->viewManager()->showWhatsNextView();
287 mCalendar->checkAlarmForIncidence( 0, true); 289 mCalendar->checkAlarmForIncidence( 0, true);
288 //showMaximized(); 290 //showMaximized();
289 //raise(); 291 //raise();
290 hide(); 292 hide();
291 return; 293 return;
292 } 294 }
293 if ( cmsg == "-newCountdown" ) { 295 if ( cmsg == "-newCountdown" ) {
294 qDebug("newCountdown "); 296 qDebug("newCountdown ");
295 297
296 } 298 }
297 QString msg ; 299 QString msg ;
298 QString allmsg = cmsg; 300 QString allmsg = cmsg;
299 while ( allmsg.length() > 0 ) { 301 while ( allmsg.length() > 0 ) {
300 int nextC = allmsg.find( "-", 1 ); 302 int nextC = allmsg.find( "-", 1 );
301 if ( nextC == -1 ) { 303 if ( nextC == -1 ) {
302 msg = allmsg; 304 msg = allmsg;
303 allmsg = ""; 305 allmsg = "";
304 } else{ 306 } else{
305 msg = allmsg.left( nextC ); 307 msg = allmsg.left( nextC );
306 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 308 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
307 } 309 }
308 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 310 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
309 if ( msg == "-newEvent" ) { 311 if ( msg == "-newEvent" ) {
310 mView->newEvent(); 312 mView->newEvent();
311 } 313 }
312 if ( msg == "-newTodo" ) { 314 if ( msg == "-newTodo" ) {
313 mView->newTodo(); 315 mView->newTodo();
314 316
315 } 317 }
316 if ( msg == "-showWN" ) { 318 if ( msg == "-showWN" ) {
317 mView->viewManager()->showWhatsNextView(); 319 mView->viewManager()->showWhatsNextView();
318 } 320 }
319 if ( msg == "-showTodo" ) { 321 if ( msg == "-showTodo" ) {
320 mView->viewManager()->showTodoView(); 322 mView->viewManager()->showTodoView();
321 } 323 }
322 if ( msg == "-showList" ) { 324 if ( msg == "-showList" ) {
323 mView->viewManager()->showListView(); 325 mView->viewManager()->showListView();
324 } 326 }
325 else if ( msg == "-showDay" ) { 327 else if ( msg == "-showDay" ) {
326 mView->viewManager()->showDayView(); 328 mView->viewManager()->showDayView();
327 } 329 }
328 else if ( msg == "-showWWeek" ) { 330 else if ( msg == "-showWWeek" ) {
329 mView->viewManager()->showWorkWeekView(); 331 mView->viewManager()->showWorkWeekView();
330 } 332 }
331 else if ( msg == "-ringSync" ) { 333 else if ( msg == "-ringSync" ) {
332 multiSync( false ); 334 multiSync( false );
333 } 335 }
334 else if ( msg == "-showWeek" ) { 336 else if ( msg == "-showWeek" ) {
335 mView->viewManager()->showWeekView(); 337 mView->viewManager()->showWeekView();
336 } 338 }
337 else if ( msg == "-showTodo" ) { 339 else if ( msg == "-showTodo" ) {
338 mView->viewManager()->showTodoView(); 340 mView->viewManager()->showTodoView();
339 } 341 }
340 else if ( msg == "-showJournal" ) { 342 else if ( msg == "-showJournal" ) {
341 mView->dateNavigator()->selectDates( 1 ); 343 mView->dateNavigator()->selectDates( 1 );
342 mView->dateNavigator()->selectToday(); 344 mView->dateNavigator()->selectToday();
343 mView->viewManager()->showJournalView(); 345 mView->viewManager()->showJournalView();
344 } 346 }
345 else if ( msg == "-showKO" ) { 347 else if ( msg == "-showKO" ) {
346 mView->viewManager()->showNextXView(); 348 mView->viewManager()->showNextXView();
347 } 349 }
348 else if ( msg == "-showWNext" || msg == "nextView()" ) { 350 else if ( msg == "-showWNext" || msg == "nextView()" ) {
349 mView->viewManager()->showWhatsNextView(); 351 mView->viewManager()->showWhatsNextView();
350 } 352 }
351 else if ( msg == "-showNextXView" ) { 353 else if ( msg == "-showNextXView" ) {
352 mView->viewManager()->showNextXView(); 354 mView->viewManager()->showNextXView();
353 } 355 }
354 356
355 357
356 } 358 }
357 359
358 showMaximized(); 360 showMaximized();
359 raise(); 361 raise();
360} 362}
361 363
362QPixmap MainWindow::loadPixmap( QString name ) 364QPixmap MainWindow::loadPixmap( QString name )
363{ 365{
364 return SmallIcon( name ); 366 return SmallIcon( name );
365 367
366} 368}
367void MainWindow::initActions() 369void MainWindow::initActions()
368{ 370{
369 //KOPrefs::instance()->mShowFullMenu 371 //KOPrefs::instance()->mShowFullMenu
370 iconToolBar->clear(); 372 iconToolBar->clear();
371 KOPrefs *p = KOPrefs::instance(); 373 KOPrefs *p = KOPrefs::instance();
372 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 374 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
373 375
374 QPopupMenu *viewMenu = new QPopupMenu( this ); 376 QPopupMenu *viewMenu = new QPopupMenu( this );
375 QPopupMenu *actionMenu = new QPopupMenu( this ); 377 QPopupMenu *actionMenu = new QPopupMenu( this );
376 QPopupMenu *importMenu = new QPopupMenu( this ); 378 QPopupMenu *importMenu = new QPopupMenu( this );
377 selectFilterMenu = new QPopupMenu( this ); 379 selectFilterMenu = new QPopupMenu( this );
378 selectFilterMenu->setCheckable( true ); 380 selectFilterMenu->setCheckable( true );
379 syncMenu = new QPopupMenu( this ); 381 syncMenu = new QPopupMenu( this );
380 configureAgendaMenu = new QPopupMenu( this ); 382 configureAgendaMenu = new QPopupMenu( this );
381 configureToolBarMenu = new QPopupMenu( this ); 383 configureToolBarMenu = new QPopupMenu( this );
382 QPopupMenu *helpMenu = new QPopupMenu( this ); 384 QPopupMenu *helpMenu = new QPopupMenu( this );
383 if ( KOPrefs::instance()->mShowFullMenu ) { 385 if ( KOPrefs::instance()->mShowFullMenu ) {
384 QMenuBar *menuBar1; 386 QMenuBar *menuBar1;
385 menuBar1 = menuBar(); 387 menuBar1 = menuBar();
386 menuBar1->insertItem( i18n("File"), importMenu ); 388 menuBar1->insertItem( i18n("File"), importMenu );
387 menuBar1->insertItem( i18n("View"), viewMenu ); 389 menuBar1->insertItem( i18n("View"), viewMenu );
388 menuBar1->insertItem( i18n("Actions"), actionMenu ); 390 menuBar1->insertItem( i18n("Actions"), actionMenu );
389 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 391 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
390 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 392 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
391 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 393 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
392 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 394 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
393 menuBar1->insertItem( i18n("Help"), helpMenu ); 395 menuBar1->insertItem( i18n("Help"), helpMenu );
394 } else { 396 } else {
395 QPEMenuBar *menuBar1; 397 QPEMenuBar *menuBar1;
396 menuBar1 = new QPEMenuBar( iconToolBar ); 398 menuBar1 = new QPEMenuBar( iconToolBar );
397 QPopupMenu *menuBar = new QPopupMenu( this ); 399 QPopupMenu *menuBar = new QPopupMenu( this );
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp
index bd83626..6100097 100644
--- a/libkdepim/externalapphandler.cpp
+++ b/libkdepim/externalapphandler.cpp
@@ -117,385 +117,384 @@ void QCopTransferItem::setSourceChannel(const QString& sourceChannel)
117 117
118 118
119/*********************************************************************************/ 119/*********************************************************************************/
120bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) 120bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data )
121{ 121{
122 122
123 // copied from old mail2 123 // copied from old mail2
124/* 124/*
125 static int ii = 0; 125 static int ii = 0;
126 126
127 // block second call 127 // block second call
128 if ( ii < 2 ) { 128 if ( ii < 2 ) {
129 ++ii; 129 ++ii;
130 if ( ii > 1 ) { 130 if ( ii > 1 ) {
131 qDebug("qcop call blocked "); 131 qDebug("qcop call blocked ");
132 return true; 132 return true;
133 } 133 }
134 } 134 }
135*/ 135*/
136 136
137// qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() ); 137// qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() );
138 138
139 //we are in the target and get a request from the source 139 //we are in the target and get a request from the source
140 if ( (_sourceMessage + _sourceMessageParameters) == cmsg.data()) 140 if ( (_sourceMessage + _sourceMessageParameters) == cmsg.data())
141 { 141 {
142 142
143 QDataStream stream( data, IO_ReadOnly ); 143 QDataStream stream( data, IO_ReadOnly );
144 144
145 145
146 QString sourceChannel; 146 QString sourceChannel;
147 QString uid; 147 QString uid;
148 QString param1; 148 QString param1;
149 QString param2; 149 QString param2;
150 QString param3; 150 QString param3;
151 151
152 stream >> sourceChannel >> uid; 152 stream >> sourceChannel >> uid;
153 153
154 if (_usedSourceParameters == 0) 154 if (_usedSourceParameters == 0)
155 { 155 {
156 emit receivedMessageFromSource(sourceChannel, uid); 156 emit receivedMessageFromSource(sourceChannel, uid);
157 } 157 }
158 else if (_usedSourceParameters == 1) 158 else if (_usedSourceParameters == 1)
159 { 159 {
160 stream >> param1; 160 stream >> param1;
161 emit receivedMessageFromSource(sourceChannel, uid, param1); 161 emit receivedMessageFromSource(sourceChannel, uid, param1);
162 } 162 }
163 else if (_usedSourceParameters == 2) 163 else if (_usedSourceParameters == 2)
164 { 164 {
165 stream >> param1 >> param2; 165 stream >> param1 >> param2;
166 emit receivedMessageFromSource(sourceChannel, uid, param1, param2); 166 emit receivedMessageFromSource(sourceChannel, uid, param1, param2);
167 } 167 }
168 else if (_usedSourceParameters == 3) 168 else if (_usedSourceParameters == 3)
169 { 169 {
170 stream >> param1 >> param2 >> param3; 170 stream >> param1 >> param2 >> param3;
171 emit receivedMessageFromSource(sourceChannel, uid, param1, param2, param3); 171 emit receivedMessageFromSource(sourceChannel, uid, param1, param2, param3);
172 } 172 }
173 173
174 return true; 174 return true;
175 } 175 }
176 176
177 return false; 177 return false;
178} 178}
179 179
180 180
181/********************************************************************************* 181/*********************************************************************************
182 * 182 *
183 ********************************************************************************/ 183 ********************************************************************************/
184 184
185 185
186QCopMapTransferItem::QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) 186QCopMapTransferItem::QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage)
187 : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) 187 : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage)
188{ 188{
189 //targetMessage returns later two parameters: uid, and map<qstring,qstring> 189 //targetMessage returns later two parameters: uid, and map<qstring,qstring>
190 _targetMessageParameters = "(QString,QMAP<QString,QString>)"; 190 _targetMessageParameters = "(QString,QMAP<QString,QString>)";
191} 191}
192 192
193/*********************************************************************************/ 193/*********************************************************************************/
194bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap) 194bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap)
195{ 195{
196#ifndef DESKTOP_VERSION 196#ifndef DESKTOP_VERSION
197 //targetMessage passes two parameters: uid, map 197 //targetMessage passes two parameters: uid, map
198 QString targetMessage = _targetMessage + _targetMessageParameters; 198 QString targetMessage = _targetMessage + _targetMessageParameters;
199 199
200 qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); 200 qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1());
201 qDebug("passing uid(%s) and map as parameter to QCopEnvelope", uid.latin1()); 201 qDebug("passing uid(%s) and map as parameter to QCopEnvelope", uid.latin1());
202 202
203 QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); 203 QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1());
204 //US we need no names in the To field. The emailadresses are enough 204 //US we need no names in the To field. The emailadresses are enough
205 205
206 e << uid << nameEmailMap; 206 e << uid << nameEmailMap;
207 207
208 qApp->processEvents(); 208 qApp->processEvents();
209 209
210 return true; 210 return true;
211 211
212#else 212#else
213 KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); 213 KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) );
214 return false; 214 return false;
215#endif 215#endif
216 216
217} 217}
218 218
219 219
220/*********************************************************************************/ 220/*********************************************************************************/
221bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) 221bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& data )
222{ 222{
223 bool res = QCopTransferItem::appMessage( cmsg, data ); 223 bool res = QCopTransferItem::appMessage( cmsg, data );
224 224
225 if (res == false) 225 if (res == false)
226 { 226 {
227 QDataStream stream( data, IO_ReadOnly ); 227 QDataStream stream( data, IO_ReadOnly );
228 228
229// qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); 229// qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() );
230 230
231 //we are in the source and get an answer from the target 231 //we are in the source and get an answer from the target
232 if ((_targetMessage + _targetMessageParameters) == cmsg.data()) 232 if ((_targetMessage + _targetMessageParameters) == cmsg.data())
233 { 233 {
234 QMap<QString,QString> adrMap; 234 QMap<QString,QString> adrMap;
235 QString uid; 235 QString uid;
236 236
237 stream >> uid >> adrMap; 237 stream >> uid >> adrMap;
238 238
239 emit receivedMessageFromTarget(uid, adrMap); 239 emit receivedMessageFromTarget(uid, adrMap);
240 240
241 241
242 return true; 242 return true;
243 } 243 }
244 } 244 }
245 245
246 return false; 246 return false;
247} 247}
248 248
249 249
250/********************************************************************************* 250/*********************************************************************************
251 * 251 *
252 ********************************************************************************/ 252 ********************************************************************************/
253 253
254 254
255QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) 255QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage)
256 : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) 256 : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage)
257{ 257{
258 //targetMessage returns later two parameters: uid, and three lists 258 //targetMessage returns later two parameters: uid, and three lists
259 _targetMessageParameters = "(QString,QStringList,QStringList,QStringList)"; 259 _targetMessageParameters = "(QString,QStringList,QStringList,QStringList)";
260} 260}
261 261
262/*********************************************************************************/ 262/*********************************************************************************/
263bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3) 263bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3)
264{ 264{
265#ifndef DESKTOP_VERSION 265#ifndef DESKTOP_VERSION
266 //targetMessage passes two parameters: uid, map 266 //targetMessage passes two parameters: uid, map
267 QString targetMessage = _targetMessage + _targetMessageParameters; 267 QString targetMessage = _targetMessage + _targetMessageParameters;
268 268
269 qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); 269 qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1());
270 qDebug("passing uid(%s) and list1, list2, list3 as parameter to QCopEnvelope", uid.latin1()); 270 qDebug("passing uid(%s) and list1, list2, list3 as parameter to QCopEnvelope", uid.latin1());
271 271
272 QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); 272 QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1());
273 //US we need no names in the To field. The emailadresses are enough 273 //US we need no names in the To field. The emailadresses are enough
274 274
275 e << uid << list1 << list2 << list3; 275 e << uid << list1 << list2 << list3;
276 276
277 qApp->processEvents(); 277 qApp->processEvents();
278 278
279 return true; 279 return true;
280 280
281#else 281#else
282 KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); 282 KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) );
283 return false; 283 return false;
284#endif 284#endif
285 285
286} 286}
287 287
288 288
289/*********************************************************************************/ 289/*********************************************************************************/
290bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) 290bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data )
291{ 291{
292 bool res = QCopTransferItem::appMessage( cmsg, data ); 292 bool res = QCopTransferItem::appMessage( cmsg, data );
293 293
294 if (res == false) 294 if (res == false)
295 { 295 {
296 QDataStream stream( data, IO_ReadOnly ); 296 QDataStream stream( data, IO_ReadOnly );
297 297
298// qDebug("QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); 298// qDebug("QCopListTransferItem- QCOP message received: %s ", cmsg.data() );
299 299
300 //we are in the source and get an answer from the target 300 //we are in the source and get an answer from the target
301 if ((_targetMessage + _targetMessageParameters) == cmsg.data()) 301 if ((_targetMessage + _targetMessageParameters) == cmsg.data())
302 { 302 {
303 QStringList list1; 303 QStringList list1;
304 QStringList list2; 304 QStringList list2;
305 QStringList list3; 305 QStringList list3;
306 QString uid; 306 QString uid;
307 307
308 stream >> uid >> list1 >> list2 >> list3; 308 stream >> uid >> list1 >> list2 >> list3;
309
310 emit receivedMessageFromTarget(uid, list1, list2, list3); 309 emit receivedMessageFromTarget(uid, list1, list2, list3);
311 310
312 311
313 return true; 312 return true;
314 } 313 }
315 } 314 }
316 315
317 return false; 316 return false;
318} 317}
319 318
320 319
321 320
322/********************************************************************************* 321/*********************************************************************************
323 * 322 *
324 ********************************************************************************/ 323 ********************************************************************************/
325 324
326 325
327ExternalAppHandler *ExternalAppHandler::sInstance = 0; 326ExternalAppHandler *ExternalAppHandler::sInstance = 0;
328static KStaticDeleter<ExternalAppHandler> staticDeleter; 327static KStaticDeleter<ExternalAppHandler> staticDeleter;
329 328
330ExternalAppHandler::ExternalAppHandler() 329ExternalAppHandler::ExternalAppHandler()
331{ 330{
332 mDefaultItems.setAutoDelete(true); 331 mDefaultItems.setAutoDelete(true);
333 332
334 mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList"); 333 mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList");
335 connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&))); 334 connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&)));
336 connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); 335 connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)));
337 336
338//US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList"); 337//US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList");
339//US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&))); 338//US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&)));
340//US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedFindByEmailEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); 339//US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedFindByEmailEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)));
341 340
342 mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", ""); 341 mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", "");
343 connect(mDisplayDetails, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&, const QString&, const QString&)), this, SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); 342 connect(mDisplayDetails, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&, const QString&, const QString&)), this, SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)));
344} 343}
345 344
346ExternalAppHandler::~ExternalAppHandler() 345ExternalAppHandler::~ExternalAppHandler()
347{ 346{
348} 347}
349 348
350void ExternalAppHandler::loadConfig() 349void ExternalAppHandler::loadConfig()
351{ 350{
352 351
353 mDefaultItems.clear(); 352 mDefaultItems.clear();
354 353
355 mEmailAppAvailable = UNDEFINED; 354 mEmailAppAvailable = UNDEFINED;
356 mPhoneAppAvailable = UNDEFINED; 355 mPhoneAppAvailable = UNDEFINED;
357 mFaxAppAvailable = UNDEFINED; 356 mFaxAppAvailable = UNDEFINED;
358 mSMSAppAvailable = UNDEFINED; 357 mSMSAppAvailable = UNDEFINED;
359 mPagerAppAvailable = UNDEFINED; 358 mPagerAppAvailable = UNDEFINED;
360 359
361 360
362 QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); 361 QString opiepath = QString::fromLatin1( getenv("OPIEDIR") );
363 QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); 362 QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") );
364 363
365 if (opiepath.isEmpty()) 364 if (opiepath.isEmpty())
366 opiepath = qtopiapath; 365 opiepath = qtopiapath;
367 366
368 //mailclients 367 //mailclients
369 QString mailmsg1 = "writeMail(QString,QString)"; 368 QString mailmsg1 = "writeMail(QString,QString)";
370 QString mailmsg2 = "writeMail(QMap(QString,QString))"; 369 QString mailmsg2 = "writeMail(QMap(QString,QString))";
371 370
372 QString undefined = ""; 371 QString undefined = "";
373 372
374 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined); 373 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined);
375 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); 374 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined);
376 375
377 if (( QFile::exists( qtopiapath + "/bin/ompi" )) || 376 if (( QFile::exists( qtopiapath + "/bin/ompi" )) ||
378 ( QFile::exists( opiepath + "/bin/ompi" ))) 377 ( QFile::exists( opiepath + "/bin/ompi" )))
379 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); 378 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2");
380 379
381 if ( QFile::exists( qtopiapath + "/bin/qtmail" )) 380 if ( QFile::exists( qtopiapath + "/bin/qtmail" ))
382 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); 381 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2");
383 382
384 if ( QFile::exists( opiepath + "/bin/opiemail" )) 383 if ( QFile::exists( opiepath + "/bin/opiemail" ))
385 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); 384 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2");
386 385
387 386
388 387
389 //phoneclients 388 //phoneclients
390 389
391 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined); 390 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined);
392 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined); 391 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined);
393 if (( QFile::exists( qtopiapath + "/bin/kppi" )) || 392 if (( QFile::exists( qtopiapath + "/bin/kppi" )) ||
394 ( QFile::exists( opiepath + "/bin/kppi" ))) 393 ( QFile::exists( opiepath + "/bin/kppi" )))
395 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); 394 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined);
396 395
397 //faxclients 396 //faxclients
398 addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined); 397 addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined);
399 addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined); 398 addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined);
400 399
401 //smsclients 400 //smsclients
402 addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined); 401 addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined);
403 addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined); 402 addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined);
404 403
405 //pagerclients 404 //pagerclients
406 addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined); 405 addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined);
407 addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined); 406 addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined);
408 407
409} 408}
410 409
411ExternalAppHandler *ExternalAppHandler::instance() 410ExternalAppHandler *ExternalAppHandler::instance()
412{ 411{
413 if ( !sInstance ) { 412 if ( !sInstance ) {
414 sInstance = staticDeleter.setObject( new ExternalAppHandler() ); 413 sInstance = staticDeleter.setObject( new ExternalAppHandler() );
415 sInstance->loadConfig(); 414 sInstance->loadConfig();
416 } 415 }
417 416
418 return sInstance; 417 return sInstance;
419} 418}
420 419
421void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameter, const QString& message2, const QString& parameter2) 420void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameter, const QString& message2, const QString& parameter2)
422{ 421{
423 DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2); 422 DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2);
424 423
425 mDefaultItems.append(dai); 424 mDefaultItems.append(dai);
426} 425}
427 426
428 427
429QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type) 428QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type)
430{ 429{
431 QList<DefaultAppItem> list; 430 QList<DefaultAppItem> list;
432 431
433 DefaultAppItem* dai; 432 DefaultAppItem* dai;
434 433
435 for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) 434 for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() )
436 { 435 {
437 if (dai->_type == type) 436 if (dai->_type == type)
438 list.append(dai); 437 list.append(dai);
439 } 438 }
440 439
441 return list; 440 return list;
442} 441}
443 442
444DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) 443DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid)
445{ 444{
446 DefaultAppItem* dai; 445 DefaultAppItem* dai;
447 446
448 for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) 447 for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() )
449 { 448 {
450 if (dai->_type == type && dai->_id == clientid) 449 if (dai->_type == type && dai->_id == clientid)
451 return dai; 450 return dai;
452 } 451 }
453 452
454 return 0; 453 return 0;
455} 454}
456 455
457bool ExternalAppHandler::isEmailAppAvailable() 456bool ExternalAppHandler::isEmailAppAvailable()
458{ 457{
459#ifndef DESKTOP_VERSION 458#ifndef DESKTOP_VERSION
460 if (mEmailAppAvailable == UNDEFINED) 459 if (mEmailAppAvailable == UNDEFINED)
461 { 460 {
462 int client = KPimGlobalPrefs::instance()->mEmailClient; 461 int client = KPimGlobalPrefs::instance()->mEmailClient;
463 if (client == KPimGlobalPrefs::NONE_EMC) 462 if (client == KPimGlobalPrefs::NONE_EMC)
464 mEmailAppAvailable = UNAVAILABLE; 463 mEmailAppAvailable = UNAVAILABLE;
465 else 464 else
466 mEmailAppAvailable = AVAILABLE; 465 mEmailAppAvailable = AVAILABLE;
467 } 466 }
468 return (mEmailAppAvailable == AVAILABLE); 467 return (mEmailAppAvailable == AVAILABLE);
469 468
470#else //DESKTOP_VERSION 469#else //DESKTOP_VERSION
471 return false; 470 return false;
472#endif //DESKTOP_VERSION 471#endif //DESKTOP_VERSION
473} 472}
474 473
475bool ExternalAppHandler::isSMSAppAvailable() 474bool ExternalAppHandler::isSMSAppAvailable()
476{ 475{
477#ifndef DESKTOP_VERSION 476#ifndef DESKTOP_VERSION
478 if (mSMSAppAvailable == UNDEFINED) 477 if (mSMSAppAvailable == UNDEFINED)
479 { 478 {
480 int client = KPimGlobalPrefs::instance()->mSMSClient; 479 int client = KPimGlobalPrefs::instance()->mSMSClient;
481 if (client == KPimGlobalPrefs::NONE_SMC) 480 if (client == KPimGlobalPrefs::NONE_SMC)
482 mSMSAppAvailable = UNAVAILABLE; 481 mSMSAppAvailable = UNAVAILABLE;
483 else 482 else
484 mSMSAppAvailable = AVAILABLE; 483 mSMSAppAvailable = AVAILABLE;
485 } 484 }
486 485
487 return (mSMSAppAvailable == AVAILABLE); 486 return (mSMSAppAvailable == AVAILABLE);
488#else //DESKTOP_VERSION 487#else //DESKTOP_VERSION
489 return false; 488 return false;
490#endif //DESKTOP_VERSION 489#endif //DESKTOP_VERSION
491} 490}
492 491
493bool ExternalAppHandler::isPhoneAppAvailable() 492bool ExternalAppHandler::isPhoneAppAvailable()
494{ 493{
495#ifndef DESKTOP_VERSION 494#ifndef DESKTOP_VERSION
496 if (mPhoneAppAvailable == UNDEFINED) 495 if (mPhoneAppAvailable == UNDEFINED)
497 { 496 {
498 int client = KPimGlobalPrefs::instance()->mPhoneClient; 497 int client = KPimGlobalPrefs::instance()->mPhoneClient;
499 if (client == KPimGlobalPrefs::NONE_PHC) 498 if (client == KPimGlobalPrefs::NONE_PHC)
500 mPhoneAppAvailable = UNAVAILABLE; 499 mPhoneAppAvailable = UNAVAILABLE;
501 else 500 else
@@ -781,236 +780,235 @@ bool ExternalAppHandler::callBySMS( const QString& phonenumber )
781 passParameters(&e, parameters, phonenumber, ""); 780 passParameters(&e, parameters, phonenumber, "");
782 781
783 782
784#else 783#else
785 KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) ); 784 KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) );
786#endif 785#endif
787 786
788 787
789 return true; 788 return true;
790} 789}
791 790
792/************************************************************************** 791/**************************************************************************
793 * 792 *
794 **************************************************************************/ 793 **************************************************************************/
795 794
796//calls the pagerapplication with the number 795//calls the pagerapplication with the number
797bool ExternalAppHandler::callByPager( const QString& pagernumber ) 796bool ExternalAppHandler::callByPager( const QString& pagernumber )
798{ 797{
799#ifndef DESKTOP_VERSION 798#ifndef DESKTOP_VERSION
800 QString channel; 799 QString channel;
801 QString message; 800 QString message;
802 QString parameters; 801 QString parameters;
803 802
804 803
805 int client = KPimGlobalPrefs::instance()->mPagerClient; 804 int client = KPimGlobalPrefs::instance()->mPagerClient;
806 if (client == KPimGlobalPrefs::OTHER_PAC) 805 if (client == KPimGlobalPrefs::OTHER_PAC)
807 { 806 {
808 channel = KPimGlobalPrefs::instance()->mPagerOtherChannel; 807 channel = KPimGlobalPrefs::instance()->mPagerOtherChannel;
809 message = KPimGlobalPrefs::instance()->mPagerOtherMessage; 808 message = KPimGlobalPrefs::instance()->mPagerOtherMessage;
810 parameters = KPimGlobalPrefs::instance()->mPagerOtherMessageParameters; 809 parameters = KPimGlobalPrefs::instance()->mPagerOtherMessageParameters;
811 } 810 }
812 else 811 else
813 { 812 {
814 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PAGER, client); 813 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PAGER, client);
815 if (!dai) 814 if (!dai)
816 { 815 {
817 qDebug("could not find configured pager application."); 816 qDebug("could not find configured pager application.");
818 return false; 817 return false;
819 } 818 }
820 channel = dai->_channel; 819 channel = dai->_channel;
821 message = dai->_message; 820 message = dai->_message;
822 parameters = dai->_parameters; 821 parameters = dai->_parameters;
823 } 822 }
824 823
825 824
826 //first check if one of the mailers need the emails right in the message. 825 //first check if one of the mailers need the emails right in the message.
827 message = translateMessage(message, pagernumber, ""); 826 message = translateMessage(message, pagernumber, "");
828 827
829 828
830 qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); 829 qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
831 qDebug("passing pagernumber(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1()); 830 qDebug("passing pagernumber(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1());
832 831
833 QCopEnvelope e(channel.latin1(), message.latin1()); 832 QCopEnvelope e(channel.latin1(), message.latin1());
834 //US we need no names in the To field. The emailadresses are enough 833 //US we need no names in the To field. The emailadresses are enough
835 834
836 passParameters(&e, parameters, pagernumber, ""); 835 passParameters(&e, parameters, pagernumber, "");
837 836
838 837
839#else 838#else
840 KMessageBox::sorry( 0, i18n( "This version does not support paging." ) ); 839 KMessageBox::sorry( 0, i18n( "This version does not support paging." ) );
841#endif 840#endif
842 841
843 842
844 return true; 843 return true;
845} 844}
846 845
847/************************************************************************** 846/**************************************************************************
848 * 847 *
849 **************************************************************************/ 848 **************************************************************************/
850 849
851//calls the faxapplication with the number 850//calls the faxapplication with the number
852bool ExternalAppHandler::callByFax( const QString& faxnumber ) 851bool ExternalAppHandler::callByFax( const QString& faxnumber )
853{ 852{
854#ifndef DESKTOP_VERSION 853#ifndef DESKTOP_VERSION
855 QString channel; 854 QString channel;
856 QString message; 855 QString message;
857 QString parameters; 856 QString parameters;
858 857
859 858
860 int client = KPimGlobalPrefs::instance()->mFaxClient; 859 int client = KPimGlobalPrefs::instance()->mFaxClient;
861 if (client == KPimGlobalPrefs::OTHER_FAC) 860 if (client == KPimGlobalPrefs::OTHER_FAC)
862 { 861 {
863 channel = KPimGlobalPrefs::instance()->mFaxOtherChannel; 862 channel = KPimGlobalPrefs::instance()->mFaxOtherChannel;
864 message = KPimGlobalPrefs::instance()->mFaxOtherMessage; 863 message = KPimGlobalPrefs::instance()->mFaxOtherMessage;
865 parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters; 864 parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters;
866 } 865 }
867 else 866 else
868 { 867 {
869 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client); 868 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client);
870 if (!dai) 869 if (!dai)
871 { 870 {
872 qDebug("could not find configured fax application."); 871 qDebug("could not find configured fax application.");
873 return false; 872 return false;
874 } 873 }
875 channel = dai->_channel; 874 channel = dai->_channel;
876 message = dai->_message; 875 message = dai->_message;
877 parameters = dai->_parameters; 876 parameters = dai->_parameters;
878 } 877 }
879 878
880 879
881 //first check if one of the mailers need the emails right in the message. 880 //first check if one of the mailers need the emails right in the message.
882 message = translateMessage(message, faxnumber, ""); 881 message = translateMessage(message, faxnumber, "");
883 882
884 883
885 qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); 884 qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
886 qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1()); 885 qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1());
887 886
888 QCopEnvelope e(channel.latin1(), message.latin1()); 887 QCopEnvelope e(channel.latin1(), message.latin1());
889 //US we need no names in the To field. The emailadresses are enough 888 //US we need no names in the To field. The emailadresses are enough
890 889
891 passParameters(&e, parameters, faxnumber, ""); 890 passParameters(&e, parameters, faxnumber, "");
892 891
893 892
894#else 893#else
895 KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) ); 894 KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) );
896#endif 895#endif
897 896
898 897
899 return true; 898 return true;
900} 899}
901 900
902/************************************************************************** 901/**************************************************************************
903 * 902 *
904 **************************************************************************/ 903 **************************************************************************/
905 904
906 905
907QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const 906QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const
908{ 907{
909 message = message.replace( QRegExp("%1"), param1 ); 908 message = message.replace( QRegExp("%1"), param1 );
910 return message.replace( QRegExp("%2"), param2 ); 909 return message.replace( QRegExp("%2"), param2 );
911} 910}
912 911
913/************************************************************************** 912/**************************************************************************
914 * 913 *
915 **************************************************************************/ 914 **************************************************************************/
916 915
917void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const 916void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const
918{ 917{
919#ifndef DESKTOP_VERSION 918#ifndef DESKTOP_VERSION
920 QMap<QString, QString> valmap; 919 QMap<QString, QString> valmap;
921 bool useValMap = false; 920 bool useValMap = false;
922 921
923 // first extract all parts of the parameters. 922 // first extract all parts of the parameters.
924 QStringList paramlist = QStringList::split(";", parameters); 923 QStringList paramlist = QStringList::split(";", parameters);
925 924
926 //Now check how many parts we have. 925 //Now check how many parts we have.
927 //=0 :no params to pass 926 //=0 :no params to pass
928 //>0 :parameters to pass 927 //>0 :parameters to pass
929 for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it ) 928 for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it )
930 { 929 {
931 QString param = (*it); 930 QString param = (*it);
932 QStringList keyvallist = QStringList::split("=", param); 931 QStringList keyvallist = QStringList::split("=", param);
933 932
934 //if we have keyvalue pairs, we assume that we pass a map to the envelope 933 //if we have keyvalue pairs, we assume that we pass a map to the envelope
935 QStringList::Iterator it2 = keyvallist.begin(); 934 QStringList::Iterator it2 = keyvallist.begin();
936 QString key = (*it2); 935 QString key = (*it2);
937 key = key.replace( QRegExp("%1"), param1 ); 936 key = key.replace( QRegExp("%1"), param1 );
938 key = key.replace( QRegExp("%2"), param2 ); 937 key = key.replace( QRegExp("%2"), param2 );
939 ++it2; 938 ++it2;
940 939
941 if(it2 != keyvallist.end()) 940 if(it2 != keyvallist.end())
942 { 941 {
943 QString value = (*it2); 942 QString value = (*it2);
944 value = value.replace( QRegExp("%1"), param1 ); 943 value = value.replace( QRegExp("%1"), param1 );
945 value = value.replace( QRegExp("%2"), param2 ); 944 value = value.replace( QRegExp("%2"), param2 );
946 945
947 valmap.insert(key, value); 946 valmap.insert(key, value);
948 useValMap = true; 947 useValMap = true;
949 } 948 }
950 else 949 else
951 { 950 {
952 // qDebug("pass parameter << %s", key.latin1()); 951 // qDebug("pass parameter << %s", key.latin1());
953 (*e) << key; 952 (*e) << key;
954 } 953 }
955 } 954 }
956 955
957 if (useValMap == true) 956 if (useValMap == true)
958 (*e) << valmap; 957 (*e) << valmap;
959 958
960#endif 959#endif
961 960
962} 961}
963 962
964 963
965 964
966/************************************************************************** 965/**************************************************************************
967 * 966 *
968 **************************************************************************/ 967 **************************************************************************/
969 968
970void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data ) 969void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data )
971{ 970{
972 bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); 971 bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data );
973
974 if (!res) 972 if (!res)
975 res = mDisplayDetails->appMessage( cmsg, data ); 973 res = mDisplayDetails->appMessage( cmsg, data );
976 974
977// if (!res) 975// if (!res)
978// res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); 976// res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data );
979} 977}
980 978
981 979
982 980
983bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid) 981bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid)
984{ 982{
985 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); 983 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel);
986 return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid); 984 return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid);
987} 985}
988 986
989bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) 987bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3)
990{ 988{
991 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); 989 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel);
992 return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3); 990 return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3);
993} 991}
994 992
995bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email) 993bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email)
996{ 994{
997 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); 995 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel);
998 return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email); 996 return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email);
999} 997}
1000 998
1001bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) 999bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3)
1002{ 1000{
1003 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); 1001 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel);
1004 return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3); 1002 return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3);
1005} 1003}
1006 1004
1007bool ExternalAppHandler::requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid) 1005bool ExternalAppHandler::requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid)
1008{ 1006{
1009 mDisplayDetails->setSourceChannel(""); 1007 mDisplayDetails->setSourceChannel("");
1010 return mDisplayDetails->sendMessageToTarget("", name, email, uid); 1008 return mDisplayDetails->sendMessageToTarget("", name, email, uid);
1011} 1009}
1012 1010
1013 1011
1014 1012
1015 1013
1016 1014