summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwm.cpp4
-rw-r--r--pwmanager/pwmanager/pwm.h2
-rw-r--r--pwmanager/pwmanager/pwmdoc.cpp2
-rw-r--r--pwmanager/pwmanager/pwmdoc.h2
4 files changed, 5 insertions, 5 deletions
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp
index e12dc49..8373850 100644
--- a/pwmanager/pwmanager/pwm.cpp
+++ b/pwmanager/pwmanager/pwm.cpp
@@ -1472,128 +1472,128 @@ void PwM::category_slot()
1472 w.setCurrCategory(view->getCurrentCategory()); 1472 w.setCurrCategory(view->getCurrentCategory());
1473 1473
1474 tryAgain: 1474 tryAgain:
1475 if (w.exec() == 1) 1475 if (w.exec() == 1)
1476 { 1476 {
1477 PwMDataItem d; 1477 PwMDataItem d;
1478 1478
1479 //US BUG: to initialize all values of curEntr with meaningfulldata, 1479 //US BUG: to initialize all values of curEntr with meaningfulldata,
1480 // we call clear on it. Reason: Metadata will be uninitialized otherwise. 1480 // we call clear on it. Reason: Metadata will be uninitialized otherwise.
1481 // another option would be to create a constructor for PwMDataItem 1481 // another option would be to create a constructor for PwMDataItem
1482 d.clear(true); 1482 d.clear(true);
1483 /* 1483 /*
1484 d.desc = w.getDescription().latin1(); 1484 d.desc = w.getDescription().latin1();
1485 d.name = w.getUsername().latin1(); 1485 d.name = w.getUsername().latin1();
1486 d.pw = w.getPassword().latin1(); 1486 d.pw = w.getPassword().latin1();
1487 d.comment = w.getComment().latin1(); 1487 d.comment = w.getComment().latin1();
1488 d.url = w.getUrl().latin1(); 1488 d.url = w.getUrl().latin1();
1489 d.launcher = w.getLauncher().latin1(); 1489 d.launcher = w.getLauncher().latin1();
1490 PwMerror ret = doc->addEntry(w.getCategory(), &d); 1490 PwMerror ret = doc->addEntry(w.getCategory(), &d);
1491 if (ret == e_entryExists) { 1491 if (ret == e_entryExists) {
1492 KMessageBox::error(this, 1492 KMessageBox::error(this,
1493 i18n 1493 i18n
1494 ("An entry with this \"Description\",\n" 1494 ("An entry with this \"Description\",\n"
1495 "does already exist.\n" 1495 "does already exist.\n"
1496 "Please select another description."), 1496 "Please select another description."),
1497 i18n("entry already exists.")); 1497 i18n("entry already exists."));
1498 goto tryAgain; 1498 goto tryAgain;
1499 } else if (ret == e_maxAllowedEntr) { 1499 } else if (ret == e_maxAllowedEntr) {
1500 KMessageBox::error(this, i18n("The maximum possible number of\nentries" 1500 KMessageBox::error(this, i18n("The maximum possible number of\nentries"
1501 "has been reached.\nYou can't add more entries."), 1501 "has been reached.\nYou can't add more entries."),
1502 i18n("maximum number of entries")); 1502 i18n("maximum number of entries"));
1503 doc->timer()->putLock(DocTimer::id_autoLockTimer); 1503 doc->timer()->putLock(DocTimer::id_autoLockTimer);
1504 return; 1504 return;
1505 } 1505 }
1506 */ 1506 */
1507 } 1507 }
1508 setVirgin(false); 1508 setVirgin(false);
1509 doc->timer()->putLock(DocTimer::id_autoLockTimer); 1509 doc->timer()->putLock(DocTimer::id_autoLockTimer);
1510} 1510}
1511 1511
1512 1512
1513void PwM::whatsnew_slot() 1513void PwM::whatsnew_slot()
1514{ 1514{
1515 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1515 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1516} 1516}
1517 1517
1518void PwM::showLicense_slot() 1518void PwM::showLicense_slot()
1519{ 1519{
1520 KApplication::showLicence(); 1520 KApplication::showLicence();
1521} 1521}
1522 1522
1523void PwM::faq_slot() 1523void PwM::faq_slot()
1524{ 1524{
1525 KApplication::showFile( "PWM/Pi FAQ", "kdepim/pwmanager/pwmanagerFAQ.txt" ); 1525 KApplication::showFile( "PWM/Pi FAQ", "kdepim/pwmanager/pwmanagerFAQ.txt" );
1526} 1526}
1527 1527
1528void PwM::syncHowTo_slot() 1528void PwM::syncHowTo_slot()
1529{ 1529{
1530 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1530 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1531} 1531}
1532 1532
1533 1533
1534void PwM::createAboutData_slot() 1534void PwM::createAboutData_slot()
1535{ 1535{
1536 QString version; 1536 QString version;
1537#include <../version> 1537#include <../version>
1538; 1538;
1539 QMessageBox::about( this, "About PwManager/Pi", 1539 QMessageBox::about( this, "About PwManager/Pi",
1540 "PwManager/Platform-independent\n" 1540 "PwManager/Platform-independent\n"
1541 "(PWM/Pi) " +version + " - " + 1541 "(PWM/Pi) " +version + " - " +
1542#ifdef DESKTOP_VERSION 1542#ifdef DESKTOP_VERSION
1543 "Desktop Edition\n" 1543 "Desktop Edition\n"
1544#else 1544#else
1545 "PDA-Edition\n" 1545 "PDA-Edition\n"
1546 "for: Zaurus 5500 / 7x0 / 8x0\n" 1546 "for: Zaurus 5500 / 7x0 / 8x0\n"
1547#endif 1547#endif
1548 1548
1549 "(c) 2004 Ulf Schenk\n" 1549 "(c) 2004 Ulf Schenk\n"
1550 "(c) 2004 Lutz Rogowski\n" 1550 "(c) 2004 Lutz Rogowski\n"
1551 "(c) 1997-2004, The KDE PIM Team\n" 1551 "(c) 1997-2004, The KDE PIM Team\n"
1552 1552
1553 "(c) Michael Buesch - main programming\nand current maintainer\nmbuesch@freenet.de\n" 1553 "(c) Michael Buesch - main programming\nand current maintainer\nmbuesch@freenet.de\n"
1554 "Matt Scifo - mscifo@o1.com\n" 1554 "Matt Scifo - mscifo@o1.com\n"
1555 "Elias Probst - elias.probst@gmx.de\n" 1555 "Elias Probst - elias.probst@gmx.de\n"
1556 "George Staikos - staikos@kde.org\n" 1556 "George Staikos - staikos@kde.org\n"
1557 "Matthew Palmer - mjp16@uow.edu.au\n" 1557 "Matthew Palmer - mjp16@uow.edu.au\n"
1558 "Olivier Sessink - gpasman@nl.linux.org\n" 1558 "Olivier Sessink - gpasman@nl.linux.org\n"
1559 "The libgcrypt developers -\nBlowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n" 1559 "The libgcrypt developers -\nBlowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n"
1560 "Troy Engel - tengel@sonic.net\n" 1560 "Troy Engel - tengel@sonic.net\n"
1561 "Wickey - wickey@gmx.at\n" 1561 "Wickey - wickey@gmx.at\n"
1562 "Ian MacGregor - original documentation author.\n" 1562 "Ian MacGregor - original documentation author.\n"
1563 ); 1563 );
1564} 1564}
1565 1565
1566 1566
1567//this are the overwritten callbackmethods from the syncinterface 1567//this are the overwritten callbackmethods from the syncinterface
1568bool PwM::sync(KSyncManager* manager, QString filename, int mode) 1568bool PwM::sync(KSyncManager* manager, QString filename, int mode,QString resource)
1569{ 1569{
1570 PWM_ASSERT(curDoc()); 1570 PWM_ASSERT(curDoc());
1571 1571
1572 bool ret = curDoc()->sync(manager, filename, mode); 1572 bool ret = curDoc()->sync(manager, filename, mode,resource);
1573 1573
1574 qDebug("PwM::sync save now: ret=%i", ret); 1574 qDebug("PwM::sync save now: ret=%i", ret);
1575 1575
1576 if (ret == true) { 1576 if (ret == true) {
1577 //US BUG: what can we call here to update the view of the current doc? 1577 //US BUG: what can we call here to update the view of the current doc?
1578 //mViewManager->refreshView(); 1578 //mViewManager->refreshView();
1579 1579
1580 //US curDoc()->sync sets the dirtyFlag in case the sync was successfull. 1580 //US curDoc()->sync sets the dirtyFlag in case the sync was successfull.
1581 save(); 1581 save();
1582 } 1582 }
1583 1583
1584 return ret; 1584 return ret;
1585} 1585}
1586 1586
1587void PwM::removeSyncInfo( QString syncProfile) 1587void PwM::removeSyncInfo( QString syncProfile)
1588{ 1588{
1589 qDebug("PWM:removeSyncInfo for profile %s ", syncProfile.latin1()); 1589 qDebug("PWM:removeSyncInfo for profile %s ", syncProfile.latin1());
1590 curDoc()->removeSyncInfo( syncProfile ); 1590 curDoc()->removeSyncInfo( syncProfile );
1591 //US curDoc()->removeSyncInfo sets the dirtyFlag. 1591 //US curDoc()->removeSyncInfo sets the dirtyFlag.
1592} 1592}
1593 1593
1594#endif 1594#endif
1595 1595
1596 1596
1597#ifndef PWM_EMBEDDED 1597#ifndef PWM_EMBEDDED
1598#include "pwm.moc" 1598#include "pwm.moc"
1599#endif 1599#endif
diff --git a/pwmanager/pwmanager/pwm.h b/pwmanager/pwmanager/pwm.h
index 2d1b854..c4bbb4e 100644
--- a/pwmanager/pwmanager/pwm.h
+++ b/pwmanager/pwmanager/pwm.h
@@ -186,115 +186,115 @@ public slots:
186 void faq_slot(); 186 void faq_slot();
187 void createAboutData_slot(); 187 void createAboutData_slot();
188 void syncHowTo_slot(); 188 void syncHowTo_slot();
189#endif 189#endif
190 190
191protected: 191protected:
192 /** is this window virgin? */ 192 /** is this window virgin? */
193 bool isVirgin() 193 bool isVirgin()
194 { return virgin; } 194 { return virgin; }
195 /** add/remove virginity */ 195 /** add/remove virginity */
196 void setVirgin(bool v); 196 void setVirgin(bool v);
197 /** initialize the menubar */ 197 /** initialize the menubar */
198 void initMenubar(); 198 void initMenubar();
199 /** initialize the toolbar */ 199 /** initialize the toolbar */
200 void initToolbar(); 200 void initToolbar();
201 /** initialize the window-metrics */ 201 /** initialize the window-metrics */
202 void initMetrics(); 202 void initMetrics();
203 /** close-event */ 203 /** close-event */
204 void closeEvent(QCloseEvent *e); 204 void closeEvent(QCloseEvent *e);
205 /** creates a new PwM-ListView and returns it */ 205 /** creates a new PwM-ListView and returns it */
206 PwMView * makeNewListView(PwMDoc *doc); 206 PwMView * makeNewListView(PwMDoc *doc);
207 /** Window hide-event */ 207 /** Window hide-event */
208 void hideEvent(QHideEvent *); 208 void hideEvent(QHideEvent *);
209 /** is this window minimized? */ 209 /** is this window minimized? */
210 bool isMinimized() 210 bool isMinimized()
211 { 211 {
212#ifndef PWM_EMBEDDED 212#ifndef PWM_EMBEDDED
213 #if KDE_VERSION >= KDE_MAKE_VERSION(3, 2, 0) 213 #if KDE_VERSION >= KDE_MAKE_VERSION(3, 2, 0)
214 return KWin::windowInfo(winId()).isMinimized(); 214 return KWin::windowInfo(winId()).isMinimized();
215 #else // KDE_VERSION 215 #else // KDE_VERSION
216 return KWin::info(winId()).isIconified(); 216 return KWin::info(winId()).isIconified();
217 #endif // KDE_VERSION 217 #endif // KDE_VERSION
218#else 218#else
219 return false; 219 return false;
220#endif 220#endif
221 } 221 }
222 /** window got the focus */ 222 /** window got the focus */
223 void focusInEvent(QFocusEvent *e); 223 void focusInEvent(QFocusEvent *e);
224 /** update the caption string */ 224 /** update the caption string */
225 void updateCaption(); 225 void updateCaption();
226#ifdef CONFIG_KWALLETIF 226#ifdef CONFIG_KWALLETIF
227 /** check if kwalletemu is enabled and ask the user what to do */ 227 /** check if kwalletemu is enabled and ask the user what to do */
228 bool checkAndAskForKWalletEmu(); 228 bool checkAndAskForKWalletEmu();
229#endif // CONFIG_KWALLETIF 229#endif // CONFIG_KWALLETIF
230 230
231protected slots: 231protected slots:
232 /** doc got closed */ 232 /** doc got closed */
233 void docClosed(PwMDoc *doc); 233 void docClosed(PwMDoc *doc);
234 234
235signals: 235signals:
236 /** window got closed (by user or someone else) */ 236 /** window got closed (by user or someone else) */
237 void closed(PwM *wnd); 237 void closed(PwM *wnd);
238 /** window got the focus (was brought to foreground) */ 238 /** window got the focus (was brought to foreground) */
239 void gotFocus(PwM *wnd); 239 void gotFocus(PwM *wnd);
240 /** window lost the focus */ 240 /** window lost the focus */
241 void lostFocus(PwM *wnd); 241 void lostFocus(PwM *wnd);
242 242
243protected: 243protected:
244 /** pointer to the view active in this KMainWindow */ 244 /** pointer to the view active in this KMainWindow */
245 PwMView *view; 245 PwMView *view;
246 /** pointer to the init class */ 246 /** pointer to the init class */
247 PwMInit *init; 247 PwMInit *init;
248 /** has this window already lost its virginity? 248 /** has this window already lost its virginity?
249 * Means is there an open working document 249 * Means is there an open working document
250 */ 250 */
251 bool virgin; 251 bool virgin;
252 /** "file" popup-menu */ 252 /** "file" popup-menu */
253 KPopupMenu *filePopup; 253 KPopupMenu *filePopup;
254 254
255 /** "manage" popup-menu */ 255 /** "manage" popup-menu */
256 KPopupMenu *managePopup; 256 KPopupMenu *managePopup;
257#ifdef CONFIG_KEYCARD 257#ifdef CONFIG_KEYCARD
258 /** "chipcard" popup-menu */ 258 /** "chipcard" popup-menu */
259 KPopupMenu *chipcardPopup; 259 KPopupMenu *chipcardPopup;
260#endif // CONFIG_KEYCARD 260#endif // CONFIG_KEYCARD
261 /** "view" popup-menu */ 261 /** "view" popup-menu */
262 KPopupMenu *viewPopup; 262 KPopupMenu *viewPopup;
263 /** "options" popup-menu */ 263 /** "options" popup-menu */
264 KPopupMenu *optionsPopup; 264 KPopupMenu *optionsPopup;
265 /** "help" popup-menu */ 265 /** "help" popup-menu */
266 KPopupMenu *helpPopup; 266 KPopupMenu *helpPopup;
267 /** "export" popup-menu */ 267 /** "export" popup-menu */
268 KPopupMenu *exportPopup; 268 KPopupMenu *exportPopup;
269 /** "import" popup-menu */ 269 /** "import" popup-menu */
270 KPopupMenu *importPopup; 270 KPopupMenu *importPopup;
271 /** force quit this window? */ 271 /** force quit this window? */
272 bool forceQuit; 272 bool forceQuit;
273 /** force minimize this window to the tray */ 273 /** force minimize this window to the tray */
274 bool forceMinimizeToTray; 274 bool forceMinimizeToTray;
275 275
276 276
277 277
278 278
279 private: 279 private:
280#ifdef PWM_EMBEDDED 280#ifdef PWM_EMBEDDED
281 //this are the overwritten callbackmethods from the syncinterface 281 //this are the overwritten callbackmethods from the syncinterface
282 virtual bool sync(KSyncManager* manager, QString filename, int mode); 282 virtual bool sync(KSyncManager* manager, QString filename, int mode,QString resource);
283 virtual void removeSyncInfo( QString syncProfile); 283 virtual void removeSyncInfo( QString syncProfile);
284 284
285 // LR ******************************* 285 // LR *******************************
286 // sync stuff! 286 // sync stuff!
287 QPopupMenu *syncPopup; 287 QPopupMenu *syncPopup;
288 KSyncManager* syncManager; 288 KSyncManager* syncManager;
289#endif 289#endif
290 290
291 291
292 292
293 293
294 294
295 295
296 296
297 297
298}; 298};
299 299
300#endif 300#endif
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp
index 1f3c58b..b58d7e2 100644
--- a/pwmanager/pwmanager/pwmdoc.cpp
+++ b/pwmanager/pwmanager/pwmdoc.cpp
@@ -3351,193 +3351,193 @@ int PwMDoc::takePwMDataItem( PwMDataItem* local, PwMDataItem* remote, QDateTime
3351 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); 3351 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() );
3352 //full = true; //debug only 3352 //full = true; //debug only
3353 if ( full ) { 3353 if ( full ) {
3354 bool equ = ( (*local) == (*remote) ); 3354 bool equ = ( (*local) == (*remote) );
3355 if ( equ ) { 3355 if ( equ ) {
3356 //qDebug("equal "); 3356 //qDebug("equal ");
3357 if ( mode < SYNC_PREF_FORCE_LOCAL ) 3357 if ( mode < SYNC_PREF_FORCE_LOCAL )
3358 return 0; 3358 return 0;
3359 3359
3360 }//else //debug only 3360 }//else //debug only
3361 //qDebug("not equal %s %s ", local->desc.c_str(), remote->desc.c_str()); 3361 //qDebug("not equal %s %s ", local->desc.c_str(), remote->desc.c_str());
3362 } 3362 }
3363 3363
3364 int result; 3364 int result;
3365 bool localIsNew; 3365 bool localIsNew;
3366 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); 3366 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() );
3367 3367
3368 if ( full && mode < SYNC_PREF_NEWEST ) 3368 if ( full && mode < SYNC_PREF_NEWEST )
3369 mode = SYNC_PREF_ASK; 3369 mode = SYNC_PREF_ASK;
3370 3370
3371 switch( mode ) { 3371 switch( mode ) {
3372 case SYNC_PREF_LOCAL: 3372 case SYNC_PREF_LOCAL:
3373 if ( lastSync > remoteMod ) 3373 if ( lastSync > remoteMod )
3374 return 1; 3374 return 1;
3375 if ( lastSync > localMod ) 3375 if ( lastSync > localMod )
3376 return 2; 3376 return 2;
3377 return 1; 3377 return 1;
3378 break; 3378 break;
3379 case SYNC_PREF_REMOTE: 3379 case SYNC_PREF_REMOTE:
3380 if ( lastSync > remoteMod ) 3380 if ( lastSync > remoteMod )
3381 return 1; 3381 return 1;
3382 if ( lastSync > localMod ) 3382 if ( lastSync > localMod )
3383 return 2; 3383 return 2;
3384 return 2; 3384 return 2;
3385 break; 3385 break;
3386 case SYNC_PREF_NEWEST: 3386 case SYNC_PREF_NEWEST:
3387 if ( localMod > remoteMod ) 3387 if ( localMod > remoteMod )
3388 return 1; 3388 return 1;
3389 else 3389 else
3390 return 2; 3390 return 2;
3391 break; 3391 break;
3392 case SYNC_PREF_ASK: 3392 case SYNC_PREF_ASK:
3393 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() ); 3393 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
3394 if ( lastSync > remoteMod ) 3394 if ( lastSync > remoteMod )
3395 return 1; 3395 return 1;
3396 if ( lastSync > localMod ) 3396 if ( lastSync > localMod )
3397 return 2; 3397 return 2;
3398 localIsNew = localMod >= remoteMod; 3398 localIsNew = localMod >= remoteMod;
3399 //qDebug("conflict! ************************************** "); 3399 //qDebug("conflict! ************************************** ");
3400 { 3400 {
3401 PwMDataItemChooser acd ( *local,*remote, localIsNew , 0/*this*/ ); 3401 PwMDataItemChooser acd ( *local,*remote, localIsNew , 0/*this*/ );
3402 result = acd.executeD(localIsNew); 3402 result = acd.executeD(localIsNew);
3403 return result; 3403 return result;
3404 } 3404 }
3405 break; 3405 break;
3406 case SYNC_PREF_FORCE_LOCAL: 3406 case SYNC_PREF_FORCE_LOCAL:
3407 return 1; 3407 return 1;
3408 break; 3408 break;
3409 case SYNC_PREF_FORCE_REMOTE: 3409 case SYNC_PREF_FORCE_REMOTE:
3410 return 2; 3410 return 2;
3411 break; 3411 break;
3412 3412
3413 default: 3413 default:
3414 // SYNC_PREF_TAKE_BOTH not implemented 3414 // SYNC_PREF_TAKE_BOTH not implemented
3415 break; 3415 break;
3416 } 3416 }
3417 return 0; 3417 return 0;
3418} 3418}
3419 3419
3420void PwMDoc::removeSyncInfo( QString syncProfile) 3420void PwMDoc::removeSyncInfo( QString syncProfile)
3421{ 3421{
3422 bool res, found; 3422 bool res, found;
3423 unsigned int count, i; 3423 unsigned int count, i;
3424 if ( syncProfile.isEmpty() ) { 3424 if ( syncProfile.isEmpty() ) {
3425 count = numSyncDataEntries(); 3425 count = numSyncDataEntries();
3426 for (i = count; count > 0; count-- ) { 3426 for (i = count; count > 0; count-- ) {
3427 res = delSyncDataEntry(i-1, false); 3427 res = delSyncDataEntry(i-1, false);
3428 if (res == false) { 3428 if (res == false) {
3429 qDebug("PwMDoc::removeSyncInfo: could not remove syncprofile"); 3429 qDebug("PwMDoc::removeSyncInfo: could not remove syncprofile");
3430 } 3430 }
3431 } 3431 }
3432 } else { 3432 } else {
3433 found = findSyncData(syncProfile, &count); 3433 found = findSyncData(syncProfile, &count);
3434 if (found == true) 3434 if (found == true)
3435 { 3435 {
3436 res = delSyncDataEntry(count, false); 3436 res = delSyncDataEntry(count, false);
3437 if (res == false) { 3437 if (res == false) {
3438 qDebug("PwMDoc::removeSyncInfo: could not remove %s", syncProfile.latin1()); 3438 qDebug("PwMDoc::removeSyncInfo: could not remove %s", syncProfile.latin1());
3439 3439
3440 } 3440 }
3441 } 3441 }
3442 } 3442 }
3443} 3443}
3444 3444
3445 3445
3446//this are the overwritten callbackmethods from the syncinterface 3446//this are the overwritten callbackmethods from the syncinterface
3447bool PwMDoc::sync(KSyncManager* manager, QString filename, int mode) 3447bool PwMDoc::sync(KSyncManager* manager, QString filename, int mode, QString resource)
3448{ 3448{
3449 QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); 3449 QString mCurrentSyncDevice = manager->getCurrentSyncDevice();
3450 3450
3451 //1) unlock local file first if necessary (ask for password) 3451 //1) unlock local file first if necessary (ask for password)
3452 if (this->isDeepLocked()) { 3452 if (this->isDeepLocked()) {
3453 PwMerror ret = this->deepLock(false); 3453 PwMerror ret = this->deepLock(false);
3454 if (ret != e_success) 3454 if (ret != e_success)
3455 return false; 3455 return false;
3456 } 3456 }
3457 3457
3458 //2) construct and open a new doc on the stack(automatic cleanup of remote file). 3458 //2) construct and open a new doc on the stack(automatic cleanup of remote file).
3459 PwMDoc syncTarget(this, "synctarget"); 3459 PwMDoc syncTarget(this, "synctarget");
3460 PwMDoc* pSyncTarget = &syncTarget; 3460 PwMDoc* pSyncTarget = &syncTarget;
3461 3461
3462 3462
3463 PwMerror err = pSyncTarget->openDoc(&filename, 1 /*== open with all entries locked*/); 3463 PwMerror err = pSyncTarget->openDoc(&filename, 1 /*== open with all entries locked*/);
3464 3464
3465 if (err == e_alreadyOpen) { 3465 if (err == e_alreadyOpen) {
3466 PwMDocList::listItem li; 3466 PwMDocList::listItem li;
3467 if (getOpenDocList()->find(filename.latin1(), &li)) 3467 if (getOpenDocList()->find(filename.latin1(), &li))
3468 pSyncTarget = li.doc; 3468 pSyncTarget = li.doc;
3469 else { 3469 else {
3470 qDebug("PwmDoc::sync: sync failed. Error %i while opening file %s",err, filename.latin1()); 3470 qDebug("PwmDoc::sync: sync failed. Error %i while opening file %s",err, filename.latin1());
3471 return false; 3471 return false;
3472 } 3472 }
3473 } 3473 }
3474 else if (err != e_success) { 3474 else if (err != e_success) {
3475 qDebug("PwmDoc::sync: sync failed. Error %i while opening file %s",err, filename.latin1()); 3475 qDebug("PwmDoc::sync: sync failed. Error %i while opening file %s",err, filename.latin1());
3476 return false; 3476 return false;
3477 } 3477 }
3478 3478
3479 qDebug("PWM file loaded %s,sync mode %d",filename.latin1(), mode ); 3479 qDebug("PWM file loaded %s,sync mode %d",filename.latin1(), mode );
3480 3480
3481 3481
3482 //3) unlock remote file first if necessary (ask for password) 3482 //3) unlock remote file first if necessary (ask for password)
3483 if (pSyncTarget->isDeepLocked()) { 3483 if (pSyncTarget->isDeepLocked()) {
3484 PwMerror ret = pSyncTarget->deepLock(false); 3484 PwMerror ret = pSyncTarget->deepLock(false);
3485 if (ret != e_success) 3485 if (ret != e_success)
3486 return false; 3486 return false;
3487 } 3487 }
3488 3488
3489 3489
3490 err = syncronize(manager, this, pSyncTarget, mode ); 3490 err = syncronize(manager, this, pSyncTarget, mode );
3491 3491
3492 if (err == e_success) { 3492 if (err == e_success) {
3493 if ( manager->mWriteBackFile ){ 3493 if ( manager->mWriteBackFile ){
3494 qDebug("Saving remote PWManager file"); 3494 qDebug("Saving remote PWManager file");
3495 err = pSyncTarget->saveDoc(conf()->confGlobCompression()); 3495 err = pSyncTarget->saveDoc(conf()->confGlobCompression());
3496 if (err != e_success) { 3496 if (err != e_success) {
3497 qDebug("PwmDoc::sync: Sync failed. Error %i while storing file %s",err, filename.latin1()); 3497 qDebug("PwmDoc::sync: Sync failed. Error %i while storing file %s",err, filename.latin1());
3498 return false; 3498 return false;
3499 } 3499 }
3500 } 3500 }
3501 3501
3502 flagDirty(); 3502 flagDirty();
3503 return true; 3503 return true;
3504 } 3504 }
3505 else { 3505 else {
3506 return false; 3506 return false;
3507 } 3507 }
3508} 3508}
3509 3509
3510#endif 3510#endif
3511 3511
3512 3512
3513bool PwMDoc::findSyncData(const QString &syncname, unsigned int *index) 3513bool PwMDoc::findSyncData(const QString &syncname, unsigned int *index)
3514{ 3514{
3515 vector<PwMSyncItem>::iterator i = dti.syncDta.begin(), 3515 vector<PwMSyncItem>::iterator i = dti.syncDta.begin(),
3516 end = dti.syncDta.end(); 3516 end = dti.syncDta.end();
3517 3517
3518 while (i != end) { 3518 while (i != end) {
3519 if ((*i).syncName == syncname.latin1()) { 3519 if ((*i).syncName == syncname.latin1()) {
3520 if (index) { 3520 if (index) {
3521 *index = i - dti.syncDta.begin(); 3521 *index = i - dti.syncDta.begin();
3522 } 3522 }
3523 return true; 3523 return true;
3524 } 3524 }
3525 ++i; 3525 ++i;
3526 } 3526 }
3527 return false; 3527 return false;
3528}; 3528};
3529 3529
3530/** add new syncdataentry */ 3530/** add new syncdataentry */
3531PwMerror PwMDoc::addSyncDataEntry(PwMSyncItem *d, bool dontFlagDirty) 3531PwMerror PwMDoc::addSyncDataEntry(PwMSyncItem *d, bool dontFlagDirty)
3532{ 3532{
3533 PWM_ASSERT(d); 3533 PWM_ASSERT(d);
3534 3534
3535 if (isDeepLocked()) { 3535 if (isDeepLocked()) {
3536 PwMerror ret; 3536 PwMerror ret;
3537 ret = deepLock(false); 3537 ret = deepLock(false);
3538 if (ret != e_success) 3538 if (ret != e_success)
3539 return e_lock; 3539 return e_lock;
3540 } 3540 }
3541 unsigned int index; 3541 unsigned int index;
3542 3542
3543 const QString tmp = d->syncName.c_str(); 3543 const QString tmp = d->syncName.c_str();
diff --git a/pwmanager/pwmanager/pwmdoc.h b/pwmanager/pwmanager/pwmdoc.h
index 45dd729..144831f 100644
--- a/pwmanager/pwmanager/pwmdoc.h
+++ b/pwmanager/pwmanager/pwmdoc.h
@@ -703,131 +703,131 @@ protected:
703 /** pointer to the list-view, using this document. 703 /** pointer to the list-view, using this document.
704 * As there can only be one list-view per doc, we 704 * As there can only be one list-view per doc, we
705 * don't need a list here. 705 * don't need a list here.
706 */ 706 */
707 PwMView *listView; 707 PwMView *listView;
708 /** unnamedNum is used to store the "unnamed counter" 708 /** unnamedNum is used to store the "unnamed counter"
709 * for this document, while it's unnamed. If it's 0, 709 * for this document, while it's unnamed. If it's 0,
710 * we have to get a new unique one. 710 * we have to get a new unique one.
711 */ 711 */
712 unsigned int unnamedNum; 712 unsigned int unnamedNum;
713 /** is this doc going to be deleted (executing in destructor context) */ 713 /** is this doc going to be deleted (executing in destructor context) */
714 bool deleted; 714 bool deleted;
715 /** document timer */ 715 /** document timer */
716 DocTimer *_timer; 716 DocTimer *_timer;
717 /** lock counter for the "dataChanged" signal */ 717 /** lock counter for the "dataChanged" signal */
718 unsigned int dataChangedLock; 718 unsigned int dataChangedLock;
719 719
720 /** list of all open documents */ 720 /** list of all open documents */
721 static PwMDocList openDocList; 721 static PwMDocList openDocList;
722 722
723protected: 723protected:
724 /** serialize "dta" and return it in "d". */ 724 /** serialize "dta" and return it in "d". */
725 bool serializeDta(string *d); 725 bool serializeDta(string *d);
726 /** de-serialize "d" and overwrite "dta" */ 726 /** de-serialize "d" and overwrite "dta" */
727 bool deSerializeDta(const string *d, bool entriesLocked); 727 bool deSerializeDta(const string *d, bool entriesLocked);
728 /** write header to file */ 728 /** write header to file */
729 PwMerror writeFileHeader(char keyHash, char dataHash, char crypt, char compress, 729 PwMerror writeFileHeader(char keyHash, char dataHash, char crypt, char compress,
730 QString *pw, QFile *f); 730 QString *pw, QFile *f);
731 /** write data-hash to file */ 731 /** write data-hash to file */
732 PwMerror writeDataHash(char dataHash, string *d, QFile *f); 732 PwMerror writeDataHash(char dataHash, string *d, QFile *f);
733 /** check header. Read header info and verify key-hash and filever. 733 /** check header. Read header info and verify key-hash and filever.
734 * returns length of header in "headerLength" */ 734 * returns length of header in "headerLength" */
735 PwMerror checkHeader(char *cryptAlgo, QString *pw, char *compress, 735 PwMerror checkHeader(char *cryptAlgo, QString *pw, char *compress,
736 unsigned int *headerLength, char *dataHashType, 736 unsigned int *headerLength, char *dataHashType,
737 string *dataHash, QFile *f); 737 string *dataHash, QFile *f);
738 /** check the data-hash */ 738 /** check the data-hash */
739 PwMerror checkDataHash(char dataHashType, const string *dataHash, const string *dataStream); 739 PwMerror checkDataHash(char dataHashType, const string *dataHash, const string *dataStream);
740 /** encrypt data "d" and write to "filename" */ 740 /** encrypt data "d" and write to "filename" */
741 PwMerror encrypt(string *d, const QString *pw, QFile *f, char algo, 741 PwMerror encrypt(string *d, const QString *pw, QFile *f, char algo,
742 char _hashalgo //US BUG: pass _hashalgo because we need it in hashPassphrase 742 char _hashalgo //US BUG: pass _hashalgo because we need it in hashPassphrase
743); 743);
744 /** read data from file beginning at "pos", decrypt and return it */ 744 /** read data from file beginning at "pos", decrypt and return it */
745 PwMerror decrypt(string *d, unsigned int pos, const QString *pw, char algo, 745 PwMerror decrypt(string *d, unsigned int pos, const QString *pw, char algo,
746 char _hashalgo, //US BUG: pass _hashalgo because we need it in hashPassphrase 746 char _hashalgo, //US BUG: pass _hashalgo because we need it in hashPassphrase
747QFile *f); 747QFile *f);
748 /** compress the data */ 748 /** compress the data */
749 bool compressDta(string *d, char algo); 749 bool compressDta(string *d, char algo);
750 /** uncompress the data */ 750 /** uncompress the data */
751 bool decompressDta(string *d, char algo); 751 bool decompressDta(string *d, char algo);
752 /** internal import function for a text-file generated by PwM. 752 /** internal import function for a text-file generated by PwM.
753 * If this is not a valid PwM-exported file, it returns e_fileFormat */ 753 * If this is not a valid PwM-exported file, it returns e_fileFormat */
754 PwMerror importText_PwM(const QString *file); 754 PwMerror importText_PwM(const QString *file);
755 /** PwM-text-import helper function to extract the name/pw/comment out 755 /** PwM-text-import helper function to extract the name/pw/comment out
756 * of one entry-line */ 756 * of one entry-line */
757 bool textExtractEntry_PwM(const char *in, ssize_t in_size, string *out); 757 bool textExtractEntry_PwM(const char *in, ssize_t in_size, string *out);
758 /** compare two strings */ 758 /** compare two strings */
759 bool compareString(const string &s1, const string &s2, bool caseSensitive, 759 bool compareString(const string &s1, const string &s2, bool caseSensitive,
760 bool exactWordMatch); 760 bool exactWordMatch);
761 /** clears all document-data */ 761 /** clears all document-data */
762 void clearDoc(); 762 void clearDoc();
763 /** delete all empty categories */ 763 /** delete all empty categories */
764 void delAllEmptyCat(bool dontFlagDirty); 764 void delAllEmptyCat(bool dontFlagDirty);
765 /** set a document status flag */ 765 /** set a document status flag */
766 void setDocStatFlag(unsigned int statFlag) 766 void setDocStatFlag(unsigned int statFlag)
767 { curDocStat |= statFlag; } 767 { curDocStat |= statFlag; }
768 /** unset a document status flag */ 768 /** unset a document status flag */
769 void unsetDocStatFlag(unsigned int statFlag) 769 void unsetDocStatFlag(unsigned int statFlag)
770 { curDocStat &= ~statFlag; } 770 { curDocStat &= ~statFlag; }
771 /** get a document status flag */ 771 /** get a document status flag */
772 bool getDocStatFlag(unsigned int statFlag) const 772 bool getDocStatFlag(unsigned int statFlag) const
773 { return (curDocStat & statFlag); } 773 { return (curDocStat & statFlag); }
774 /** set the "currentPassword" */ 774 /** set the "currentPassword" */
775 void setCurrentPw(const QString &pw) 775 void setCurrentPw(const QString &pw)
776 { 776 {
777 currentPw = pw; 777 currentPw = pw;
778 setDocStatFlag(DOC_STAT_DISK_DIRTY); 778 setDocStatFlag(DOC_STAT_DISK_DIRTY);
779 } 779 }
780 /** make a backup-copy of the given file */ 780 /** make a backup-copy of the given file */
781 bool backupFile(const QString &filePath); 781 bool backupFile(const QString &filePath);
782 /** copy a file from src to dst */ 782 /** copy a file from src to dst */
783 bool copyFile(const QString &src, const QString &dst); 783 bool copyFile(const QString &src, const QString &dst);
784 784
785 785
786 public: 786 public:
787#ifdef PWM_EMBEDDED 787#ifdef PWM_EMBEDDED
788 //US ENH: this is the magic function that syncronizes the local doc with the remote doc. 788 //US ENH: this is the magic function that syncronizes the local doc with the remote doc.
789 PwMerror syncronize(KSyncManager* manager, PwMDoc* syncLocal, PwMDoc* syncRemote, int mode ); 789 PwMerror syncronize(KSyncManager* manager, PwMDoc* syncLocal, PwMDoc* syncRemote, int mode );
790 790
791 //takePwMDataItem returns the following values 791 //takePwMDataItem returns the following values
792 // 0 equal 792 // 0 equal
793 // 1 take local 793 // 1 take local
794 // 2 take remote 794 // 2 take remote
795 // 3 cancel 795 // 3 cancel
796 int takePwMDataItem( PwMDataItem* local, PwMDataItem* remote, QDateTime lastSync, int mode , bool full ); 796 int takePwMDataItem( PwMDataItem* local, PwMDataItem* remote, QDateTime lastSync, int mode , bool full );
797 797
798 //the following methods are the overwritten callbackmethods from the syncinterface 798 //the following methods are the overwritten callbackmethods from the syncinterface
799 virtual bool sync(KSyncManager* manager, QString filename, int mode); 799 virtual bool sync(KSyncManager* manager, QString filename, int mode, QString resource);
800 virtual void removeSyncInfo( QString syncProfile); 800 virtual void removeSyncInfo( QString syncProfile);
801 801
802#endif 802#endif
803 //US ENH: helpermethods to return a whole category entry 803 //US ENH: helpermethods to return a whole category entry
804 /** returns a pointer to the categoryitem */ 804 /** returns a pointer to the categoryitem */
805 PwMCategoryItem* getCategoryEntry(unsigned int index) 805 PwMCategoryItem* getCategoryEntry(unsigned int index)
806 { return &(dti.dta[index]); } 806 { return &(dti.dta[index]); }
807 807
808 private: 808 private:
809 //US ENH: helpermethods to access the sync data for a certain syncname. 809 //US ENH: helpermethods to access the sync data for a certain syncname.
810 // It returns the syncdatas index 810 // It returns the syncdatas index
811 bool findSyncData(const QString &syncname, unsigned int *index); 811 bool findSyncData(const QString &syncname, unsigned int *index);
812 812
813 /** add new syncdataentry */ 813 /** add new syncdataentry */
814 PwMerror addSyncDataEntry(PwMSyncItem *d, bool dontFlagDirty = false); 814 PwMerror addSyncDataEntry(PwMSyncItem *d, bool dontFlagDirty = false);
815 815
816 /** returns a pointer to the syncdata */ 816 /** returns a pointer to the syncdata */
817 PwMSyncItem* getSyncDataEntry(unsigned int index) 817 PwMSyncItem* getSyncDataEntry(unsigned int index)
818 { return &(dti.syncDta[index]); } 818 { return &(dti.syncDta[index]); }
819 819
820 /** delete entry */ 820 /** delete entry */
821 bool delSyncDataEntry(unsigned int index, bool dontFlagDirty = false); 821 bool delSyncDataEntry(unsigned int index, bool dontFlagDirty = false);
822 822
823 /** returns number of categories */ 823 /** returns number of categories */
824 unsigned int numSyncDataEntries() 824 unsigned int numSyncDataEntries()
825 { return dti.syncDta.size(); } 825 { return dti.syncDta.size(); }
826 826
827 PwMDataItem* findEntryByID(const QString &uid, unsigned int *category, unsigned int *index); 827 PwMDataItem* findEntryByID(const QString &uid, unsigned int *category, unsigned int *index);
828 828
829 QStringList getIDEntryList(); 829 QStringList getIDEntryList();
830 830
831}; 831};
832 832
833#endif 833#endif