summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/pwmdoc.cpp
Unidiff
Diffstat (limited to 'pwmanager/pwmanager/pwmdoc.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwmdoc.cpp85
1 files changed, 53 insertions, 32 deletions
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp
index 0ac5517..2a7b11d 100644
--- a/pwmanager/pwmanager/pwmdoc.cpp
+++ b/pwmanager/pwmanager/pwmdoc.cpp
@@ -489,3 +489,4 @@ PwMerror PwMDoc::saveDoc(char compress, const QString *file)
489 ret = e_success; 489 ret = e_success;
490 printDebug(string("writing file { compress: ") 490 printDebug(string("writing file { name: ")
491 + filename.latin1() + " compress: "
491 + tostr(static_cast<int>(compress)) + " cryptAlgo: " 492 + tostr(static_cast<int>(compress)) + " cryptAlgo: "
@@ -607,3 +608,5 @@ PwMerror PwMDoc::writeFileHeader(char keyHash, char dataHash, char crypt, char c
607 PWM_ASSERT(f); 608 PWM_ASSERT(f);
608 PWM_ASSERT(listView); 609 //US ENH: or maybe a bug: checking here for listView does not make sense because we do not check anywhere else
610 //Wenn I sync, I open a doc without a view => listView is 0 => Assertion
611 //USPWM_ASSERT(listView);
609 if (f->writeBlock(FILE_ID_HEADER, strlen(FILE_ID_HEADER)) != 612 if (f->writeBlock(FILE_ID_HEADER, strlen(FILE_ID_HEADER)) !=
@@ -2806,3 +2809,9 @@ void PwMDoc::ensureLvp()
2806 2809
2810 //US ENH BUG: when using syncronizing, this way of sorting
2811 //is not sufficient, because there might be empty spaces
2812 // at the beginning. But this algorythm only can add elements
2813 //to the end.The result are crashes because of listoverflows
2814 //we need something to fill all gaps.
2807 vector< vector<PwMDataItem>::iterator > undefined; 2815 vector< vector<PwMDataItem>::iterator > undefined;
2816 vector< vector<PwMDataItem>::iterator > sorted;
2808 vector< vector<PwMDataItem>::iterator >::iterator undefBegin, 2817 vector< vector<PwMDataItem>::iterator >::iterator undefBegin,
@@ -2810,2 +2819,5 @@ void PwMDoc::ensureLvp()
2810 undefI; 2819 undefI;
2820 vector< vector<PwMDataItem>::iterator >::iterator sortedBegin,
2821 sortedEnd,
2822 sortedI;
2811 vector<PwMCategoryItem>::iterator catBegin = dti.dta.begin(), 2823 vector<PwMCategoryItem>::iterator catBegin = dti.dta.begin(),
@@ -2828,6 +2840,20 @@ void PwMDoc::ensureLvp()
2828 undefined.push_back(entrI); 2840 undefined.push_back(entrI);
2829 else if (tmpLvp > lvpTop) 2841 else
2830 lvpTop = tmpLvp; 2842 sorted[tmpLvp] = entrI;
2843 //US else if (tmpLvp > lvpTop)
2844 //US lvpTop = tmpLvp;
2831 ++entrI; 2845 ++entrI;
2832 } 2846 }
2847
2848 //now we have all undefied in the collection. Now insert the existing
2849 sortedBegin = sorted.begin();
2850 sortedEnd = sorted.end();
2851 sortedI = sortedBegin;
2852
2853 while (sortedI != sortedEnd) {
2854 tmpLvp = (*sortedI)->listViewPos;
2855 undefined[tmpLvp] = *sortedI;
2856 ++sortedI;
2857 }
2858
2833 undefBegin = undefined.begin(); 2859 undefBegin = undefined.begin();
@@ -2850,2 +2876,12 @@ QString PwMDoc::getTitle()
2850 QString title(getFilename()); 2876 QString title(getFilename());
2877
2878 //US ENH: The whole filename on PDAs is too long. So use only the last characters
2879 if (QApplication::desktop()->width() < 640)
2880 {
2881 if (title.length() > 30)
2882 title = "..." + title.right(30);
2883
2884 }
2885
2886
2851 if (title.isEmpty()) { 2887 if (title.isEmpty()) {
@@ -2929,3 +2965,3 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
2929 syncItemLocal = syncLocal->getSyncDataEntry(index); 2965 syncItemLocal = syncLocal->getSyncDataEntry(index);
2930 qDebug("Last Sync %s ", syncItemLocal->lastSyncDate.toString().latin1()); 2966 qDebug("Last Sync Local %s ", syncItemLocal->lastSyncDate.toString().latin1());
2931 2967
@@ -2949,2 +2985,3 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
2949 syncItemRemote = syncRemote->getSyncDataEntry(index); 2985 syncItemRemote = syncRemote->getSyncDataEntry(index);
2986 qDebug("Last Sync Remote %s ", syncItemRemote->lastSyncDate.toString().latin1());
2950 //and remove the found entry here. We will reenter it later again. 2987 //and remove the found entry here. We will reenter it later again.
@@ -2961,4 +2998,4 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
2961 2998
2962 // qDebug("set fulldate to true %s %s" ,addresseeLSync->dtStart().toString().latin1(), addresseeRSync->dtStart().toString().latin1() ); 2999 // qDebug("set fulldate to true %s %s" ,syncItemLocal->lastSyncDate.toString().latin1(), syncItemRemote->lastSyncDate.toString().latin1() );
2963 //qDebug("%d %d %d %d ", addresseeLSync->dtStart().time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec()); 3000 // qDebug("%d %d %d %d ", syncItemLocal->lastSyncDate.time().second(), addresseeLSync->dtStart().time().msec() , addresseeRSync->dtStart().time().second(), addresseeRSync->dtStart().time().msec());
2964 fullDateRange = true; 3001 fullDateRange = true;
@@ -2975,3 +3012,3 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
2975 qDebug("*************************** "); 3012 qDebug("*************************** ");
2976 // qDebug("mLastAddressbookSync %s ",mLastAddressbookSync.toString().latin1() ); 3013 qDebug("mLastSync %s ",mLastSync.toString().latin1() );
2977 QStringList er = syncRemote->getIDEntryList(); 3014 QStringList er = syncRemote->getIDEntryList();
@@ -3003,3 +3040,3 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
3003 if ( (take = takePwMDataItem( inLocal, inRemote, mLastSync, mode, fullDateRange) ) ) { 3040 if ( (take = takePwMDataItem( inLocal, inRemote, mLastSync, mode, fullDateRange) ) ) {
3004 //qDebug("take %d %s ", take, inL.summary().latin1()); 3041 qDebug("take %d %s ", take, inLocal->desc.c_str());
3005 if ( take == 3 ) 3042 if ( take == 3 )
@@ -3054,2 +3091,3 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s
3054 uid = el[ incCounter ]; 3091 uid = el[ incCounter ];
3092 qDebug("sync uid %s from local file", uid.latin1());
3055 3093
@@ -3134,7 +3172,7 @@ int PwMDoc::takePwMDataItem( PwMDataItem* local, PwMDataItem* remote, QDateTime
3134 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); 3172 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() );
3135 //full = true; //debug only 3173 full = true; //debug only
3136 if ( full ) { 3174 if ( full ) {
3137 bool equ = true;//US ( (*local) == (*remote) ); 3175 bool equ = ( (*local) == (*remote) );
3138 if ( equ ) { 3176 if ( equ ) {
3139 //qDebug("equal "); 3177 qDebug("equal ");
3140 if ( mode < SYNC_PREF_FORCE_LOCAL ) 3178 if ( mode < SYNC_PREF_FORCE_LOCAL )
@@ -3142,4 +3180,4 @@ int PwMDoc::takePwMDataItem( PwMDataItem* local, PwMDataItem* remote, QDateTime
3142 3180
3143 }//else //debug only 3181 }else //debug only
3144 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 3182 qDebug("not equal %s %s ", local->desc.c_str(), remote->desc.c_str());
3145 } 3183 }
@@ -3217,3 +3255,3 @@ bool PwMDoc::sync(KSyncManager* manager, QString filename, int mode)
3217 3255
3218 //2) construct and open a new doc on the stack(automatic cleanup) for remote file. 3256 //2) construct and open a new doc on the stack(automatic cleanup of remote file).
3219 PwMDoc syncTarget(this, "synctarget"); 3257 PwMDoc syncTarget(this, "synctarget");
@@ -3269,19 +3307,2 @@ bool PwMDoc::sync(KSyncManager* manager, QString filename, int mode)
3269 3307
3270//called by the syncmanager to indicate that the work has to marked as dirty.
3271void PwMDoc::sync_setModified()
3272{
3273 flagDirty();
3274}
3275
3276//called by the syncmanager to ask if the dirty flag is set.
3277bool PwMDoc::sync_isModified()
3278{
3279 return isDirty();
3280}
3281
3282//called by the syncmanager to indicate that the work has to be saved.
3283void PwMDoc::sync_save()
3284{
3285 saveDoc(conf()->confGlobCompression());
3286}
3287#endif 3308#endif