summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2004-10-09 21:35:22 (UTC)
committer zautrix <zautrix>2004-10-09 21:35:22 (UTC)
commit213a9d993e5a4751b64e18320cfbebb000681d13 (patch) (unidiff)
tree995b465797464e689b73d3271ff4a3f8f0d3749b /kaddressbook
parentd68435216e1ebc5a7fed391157197994e13992b3 (diff)
downloadkdepimpi-213a9d993e5a4751b64e18320cfbebb000681d13.zip
kdepimpi-213a9d993e5a4751b64e18320cfbebb000681d13.tar.gz
kdepimpi-213a9d993e5a4751b64e18320cfbebb000681d13.tar.bz2
ab phone sync implemented
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp65
-rw-r--r--kaddressbook/kabcore.h3
2 files changed, 47 insertions, 21 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 452f1bc..a7967cb 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2634,266 +2634,291 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo
2634 } 2634 }
2635 } else { // no conflict 2635 } else { // no conflict
2636 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2636 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2637 QString des = addresseeLSync.note(); 2637 QString des = addresseeLSync.note();
2638 if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it 2638 if ( des.find( inR.getID(mCurrentSyncDevice) +"," ) >= 0 && mode != 5) { // delete it
2639 inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 2639 inR.setTempSyncStat( SYNC_TEMPSTATE_DELETE );
2640 remote->insertAddressee( inR, false ); 2640 remote->insertAddressee( inR, false );
2641 ++deletedAddresseeR; 2641 ++deletedAddresseeR;
2642 } else { 2642 } else {
2643 inR.setRevision( modifiedCalendar ); 2643 inR.setRevision( modifiedCalendar );
2644 remote->insertAddressee( inR, false ); 2644 remote->insertAddressee( inR, false );
2645 inL = inR; 2645 inL = inR;
2646 inL.setResource( 0 ); 2646 inL.setResource( 0 );
2647 local->insertAddressee( inL , false); 2647 local->insertAddressee( inL , false);
2648 ++addedAddressee; 2648 ++addedAddressee;
2649 } 2649 }
2650 } else { 2650 } else {
2651 if ( inR.revision() > mLastAddressbookSync || mode == 5 ) { 2651 if ( inR.revision() > mLastAddressbookSync || mode == 5 ) {
2652 inR.setRevision( modifiedCalendar ); 2652 inR.setRevision( modifiedCalendar );
2653 remote->insertAddressee( inR, false ); 2653 remote->insertAddressee( inR, false );
2654 inR.setResource( 0 ); 2654 inR.setResource( 0 );
2655 local->insertAddressee( inR, false ); 2655 local->insertAddressee( inR, false );
2656 ++addedAddressee; 2656 ++addedAddressee;
2657 } else { 2657 } else {
2658 // pending checkExternSyncAddressee(addresseeRSyncSharp, inR); 2658 // pending checkExternSyncAddressee(addresseeRSyncSharp, inR);
2659 remote->removeAddressee( inR ); 2659 remote->removeAddressee( inR );
2660 ++deletedAddresseeR; 2660 ++deletedAddresseeR;
2661 } 2661 }
2662 } 2662 }
2663 } 2663 }
2664 } 2664 }
2665 ++incCounter; 2665 ++incCounter;
2666 } 2666 }
2667 er.clear(); 2667 er.clear();
2668 QStringList el = local->uidList(); 2668 QStringList el = local->uidList();
2669 modulo = (el.count()/10)+1; 2669 modulo = (el.count()/10)+1;
2670 2670
2671 syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count()); 2671 syncManager->showProgressBar(0, i18n("Add / remove addressees"), el.count());
2672 incCounter = 0; 2672 incCounter = 0;
2673 while ( incCounter < el.count()) { 2673 while ( incCounter < el.count()) {
2674 qApp->processEvents(); 2674 qApp->processEvents();
2675 if (syncManager->isProgressBarCanceled()) 2675 if (syncManager->isProgressBarCanceled())
2676 return false; 2676 return false;
2677 if ( incCounter % modulo == 0 ) 2677 if ( incCounter % modulo == 0 )
2678 syncManager->showProgressBar(incCounter); 2678 syncManager->showProgressBar(incCounter);
2679 uid = el[ incCounter ]; 2679 uid = el[ incCounter ];
2680 bool skipIncidence = false; 2680 bool skipIncidence = false;
2681 if ( uid.left(19) == QString("last-syncAddressee-") ) 2681 if ( uid.left(19) == QString("last-syncAddressee-") )
2682 skipIncidence = true; 2682 skipIncidence = true;
2683 if ( !skipIncidence ) { 2683 if ( !skipIncidence ) {
2684 inL = local->findByUid( uid ); 2684 inL = local->findByUid( uid );
2685 inR = remote->findByUid( uid ); 2685 inR = remote->findByUid( uid );
2686 if ( inR.isEmpty() ) { 2686 if ( inR.isEmpty() ) {
2687 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2687 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2688 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { 2688 if ( !inL.getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) {
2689 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 2689 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
2690 local->removeAddressee( inL ); 2690 local->removeAddressee( inL );
2691 ++deletedAddresseeL; 2691 ++deletedAddresseeL;
2692 } else { 2692 } else {
2693 if ( ! syncManager->mWriteBackExistingOnly ) { 2693 if ( ! syncManager->mWriteBackExistingOnly ) {
2694 inL.removeID(mCurrentSyncDevice ); 2694 inL.removeID(mCurrentSyncDevice );
2695 ++addedAddresseeR; 2695 ++addedAddresseeR;
2696 inL.setRevision( modifiedCalendar ); 2696 inL.setRevision( modifiedCalendar );
2697 local->insertAddressee( inL, false ); 2697 local->insertAddressee( inL, false );
2698 inR = inL; 2698 inR = inL;
2699 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL ); 2699 inR.setTempSyncStat( SYNC_TEMPSTATE_ADDED_EXTERNAL );
2700 inR.setResource( 0 ); 2700 inR.setResource( 0 );
2701 remote->insertAddressee( inR, false ); 2701 remote->insertAddressee( inR, false );
2702 } 2702 }
2703 } 2703 }
2704 } else { 2704 } else {
2705 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) { 2705 if ( inL.revision() < mLastAddressbookSync && mode != 4 ) {
2706 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL); 2706 // pending checkExternSyncAddressee(addresseeLSyncSharp, inL);
2707 local->removeAddressee( inL ); 2707 local->removeAddressee( inL );
2708 ++deletedAddresseeL; 2708 ++deletedAddresseeL;
2709 } else { 2709 } else {
2710 if ( ! syncManager->mWriteBackExistingOnly ) { 2710 if ( ! syncManager->mWriteBackExistingOnly ) {
2711 ++addedAddresseeR; 2711 ++addedAddresseeR;
2712 inL.setRevision( modifiedCalendar ); 2712 inL.setRevision( modifiedCalendar );
2713 local->insertAddressee( inL, false ); 2713 local->insertAddressee( inL, false );
2714 inR = inL; 2714 inR = inL;
2715 inR.setResource( 0 ); 2715 inR.setResource( 0 );
2716 remote->insertAddressee( inR, false ); 2716 remote->insertAddressee( inR, false );
2717 } 2717 }
2718 } 2718 }
2719 } 2719 }
2720 } 2720 }
2721 } 2721 }
2722 ++incCounter; 2722 ++incCounter;
2723 } 2723 }
2724 el.clear(); 2724 el.clear();
2725 syncManager->hideProgressBar(); 2725 syncManager->hideProgressBar();
2726 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 ); 2726 mLastAddressbookSync = QDateTime::currentDateTime().addSecs( 1 );
2727 // get rid of micro seconds 2727 // get rid of micro seconds
2728 QTime t = mLastAddressbookSync.time(); 2728 QTime t = mLastAddressbookSync.time();
2729 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); 2729 mLastAddressbookSync.setTime( QTime (t.hour (), t.minute (), t.second () ) );
2730 addresseeLSync.setRevision( mLastAddressbookSync ); 2730 addresseeLSync.setRevision( mLastAddressbookSync );
2731 addresseeRSync.setRevision( mLastAddressbookSync ); 2731 addresseeRSync.setRevision( mLastAddressbookSync );
2732 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; 2732 addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ;
2733 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); 2733 addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName );
2734 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ; 2734 addresseeRSync.setGivenName( i18n("!DO NOT EDIT!") ) ;
2735 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") ); 2735 addresseeLSync.setGivenName(i18n("!DO NOT EDIT!") );
2736 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ; 2736 addresseeRSync.setOrganization( "!"+mLastAddressbookSync.toString() ) ;
2737 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() ); 2737 addresseeLSync.setOrganization("!"+ mLastAddressbookSync.toString() );
2738 addresseeRSync.setNote( "" ) ; 2738 addresseeRSync.setNote( "" ) ;
2739 addresseeLSync.setNote( "" ); 2739 addresseeLSync.setNote( "" );
2740 2740
2741 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 2741 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
2742 remote->insertAddressee( addresseeRSync, false ); 2742 remote->insertAddressee( addresseeRSync, false );
2743 local->insertAddressee( addresseeLSync, false ); 2743 local->insertAddressee( addresseeLSync, false );
2744 QString mes; 2744 QString mes;
2745 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR ); 2745 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedAddressee, addedAddresseeR, changedLocal, changedRemote, deletedAddresseeL, deletedAddresseeR );
2746 if ( syncManager->mShowSyncSummary ) { 2746 if ( syncManager->mShowSyncSummary ) {
2747 KMessageBox::information(this, mes, i18n("KA/Pi Synchronization") ); 2747 KMessageBox::information(this, mes, i18n("KA/Pi Synchronization") );
2748 } 2748 }
2749 qDebug( mes ); 2749 qDebug( mes );
2750 return syncOK; 2750 return syncOK;
2751} 2751}
2752 2752
2753 2753
2754//this is a overwritten callbackmethods from the syncinterface 2754//this is a overwritten callbackmethods from the syncinterface
2755bool KABCore::sync(KSyncManager* manager, QString filename, int mode) 2755bool KABCore::sync(KSyncManager* manager, QString filename, int mode)
2756{ 2756{
2757 2757
2758 //pending prepare addresseeview for output 2758 //pending prepare addresseeview for output
2759 //pending detect, if remote file has REV field. if not switch to external sync 2759 //pending detect, if remote file has REV field. if not switch to external sync
2760 mGlobalSyncMode = SYNC_MODE_NORMAL; 2760 mGlobalSyncMode = SYNC_MODE_NORMAL;
2761 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 2761 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
2762 2762
2763 AddressBook abLocal(filename,"syncContact"); 2763 AddressBook abLocal(filename,"syncContact");
2764 bool syncOK = false; 2764 bool syncOK = false;
2765 if ( abLocal.load() ) { 2765 if ( abLocal.load() ) {
2766 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode ); 2766 qDebug("AB loaded %s,sync mode %d",filename.latin1(), mode );
2767 bool external = false; 2767 bool external = false;
2768 bool isXML = false; 2768 bool isXML = false;
2769 if ( filename.right(4) == ".xml") { 2769 if ( filename.right(4) == ".xml") {
2770 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2770 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2771 isXML = true; 2771 isXML = true;
2772 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice ); 2772 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice );
2773 } else { 2773 } else {
2774 Addressee lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2774 Addressee lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
2775 if ( ! lse.isEmpty() ) { 2775 if ( ! lse.isEmpty() ) {
2776 if ( lse.familyName().left(4) == "!E: " ) 2776 if ( lse.familyName().left(4) == "!E: " )
2777 external = true; 2777 external = true;
2778 } else { 2778 } else {
2779 bool found = false; 2779 bool found = false;
2780 AddressBook::Iterator it; 2780 AddressBook::Iterator it;
2781 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2781 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2782 if ( (*it).revision().date().year() > 2003 ) { 2782 if ( (*it).revision().date().year() > 2003 ) {
2783 found = true; 2783 found = true;
2784 break; 2784 break;
2785 } 2785 }
2786 } 2786 }
2787 external = ! found; 2787 external = ! found;
2788 } 2788 }
2789 2789
2790 if ( external ) { 2790 if ( external ) {
2791 qDebug("Setting vcf mode to external "); 2791 qDebug("Setting vcf mode to external ");
2792 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2792 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2793 AddressBook::Iterator it; 2793 AddressBook::Iterator it;
2794 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2794 for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2795 (*it).setID( mCurrentSyncDevice, (*it).uid() ); 2795 (*it).setID( mCurrentSyncDevice, (*it).uid() );
2796 (*it).computeCsum( mCurrentSyncDevice ); 2796 (*it).computeCsum( mCurrentSyncDevice );
2797 } 2797 }
2798 } 2798 }
2799 } 2799 }
2800 //AddressBook::Iterator it; 2800 //AddressBook::Iterator it;
2801 //QStringList vcards; 2801 //QStringList vcards;
2802 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) { 2802 //for ( it = abLocal.begin(); it != abLocal.end(); ++it ) {
2803 // qDebug("Name %s ", (*it).familyName().latin1()); 2803 // qDebug("Name %s ", (*it).familyName().latin1());
2804 //} 2804 //}
2805 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode ); 2805 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, mode );
2806 if ( syncOK ) { 2806 if ( syncOK ) {
2807 if ( syncManager->mWriteBackFile ) 2807 if ( syncManager->mWriteBackFile )
2808 { 2808 {
2809 if ( external ) 2809 if ( external )
2810 abLocal.removeSyncAddressees( !isXML); 2810 abLocal.removeSyncAddressees( !isXML);
2811 qDebug("Saving remote AB "); 2811 qDebug("Saving remote AB ");
2812 if ( ! abLocal.saveAB()) 2812 if ( ! abLocal.saveAB())
2813 qDebug("Error writing back AB to file "); 2813 qDebug("Error writing back AB to file ");
2814 if ( isXML ) { 2814 if ( isXML ) {
2815 // afterwrite processing 2815 // afterwrite processing
2816 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); 2816 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
2817 } 2817 }
2818 } 2818 }
2819 } 2819 }
2820 setModified(); 2820 setModified();
2821 2821
2822 } 2822 }
2823 if ( syncOK ) 2823 if ( syncOK )
2824 mViewManager->refreshView(); 2824 mViewManager->refreshView();
2825 return syncOK; 2825 return syncOK;
2826#if 0
2827 2826
2828 if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) {
2829 getEventViewerDialog()->setSyncMode( true );
2830 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
2831 getEventViewerDialog()->setSyncMode( false );
2832 if ( syncOK ) {
2833 if ( KOPrefs::instance()->mWriteBackFile )
2834 {
2835 storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
2836 storage->save();
2837 }
2838 }
2839 setModified();
2840 }
2841
2842#endif
2843} 2827}
2844 2828
2845 2829
2846//this is a overwritten callbackmethods from the syncinterface 2830//this is a overwritten callbackmethods from the syncinterface
2847bool KABCore::syncExternal(KSyncManager* manager, QString resource) 2831bool KABCore::syncExternal(KSyncManager* manager, QString resource)
2848{ 2832{
2833 if ( resource == "phone" )
2834 return syncPhone();
2849 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 2835 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
2850 2836
2851 AddressBook abLocal( resource,"syncContact"); 2837 AddressBook abLocal( resource,"syncContact");
2852 bool syncOK = false; 2838 bool syncOK = false;
2853 if ( abLocal.load() ) { 2839 if ( abLocal.load() ) {
2854 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1()); 2840 qDebug("AB sharp loaded ,sync device %s",mCurrentSyncDevice.latin1());
2855 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2841 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2856 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice ); 2842 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice );
2857 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs ); 2843 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
2858 if ( syncOK ) { 2844 if ( syncOK ) {
2859 if ( syncManager->mWriteBackFile ) { 2845 if ( syncManager->mWriteBackFile ) {
2860 abLocal.saveAB(); 2846 abLocal.saveAB();
2861 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice ); 2847 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
2862 } 2848 }
2863 } 2849 }
2864 setModified(); 2850 setModified();
2865 } 2851 }
2866 if ( syncOK ) 2852 if ( syncOK )
2867 mViewManager->refreshView(); 2853 mViewManager->refreshView();
2868 return syncOK; 2854 return syncOK;
2869 2855
2870} 2856}
2871 2857void KABCore::message( QString m )
2872void KABCore::getFile( bool success )
2873{ 2858{
2859
2860 topLevelWidget()->setCaption( m );
2874 QTimer::singleShot( 15000, this , SLOT ( setCaptionBack())); 2861 QTimer::singleShot( 15000, this , SLOT ( setCaptionBack()));
2862}
2863bool KABCore::syncPhone()
2864{
2865 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2866 QString fileName;
2867#ifdef _WIN32_
2868 fileName = locateLocal("tmp", "phonefile.vcf");
2869#else
2870 fileName = "/tmp/phonefile.vcf";
2871#endif
2872 if ( !PhoneAccess::readFromPhone( fileName) ) {
2873 message(i18n("Phone access failed!"));
2874 return false;
2875 }
2876 AddressBook abLocal( fileName,"syncContact");
2877 bool syncOK = false;
2878 if ( abLocal.load() ) {
2879 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1());
2880 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2881 abLocal.preparePhoneSync( mCurrentSyncDevice, true );
2882 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice );
2883 syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
2884 if ( syncOK ) {
2885 if ( syncManager->mWriteBackFile ) {
2886 abLocal.saveABphone( fileName );
2887 abLocal.preparePhoneSync( mCurrentSyncDevice, false );
2888 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice );
2889 abLocal.postExternSync( mAddressBook,mCurrentSyncDevice );
2890 }
2891 }
2892 setModified();
2893 }
2894 if ( syncOK )
2895 mViewManager->refreshView();
2896 return syncOK;
2897}
2898void KABCore::getFile( bool success )
2899{
2875 if ( ! success ) { 2900 if ( ! success ) {
2876 setCaption( i18n("Error receiving file. Nothing changed!") ); 2901 message( i18n("Error receiving file. Nothing changed!") );
2877 return; 2902 return;
2878 } 2903 }
2879 mAddressBook->importFromFile( sentSyncFile() , false, true ); 2904 mAddressBook->importFromFile( sentSyncFile() , false, true );
2880 topLevelWidget()->setCaption( i18n("Pi-Sync successful!") ); 2905 message( i18n("Pi-Sync successful!") );
2881 mViewManager->refreshView(); 2906 mViewManager->refreshView();
2882} 2907}
2883void KABCore::syncFileRequest() 2908void KABCore::syncFileRequest()
2884{ 2909{
2885 mAddressBook->export2File( sentSyncFile() ); 2910 mAddressBook->export2File( sentSyncFile() );
2886} 2911}
2887QString KABCore::sentSyncFile() 2912QString KABCore::sentSyncFile()
2888{ 2913{
2889#ifdef _WIN32_ 2914#ifdef _WIN32_
2890 return locateLocal( "tmp", "copysyncab.vcf" ); 2915 return locateLocal( "tmp", "copysyncab.vcf" );
2891#else 2916#else
2892 return QString( "/tmp/copysyncab.vcf" ); 2917 return QString( "/tmp/copysyncab.vcf" );
2893#endif 2918#endif
2894} 2919}
2895 2920
2896void KABCore::setCaptionBack() 2921void KABCore::setCaptionBack()
2897{ 2922{
2898 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") ); 2923 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") );
2899} 2924}
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 43c5f99..04ce33d 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -275,209 +275,210 @@ class KABCore : public QWidget, public KSyncInterface
275 DCOP METHODS. 275 DCOP METHODS.
276 */ 276 */
277 void addEmail( QString addr ); 277 void addEmail( QString addr );
278 void importVCard( const KURL& url, bool showPreview ); 278 void importVCard( const KURL& url, bool showPreview );
279 void importVCard( const QString& vCard, bool showPreview ); 279 void importVCard( const QString& vCard, bool showPreview );
280 void newContact(); 280 void newContact();
281 QString getNameByPhone( const QString& phone ); 281 QString getNameByPhone( const QString& phone );
282 /** 282 /**
283 END DCOP METHODS 283 END DCOP METHODS
284 */ 284 */
285 285
286 /** 286 /**
287 Saves the contents of the AddressBook back to disk. 287 Saves the contents of the AddressBook back to disk.
288 */ 288 */
289 void save(); 289 void save();
290 290
291 /** 291 /**
292 Undos the last command using the undo stack. 292 Undos the last command using the undo stack.
293 */ 293 */
294 void undo(); 294 void undo();
295 295
296 /** 296 /**
297 Redos the last command that was undone, using the redo stack. 297 Redos the last command that was undone, using the redo stack.
298 */ 298 */
299 void redo(); 299 void redo();
300 300
301 /** 301 /**
302 Shows the edit dialog for the given uid. If the uid is QString::null, 302 Shows the edit dialog for the given uid. If the uid is QString::null,
303 the method will try to find a selected addressee in the view. 303 the method will try to find a selected addressee in the view.
304 */ 304 */
305 void editContact( const QString &uid /*US = QString::null*/ ); 305 void editContact( const QString &uid /*US = QString::null*/ );
306//US added a second method without defaultparameter 306//US added a second method without defaultparameter
307 void editContact2(); 307 void editContact2();
308 308
309 /** 309 /**
310 Shows or edits the detail view for the given uid. If the uid is QString::null, 310 Shows or edits the detail view for the given uid. If the uid is QString::null,
311 the method will try to find a selected addressee in the view. 311 the method will try to find a selected addressee in the view.
312 */ 312 */
313 void executeContact( const QString &uid /*US = QString::null*/ ); 313 void executeContact( const QString &uid /*US = QString::null*/ );
314 314
315 /** 315 /**
316 Launches the configuration dialog. 316 Launches the configuration dialog.
317 */ 317 */
318 void openConfigDialog(); 318 void openConfigDialog();
319 319
320 /** 320 /**
321 Launches the ldap search dialog. 321 Launches the ldap search dialog.
322 */ 322 */
323 void openLDAPDialog(); 323 void openLDAPDialog();
324 324
325 /** 325 /**
326 Creates a KAddressBookPrinter, which will display the print 326 Creates a KAddressBookPrinter, which will display the print
327 dialog and do the printing. 327 dialog and do the printing.
328 */ 328 */
329 void print(); 329 void print();
330 330
331 /** 331 /**
332 Registers a new GUI client, so plugins can register its actions. 332 Registers a new GUI client, so plugins can register its actions.
333 */ 333 */
334 void addGUIClient( KXMLGUIClient *client ); 334 void addGUIClient( KXMLGUIClient *client );
335 335
336 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 336 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
337 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 337 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
338 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); 338 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
339 339
340 340
341 signals: 341 signals:
342 void contactSelected( const QString &name ); 342 void contactSelected( const QString &name );
343 void contactSelected( const QPixmap &pixmap ); 343 void contactSelected( const QPixmap &pixmap );
344 public slots: 344 public slots:
345 void recieve(QString cmsg ); 345 void recieve(QString cmsg );
346 void getFile( bool success ); 346 void getFile( bool success );
347 void syncFileRequest(); 347 void syncFileRequest();
348 void setDetailsVisible( bool visible ); 348 void setDetailsVisible( bool visible );
349 void setDetailsToState(); 349 void setDetailsToState();
350 // void slotSyncMenu( int ); 350 // void slotSyncMenu( int );
351 private slots: 351 private slots:
352 void setJumpButtonBarVisible( bool visible ); 352 void setJumpButtonBarVisible( bool visible );
353 void setCaptionBack(); 353 void setCaptionBack();
354 void importFromOL(); 354 void importFromOL();
355 void extensionModified( const KABC::Addressee::List &list ); 355 void extensionModified( const KABC::Addressee::List &list );
356 void extensionChanged( int id ); 356 void extensionChanged( int id );
357 void clipboardDataChanged(); 357 void clipboardDataChanged();
358 void updateActionMenu(); 358 void updateActionMenu();
359 void configureKeyBindings(); 359 void configureKeyBindings();
360 void removeVoice(); 360 void removeVoice();
361#ifdef KAB_EMBEDDED 361#ifdef KAB_EMBEDDED
362 void configureResources(); 362 void configureResources();
363#endif //KAB_EMBEDDED 363#endif //KAB_EMBEDDED
364 364
365 void slotEditorDestroyed( const QString &uid ); 365 void slotEditorDestroyed( const QString &uid );
366 void configurationChanged(); 366 void configurationChanged();
367 void addressBookChanged(); 367 void addressBookChanged();
368 368
369 private: 369 private:
370 void initGUI(); 370 void initGUI();
371 void initActions(); 371 void initActions();
372 372
373 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 373 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
374 const char *name = 0 ); 374 const char *name = 0 );
375 375
376 KXMLGUIClient *mGUIClient; 376 KXMLGUIClient *mGUIClient;
377 377
378 KABC::AddressBook *mAddressBook; 378 KABC::AddressBook *mAddressBook;
379 379
380 ViewManager *mViewManager; 380 ViewManager *mViewManager;
381 // QSplitter *mDetailsSplitter; 381 // QSplitter *mDetailsSplitter;
382 KDGanttMinimizeSplitter *mExtensionBarSplitter; 382 KDGanttMinimizeSplitter *mExtensionBarSplitter;
383 ViewContainer *mDetails; 383 ViewContainer *mDetails;
384 KDGanttMinimizeSplitter* mMiniSplitter; 384 KDGanttMinimizeSplitter* mMiniSplitter;
385 XXPortManager *mXXPortManager; 385 XXPortManager *mXXPortManager;
386 JumpButtonBar *mJumpButtonBar; 386 JumpButtonBar *mJumpButtonBar;
387 IncSearchWidget *mIncSearchWidget; 387 IncSearchWidget *mIncSearchWidget;
388 ExtensionManager *mExtensionManager; 388 ExtensionManager *mExtensionManager;
389 389
390 KCMultiDialog *mConfigureDialog; 390 KCMultiDialog *mConfigureDialog;
391 391
392#ifndef KAB_EMBEDDED 392#ifndef KAB_EMBEDDED
393 LDAPSearchDialog *mLdapSearchDialog; 393 LDAPSearchDialog *mLdapSearchDialog;
394#endif //KAB_EMBEDDED 394#endif //KAB_EMBEDDED
395 // QDict<AddresseeEditorDialog> mEditorDict; 395 // QDict<AddresseeEditorDialog> mEditorDict;
396 AddresseeEditorDialog *mEditorDialog; 396 AddresseeEditorDialog *mEditorDialog;
397 bool mReadWrite; 397 bool mReadWrite;
398 bool mModified; 398 bool mModified;
399 bool mIsPart; 399 bool mIsPart;
400 bool mMultipleViewsAtOnce; 400 bool mMultipleViewsAtOnce;
401 401
402 402
403 //US file menu 403 //US file menu
404 KAction *mActionMail; 404 KAction *mActionMail;
405 KAction *mActionBeam; 405 KAction *mActionBeam;
406 KAction *mActionExport2phone; 406 KAction *mActionExport2phone;
407 KAction* mActionPrint; 407 KAction* mActionPrint;
408 KAction* mActionNewContact; 408 KAction* mActionNewContact;
409 KAction *mActionSave; 409 KAction *mActionSave;
410 KAction *mActionEditAddressee; 410 KAction *mActionEditAddressee;
411 KAction *mActionMailVCard; 411 KAction *mActionMailVCard;
412 KAction *mActionBeamVCard; 412 KAction *mActionBeamVCard;
413 413
414 KAction *mActionQuit; 414 KAction *mActionQuit;
415 415
416 //US edit menu 416 //US edit menu
417 KAction *mActionCopy; 417 KAction *mActionCopy;
418 KAction *mActionCut; 418 KAction *mActionCut;
419 KAction *mActionPaste; 419 KAction *mActionPaste;
420 KAction *mActionSelectAll; 420 KAction *mActionSelectAll;
421 KAction *mActionUndo; 421 KAction *mActionUndo;
422 KAction *mActionRedo; 422 KAction *mActionRedo;
423 KAction *mActionDelete; 423 KAction *mActionDelete;
424 424
425 //US settings menu 425 //US settings menu
426 KAction *mActionConfigResources; 426 KAction *mActionConfigResources;
427 KAction *mActionConfigKAddressbook; 427 KAction *mActionConfigKAddressbook;
428 KAction *mActionConfigShortcuts; 428 KAction *mActionConfigShortcuts;
429 KAction *mActionConfigureToolbars; 429 KAction *mActionConfigureToolbars;
430 KAction *mActionKeyBindings; 430 KAction *mActionKeyBindings;
431 KToggleAction *mActionJumpBar; 431 KToggleAction *mActionJumpBar;
432 KToggleAction *mActionDetails; 432 KToggleAction *mActionDetails;
433 KAction *mActionWhoAmI; 433 KAction *mActionWhoAmI;
434 KAction *mActionCategories; 434 KAction *mActionCategories;
435 KAction *mActionAboutKAddressbook; 435 KAction *mActionAboutKAddressbook;
436 KAction *mActionLicence; 436 KAction *mActionLicence;
437 KAction *mActionFaq; 437 KAction *mActionFaq;
438 438
439 KAction *mActionDeleteView; 439 KAction *mActionDeleteView;
440 440
441 QPopupMenu *viewMenu; 441 QPopupMenu *viewMenu;
442 QPopupMenu *filterMenu; 442 QPopupMenu *filterMenu;
443 QPopupMenu *settingsMenu; 443 QPopupMenu *settingsMenu;
444 QPopupMenu *changeMenu; 444 QPopupMenu *changeMenu;
445//US QAction *mActionSave; 445//US QAction *mActionSave;
446 QPopupMenu *ImportMenu; 446 QPopupMenu *ImportMenu;
447 QPopupMenu *ExportMenu; 447 QPopupMenu *ExportMenu;
448 //LR additional methods 448 //LR additional methods
449 KAction *mActionRemoveVoice; 449 KAction *mActionRemoveVoice;
450 KAction * mActionImportOL; 450 KAction * mActionImportOL;
451 451
452#ifndef KAB_EMBEDDED 452#ifndef KAB_EMBEDDED
453 KAddressBookService *mAddressBookService; 453 KAddressBookService *mAddressBookService;
454#endif //KAB_EMBEDDED 454#endif //KAB_EMBEDDED
455 455
456 class KABCorePrivate; 456 class KABCorePrivate;
457 KABCorePrivate *d; 457 KABCorePrivate *d;
458 //US bool mBlockSaveFlag; 458 //US bool mBlockSaveFlag;
459 459
460#ifdef KAB_EMBEDDED 460#ifdef KAB_EMBEDDED
461 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 461 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
462#endif //KAB_EMBEDDED 462#endif //KAB_EMBEDDED
463 463
464 //this are the overwritten callbackmethods from the syncinterface 464 //this are the overwritten callbackmethods from the syncinterface
465 virtual bool sync(KSyncManager* manager, QString filename, int mode); 465 virtual bool sync(KSyncManager* manager, QString filename, int mode);
466 virtual bool syncExternal(KSyncManager* manager, QString resource); 466 virtual bool syncExternal(KSyncManager* manager, QString resource);
467 467 bool syncPhone();
468 void message( QString m );
468 469
469 // LR ******************************* 470 // LR *******************************
470 // sync stuff! 471 // sync stuff!
471 QString sentSyncFile(); 472 QString sentSyncFile();
472 QPopupMenu *syncMenu; 473 QPopupMenu *syncMenu;
473 KSyncManager* syncManager; 474 KSyncManager* syncManager;
474 int mGlobalSyncMode; 475 int mGlobalSyncMode;
475 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); 476 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
476 KABC::Addressee getLastSyncAddressee(); 477 KABC::Addressee getLastSyncAddressee();
477 QDateTime mLastAddressbookSync; 478 QDateTime mLastAddressbookSync;
478 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); 479 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
479 // ********************* 480 // *********************
480 481
481}; 482};
482 483
483#endif 484#endif