summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwmdoc.cpp22
-rw-r--r--pwmanager/pwmanager/pwmdoc.h4
2 files changed, 13 insertions, 13 deletions
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp
index ab3238a..3f2f042 100644
--- a/pwmanager/pwmanager/pwmdoc.cpp
+++ b/pwmanager/pwmanager/pwmdoc.cpp
@@ -2790,26 +2790,26 @@ out_ignore:
2790#ifdef PWM_EMBEDDED 2790#ifdef PWM_EMBEDDED
2791//US ENH: this is the magic function that syncronizes the this doc with the remote doc 2791//US ENH: this is the magic function that syncronizes the this doc with the remote doc
2792//US it could have been defined as static, but I did not want to. 2792//US it could have been defined as static, but I did not want to.
2793PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* syncRemote, int mode ) 2793PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* syncRemote, int mode )
2794{ 2794{
2795 int addedPasswordsLocal = 0; 2795 int addedPasswordsLocal = 0;
2796 int addedPasswordsRemote = 0; 2796 int addedPasswordsRemote = 0;
2797 int deletedPasswordsRemote = 0; 2797 int deletedPasswordsRemote = 0;
2798 int deletedPasswordsLocal = 0; 2798 int deletedPasswordsLocal = 0;
2799 int changedLocal = 0; 2799 int changedLocal = 0;
2800 int changedRemote = 0; 2800 int changedRemote = 0;
2801 2801
2802 PwMSyncItem syncItemLocal; 2802 PwMSyncItem* syncItemLocal;
2803 PwMSyncItem syncItemRemote; 2803 PwMSyncItem* syncItemRemote;
2804 2804
2805 QString mCurrentSyncName = manager->getCurrentSyncName(); 2805 QString mCurrentSyncName = manager->getCurrentSyncName();
2806 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 2806 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
2807 2807
2808 bool fullDateRange = false; 2808 bool fullDateRange = false;
2809 int take; 2809 int take;
2810 // local->resetTempSyncStat(); 2810 // local->resetTempSyncStat();
2811 QDateTime mLastSync = QDateTime::currentDateTime(); 2811 QDateTime mLastSync = QDateTime::currentDateTime();
2812 QDateTime modifiedSync = mLastSync; 2812 QDateTime modifiedSync = mLastSync;
2813 2813
2814 unsigned int index; 2814 unsigned int index;
2815 //Step 1. Find syncinfo in Local file and create if not existent. 2815 //Step 1. Find syncinfo in Local file and create if not existent.
@@ -2819,60 +2819,60 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
2819 PwMSyncItem newSyncItemLocal; 2819 PwMSyncItem newSyncItemLocal;
2820 newSyncItemLocal.syncName = mCurrentSyncDevice; 2820 newSyncItemLocal.syncName = mCurrentSyncDevice;
2821 newSyncItemLocal.lastSyncDate = mLastSync; 2821 newSyncItemLocal.lastSyncDate = mLastSync;
2822 syncLocal->addSyncDataEntry(&newSyncItemLocal, true); 2822 syncLocal->addSyncDataEntry(&newSyncItemLocal, true);
2823 found = syncLocal->findSyncData(mCurrentSyncDevice, &index); 2823 found = syncLocal->findSyncData(mCurrentSyncDevice, &index);
2824 if (found == false) { 2824 if (found == false) {
2825 qDebug("PwMDoc::syncronize : newly created local sync data could not be found"); 2825 qDebug("PwMDoc::syncronize : newly created local sync data could not be found");
2826 return e_syncError; 2826 return e_syncError;
2827 } 2827 }
2828 } 2828 }
2829 2829
2830 syncItemLocal = syncLocal->getSyncDataEntry(index); 2830 syncItemLocal = syncLocal->getSyncDataEntry(index);
2831 qDebug("Last Sync %s ", syncItemLocal.lastSyncDate.toString().latin1()); 2831 qDebug("Last Sync %s ", syncItemLocal->lastSyncDate.toString().latin1());
2832 2832
2833 //Step 2. Find syncinfo in remote file and create if not existent. 2833 //Step 2. Find syncinfo in remote file and create if not existent.
2834 found = syncRemote->findSyncData(mCurrentSyncName, &index); 2834 found = syncRemote->findSyncData(mCurrentSyncName, &index);
2835 if (found == false) 2835 if (found == false)
2836 { 2836 {
2837 qDebug("FULLDATE 1"); 2837 qDebug("FULLDATE 1");
2838 fullDateRange = true; 2838 fullDateRange = true;
2839 PwMSyncItem newSyncItemRemote; 2839 PwMSyncItem newSyncItemRemote;
2840 newSyncItemRemote.syncName = mCurrentSyncName; 2840 newSyncItemRemote.syncName = mCurrentSyncName;
2841 newSyncItemRemote.lastSyncDate = mLastSync; 2841 newSyncItemRemote.lastSyncDate = mLastSync;
2842 syncRemote->addSyncDataEntry(&newSyncItemRemote, true); 2842 syncRemote->addSyncDataEntry(&newSyncItemRemote, true);
2843 found = syncRemote->findSyncData(mCurrentSyncName, &index); 2843 found = syncRemote->findSyncData(mCurrentSyncName, &index);
2844 if (found == false) { 2844 if (found == false) {
2845 qDebug("PwMDoc::syncronize : newly created remote sync data could not be found"); 2845 qDebug("PwMDoc::syncronize : newly created remote sync data could not be found");
2846 return e_syncError; 2846 return e_syncError;
2847 } 2847 }
2848 } 2848 }
2849 2849
2850 syncItemRemote = syncRemote->getSyncDataEntry(index); 2850 syncItemRemote = syncRemote->getSyncDataEntry(index);
2851 //and remove the found entry here. We will reenter it later again. 2851 //and remove the found entry here. We will reenter it later again.
2852 syncRemote->delSyncDataEntry(index, true); 2852 //US syncRemote->delSyncDataEntry(index, true);
2853 2853
2854 2854
2855 if ( syncItemLocal.lastSyncDate == mLastSync ) { 2855 if ( syncItemLocal->lastSyncDate == mLastSync ) {
2856 qDebug("FULLDATE 2"); 2856 qDebug("FULLDATE 2");
2857 fullDateRange = true; 2857 fullDateRange = true;
2858 } 2858 }
2859 2859
2860 if ( ! fullDateRange ) { 2860 if ( ! fullDateRange ) {
2861 if ( syncItemLocal.lastSyncDate != syncItemRemote->lastSyncDate ) { 2861 if ( syncItemLocal->lastSyncDate != syncItemRemote->lastSyncDate ) {
2862 2862
2863 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); 2863 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() );
2864 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); 2864 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec());
2865 fullDateRange = true; 2865 fullDateRange = true;
2866 qDebug("FULLDATE 3 %s %s", syncItemLocal.lastSyncDate.toString().latin1() , syncItemRemote.lastSyncDate.toString().latin1() ); 2866 qDebug("FULLDATE 3 %s %s", syncItemLocal->lastSyncDate.toString().latin1() , syncItemRemote->lastSyncDate.toString().latin1() );
2867 } 2867 }
2868 } 2868 }
2869 // fullDateRange = true; // debug only! 2869 // fullDateRange = true; // debug only!
2870 if ( fullDateRange ) 2870 if ( fullDateRange )
2871 mLastSync = QDateTime::currentDateTime().addDays( -100*365); 2871 mLastSync = QDateTime::currentDateTime().addDays( -100*365);
2872 else 2872 else
2873 mLastSync = syncItemLocal->lastSyncDate; 2873 mLastSync = syncItemLocal->lastSyncDate;
2874 2874
2875 2875
2876 qDebug("*************************** "); 2876 qDebug("*************************** ");
2877 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); 2877 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() );
2878 QStringList er = syncRemote->getIDEntryList(); 2878 QStringList er = syncRemote->getIDEntryList();
@@ -2988,32 +2988,32 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
2988 } 2988 }
2989 el.clear(); 2989 el.clear();
2990 manager->hideProgressBar(); 2990 manager->hideProgressBar();
2991 2991
2992 // Now write the info back into the sync data space of the files 2992 // Now write the info back into the sync data space of the files
2993 2993
2994 mLastSync = QDateTime::currentDateTime().addSecs( 1 ); 2994 mLastSync = QDateTime::currentDateTime().addSecs( 1 );
2995 // get rid of micro seconds 2995 // get rid of micro seconds
2996 QTime t = mLastSync.time(); 2996 QTime t = mLastSync.time();
2997 mLastSync.setTime( QTime (t.hour (), t.minute (), t.second () ) ); 2997 mLastSync.setTime( QTime (t.hour (), t.minute (), t.second () ) );
2998 2998
2999 2999
3000 syncItemLocal.lastSyncDate = mLastSync; 3000 syncItemLocal->lastSyncDate = mLastSync;
3001 syncItemRemote.lastSyncDate = mLastSync; 3001 syncItemRemote->lastSyncDate = mLastSync;
3002 3002
3003 // addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ; 3003 // addresseeRSync.setRole( i18n("!Remote from: ")+mCurrentSyncName ) ;
3004 // addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName ); 3004 // addresseeLSync.setRole(i18n("!Local from: ") + mCurrentSyncName );
3005 3005
3006 syncRemote->addSyncDataEntry( syncItemRemote, false ); 3006 //US syncRemote->addSyncDataEntry( syncItemRemote, false );
3007 syncLocal->addSyncDataEntry( syncItemLocal, false ); 3007 //US syncLocal->addSyncDataEntry( syncItemLocal, false );
3008 QString mes; 3008 QString mes;
3009 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"),addedPasswordsLocal, addedPasswordsRemote, changedLocal, changedRemote, deletedPasswordsLocal, deletedPasswordsRemote ); 3009 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"),addedPasswordsLocal, addedPasswordsRemote, changedLocal, changedRemote, deletedPasswordsLocal, deletedPasswordsRemote );
3010 if ( manager->mShowSyncSummary ) { 3010 if ( manager->mShowSyncSummary ) {
3011 KMessageBox::information(0, mes, i18n("PWM/Pi Synchronization") ); 3011 KMessageBox::information(0, mes, i18n("PWM/Pi Synchronization") );
3012 } 3012 }
3013 qDebug( mes ); 3013 qDebug( mes );
3014 return e_success; 3014 return e_success;
3015} 3015}
3016 3016
3017 3017
3018int PwMDoc::takePwMDataItem( PwMDataItem* local, PwMDataItem* remote, QDateTime lastSync, int mode , bool full ) 3018int PwMDoc::takePwMDataItem( PwMDataItem* local, PwMDataItem* remote, QDateTime lastSync, int mode , bool full )
3019{ 3019{
diff --git a/pwmanager/pwmanager/pwmdoc.h b/pwmanager/pwmanager/pwmdoc.h
index ddab7f3..2e9547e 100644
--- a/pwmanager/pwmanager/pwmdoc.h
+++ b/pwmanager/pwmanager/pwmdoc.h
@@ -782,25 +782,25 @@ protected:
782 virtual void sync_save(); 782 virtual void sync_save();
783 783
784#endif 784#endif
785 private: 785 private:
786 //US ENH: helpermethods to access the sync data for a certain syncname. 786 //US ENH: helpermethods to access the sync data for a certain syncname.
787 // It returns the syncdatas index 787 // It returns the syncdatas index
788 bool findSyncData(const QString &syncname, unsigned int *index); 788 bool findSyncData(const QString &syncname, unsigned int *index);
789 789
790 /** add new syncdataentry */ 790 /** add new syncdataentry */
791 PwMerror addSyncDataEntry(PwMSyncItem *d, bool dontFlagDirty = false); 791 PwMerror addSyncDataEntry(PwMSyncItem *d, bool dontFlagDirty = false);
792 792
793 /** returns a pointer to the syncdata */ 793 /** returns a pointer to the syncdata */
794 PwMSyncItem getSyncDataEntry(unsigned int index) 794 PwMSyncItem* getSyncDataEntry(unsigned int index)
795 { return *(dti.syncDta[index]); } 795 { return &(dti.syncDta[index]); }
796 796
797 /** delete entry */ 797 /** delete entry */
798 bool delSyncDataEntry(unsigned int index, bool dontFlagDirty = false); 798 bool delSyncDataEntry(unsigned int index, bool dontFlagDirty = false);
799 799
800 PwMDataItem* findEntryByID(const QString &uid, unsigned int *category, unsigned int *index); 800 PwMDataItem* findEntryByID(const QString &uid, unsigned int *category, unsigned int *index);
801 801
802 QStringList getIDEntryList(); 802 QStringList getIDEntryList();
803 803
804}; 804};
805 805
806#endif 806#endif