author | zautrix <zautrix> | 2004-10-27 11:17:28 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-27 11:17:28 (UTC) |
commit | f73d249579d52d7aeaacde2dcb23abeb42f9ee95 (patch) (unidiff) | |
tree | 75dfc3cd592804c1b87bd2588df2e856a0ac776b | |
parent | ce5b6b62c92cc051c5c9e780508b6d42c46df8ed (diff) | |
download | kdepimpi-f73d249579d52d7aeaacde2dcb23abeb42f9ee95.zip kdepimpi-f73d249579d52d7aeaacde2dcb23abeb42f9ee95.tar.gz kdepimpi-f73d249579d52d7aeaacde2dcb23abeb42f9ee95.tar.bz2 |
compile fix
-rw-r--r-- | kabc/addressbook.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 4 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index df0fba4..d101589 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -387,385 +387,385 @@ void AddressBook::export2File( QString fileName ) | |||
387 | return ; | 387 | return ; |
388 | } | 388 | } |
389 | QTextStream t( &outFile ); | 389 | QTextStream t( &outFile ); |
390 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 390 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
391 | Iterator it; | 391 | Iterator it; |
392 | KABC::VCardConverter::Version version; | 392 | KABC::VCardConverter::Version version; |
393 | version = KABC::VCardConverter::v3_0; | 393 | version = KABC::VCardConverter::v3_0; |
394 | for ( it = begin(); it != end(); ++it ) { | 394 | for ( it = begin(); it != end(); ++it ) { |
395 | if ( (*it).resource() && (*it).resource()->includeInSync() ) { | 395 | if ( (*it).resource() && (*it).resource()->includeInSync() ) { |
396 | if ( !(*it).IDStr().isEmpty() ) { | 396 | if ( !(*it).IDStr().isEmpty() ) { |
397 | (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() ); | 397 | (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() ); |
398 | } | 398 | } |
399 | KABC::VCardConverter converter; | 399 | KABC::VCardConverter converter; |
400 | QString vcard; | 400 | QString vcard; |
401 | //Resource *resource() const; | 401 | //Resource *resource() const; |
402 | converter.addresseeToVCard( *it, vcard, version ); | 402 | converter.addresseeToVCard( *it, vcard, version ); |
403 | t << vcard << "\r\n"; | 403 | t << vcard << "\r\n"; |
404 | } | 404 | } |
405 | } | 405 | } |
406 | t << "\r\n\r\n"; | 406 | t << "\r\n\r\n"; |
407 | outFile.close(); | 407 | outFile.close(); |
408 | } | 408 | } |
409 | // if QStringList uids is empty, all are exported | 409 | // if QStringList uids is empty, all are exported |
410 | bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName ) | 410 | bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName ) |
411 | { | 411 | { |
412 | KABC::VCardConverter converter; | 412 | KABC::VCardConverter converter; |
413 | QString datastream; | 413 | QString datastream; |
414 | Iterator it; | 414 | Iterator it; |
415 | bool all = uids.isEmpty(); | 415 | bool all = uids.isEmpty(); |
416 | for ( it = begin(); it != end(); ++it ) { | 416 | for ( it = begin(); it != end(); ++it ) { |
417 | // for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 417 | // for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
418 | if ( ! all ) { | 418 | if ( ! all ) { |
419 | if ( ! ( uids.contains((*it).uid() ) )) | 419 | if ( ! ( uids.contains((*it).uid() ) )) |
420 | continue; | 420 | continue; |
421 | } | 421 | } |
422 | KABC::Addressee a = ( *it ); | 422 | KABC::Addressee a = ( *it ); |
423 | if ( a.isEmpty() ) | 423 | if ( a.isEmpty() ) |
424 | continue; | 424 | continue; |
425 | if ( all && a.resource() && !a.resource()->includeInSync() ) | 425 | if ( all && a.resource() && !a.resource()->includeInSync() ) |
426 | continue; | 426 | continue; |
427 | a.simplifyEmails(); | 427 | a.simplifyEmails(); |
428 | a.simplifyPhoneNumbers(); | 428 | a.simplifyPhoneNumbers(); |
429 | a.simplifyPhoneNumberTypes(); | 429 | a.simplifyPhoneNumberTypes(); |
430 | a.simplifyAddresses(); | 430 | a.simplifyAddresses(); |
431 | 431 | ||
432 | QString vcard; | 432 | QString vcard; |
433 | QString vcardnew; | 433 | QString vcardnew; |
434 | converter.addresseeToVCard( a, vcard ); | 434 | converter.addresseeToVCard( a, vcard ); |
435 | int start = 0; | 435 | int start = 0; |
436 | int next; | 436 | int next; |
437 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { | 437 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { |
438 | int semi = vcard.find(";", next); | 438 | int semi = vcard.find(";", next); |
439 | int dopp = vcard.find(":", next); | 439 | int dopp = vcard.find(":", next); |
440 | int sep; | 440 | int sep; |
441 | if ( semi < dopp && semi >= 0 ) | 441 | if ( semi < dopp && semi >= 0 ) |
442 | sep = semi ; | 442 | sep = semi ; |
443 | else | 443 | else |
444 | sep = dopp; | 444 | sep = dopp; |
445 | vcardnew +=vcard.mid( start, next - start); | 445 | vcardnew +=vcard.mid( start, next - start); |
446 | vcardnew +=vcard.mid( next+5,sep -next -5 ).upper(); | 446 | vcardnew +=vcard.mid( next+5,sep -next -5 ).upper(); |
447 | start = sep; | 447 | start = sep; |
448 | } | 448 | } |
449 | vcardnew += vcard.mid( start,vcard.length() ); | 449 | vcardnew += vcard.mid( start,vcard.length() ); |
450 | vcard = ""; | 450 | vcard = ""; |
451 | start = 0; | 451 | start = 0; |
452 | while ( (next = vcardnew.find("ADR", start) )>= 0 ) { | 452 | while ( (next = vcardnew.find("ADR", start) )>= 0 ) { |
453 | int sep = vcardnew.find(":", next); | 453 | int sep = vcardnew.find(":", next); |
454 | vcard +=vcardnew.mid( start, next - start+3); | 454 | vcard +=vcardnew.mid( start, next - start+3); |
455 | start = sep; | 455 | start = sep; |
456 | } | 456 | } |
457 | vcard += vcardnew.mid( start,vcardnew.length() ); | 457 | vcard += vcardnew.mid( start,vcardnew.length() ); |
458 | vcard.replace ( QRegExp(";;;") , "" ); | 458 | vcard.replace ( QRegExp(";;;") , "" ); |
459 | vcard.replace ( QRegExp(";;") , "" ); | 459 | vcard.replace ( QRegExp(";;") , "" ); |
460 | datastream += vcard; | 460 | datastream += vcard; |
461 | 461 | ||
462 | } | 462 | } |
463 | 463 | ||
464 | QFile outFile(fileName); | 464 | QFile outFile(fileName); |
465 | if ( outFile.open(IO_WriteOnly) ) { | 465 | if ( outFile.open(IO_WriteOnly) ) { |
466 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); | 466 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); |
467 | QTextStream t( &outFile ); // use a text stream | 467 | QTextStream t( &outFile ); // use a text stream |
468 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 468 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
469 | t <<datastream; | 469 | t <<datastream; |
470 | t << "\r\n\r\n"; | 470 | t << "\r\n\r\n"; |
471 | outFile.close(); | 471 | outFile.close(); |
472 | 472 | ||
473 | } else { | 473 | } else { |
474 | qDebug("Error open temp file "); | 474 | qDebug("Error open temp file "); |
475 | return false; | 475 | return false; |
476 | } | 476 | } |
477 | return true; | 477 | return true; |
478 | 478 | ||
479 | } | 479 | } |
480 | int AddressBook::importFromFile( QString fileName, bool replaceLabel, bool removeOld ) | 480 | int AddressBook::importFromFile( QString fileName, bool replaceLabel, bool removeOld ) |
481 | { | 481 | { |
482 | 482 | ||
483 | if ( removeOld ) | 483 | if ( removeOld ) |
484 | setUntagged( true ); | 484 | setUntagged( true ); |
485 | KABC::Addressee::List list; | 485 | KABC::Addressee::List list; |
486 | QFile file( fileName ); | 486 | QFile file( fileName ); |
487 | file.open( IO_ReadOnly ); | 487 | file.open( IO_ReadOnly ); |
488 | QByteArray rawData = file.readAll(); | 488 | QByteArray rawData = file.readAll(); |
489 | file.close(); | 489 | file.close(); |
490 | QString data; | 490 | QString data; |
491 | if ( replaceLabel ) { | 491 | if ( replaceLabel ) { |
492 | data = QString::fromLatin1( rawData.data(), rawData.size() + 1 ); | 492 | data = QString::fromLatin1( rawData.data(), rawData.size() + 1 ); |
493 | data.replace ( QRegExp("LABEL") , "ADR" ); | 493 | data.replace ( QRegExp("LABEL") , "ADR" ); |
494 | data.replace ( QRegExp("CHARSET=ISO-8859-1") , "" ); | 494 | data.replace ( QRegExp("CHARSET=ISO-8859-1") , "" ); |
495 | } else | 495 | } else |
496 | data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); | 496 | data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); |
497 | KABC::VCardTool tool; | 497 | KABC::VCardTool tool; |
498 | list = tool.parseVCards( data ); | 498 | list = tool.parseVCards( data ); |
499 | KABC::Addressee::List::Iterator it; | 499 | KABC::Addressee::List::Iterator it; |
500 | for ( it = list.begin(); it != list.end(); ++it ) { | 500 | for ( it = list.begin(); it != list.end(); ++it ) { |
501 | QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" ); | 501 | QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" ); |
502 | if ( !id.isEmpty() ) | 502 | if ( !id.isEmpty() ) |
503 | (*it).setIDStr(id ); | 503 | (*it).setIDStr(id ); |
504 | (*it).setResource( 0 ); | 504 | (*it).setResource( 0 ); |
505 | if ( replaceLabel ) | 505 | if ( replaceLabel ) |
506 | (*it).removeVoice(); | 506 | (*it).removeVoice(); |
507 | if ( removeOld ) | 507 | if ( removeOld ) |
508 | (*it).setTagged( true ); | 508 | (*it).setTagged( true ); |
509 | insertAddressee( (*it), false, true ); | 509 | insertAddressee( (*it), false, true ); |
510 | } | 510 | } |
511 | if ( removeOld ) | 511 | if ( removeOld ) |
512 | removeUntagged(); | 512 | removeUntagged(); |
513 | return list.count(); | 513 | return list.count(); |
514 | } | 514 | } |
515 | void AddressBook::setUntagged(bool setNonSyncTagged) // = false) | 515 | void AddressBook::setUntagged(bool setNonSyncTagged) // = false) |
516 | { | 516 | { |
517 | Iterator ait; | 517 | Iterator ait; |
518 | for ( ait = begin(); ait != end(); ++ait ) { | 518 | for ( ait = begin(); ait != end(); ++ait ) { |
519 | if ( setNonSyncTagged ) { | 519 | if ( setNonSyncTagged ) { |
520 | if ( (*ait).resource() && ! (*ait).resource()->includeInSync() ) { | 520 | if ( (*ait).resource() && ! (*ait).resource()->includeInSync() ) { |
521 | (*ait).setTagged( true ); | 521 | (*ait).setTagged( true ); |
522 | } else | 522 | } else |
523 | (*ait).setTagged( false ); | 523 | (*ait).setTagged( false ); |
524 | } else | 524 | } else |
525 | (*ait).setTagged( false ); | 525 | (*ait).setTagged( false ); |
526 | } | 526 | } |
527 | } | 527 | } |
528 | void AddressBook::removeUntagged() | 528 | void AddressBook::removeUntagged() |
529 | { | 529 | { |
530 | Iterator ait; | 530 | Iterator ait; |
531 | bool todelete = false; | 531 | bool todelete = false; |
532 | Iterator todel; | 532 | Iterator todel; |
533 | for ( ait = begin(); ait != end(); ++ait ) { | 533 | for ( ait = begin(); ait != end(); ++ait ) { |
534 | if ( todelete ) | 534 | if ( todelete ) |
535 | removeAddressee( todel ); | 535 | removeAddressee( todel ); |
536 | if (!(*ait).tagged()) { | 536 | if (!(*ait).tagged()) { |
537 | todelete = true; | 537 | todelete = true; |
538 | todel = ait; | 538 | todel = ait; |
539 | } else | 539 | } else |
540 | todelete = false; | 540 | todelete = false; |
541 | } | 541 | } |
542 | if ( todelete ) | 542 | if ( todelete ) |
543 | removeAddressee( todel ); | 543 | removeAddressee( todel ); |
544 | deleteRemovedAddressees(); | 544 | deleteRemovedAddressees(); |
545 | } | 545 | } |
546 | void AddressBook::smplifyAddressees() | 546 | void AddressBook::smplifyAddressees() |
547 | { | 547 | { |
548 | Iterator ait; | 548 | Iterator ait; |
549 | for ( ait = begin(); ait != end(); ++ait ) { | 549 | for ( ait = begin(); ait != end(); ++ait ) { |
550 | (*ait).simplifyEmails(); | 550 | (*ait).simplifyEmails(); |
551 | (*ait).simplifyPhoneNumbers(); | 551 | (*ait).simplifyPhoneNumbers(); |
552 | (*ait).simplifyPhoneNumberTypes(); | 552 | (*ait).simplifyPhoneNumberTypes(); |
553 | (*ait).simplifyAddresses(); | 553 | (*ait).simplifyAddresses(); |
554 | } | 554 | } |
555 | } | 555 | } |
556 | void AddressBook::removeSyncInfo( QString syncProfile) | 556 | void AddressBook::removeSyncInfo( QString syncProfile) |
557 | { | 557 | { |
558 | Iterator ait; | 558 | Iterator ait; |
559 | for ( ait = begin(); ait != end(); ++ait ) { | 559 | for ( ait = begin(); ait != end(); ++ait ) { |
560 | (*ait).removeID( syncProfile ); | 560 | (*ait).removeID( syncProfile ); |
561 | } | 561 | } |
562 | if ( syncProfile.isEmpty() ) { | 562 | if ( syncProfile.isEmpty() ) { |
563 | Iterator it = begin(); | 563 | Iterator it = begin(); |
564 | Iterator it2 ; | 564 | Iterator it2 ; |
565 | QDateTime dt ( QDate( 2004,1,1) ); | 565 | QDateTime dt ( QDate( 2004,1,1) ); |
566 | while ( it != end() ) { | 566 | while ( it != end() ) { |
567 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { | 567 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { |
568 | it2 = it; | 568 | it2 = it; |
569 | //qDebug("removing %s ",(*it).uid().latin1() ); | 569 | //qDebug("removing %s ",(*it).uid().latin1() ); |
570 | ++it; | 570 | ++it; |
571 | removeAddressee( it2 ); | 571 | removeAddressee( it2 ); |
572 | } else { | 572 | } else { |
573 | //qDebug("skipping %s ",(*it).uid().latin1() ); | 573 | //qDebug("skipping %s ",(*it).uid().latin1() ); |
574 | ++it; | 574 | ++it; |
575 | } | 575 | } |
576 | } | 576 | } |
577 | } else { | 577 | } else { |
578 | Addressee lse; | 578 | Addressee lse; |
579 | lse = mAddressBook->findByUid( "last-syncAddressee-"+ syncProfile ); | 579 | lse = findByUid( "last-syncAddressee-"+ syncProfile ); |
580 | if ( ! lse.isEmpty() ) | 580 | if ( ! lse.isEmpty() ) |
581 | removeAddressee( lse ); | 581 | removeAddressee( lse ); |
582 | } | 582 | } |
583 | 583 | ||
584 | } | 584 | } |
585 | void AddressBook::preparePhoneSync( QString currentSyncDevice, bool isPreSync ) | 585 | void AddressBook::preparePhoneSync( QString currentSyncDevice, bool isPreSync ) |
586 | { | 586 | { |
587 | Iterator ait; | 587 | Iterator ait; |
588 | for ( ait = begin(); ait != end(); ++ait ) { | 588 | for ( ait = begin(); ait != end(); ++ait ) { |
589 | QString id = (*ait).IDStr(); | 589 | QString id = (*ait).IDStr(); |
590 | (*ait).setIDStr( ":"); | 590 | (*ait).setIDStr( ":"); |
591 | (*ait).setExternalUID( id ); | 591 | (*ait).setExternalUID( id ); |
592 | (*ait).setOriginalExternalUID( id ); | 592 | (*ait).setOriginalExternalUID( id ); |
593 | if ( isPreSync ) | 593 | if ( isPreSync ) |
594 | (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); | 594 | (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); |
595 | else { | 595 | else { |
596 | (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); | 596 | (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); |
597 | (*ait).setID( currentSyncDevice,id ); | 597 | (*ait).setID( currentSyncDevice,id ); |
598 | 598 | ||
599 | } | 599 | } |
600 | } | 600 | } |
601 | } | 601 | } |
602 | void AddressBook::findNewExtIds( QString fileName, QString currentSyncDevice ) | 602 | void AddressBook::findNewExtIds( QString fileName, QString currentSyncDevice ) |
603 | { | 603 | { |
604 | 604 | ||
605 | setUntagged(); | 605 | setUntagged(); |
606 | KABC::Addressee::List list; | 606 | KABC::Addressee::List list; |
607 | QFile file( fileName ); | 607 | QFile file( fileName ); |
608 | file.open( IO_ReadOnly ); | 608 | file.open( IO_ReadOnly ); |
609 | QByteArray rawData = file.readAll(); | 609 | QByteArray rawData = file.readAll(); |
610 | file.close(); | 610 | file.close(); |
611 | QString data; | 611 | QString data; |
612 | 612 | ||
613 | data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); | 613 | data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); |
614 | KABC::VCardTool tool; | 614 | KABC::VCardTool tool; |
615 | list = tool.parseVCards( data ); | 615 | list = tool.parseVCards( data ); |
616 | KABC::Addressee::List::Iterator it; | 616 | KABC::Addressee::List::Iterator it; |
617 | for ( it = list.begin(); it != list.end(); ++it ) { | 617 | for ( it = list.begin(); it != list.end(); ++it ) { |
618 | Iterator ait; | 618 | Iterator ait; |
619 | for ( ait = begin(); ait != end(); ++ait ) { | 619 | for ( ait = begin(); ait != end(); ++ait ) { |
620 | if ( !(*ait).tagged() ) { | 620 | if ( !(*ait).tagged() ) { |
621 | if ( (*ait).containsAdr(*it)) { | 621 | if ( (*ait).containsAdr(*it)) { |
622 | (*ait).setTagged(true); | 622 | (*ait).setTagged(true); |
623 | QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" ); | 623 | QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" ); |
624 | (*it).setIDStr( ":"); | 624 | (*it).setIDStr( ":"); |
625 | (*it).setID( currentSyncDevice,id ); | 625 | (*it).setID( currentSyncDevice,id ); |
626 | (*it).setExternalUID( id ); | 626 | (*it).setExternalUID( id ); |
627 | (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); | 627 | (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); |
628 | (*it).setUid( ( (*ait).uid() )); | 628 | (*it).setUid( ( (*ait).uid() )); |
629 | break; | 629 | break; |
630 | } | 630 | } |
631 | } | 631 | } |
632 | 632 | ||
633 | } | 633 | } |
634 | if ( ait == end() ) | 634 | if ( ait == end() ) |
635 | qDebug("ERROR:: no ext ID found for uid: %s", (*it).uid().latin1()); | 635 | qDebug("ERROR:: no ext ID found for uid: %s", (*it).uid().latin1()); |
636 | } | 636 | } |
637 | clear(); | 637 | clear(); |
638 | for ( it = list.begin(); it != list.end(); ++it ) { | 638 | for ( it = list.begin(); it != list.end(); ++it ) { |
639 | insertAddressee( (*it) ); | 639 | insertAddressee( (*it) ); |
640 | } | 640 | } |
641 | } | 641 | } |
642 | 642 | ||
643 | bool AddressBook::saveABphone( QString fileName ) | 643 | bool AddressBook::saveABphone( QString fileName ) |
644 | { | 644 | { |
645 | //smplifyAddressees(); | 645 | //smplifyAddressees(); |
646 | qDebug("saveABphone:: saving AB... "); | 646 | qDebug("saveABphone:: saving AB... "); |
647 | if ( ! export2PhoneFormat( QStringList() ,fileName ) ) | 647 | if ( ! export2PhoneFormat( QStringList() ,fileName ) ) |
648 | return false; | 648 | return false; |
649 | qDebug("saveABphone:: writing to phone... "); | 649 | qDebug("saveABphone:: writing to phone... "); |
650 | if ( !PhoneAccess::writeToPhone( fileName) ) { | 650 | if ( !PhoneAccess::writeToPhone( fileName) ) { |
651 | return false; | 651 | return false; |
652 | } | 652 | } |
653 | qDebug("saveABphone:: re-reading from phone... "); | 653 | qDebug("saveABphone:: re-reading from phone... "); |
654 | if ( !PhoneAccess::readFromPhone( fileName) ) { | 654 | if ( !PhoneAccess::readFromPhone( fileName) ) { |
655 | return false; | 655 | return false; |
656 | } | 656 | } |
657 | return true; | 657 | return true; |
658 | } | 658 | } |
659 | bool AddressBook::saveAB() | 659 | bool AddressBook::saveAB() |
660 | { | 660 | { |
661 | bool ok = true; | 661 | bool ok = true; |
662 | 662 | ||
663 | deleteRemovedAddressees(); | 663 | deleteRemovedAddressees(); |
664 | Iterator ait; | 664 | Iterator ait; |
665 | for ( ait = begin(); ait != end(); ++ait ) { | 665 | for ( ait = begin(); ait != end(); ++ait ) { |
666 | if ( !(*ait).IDStr().isEmpty() ) { | 666 | if ( !(*ait).IDStr().isEmpty() ) { |
667 | (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() ); | 667 | (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() ); |
668 | } | 668 | } |
669 | } | 669 | } |
670 | KRES::Manager<Resource>::ActiveIterator it; | 670 | KRES::Manager<Resource>::ActiveIterator it; |
671 | KRES::Manager<Resource> *manager = d->mManager; | 671 | KRES::Manager<Resource> *manager = d->mManager; |
672 | qDebug("SaveAB::saving..." ); | 672 | qDebug("SaveAB::saving..." ); |
673 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { | 673 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { |
674 | qDebug("SaveAB::checking resource..." ); | 674 | qDebug("SaveAB::checking resource..." ); |
675 | if ( (*it)->readOnly() ) | 675 | if ( (*it)->readOnly() ) |
676 | qDebug("resource is readonly." ); | 676 | qDebug("resource is readonly." ); |
677 | if ( (*it)->isOpen() ) | 677 | if ( (*it)->isOpen() ) |
678 | qDebug("resource is open" ); | 678 | qDebug("resource is open" ); |
679 | 679 | ||
680 | if ( !(*it)->readOnly() && (*it)->isOpen() ) { | 680 | if ( !(*it)->readOnly() && (*it)->isOpen() ) { |
681 | Ticket *ticket = requestSaveTicket( *it ); | 681 | Ticket *ticket = requestSaveTicket( *it ); |
682 | qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); | 682 | qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); |
683 | if ( !ticket ) { | 683 | if ( !ticket ) { |
684 | qDebug( i18n( "Unable to save to resource '%1'. It is locked." ) | 684 | qDebug( i18n( "Unable to save to resource '%1'. It is locked." ) |
685 | .arg( (*it)->resourceName() ) ); | 685 | .arg( (*it)->resourceName() ) ); |
686 | return false; | 686 | return false; |
687 | } | 687 | } |
688 | 688 | ||
689 | //if ( !save( ticket ) ) | 689 | //if ( !save( ticket ) ) |
690 | if ( ticket->resource() ) { | 690 | if ( ticket->resource() ) { |
691 | QString name = ticket->resource()->resourceName(); | 691 | QString name = ticket->resource()->resourceName(); |
692 | if ( ! ticket->resource()->save( ticket ) ) | 692 | if ( ! ticket->resource()->save( ticket ) ) |
693 | ok = false; | 693 | ok = false; |
694 | else | 694 | else |
695 | qDebug("StdAddressBook::resource saved '%s'", name.latin1() ); | 695 | qDebug("StdAddressBook::resource saved '%s'", name.latin1() ); |
696 | 696 | ||
697 | } else | 697 | } else |
698 | ok = false; | 698 | ok = false; |
699 | 699 | ||
700 | } | 700 | } |
701 | } | 701 | } |
702 | return ok; | 702 | return ok; |
703 | } | 703 | } |
704 | 704 | ||
705 | AddressBook::Iterator AddressBook::begin() | 705 | AddressBook::Iterator AddressBook::begin() |
706 | { | 706 | { |
707 | Iterator it = Iterator(); | 707 | Iterator it = Iterator(); |
708 | it.d->mIt = d->mAddressees.begin(); | 708 | it.d->mIt = d->mAddressees.begin(); |
709 | return it; | 709 | return it; |
710 | } | 710 | } |
711 | 711 | ||
712 | AddressBook::ConstIterator AddressBook::begin() const | 712 | AddressBook::ConstIterator AddressBook::begin() const |
713 | { | 713 | { |
714 | ConstIterator it = ConstIterator(); | 714 | ConstIterator it = ConstIterator(); |
715 | it.d->mIt = d->mAddressees.begin(); | 715 | it.d->mIt = d->mAddressees.begin(); |
716 | return it; | 716 | return it; |
717 | } | 717 | } |
718 | 718 | ||
719 | AddressBook::Iterator AddressBook::end() | 719 | AddressBook::Iterator AddressBook::end() |
720 | { | 720 | { |
721 | Iterator it = Iterator(); | 721 | Iterator it = Iterator(); |
722 | it.d->mIt = d->mAddressees.end(); | 722 | it.d->mIt = d->mAddressees.end(); |
723 | return it; | 723 | return it; |
724 | } | 724 | } |
725 | 725 | ||
726 | AddressBook::ConstIterator AddressBook::end() const | 726 | AddressBook::ConstIterator AddressBook::end() const |
727 | { | 727 | { |
728 | ConstIterator it = ConstIterator(); | 728 | ConstIterator it = ConstIterator(); |
729 | it.d->mIt = d->mAddressees.end(); | 729 | it.d->mIt = d->mAddressees.end(); |
730 | return it; | 730 | return it; |
731 | } | 731 | } |
732 | 732 | ||
733 | void AddressBook::clear() | 733 | void AddressBook::clear() |
734 | { | 734 | { |
735 | d->mAddressees.clear(); | 735 | d->mAddressees.clear(); |
736 | } | 736 | } |
737 | 737 | ||
738 | Ticket *AddressBook::requestSaveTicket( Resource *resource ) | 738 | Ticket *AddressBook::requestSaveTicket( Resource *resource ) |
739 | { | 739 | { |
740 | kdDebug(5700) << "AddressBook::requestSaveTicket()" << endl; | 740 | kdDebug(5700) << "AddressBook::requestSaveTicket()" << endl; |
741 | 741 | ||
742 | if ( !resource ) | 742 | if ( !resource ) |
743 | { | 743 | { |
744 | qDebug("AddressBook::requestSaveTicket no resource" ); | 744 | qDebug("AddressBook::requestSaveTicket no resource" ); |
745 | resource = standardResource(); | 745 | resource = standardResource(); |
746 | } | 746 | } |
747 | 747 | ||
748 | KRES::Manager<Resource>::ActiveIterator it; | 748 | KRES::Manager<Resource>::ActiveIterator it; |
749 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { | 749 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { |
750 | if ( (*it) == resource ) { | 750 | if ( (*it) == resource ) { |
751 | if ( (*it)->readOnly() || !(*it)->isOpen() ) | 751 | if ( (*it)->readOnly() || !(*it)->isOpen() ) |
752 | return 0; | 752 | return 0; |
753 | else | 753 | else |
754 | return (*it)->requestSaveTicket(); | 754 | return (*it)->requestSaveTicket(); |
755 | } | 755 | } |
756 | } | 756 | } |
757 | 757 | ||
758 | return 0; | 758 | return 0; |
759 | } | 759 | } |
760 | //void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false); | 760 | //void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false); |
761 | void AddressBook::insertAddressee( const Addressee &a, bool setRev, bool takeResource ) | 761 | void AddressBook::insertAddressee( const Addressee &a, bool setRev, bool takeResource ) |
762 | { | 762 | { |
763 | if ( blockLSEchange && setRev && a.uid().left( 19 ) == QString("last-syncAddressee-") ) { | 763 | if ( blockLSEchange && setRev && a.uid().left( 19 ) == QString("last-syncAddressee-") ) { |
764 | //qDebug("block insert "); | 764 | //qDebug("block insert "); |
765 | return; | 765 | return; |
766 | } | 766 | } |
767 | //qDebug("inserting.... %s ",a.uid().latin1() ); | 767 | //qDebug("inserting.... %s ",a.uid().latin1() ); |
768 | bool found = false; | 768 | bool found = false; |
769 | Addressee::List::Iterator it; | 769 | Addressee::List::Iterator it; |
770 | for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { | 770 | for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { |
771 | if ( a.uid() == (*it).uid() ) { | 771 | if ( a.uid() == (*it).uid() ) { |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index e56e46a..2f00a09 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -124,389 +124,389 @@ $Id$ | |||
124 | #include <resource.h> | 124 | #include <resource.h> |
125 | 125 | ||
126 | //US#include <qsplitter.h> | 126 | //US#include <qsplitter.h> |
127 | #include <qmap.h> | 127 | #include <qmap.h> |
128 | #include <qdir.h> | 128 | #include <qdir.h> |
129 | #include <qfile.h> | 129 | #include <qfile.h> |
130 | #include <qvbox.h> | 130 | #include <qvbox.h> |
131 | #include <qlayout.h> | 131 | #include <qlayout.h> |
132 | #include <qclipboard.h> | 132 | #include <qclipboard.h> |
133 | #include <qtextstream.h> | 133 | #include <qtextstream.h> |
134 | 134 | ||
135 | #include <libkdepim/categoryselectdialog.h> | 135 | #include <libkdepim/categoryselectdialog.h> |
136 | #include <kabc/vcardconverter.h> | 136 | #include <kabc/vcardconverter.h> |
137 | 137 | ||
138 | 138 | ||
139 | #include "addresseeutil.h" | 139 | #include "addresseeutil.h" |
140 | #include "undocmds.h" | 140 | #include "undocmds.h" |
141 | #include "addresseeeditordialog.h" | 141 | #include "addresseeeditordialog.h" |
142 | #include "viewmanager.h" | 142 | #include "viewmanager.h" |
143 | #include "details/detailsviewcontainer.h" | 143 | #include "details/detailsviewcontainer.h" |
144 | #include "kabprefs.h" | 144 | #include "kabprefs.h" |
145 | #include "xxportmanager.h" | 145 | #include "xxportmanager.h" |
146 | #include "incsearchwidget.h" | 146 | #include "incsearchwidget.h" |
147 | #include "jumpbuttonbar.h" | 147 | #include "jumpbuttonbar.h" |
148 | #include "extensionmanager.h" | 148 | #include "extensionmanager.h" |
149 | #include "addresseeconfig.h" | 149 | #include "addresseeconfig.h" |
150 | #include <kcmultidialog.h> | 150 | #include <kcmultidialog.h> |
151 | 151 | ||
152 | #ifdef _WIN32_ | 152 | #ifdef _WIN32_ |
153 | 153 | ||
154 | #include "kaimportoldialog.h" | 154 | #include "kaimportoldialog.h" |
155 | #else | 155 | #else |
156 | #include <unistd.h> | 156 | #include <unistd.h> |
157 | #endif | 157 | #endif |
158 | // sync includes | 158 | // sync includes |
159 | #include <libkdepim/ksyncprofile.h> | 159 | #include <libkdepim/ksyncprofile.h> |
160 | #include <libkdepim/ksyncprefsdialog.h> | 160 | #include <libkdepim/ksyncprefsdialog.h> |
161 | 161 | ||
162 | class KAex2phonePrefs : public QDialog | 162 | class KAex2phonePrefs : public QDialog |
163 | { | 163 | { |
164 | public: | 164 | public: |
165 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 165 | KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
166 | QDialog( parent, name, true ) | 166 | QDialog( parent, name, true ) |
167 | { | 167 | { |
168 | setCaption( i18n("Export to phone options") ); | 168 | setCaption( i18n("Export to phone options") ); |
169 | QVBoxLayout* lay = new QVBoxLayout( this ); | 169 | QVBoxLayout* lay = new QVBoxLayout( this ); |
170 | lay->setSpacing( 3 ); | 170 | lay->setSpacing( 3 ); |
171 | lay->setMargin( 3 ); | 171 | lay->setMargin( 3 ); |
172 | QLabel *lab; | 172 | QLabel *lab; |
173 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 173 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
174 | lab->setAlignment (AlignHCenter ); | 174 | lab->setAlignment (AlignHCenter ); |
175 | QHBox* temphb; | 175 | QHBox* temphb; |
176 | temphb = new QHBox( this ); | 176 | temphb = new QHBox( this ); |
177 | new QLabel( i18n("I/O device: "), temphb ); | 177 | new QLabel( i18n("I/O device: "), temphb ); |
178 | mPhoneDevice = new QLineEdit( temphb); | 178 | mPhoneDevice = new QLineEdit( temphb); |
179 | lay->addWidget( temphb ); | 179 | lay->addWidget( temphb ); |
180 | temphb = new QHBox( this ); | 180 | temphb = new QHBox( this ); |
181 | new QLabel( i18n("Connection: "), temphb ); | 181 | new QLabel( i18n("Connection: "), temphb ); |
182 | mPhoneConnection = new QLineEdit( temphb); | 182 | mPhoneConnection = new QLineEdit( temphb); |
183 | lay->addWidget( temphb ); | 183 | lay->addWidget( temphb ); |
184 | temphb = new QHBox( this ); | 184 | temphb = new QHBox( this ); |
185 | new QLabel( i18n("Model(opt.): "), temphb ); | 185 | new QLabel( i18n("Model(opt.): "), temphb ); |
186 | mPhoneModel = new QLineEdit( temphb); | 186 | mPhoneModel = new QLineEdit( temphb); |
187 | lay->addWidget( temphb ); | 187 | lay->addWidget( temphb ); |
188 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); | 188 | // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); |
189 | // lay->addWidget( mWriteToSim ); | 189 | // lay->addWidget( mWriteToSim ); |
190 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); | 190 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); |
191 | lab->setAlignment (AlignHCenter ); | 191 | lab->setAlignment (AlignHCenter ); |
192 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 192 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
193 | lay->addWidget( ok ); | 193 | lay->addWidget( ok ); |
194 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 194 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
195 | lay->addWidget( cancel ); | 195 | lay->addWidget( cancel ); |
196 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 196 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
197 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 197 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
198 | resize( 220, 240 ); | 198 | resize( 220, 240 ); |
199 | 199 | ||
200 | } | 200 | } |
201 | 201 | ||
202 | public: | 202 | public: |
203 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 203 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
204 | QCheckBox* mWriteToSim; | 204 | QCheckBox* mWriteToSim; |
205 | }; | 205 | }; |
206 | 206 | ||
207 | 207 | ||
208 | bool pasteWithNewUid = true; | 208 | bool pasteWithNewUid = true; |
209 | 209 | ||
210 | #ifdef KAB_EMBEDDED | 210 | #ifdef KAB_EMBEDDED |
211 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 211 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
212 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 212 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
213 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 213 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
214 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 214 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
215 | #else //KAB_EMBEDDED | 215 | #else //KAB_EMBEDDED |
216 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 216 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
217 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), | 217 | : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), |
218 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 218 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
219 | mReadWrite( readWrite ), mModified( false ) | 219 | mReadWrite( readWrite ), mModified( false ) |
220 | #endif //KAB_EMBEDDED | 220 | #endif //KAB_EMBEDDED |
221 | { | 221 | { |
222 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); | 222 | // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); |
223 | // syncManager->setBlockSave(false); | 223 | // syncManager->setBlockSave(false); |
224 | mExtensionBarSplitter = 0; | 224 | mExtensionBarSplitter = 0; |
225 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 225 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
226 | mAddressBook = KABC::StdAddressBook::self(); | 226 | mAddressBook = KABC::StdAddressBook::self(); |
227 | KABC::StdAddressBook::setAutomaticSave( false ); | 227 | KABC::StdAddressBook::setAutomaticSave( false ); |
228 | 228 | ||
229 | #ifndef KAB_EMBEDDED | 229 | #ifndef KAB_EMBEDDED |
230 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 230 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
231 | #endif //KAB_EMBEDDED | 231 | #endif //KAB_EMBEDDED |
232 | 232 | ||
233 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 233 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
234 | SLOT( addressBookChanged() ) ); | 234 | SLOT( addressBookChanged() ) ); |
235 | 235 | ||
236 | #if 0 | 236 | #if 0 |
237 | // LP moved to addressbook init method | 237 | // LP moved to addressbook init method |
238 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 238 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
239 | "X-Department", "KADDRESSBOOK" ); | 239 | "X-Department", "KADDRESSBOOK" ); |
240 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 240 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
241 | "X-Profession", "KADDRESSBOOK" ); | 241 | "X-Profession", "KADDRESSBOOK" ); |
242 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 242 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
243 | "X-AssistantsName", "KADDRESSBOOK" ); | 243 | "X-AssistantsName", "KADDRESSBOOK" ); |
244 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 244 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
245 | "X-ManagersName", "KADDRESSBOOK" ); | 245 | "X-ManagersName", "KADDRESSBOOK" ); |
246 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 246 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
247 | "X-SpousesName", "KADDRESSBOOK" ); | 247 | "X-SpousesName", "KADDRESSBOOK" ); |
248 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 248 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
249 | "X-Office", "KADDRESSBOOK" ); | 249 | "X-Office", "KADDRESSBOOK" ); |
250 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 250 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
251 | "X-IMAddress", "KADDRESSBOOK" ); | 251 | "X-IMAddress", "KADDRESSBOOK" ); |
252 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 252 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
253 | "X-Anniversary", "KADDRESSBOOK" ); | 253 | "X-Anniversary", "KADDRESSBOOK" ); |
254 | 254 | ||
255 | //US added this field to become compatible with Opie/qtopia addressbook | 255 | //US added this field to become compatible with Opie/qtopia addressbook |
256 | // values can be "female" or "male" or "". An empty field represents undefined. | 256 | // values can be "female" or "male" or "". An empty field represents undefined. |
257 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 257 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
258 | "X-Gender", "KADDRESSBOOK" ); | 258 | "X-Gender", "KADDRESSBOOK" ); |
259 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | 259 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, |
260 | "X-Children", "KADDRESSBOOK" ); | 260 | "X-Children", "KADDRESSBOOK" ); |
261 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 261 | mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
262 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 262 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
263 | #endif | 263 | #endif |
264 | initGUI(); | 264 | initGUI(); |
265 | 265 | ||
266 | mIncSearchWidget->setFocus(); | 266 | mIncSearchWidget->setFocus(); |
267 | 267 | ||
268 | 268 | ||
269 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 269 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
270 | SLOT( setContactSelected( const QString& ) ) ); | 270 | SLOT( setContactSelected( const QString& ) ) ); |
271 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 271 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
272 | SLOT( executeContact( const QString& ) ) ); | 272 | SLOT( executeContact( const QString& ) ) ); |
273 | 273 | ||
274 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 274 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
275 | SLOT( deleteContacts( ) ) ); | 275 | SLOT( deleteContacts( ) ) ); |
276 | connect( mViewManager, SIGNAL( modified() ), | 276 | connect( mViewManager, SIGNAL( modified() ), |
277 | SLOT( setModified() ) ); | 277 | SLOT( setModified() ) ); |
278 | 278 | ||
279 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 279 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
280 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); | 280 | connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); |
281 | 281 | ||
282 | connect( mXXPortManager, SIGNAL( modified() ), | 282 | connect( mXXPortManager, SIGNAL( modified() ), |
283 | SLOT( setModified() ) ); | 283 | SLOT( setModified() ) ); |
284 | 284 | ||
285 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 285 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
286 | SLOT( incrementalSearch( const QString& ) ) ); | 286 | SLOT( incrementalSearch( const QString& ) ) ); |
287 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 287 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
288 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 288 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
289 | 289 | ||
290 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 290 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
291 | SLOT( sendMail( const QString& ) ) ); | 291 | SLOT( sendMail( const QString& ) ) ); |
292 | 292 | ||
293 | 293 | ||
294 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); | 294 | connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); |
295 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); | 295 | connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); |
296 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); | 296 | connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); |
297 | 297 | ||
298 | 298 | ||
299 | #ifndef KAB_EMBEDDED | 299 | #ifndef KAB_EMBEDDED |
300 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 300 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
301 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 301 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
302 | 302 | ||
303 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 303 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
304 | SLOT( browse( const QString& ) ) ); | 304 | SLOT( browse( const QString& ) ) ); |
305 | 305 | ||
306 | 306 | ||
307 | mAddressBookService = new KAddressBookService( this ); | 307 | mAddressBookService = new KAddressBookService( this ); |
308 | 308 | ||
309 | #endif //KAB_EMBEDDED | 309 | #endif //KAB_EMBEDDED |
310 | 310 | ||
311 | mMessageTimer = new QTimer( this ); | 311 | mMessageTimer = new QTimer( this ); |
312 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); | 312 | connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); |
313 | mEditorDialog = 0; | 313 | mEditorDialog = 0; |
314 | createAddresseeEditorDialog( this ); | 314 | createAddresseeEditorDialog( this ); |
315 | setModified( false ); | 315 | setModified( false ); |
316 | mBRdisabled = 0; | 316 | mBRdisabled = false; |
317 | #ifndef DESKTOP_VERSION | 317 | #ifndef DESKTOP_VERSION |
318 | infrared = 0; | 318 | infrared = 0; |
319 | #endif | 319 | #endif |
320 | toggleBeamReceive( ); | 320 | //toggleBeamReceive( ); |
321 | } | 321 | } |
322 | 322 | ||
323 | KABCore::~KABCore() | 323 | KABCore::~KABCore() |
324 | { | 324 | { |
325 | // save(); | 325 | // save(); |
326 | //saveSettings(); | 326 | //saveSettings(); |
327 | //KABPrefs::instance()->writeConfig(); | 327 | //KABPrefs::instance()->writeConfig(); |
328 | delete AddresseeConfig::instance(); | 328 | delete AddresseeConfig::instance(); |
329 | mAddressBook = 0; | 329 | mAddressBook = 0; |
330 | KABC::StdAddressBook::close(); | 330 | KABC::StdAddressBook::close(); |
331 | 331 | ||
332 | delete syncManager; | 332 | delete syncManager; |
333 | #ifndef DESKTOP_VERSION | 333 | #ifndef DESKTOP_VERSION |
334 | if ( infrared ) | 334 | if ( infrared ) |
335 | delete infrared; | 335 | delete infrared; |
336 | #endif | 336 | #endif |
337 | } | 337 | } |
338 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) | 338 | void KABCore::receive( const QCString& cmsg, const QByteArray& data ) |
339 | { | 339 | { |
340 | qDebug("KA: QCOP message received: %s ", cmsg.data() ); | 340 | qDebug("KA: QCOP message received: %s ", cmsg.data() ); |
341 | if ( cmsg == "setDocument(QString)" ) { | 341 | if ( cmsg == "setDocument(QString)" ) { |
342 | QDataStream stream( data, IO_ReadOnly ); | 342 | QDataStream stream( data, IO_ReadOnly ); |
343 | QString fileName; | 343 | QString fileName; |
344 | stream >> fileName; | 344 | stream >> fileName; |
345 | recieve( fileName ); | 345 | recieve( fileName ); |
346 | return; | 346 | return; |
347 | } | 347 | } |
348 | } | 348 | } |
349 | void KABCore::toggleBeamReceive( ) | 349 | void KABCore::toggleBeamReceive( ) |
350 | { | 350 | { |
351 | if ( mBRdisabled ) | 351 | if ( mBRdisabled ) |
352 | return; | 352 | return; |
353 | #ifndef DESKTOP_VERSION | 353 | #ifndef DESKTOP_VERSION |
354 | if ( infrared ) { | 354 | if ( infrared ) { |
355 | qDebug("AB disable BeamReceive "); | 355 | qDebug("AB disable BeamReceive "); |
356 | delete infrared; | 356 | delete infrared; |
357 | infrared = 0; | 357 | infrared = 0; |
358 | mActionBR->setChecked(false); | 358 | mActionBR->setChecked(false); |
359 | return; | 359 | return; |
360 | } | 360 | } |
361 | qDebug("AB enable BeamReceive "); | 361 | qDebug("AB enable BeamReceive "); |
362 | mActionBR->setChecked(true); | 362 | mActionBR->setChecked(true); |
363 | 363 | ||
364 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; | 364 | infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; |
365 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); | 365 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); |
366 | #endif | 366 | #endif |
367 | } | 367 | } |
368 | 368 | ||
369 | 369 | ||
370 | void KABCore::disableBR(bool b) | 370 | void KABCore::disableBR(bool b) |
371 | { | 371 | { |
372 | #ifndef DESKTOP_VERSION | 372 | #ifndef DESKTOP_VERSION |
373 | if ( b ) { | 373 | if ( b ) { |
374 | if ( infrared ) { | 374 | if ( infrared ) { |
375 | toggleBeamReceive( ); | 375 | toggleBeamReceive( ); |
376 | } | 376 | } |
377 | mBRdisabled = true; | 377 | mBRdisabled = true; |
378 | } else { | 378 | } else { |
379 | if ( mBRdisabled ) { | 379 | if ( mBRdisabled ) { |
380 | mBRdisabled = false; | 380 | mBRdisabled = false; |
381 | //toggleBeamReceive( ); | 381 | //toggleBeamReceive( ); |
382 | } | 382 | } |
383 | } | 383 | } |
384 | #endif | 384 | #endif |
385 | 385 | ||
386 | } | 386 | } |
387 | void KABCore::recieve( QString fn ) | 387 | void KABCore::recieve( QString fn ) |
388 | { | 388 | { |
389 | //qDebug("KABCore::recieve "); | 389 | //qDebug("KABCore::recieve "); |
390 | int count = mAddressBook->importFromFile( fn, true ); | 390 | int count = mAddressBook->importFromFile( fn, true ); |
391 | if ( count ) | 391 | if ( count ) |
392 | setModified( true ); | 392 | setModified( true ); |
393 | mViewManager->refreshView(); | 393 | mViewManager->refreshView(); |
394 | message(i18n("%1 contact(s) received!").arg( count )); | 394 | message(i18n("%1 contact(s) received!").arg( count )); |
395 | topLevelWidget()->showMaximized(); | 395 | topLevelWidget()->showMaximized(); |
396 | topLevelWidget()->raise(); | 396 | topLevelWidget()->raise(); |
397 | } | 397 | } |
398 | void KABCore::restoreSettings() | 398 | void KABCore::restoreSettings() |
399 | { | 399 | { |
400 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; | 400 | mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; |
401 | 401 | ||
402 | bool state; | 402 | bool state; |
403 | 403 | ||
404 | if (mMultipleViewsAtOnce) | 404 | if (mMultipleViewsAtOnce) |
405 | state = KABPrefs::instance()->mDetailsPageVisible; | 405 | state = KABPrefs::instance()->mDetailsPageVisible; |
406 | else | 406 | else |
407 | state = false; | 407 | state = false; |
408 | 408 | ||
409 | mActionDetails->setChecked( state ); | 409 | mActionDetails->setChecked( state ); |
410 | setDetailsVisible( state ); | 410 | setDetailsVisible( state ); |
411 | 411 | ||
412 | state = KABPrefs::instance()->mJumpButtonBarVisible; | 412 | state = KABPrefs::instance()->mJumpButtonBarVisible; |
413 | 413 | ||
414 | mActionJumpBar->setChecked( state ); | 414 | mActionJumpBar->setChecked( state ); |
415 | setJumpButtonBarVisible( state ); | 415 | setJumpButtonBarVisible( state ); |
416 | /*US | 416 | /*US |
417 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 417 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
418 | if ( splitterSize.count() == 0 ) { | 418 | if ( splitterSize.count() == 0 ) { |
419 | splitterSize.append( width() / 2 ); | 419 | splitterSize.append( width() / 2 ); |
420 | splitterSize.append( width() / 2 ); | 420 | splitterSize.append( width() / 2 ); |
421 | } | 421 | } |
422 | mMiniSplitter->setSizes( splitterSize ); | 422 | mMiniSplitter->setSizes( splitterSize ); |
423 | if ( mExtensionBarSplitter ) { | 423 | if ( mExtensionBarSplitter ) { |
424 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 424 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
425 | if ( splitterSize.count() == 0 ) { | 425 | if ( splitterSize.count() == 0 ) { |
426 | splitterSize.append( width() / 2 ); | 426 | splitterSize.append( width() / 2 ); |
427 | splitterSize.append( width() / 2 ); | 427 | splitterSize.append( width() / 2 ); |
428 | } | 428 | } |
429 | mExtensionBarSplitter->setSizes( splitterSize ); | 429 | mExtensionBarSplitter->setSizes( splitterSize ); |
430 | 430 | ||
431 | } | 431 | } |
432 | */ | 432 | */ |
433 | mViewManager->restoreSettings(); | 433 | mViewManager->restoreSettings(); |
434 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 434 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
435 | mExtensionManager->restoreSettings(); | 435 | mExtensionManager->restoreSettings(); |
436 | #ifdef DESKTOP_VERSION | 436 | #ifdef DESKTOP_VERSION |
437 | int wid = width(); | 437 | int wid = width(); |
438 | if ( wid < 10 ) | 438 | if ( wid < 10 ) |
439 | wid = 400; | 439 | wid = 400; |
440 | #else | 440 | #else |
441 | int wid = QApplication::desktop()->width(); | 441 | int wid = QApplication::desktop()->width(); |
442 | if ( wid < 640 ) | 442 | if ( wid < 640 ) |
443 | wid = QApplication::desktop()->height(); | 443 | wid = QApplication::desktop()->height(); |
444 | #endif | 444 | #endif |
445 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; | 445 | QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; |
446 | if ( true /*splitterSize.count() == 0*/ ) { | 446 | if ( true /*splitterSize.count() == 0*/ ) { |
447 | splitterSize.append( wid / 2 ); | 447 | splitterSize.append( wid / 2 ); |
448 | splitterSize.append( wid / 2 ); | 448 | splitterSize.append( wid / 2 ); |
449 | } | 449 | } |
450 | mMiniSplitter->setSizes( splitterSize ); | 450 | mMiniSplitter->setSizes( splitterSize ); |
451 | if ( mExtensionBarSplitter ) { | 451 | if ( mExtensionBarSplitter ) { |
452 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 452 | //splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
453 | if ( true /*splitterSize.count() == 0*/ ) { | 453 | if ( true /*splitterSize.count() == 0*/ ) { |
454 | splitterSize.append( wid / 2 ); | 454 | splitterSize.append( wid / 2 ); |
455 | splitterSize.append( wid / 2 ); | 455 | splitterSize.append( wid / 2 ); |
456 | } | 456 | } |
457 | mExtensionBarSplitter->setSizes( splitterSize ); | 457 | mExtensionBarSplitter->setSizes( splitterSize ); |
458 | 458 | ||
459 | } | 459 | } |
460 | 460 | ||
461 | 461 | ||
462 | } | 462 | } |
463 | 463 | ||
464 | void KABCore::saveSettings() | 464 | void KABCore::saveSettings() |
465 | { | 465 | { |
466 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 466 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
467 | if ( mExtensionBarSplitter ) | 467 | if ( mExtensionBarSplitter ) |
468 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 468 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
469 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 469 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
470 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 470 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
471 | #ifndef KAB_EMBEDDED | 471 | #ifndef KAB_EMBEDDED |
472 | 472 | ||
473 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 473 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
474 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 474 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
475 | #endif //KAB_EMBEDDED | 475 | #endif //KAB_EMBEDDED |
476 | mExtensionManager->saveSettings(); | 476 | mExtensionManager->saveSettings(); |
477 | mViewManager->saveSettings(); | 477 | mViewManager->saveSettings(); |
478 | 478 | ||
479 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 479 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
480 | } | 480 | } |
481 | 481 | ||
482 | KABC::AddressBook *KABCore::addressBook() const | 482 | KABC::AddressBook *KABCore::addressBook() const |
483 | { | 483 | { |
484 | return mAddressBook; | 484 | return mAddressBook; |
485 | } | 485 | } |
486 | 486 | ||
487 | KConfig *KABCore::config() | 487 | KConfig *KABCore::config() |
488 | { | 488 | { |
489 | #ifndef KAB_EMBEDDED | 489 | #ifndef KAB_EMBEDDED |
490 | return KABPrefs::instance()->config(); | 490 | return KABPrefs::instance()->config(); |
491 | #else //KAB_EMBEDDED | 491 | #else //KAB_EMBEDDED |
492 | return KABPrefs::instance()->getConfig(); | 492 | return KABPrefs::instance()->getConfig(); |
493 | #endif //KAB_EMBEDDED | 493 | #endif //KAB_EMBEDDED |
494 | } | 494 | } |
495 | 495 | ||
496 | KActionCollection *KABCore::actionCollection() const | 496 | KActionCollection *KABCore::actionCollection() const |
497 | { | 497 | { |
498 | return mGUIClient->actionCollection(); | 498 | return mGUIClient->actionCollection(); |
499 | } | 499 | } |
500 | 500 | ||
501 | KABC::Field *KABCore::currentSearchField() const | 501 | KABC::Field *KABCore::currentSearchField() const |
502 | { | 502 | { |
503 | if (mIncSearchWidget) | 503 | if (mIncSearchWidget) |
504 | return mIncSearchWidget->currentField(); | 504 | return mIncSearchWidget->currentField(); |
505 | else | 505 | else |
506 | return 0; | 506 | return 0; |
507 | } | 507 | } |
508 | 508 | ||
509 | QStringList KABCore::selectedUIDs() const | 509 | QStringList KABCore::selectedUIDs() const |
510 | { | 510 | { |
511 | return mViewManager->selectedUids(); | 511 | return mViewManager->selectedUids(); |
512 | } | 512 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index dc2026b..fc2d59b 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -90,385 +90,385 @@ class KOex2phonePrefs : public QDialog | |||
90 | lay->addWidget( temphb ); | 90 | lay->addWidget( temphb ); |
91 | temphb = new QHBox( this ); | 91 | temphb = new QHBox( this ); |
92 | new QLabel( i18n("Connection: "), temphb ); | 92 | new QLabel( i18n("Connection: "), temphb ); |
93 | mPhoneConnection = new QLineEdit( temphb); | 93 | mPhoneConnection = new QLineEdit( temphb); |
94 | lay->addWidget( temphb ); | 94 | lay->addWidget( temphb ); |
95 | temphb = new QHBox( this ); | 95 | temphb = new QHBox( this ); |
96 | new QLabel( i18n("Model(opt.): "), temphb ); | 96 | new QLabel( i18n("Model(opt.): "), temphb ); |
97 | mPhoneModel = new QLineEdit( temphb); | 97 | mPhoneModel = new QLineEdit( temphb); |
98 | lay->addWidget( temphb ); | 98 | lay->addWidget( temphb ); |
99 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 99 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
100 | mWriteBackFuture->setChecked( true ); | 100 | mWriteBackFuture->setChecked( true ); |
101 | lay->addWidget( mWriteBackFuture ); | 101 | lay->addWidget( mWriteBackFuture ); |
102 | temphb = new QHBox( this ); | 102 | temphb = new QHBox( this ); |
103 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 103 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
104 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 104 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
105 | mWriteBackFutureWeeks->setValue( 8 ); | 105 | mWriteBackFutureWeeks->setValue( 8 ); |
106 | lay->addWidget( temphb ); | 106 | lay->addWidget( temphb ); |
107 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 107 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
108 | lab->setAlignment (AlignHCenter ); | 108 | lab->setAlignment (AlignHCenter ); |
109 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 109 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
110 | lay->addWidget( ok ); | 110 | lay->addWidget( ok ); |
111 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 111 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
112 | lay->addWidget( cancel ); | 112 | lay->addWidget( cancel ); |
113 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 113 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
114 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 114 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
115 | resize( 220, 240 ); | 115 | resize( 220, 240 ); |
116 | 116 | ||
117 | } | 117 | } |
118 | 118 | ||
119 | public: | 119 | public: |
120 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 120 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
121 | QCheckBox* mWriteBackFuture; | 121 | QCheckBox* mWriteBackFuture; |
122 | QSpinBox* mWriteBackFutureWeeks; | 122 | QSpinBox* mWriteBackFutureWeeks; |
123 | }; | 123 | }; |
124 | 124 | ||
125 | int globalFlagBlockStartup; | 125 | int globalFlagBlockStartup; |
126 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 126 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
127 | QMainWindow( parent, name ) | 127 | QMainWindow( parent, name ) |
128 | { | 128 | { |
129 | 129 | ||
130 | #ifdef DESKTOP_VERSION | 130 | #ifdef DESKTOP_VERSION |
131 | setFont( QFont("Arial"), 14 ); | 131 | setFont( QFont("Arial"), 14 ); |
132 | #endif | 132 | #endif |
133 | mClosed = false; | 133 | mClosed = false; |
134 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 134 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
135 | QString confFile = locateLocal("config","korganizerrc"); | 135 | QString confFile = locateLocal("config","korganizerrc"); |
136 | QFileInfo finf ( confFile ); | 136 | QFileInfo finf ( confFile ); |
137 | bool showWarning = !finf.exists(); | 137 | bool showWarning = !finf.exists(); |
138 | setIcon(SmallIcon( "ko24" ) ); | 138 | setIcon(SmallIcon( "ko24" ) ); |
139 | mBlockAtStartup = true; | 139 | mBlockAtStartup = true; |
140 | mFlagKeyPressed = false; | 140 | mFlagKeyPressed = false; |
141 | setCaption("KOrganizer/Pi"); | 141 | setCaption("KOrganizer/Pi"); |
142 | KOPrefs *p = KOPrefs::instance(); | 142 | KOPrefs *p = KOPrefs::instance(); |
143 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 143 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
144 | if ( p->mHourSize > 18 ) | 144 | if ( p->mHourSize > 18 ) |
145 | p->mHourSize = 18; | 145 | p->mHourSize = 18; |
146 | QMainWindow::ToolBarDock tbd; | 146 | QMainWindow::ToolBarDock tbd; |
147 | if ( p->mToolBarHor ) { | 147 | if ( p->mToolBarHor ) { |
148 | if ( p->mToolBarUp ) | 148 | if ( p->mToolBarUp ) |
149 | tbd = Bottom; | 149 | tbd = Bottom; |
150 | else | 150 | else |
151 | tbd = Top; | 151 | tbd = Top; |
152 | } | 152 | } |
153 | else { | 153 | else { |
154 | if ( p->mToolBarUp ) | 154 | if ( p->mToolBarUp ) |
155 | tbd = Right; | 155 | tbd = Right; |
156 | else | 156 | else |
157 | tbd = Left; | 157 | tbd = Left; |
158 | } | 158 | } |
159 | if ( KOPrefs::instance()->mUseAppColors ) | 159 | if ( KOPrefs::instance()->mUseAppColors ) |
160 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 160 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
161 | globalFlagBlockStartup = 1; | 161 | globalFlagBlockStartup = 1; |
162 | iconToolBar = new QPEToolBar( this ); | 162 | iconToolBar = new QPEToolBar( this ); |
163 | addToolBar (iconToolBar , tbd ); | 163 | addToolBar (iconToolBar , tbd ); |
164 | mCalendarModifiedFlag = false; | 164 | mCalendarModifiedFlag = false; |
165 | 165 | ||
166 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 166 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
167 | splash->setAlignment ( AlignCenter ); | 167 | splash->setAlignment ( AlignCenter ); |
168 | setCentralWidget( splash ); | 168 | setCentralWidget( splash ); |
169 | #ifndef DESKTOP_VERSION | 169 | #ifndef DESKTOP_VERSION |
170 | showMaximized(); | 170 | showMaximized(); |
171 | #endif | 171 | #endif |
172 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 172 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
173 | setDefaultPreferences(); | 173 | setDefaultPreferences(); |
174 | mCalendar = new CalendarLocal(); | 174 | mCalendar = new CalendarLocal(); |
175 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 175 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
176 | mView->hide(); | 176 | mView->hide(); |
177 | //mView->resize(splash->size() ); | 177 | //mView->resize(splash->size() ); |
178 | initActions(); | 178 | initActions(); |
179 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 179 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
180 | mSyncManager->setBlockSave(false); | 180 | mSyncManager->setBlockSave(false); |
181 | mView->setSyncManager(mSyncManager); | 181 | mView->setSyncManager(mSyncManager); |
182 | #ifndef DESKTOP_VERSION | 182 | #ifndef DESKTOP_VERSION |
183 | iconToolBar->show(); | 183 | iconToolBar->show(); |
184 | qApp->processEvents(); | 184 | qApp->processEvents(); |
185 | #endif | 185 | #endif |
186 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 186 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
187 | int vh = height() ; | 187 | int vh = height() ; |
188 | int vw = width(); | 188 | int vw = width(); |
189 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 189 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
190 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 190 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
191 | vh -= iconToolBar->height(); | 191 | vh -= iconToolBar->height(); |
192 | } else { | 192 | } else { |
193 | vw -= iconToolBar->height(); | 193 | vw -= iconToolBar->height(); |
194 | } | 194 | } |
195 | //mView->setMaximumSize( splash->size() ); | 195 | //mView->setMaximumSize( splash->size() ); |
196 | //mView->resize( splash->size() ); | 196 | //mView->resize( splash->size() ); |
197 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 197 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
198 | mView->readSettings(); | 198 | mView->readSettings(); |
199 | bool newFile = false; | 199 | bool newFile = false; |
200 | if( !QFile::exists( defaultFileName() ) ) { | 200 | if( !QFile::exists( defaultFileName() ) ) { |
201 | QFileInfo finfo ( defaultFileName() ); | 201 | QFileInfo finfo ( defaultFileName() ); |
202 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 202 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
203 | qDebug("oldfile %s ", oldFile.latin1()); | 203 | qDebug("oldfile %s ", oldFile.latin1()); |
204 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 204 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
205 | finfo.setFile( oldFile ); | 205 | finfo.setFile( oldFile ); |
206 | if (finfo.exists() ) { | 206 | if (finfo.exists() ) { |
207 | KMessageBox::information( this, message); | 207 | KMessageBox::information( this, message); |
208 | mView->openCalendar( oldFile ); | 208 | mView->openCalendar( oldFile ); |
209 | qApp->processEvents(); | 209 | qApp->processEvents(); |
210 | } else { | 210 | } else { |
211 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 211 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
212 | finfo.setFile( oldFile ); | 212 | finfo.setFile( oldFile ); |
213 | if (finfo.exists() ) { | 213 | if (finfo.exists() ) { |
214 | KMessageBox::information( this, message); | 214 | KMessageBox::information( this, message); |
215 | mView->openCalendar( oldFile ); | 215 | mView->openCalendar( oldFile ); |
216 | qApp->processEvents(); | 216 | qApp->processEvents(); |
217 | } | 217 | } |
218 | } | 218 | } |
219 | mView->saveCalendar( defaultFileName() ); | 219 | mView->saveCalendar( defaultFileName() ); |
220 | newFile = true; | 220 | newFile = true; |
221 | } | 221 | } |
222 | 222 | ||
223 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 223 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
224 | mView->openCalendar( defaultFileName() ); | 224 | mView->openCalendar( defaultFileName() ); |
225 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 225 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
226 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 226 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
227 | 227 | ||
228 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 228 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
229 | KOPrefs::instance()->setCategoryDefaults(); | 229 | KOPrefs::instance()->setCategoryDefaults(); |
230 | int count = mView->addCategories(); | 230 | int count = mView->addCategories(); |
231 | } | 231 | } |
232 | processIncidenceSelection( 0 ); | 232 | processIncidenceSelection( 0 ); |
233 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 233 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
234 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 234 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
235 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 235 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
236 | SLOT( slotModifiedChanged( bool ) ) ); | 236 | SLOT( slotModifiedChanged( bool ) ) ); |
237 | 237 | ||
238 | 238 | ||
239 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 239 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
240 | SLOT( disableBR(bool) ) ); | 240 | SLOT( disableBR(bool) ) ); |
241 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 241 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
242 | mView->setModified( false ); | 242 | mView->setModified( false ); |
243 | mBlockAtStartup = false; | 243 | mBlockAtStartup = false; |
244 | mView->setModified( false ); | 244 | mView->setModified( false ); |
245 | setCentralWidget( mView ); | 245 | setCentralWidget( mView ); |
246 | globalFlagBlockStartup = 0; | 246 | globalFlagBlockStartup = 0; |
247 | mView->show(); | 247 | mView->show(); |
248 | delete splash; | 248 | delete splash; |
249 | if ( newFile ) | 249 | if ( newFile ) |
250 | mView->updateConfig(); | 250 | mView->updateConfig(); |
251 | // qApp->processEvents(); | 251 | // qApp->processEvents(); |
252 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 252 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
253 | //fillSyncMenu(); | 253 | //fillSyncMenu(); |
254 | 254 | ||
255 | 255 | ||
256 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 256 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
257 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 257 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
258 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 258 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
259 | mSyncManager->setDefaultFileName( defaultFileName()); | 259 | mSyncManager->setDefaultFileName( defaultFileName()); |
260 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 260 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
261 | mSyncManager->fillSyncMenu(); | 261 | mSyncManager->fillSyncMenu(); |
262 | 262 | ||
263 | 263 | ||
264 | 264 | ||
265 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 265 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
266 | if ( showWarning ) { | 266 | if ( showWarning ) { |
267 | KMessageBox::information( this, | 267 | KMessageBox::information( this, |
268 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); | 268 | "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); |
269 | qApp->processEvents(); | 269 | qApp->processEvents(); |
270 | mView->dialogManager()->showSyncOptions(); | 270 | mView->dialogManager()->showSyncOptions(); |
271 | } | 271 | } |
272 | 272 | ||
273 | //US listen for result adressed from Ka/Pi | 273 | //US listen for result adressed from Ka/Pi |
274 | #ifndef DESKTOP_VERSION | 274 | #ifndef DESKTOP_VERSION |
275 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 275 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
276 | #endif | 276 | #endif |
277 | #ifndef DESKTOP_VERSION | 277 | #ifndef DESKTOP_VERSION |
278 | infrared = 0; | 278 | infrared = 0; |
279 | #endif | 279 | #endif |
280 | 280 | ||
281 | mBRdisabled = false; | 281 | mBRdisabled = false; |
282 | toggleBeamReceive(); | 282 | //toggleBeamReceive(); |
283 | } | 283 | } |
284 | MainWindow::~MainWindow() | 284 | MainWindow::~MainWindow() |
285 | { | 285 | { |
286 | //qDebug("MainWindow::~MainWindow() "); | 286 | //qDebug("MainWindow::~MainWindow() "); |
287 | //save toolbar location | 287 | //save toolbar location |
288 | delete mCalendar; | 288 | delete mCalendar; |
289 | delete mSyncManager; | 289 | delete mSyncManager; |
290 | #ifndef DESKTOP_VERSION | 290 | #ifndef DESKTOP_VERSION |
291 | if ( infrared ) | 291 | if ( infrared ) |
292 | delete infrared; | 292 | delete infrared; |
293 | #endif | 293 | #endif |
294 | 294 | ||
295 | 295 | ||
296 | } | 296 | } |
297 | 297 | ||
298 | void MainWindow::disableBR(bool b) | 298 | void MainWindow::disableBR(bool b) |
299 | { | 299 | { |
300 | #ifndef DESKTOP_VERSION | 300 | #ifndef DESKTOP_VERSION |
301 | if ( b ) { | 301 | if ( b ) { |
302 | if ( infrared ) { | 302 | if ( infrared ) { |
303 | toggleBeamReceive(); | 303 | toggleBeamReceive(); |
304 | mBRdisabled = true; | 304 | mBRdisabled = true; |
305 | } | 305 | } |
306 | mBRdisabled = true; | 306 | mBRdisabled = true; |
307 | } else { | 307 | } else { |
308 | if ( mBRdisabled ) { | 308 | if ( mBRdisabled ) { |
309 | mBRdisabled = false; | 309 | mBRdisabled = false; |
310 | //makes no sense,because other cal ap is probably running | 310 | //makes no sense,because other cal ap is probably running |
311 | // toggleBeamReceive(); | 311 | // toggleBeamReceive(); |
312 | } | 312 | } |
313 | } | 313 | } |
314 | #endif | 314 | #endif |
315 | 315 | ||
316 | } | 316 | } |
317 | bool MainWindow::beamReceiveEnabled() | 317 | bool MainWindow::beamReceiveEnabled() |
318 | { | 318 | { |
319 | #ifndef DESKTOP_VERSION | 319 | #ifndef DESKTOP_VERSION |
320 | return ( infrared != 0 ); | 320 | return ( infrared != 0 ); |
321 | #endif | 321 | #endif |
322 | return false; | 322 | return false; |
323 | } | 323 | } |
324 | 324 | ||
325 | void MainWindow::toggleBeamReceive() | 325 | void MainWindow::toggleBeamReceive() |
326 | { | 326 | { |
327 | if ( mBRdisabled ) | 327 | if ( mBRdisabled ) |
328 | return; | 328 | return; |
329 | #ifndef DESKTOP_VERSION | 329 | #ifndef DESKTOP_VERSION |
330 | if ( infrared ) { | 330 | if ( infrared ) { |
331 | qDebug("disable BeamReceive "); | 331 | qDebug("disable BeamReceive "); |
332 | delete infrared; | 332 | delete infrared; |
333 | infrared = 0; | 333 | infrared = 0; |
334 | brAction->setOn(false); | 334 | brAction->setOn(false); |
335 | return; | 335 | return; |
336 | } | 336 | } |
337 | qDebug("enable BeamReceive "); | 337 | qDebug("enable BeamReceive "); |
338 | brAction->setOn(true); | 338 | brAction->setOn(true); |
339 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 339 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
340 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 340 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
341 | #endif | 341 | #endif |
342 | } | 342 | } |
343 | void MainWindow::showMaximized () | 343 | void MainWindow::showMaximized () |
344 | { | 344 | { |
345 | #ifndef DESKTOP_VERSION | 345 | #ifndef DESKTOP_VERSION |
346 | if ( ! globalFlagBlockStartup ) | 346 | if ( ! globalFlagBlockStartup ) |
347 | if ( mClosed ) | 347 | if ( mClosed ) |
348 | mView->goToday(); | 348 | mView->goToday(); |
349 | #endif | 349 | #endif |
350 | QWidget::showMaximized () ; | 350 | QWidget::showMaximized () ; |
351 | mClosed = false; | 351 | mClosed = false; |
352 | } | 352 | } |
353 | void MainWindow::closeEvent( QCloseEvent* ce ) | 353 | void MainWindow::closeEvent( QCloseEvent* ce ) |
354 | { | 354 | { |
355 | 355 | ||
356 | 356 | ||
357 | 357 | ||
358 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 358 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
359 | saveOnClose(); | 359 | saveOnClose(); |
360 | mClosed = true; | 360 | mClosed = true; |
361 | ce->accept(); | 361 | ce->accept(); |
362 | return; | 362 | return; |
363 | 363 | ||
364 | } | 364 | } |
365 | 365 | ||
366 | switch( QMessageBox::information( this, "KO/Pi", | 366 | switch( QMessageBox::information( this, "KO/Pi", |
367 | i18n("Do you really want\nto close KO/Pi?"), | 367 | i18n("Do you really want\nto close KO/Pi?"), |
368 | i18n("Close"), i18n("No"), | 368 | i18n("Close"), i18n("No"), |
369 | 0, 0 ) ) { | 369 | 0, 0 ) ) { |
370 | case 0: | 370 | case 0: |
371 | saveOnClose(); | 371 | saveOnClose(); |
372 | mClosed = true; | 372 | mClosed = true; |
373 | ce->accept(); | 373 | ce->accept(); |
374 | break; | 374 | break; |
375 | case 1: | 375 | case 1: |
376 | ce->ignore(); | 376 | ce->ignore(); |
377 | break; | 377 | break; |
378 | case 2: | 378 | case 2: |
379 | 379 | ||
380 | default: | 380 | default: |
381 | break; | 381 | break; |
382 | } | 382 | } |
383 | 383 | ||
384 | 384 | ||
385 | } | 385 | } |
386 | 386 | ||
387 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 387 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
388 | { | 388 | { |
389 | QDataStream stream( data, IO_ReadOnly ); | 389 | QDataStream stream( data, IO_ReadOnly ); |
390 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 390 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
391 | //QString datamess; | 391 | //QString datamess; |
392 | //qDebug("message "); | 392 | //qDebug("message "); |
393 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 393 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
394 | 394 | ||
395 | if ( cmsg == "setDocument(QString)" ) { | 395 | if ( cmsg == "setDocument(QString)" ) { |
396 | QDataStream stream( data, IO_ReadOnly ); | 396 | QDataStream stream( data, IO_ReadOnly ); |
397 | QString fileName; | 397 | QString fileName; |
398 | stream >> fileName; | 398 | stream >> fileName; |
399 | //qDebug("filename %s ", fileName.latin1()); | 399 | //qDebug("filename %s ", fileName.latin1()); |
400 | showMaximized(); | 400 | showMaximized(); |
401 | raise(); | 401 | raise(); |
402 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 402 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
403 | mSyncManager->slotSyncMenu( 1002 ); | 403 | mSyncManager->slotSyncMenu( 1002 ); |
404 | return; | 404 | return; |
405 | } | 405 | } |
406 | 406 | ||
407 | if ( cmsg == "-writeFile" ) { | 407 | if ( cmsg == "-writeFile" ) { |
408 | // I made from the "-writeFile" an "-writeAlarm" | 408 | // I made from the "-writeFile" an "-writeAlarm" |
409 | mView->viewManager()->showWhatsNextView(); | 409 | mView->viewManager()->showWhatsNextView(); |
410 | mCalendar->checkAlarmForIncidence( 0, true); | 410 | mCalendar->checkAlarmForIncidence( 0, true); |
411 | showMaximized(); | 411 | showMaximized(); |
412 | raise(); | 412 | raise(); |
413 | return; | 413 | return; |
414 | 414 | ||
415 | } | 415 | } |
416 | if ( cmsg == "-writeFileSilent" ) { | 416 | if ( cmsg == "-writeFileSilent" ) { |
417 | // I made from the "-writeFile" an "-writeAlarm" | 417 | // I made from the "-writeFile" an "-writeAlarm" |
418 | // mView->viewManager()->showWhatsNextView(); | 418 | // mView->viewManager()->showWhatsNextView(); |
419 | mCalendar->checkAlarmForIncidence( 0, true); | 419 | mCalendar->checkAlarmForIncidence( 0, true); |
420 | //showMaximized(); | 420 | //showMaximized(); |
421 | //raise(); | 421 | //raise(); |
422 | hide(); | 422 | hide(); |
423 | return; | 423 | return; |
424 | } | 424 | } |
425 | if ( cmsg == "-newCountdown" ) { | 425 | if ( cmsg == "-newCountdown" ) { |
426 | qDebug("newCountdown "); | 426 | qDebug("newCountdown "); |
427 | 427 | ||
428 | } | 428 | } |
429 | QString msg ; | 429 | QString msg ; |
430 | QString allmsg = cmsg; | 430 | QString allmsg = cmsg; |
431 | while ( allmsg.length() > 0 ) { | 431 | while ( allmsg.length() > 0 ) { |
432 | int nextC = allmsg.find( "-", 1 ); | 432 | int nextC = allmsg.find( "-", 1 ); |
433 | if ( nextC == -1 ) { | 433 | if ( nextC == -1 ) { |
434 | msg = allmsg; | 434 | msg = allmsg; |
435 | allmsg = ""; | 435 | allmsg = ""; |
436 | } else{ | 436 | } else{ |
437 | msg = allmsg.left( nextC ); | 437 | msg = allmsg.left( nextC ); |
438 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 438 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
439 | } | 439 | } |
440 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 440 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
441 | if ( msg == "-newEvent" ) { | 441 | if ( msg == "-newEvent" ) { |
442 | mView->newEvent(); | 442 | mView->newEvent(); |
443 | } | 443 | } |
444 | if ( msg == "-newTodo" ) { | 444 | if ( msg == "-newTodo" ) { |
445 | mView->newTodo(); | 445 | mView->newTodo(); |
446 | 446 | ||
447 | } | 447 | } |
448 | if ( msg == "-showWN" ) { | 448 | if ( msg == "-showWN" ) { |
449 | mView->viewManager()->showWhatsNextView(); | 449 | mView->viewManager()->showWhatsNextView(); |
450 | } | 450 | } |
451 | if ( msg == "-showTodo" ) { | 451 | if ( msg == "-showTodo" ) { |
452 | mView->viewManager()->showTodoView(); | 452 | mView->viewManager()->showTodoView(); |
453 | } | 453 | } |
454 | if ( msg == "-showList" ) { | 454 | if ( msg == "-showList" ) { |
455 | mView->viewManager()->showListView(); | 455 | mView->viewManager()->showListView(); |
456 | } | 456 | } |
457 | else if ( msg == "-showDay" ) { | 457 | else if ( msg == "-showDay" ) { |
458 | mView->viewManager()->showDayView(); | 458 | mView->viewManager()->showDayView(); |
459 | } | 459 | } |
460 | else if ( msg == "-showWWeek" ) { | 460 | else if ( msg == "-showWWeek" ) { |
461 | mView->viewManager()->showWorkWeekView(); | 461 | mView->viewManager()->showWorkWeekView(); |
462 | } | 462 | } |
463 | else if ( msg == "-ringSync" ) { | 463 | else if ( msg == "-ringSync" ) { |
464 | mSyncManager->multiSync( false ); | 464 | mSyncManager->multiSync( false ); |
465 | } | 465 | } |
466 | else if ( msg == "-showWeek" ) { | 466 | else if ( msg == "-showWeek" ) { |
467 | mView->viewManager()->showWeekView(); | 467 | mView->viewManager()->showWeekView(); |
468 | } | 468 | } |
469 | else if ( msg == "-showTodo" ) { | 469 | else if ( msg == "-showTodo" ) { |
470 | mView->viewManager()->showTodoView(); | 470 | mView->viewManager()->showTodoView(); |
471 | } | 471 | } |
472 | else if ( msg == "-showJournal" ) { | 472 | else if ( msg == "-showJournal" ) { |
473 | mView->dateNavigator()->selectDates( 1 ); | 473 | mView->dateNavigator()->selectDates( 1 ); |
474 | mView->dateNavigator()->selectToday(); | 474 | mView->dateNavigator()->selectToday(); |