author | ulf69 <ulf69> | 2004-10-03 23:29:56 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-10-03 23:29:56 (UTC) |
commit | aaea91151fe9a747e9eddfb8ba7d5896744faf30 (patch) (unidiff) | |
tree | b2b064757d65bc83427e7a86692601364051b631 /pwmanager | |
parent | a5c204da5a2dba950fc5ad2c45861dbe56849c09 (diff) | |
download | kdepimpi-aaea91151fe9a747e9eddfb8ba7d5896744faf30.zip kdepimpi-aaea91151fe9a747e9eddfb8ba7d5896744faf30.tar.gz kdepimpi-aaea91151fe9a747e9eddfb8ba7d5896744faf30.tar.bz2 |
moved sync related progressbar management to ksyncmanager, and proceeded with
the sync implementation of pwmanager
-rw-r--r-- | pwmanager/pwmanager/pwm.cpp | 22 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwm.h | 1 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmdoc.cpp | 92 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmdoc.h | 25 |
4 files changed, 132 insertions, 8 deletions
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp index ac2e66e..014e809 100644 --- a/pwmanager/pwmanager/pwm.cpp +++ b/pwmanager/pwmanager/pwm.cpp | |||
@@ -1301,55 +1301,65 @@ void PwM::createAboutData_slot() | |||
1301 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 1301 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
1302 | #endif | 1302 | #endif |
1303 | 1303 | ||
1304 | "(c) 2004 Ulf Schenk\n" | 1304 | "(c) 2004 Ulf Schenk\n" |
1305 | "(c) 2004 Lutz Rogowski\n" | 1305 | "(c) 2004 Lutz Rogowski\n" |
1306 | "(c) 1997-2004, The KDE PIM Team\n" | 1306 | "(c) 1997-2004, The KDE PIM Team\n" |
1307 | 1307 | ||
1308 | "(c) Michael Buesch - main programming\nand current maintainer\nmbuesch@freenet.de\n" | 1308 | "(c) Michael Buesch - main programming\nand current maintainer\nmbuesch@freenet.de\n" |
1309 | "Matt Scifo - mscifo@o1.com\n" | 1309 | "Matt Scifo - mscifo@o1.com\n" |
1310 | "Elias Probst - elias.probst@gmx.de\n" | 1310 | "Elias Probst - elias.probst@gmx.de\n" |
1311 | "George Staikos - staikos@kde.org\n" | 1311 | "George Staikos - staikos@kde.org\n" |
1312 | "Matthew Palmer - mjp16@uow.edu.au\n" | 1312 | "Matthew Palmer - mjp16@uow.edu.au\n" |
1313 | "Olivier Sessink - gpasman@nl.linux.org\n" | 1313 | "Olivier Sessink - gpasman@nl.linux.org\n" |
1314 | "The libgcrypt developers -\nBlowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n" | 1314 | "The libgcrypt developers -\nBlowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n" |
1315 | "Troy Engel - tengel@sonic.net\n" | 1315 | "Troy Engel - tengel@sonic.net\n" |
1316 | "Wickey - wickey@gmx.at\n" | 1316 | "Wickey - wickey@gmx.at\n" |
1317 | "Ian MacGregor - original documentation author.\n" | 1317 | "Ian MacGregor - original documentation author.\n" |
1318 | ); | 1318 | ); |
1319 | } | 1319 | } |
1320 | 1320 | ||
1321 | 1321 | ||
1322 | //this are the overwritten callbackmethods from the syncinterface | 1322 | //this are the overwritten callbackmethods from the syncinterface |
1323 | bool PwM::sync(KSyncManager* manager, QString filename, int mode) | 1323 | bool PwM::sync(KSyncManager* manager, QString filename, int mode) |
1324 | { | 1324 | { |
1325 | return true; | 1325 | PWM_ASSERT(curDoc()); |
1326 | } | ||
1327 | 1326 | ||
1328 | bool PwM::syncExternal(KSyncManager* manager, QString resource) | 1327 | bool ret = curDoc()->sync(manager, filename, mode); |
1329 | { | 1328 | |
1330 | return true; | 1329 | if (ret == true) { |
1330 | //US BUG: what can we call here to update the view of the current doc? | ||
1331 | //mViewManager->refreshView(); | ||
1332 | } | ||
1333 | |||
1334 | return ret; | ||
1331 | } | 1335 | } |
1332 | 1336 | ||
1333 | //called by the syncmanager to indicate that the work has to marked as dirty. | 1337 | //called by the syncmanager to indicate that the work has to be marked as dirty. |
1334 | void PwM::sync_setModified() | 1338 | void PwM::sync_setModified() |
1335 | { | 1339 | { |
1340 | PWM_ASSERT(curDoc()); | ||
1341 | curDoc()->sync_setModified(); | ||
1336 | } | 1342 | } |
1337 | 1343 | ||
1338 | //called by the syncmanager to ask if the dirty flag is set. | 1344 | //called by the syncmanager to ask if the dirty flag is set. |
1339 | bool PwM::sync_isModified() | 1345 | bool PwM::sync_isModified() |
1340 | { | 1346 | { |
1347 | PWM_ASSERT(curDoc()); | ||
1348 | return curDoc()->sync_isModified(); | ||
1341 | } | 1349 | } |
1342 | 1350 | ||
1343 | //called by the syncmanager to indicate that the work has to be saved. | 1351 | //called by the syncmanager to indicate that the work has to be saved. |
1344 | void PwM::sync_save() | 1352 | void PwM::sync_save() |
1345 | { | 1353 | { |
1354 | PWM_ASSERT(curDoc()); | ||
1355 | return curDoc()->sync_save(); | ||
1346 | } | 1356 | } |
1347 | 1357 | ||
1348 | 1358 | ||
1349 | 1359 | ||
1350 | #endif | 1360 | #endif |
1351 | 1361 | ||
1352 | 1362 | ||
1353 | #ifndef PWM_EMBEDDED | 1363 | #ifndef PWM_EMBEDDED |
1354 | #include "pwm.moc" | 1364 | #include "pwm.moc" |
1355 | #endif | 1365 | #endif |
diff --git a/pwmanager/pwmanager/pwm.h b/pwmanager/pwmanager/pwm.h index 2fe7352..7c6bf0d 100644 --- a/pwmanager/pwmanager/pwm.h +++ b/pwmanager/pwmanager/pwm.h | |||
@@ -250,49 +250,48 @@ protected: | |||
250 | KPopupMenu *chipcardPopup; | 250 | KPopupMenu *chipcardPopup; |
251 | #endif // CONFIG_KEYCARD | 251 | #endif // CONFIG_KEYCARD |
252 | /** "view" popup-menu */ | 252 | /** "view" popup-menu */ |
253 | KPopupMenu *viewPopup; | 253 | KPopupMenu *viewPopup; |
254 | /** "options" popup-menu */ | 254 | /** "options" popup-menu */ |
255 | KPopupMenu *optionsPopup; | 255 | KPopupMenu *optionsPopup; |
256 | /** "help" popup-menu */ | 256 | /** "help" popup-menu */ |
257 | KPopupMenu *helpPopup; | 257 | KPopupMenu *helpPopup; |
258 | /** "export" popup-menu */ | 258 | /** "export" popup-menu */ |
259 | KPopupMenu *exportPopup; | 259 | KPopupMenu *exportPopup; |
260 | /** "import" popup-menu */ | 260 | /** "import" popup-menu */ |
261 | KPopupMenu *importPopup; | 261 | KPopupMenu *importPopup; |
262 | /** force quit this window? */ | 262 | /** force quit this window? */ |
263 | bool forceQuit; | 263 | bool forceQuit; |
264 | /** force minimize this window to the tray */ | 264 | /** force minimize this window to the tray */ |
265 | bool forceMinimizeToTray; | 265 | bool forceMinimizeToTray; |
266 | 266 | ||
267 | 267 | ||
268 | 268 | ||
269 | 269 | ||
270 | private: | 270 | private: |
271 | #ifdef PWM_EMBEDDED | 271 | #ifdef PWM_EMBEDDED |
272 | //this are the overwritten callbackmethods from the syncinterface | 272 | //this are the overwritten callbackmethods from the syncinterface |
273 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 273 | virtual bool sync(KSyncManager* manager, QString filename, int mode); |
274 | virtual bool syncExternal(KSyncManager* manager, QString resource); | ||
275 | 274 | ||
276 | //called by the syncmanager to indicate that the work has to marked as dirty. | 275 | //called by the syncmanager to indicate that the work has to marked as dirty. |
277 | virtual void sync_setModified(); | 276 | virtual void sync_setModified(); |
278 | //called by the syncmanager to ask if the dirty flag is set. | 277 | //called by the syncmanager to ask if the dirty flag is set. |
279 | virtual bool sync_isModified(); | 278 | virtual bool sync_isModified(); |
280 | //called by the syncmanager to indicate that the work has to be saved. | 279 | //called by the syncmanager to indicate that the work has to be saved. |
281 | virtual void sync_save(); | 280 | virtual void sync_save(); |
282 | 281 | ||
283 | // LR ******************************* | 282 | // LR ******************************* |
284 | // sync stuff! | 283 | // sync stuff! |
285 | QPopupMenu *syncPopup; | 284 | QPopupMenu *syncPopup; |
286 | KSyncManager* syncManager; | 285 | KSyncManager* syncManager; |
287 | #endif | 286 | #endif |
288 | 287 | ||
289 | 288 | ||
290 | 289 | ||
291 | 290 | ||
292 | 291 | ||
293 | 292 | ||
294 | 293 | ||
295 | 294 | ||
296 | }; | 295 | }; |
297 | 296 | ||
298 | #endif | 297 | #endif |
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp index 1b6d36f..82fc746 100644 --- a/pwmanager/pwmanager/pwmdoc.cpp +++ b/pwmanager/pwmanager/pwmdoc.cpp | |||
@@ -2760,27 +2760,119 @@ QString PwMDoc::getTitle() | |||
2760 | bool PwMDoc::tryDelete() | 2760 | bool PwMDoc::tryDelete() |
2761 | { | 2761 | { |
2762 | if (deleted) | 2762 | if (deleted) |
2763 | return true; | 2763 | return true; |
2764 | int ret; | 2764 | int ret; |
2765 | if (isDirty()) { | 2765 | if (isDirty()) { |
2766 | ret = dirtyAskSave(getTitle()); | 2766 | ret = dirtyAskSave(getTitle()); |
2767 | if (ret == 0) { // save to disk | 2767 | if (ret == 0) { // save to disk |
2768 | if (!saveDocUi(this)) | 2768 | if (!saveDocUi(this)) |
2769 | goto out_ignore; | 2769 | goto out_ignore; |
2770 | } else if (ret == 1) { // don't save and delete | 2770 | } else if (ret == 1) { // don't save and delete |
2771 | goto out_accept; | 2771 | goto out_accept; |
2772 | } else { // cancel operation | 2772 | } else { // cancel operation |
2773 | goto out_ignore; | 2773 | goto out_ignore; |
2774 | } | 2774 | } |
2775 | } | 2775 | } |
2776 | out_accept: | 2776 | out_accept: |
2777 | deleted = true; | 2777 | deleted = true; |
2778 | delete this; | 2778 | delete this; |
2779 | return true; | 2779 | return true; |
2780 | out_ignore: | 2780 | out_ignore: |
2781 | return false; | 2781 | return false; |
2782 | } | 2782 | } |
2783 | 2783 | ||
2784 | |||
2785 | |||
2786 | #ifdef PWM_EMBEDDED | ||
2787 | //US ENH: this is the magic function that syncronizes the this doc with the remote doc | ||
2788 | PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* syncRemote, int mode ) | ||
2789 | { | ||
2790 | bool syncOK = true; | ||
2791 | int addedPasswordsLocal = 0; | ||
2792 | int addedPasswordsRemote = 0; | ||
2793 | int deletedPasswordsRemote = 0; | ||
2794 | int deletedPasswordsLocal = 0; | ||
2795 | int changedLocal = 0; | ||
2796 | int changedRemote = 0; | ||
2797 | |||
2798 | QString mCurrentSyncName = manager->getCurrentSyncName(); | ||
2799 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | ||
2800 | |||
2801 | |||
2802 | |||
2803 | |||
2804 | |||
2805 | |||
2806 | |||
2807 | |||
2808 | |||
2809 | return e_success; | ||
2810 | } | ||
2811 | |||
2812 | |||
2813 | |||
2814 | //this are the overwritten callbackmethods from the syncinterface | ||
2815 | bool PwMDoc::sync(KSyncManager* manager, QString filename, int mode) | ||
2816 | { | ||
2817 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | ||
2818 | |||
2819 | // construct on the stack = automatic cleanup. | ||
2820 | PwMDoc syncTarget(this, "synctarget"); | ||
2821 | |||
2822 | PwMerror err = syncTarget.openDoc(&filename, 2 /*== deeplocked*/); | ||
2823 | |||
2824 | if (err != e_success) | ||
2825 | return false; | ||
2826 | |||
2827 | qDebug("PWM file loaded %s,sync mode %d",filename.latin1(), mode ); | ||
2828 | |||
2829 | |||
2830 | err = syncronize(manager, this, &syncTarget, mode ); | ||
2831 | |||
2832 | if (err == e_success) { | ||
2833 | if ( PWMPrefs::instance()->mWriteBackFile ){ | ||
2834 | qDebug("Saving remote PWManager file"); | ||
2835 | err = syncTarget.saveDoc(conf()->confGlobCompression()); | ||
2836 | if (err != e_success) | ||
2837 | return false; | ||
2838 | |||
2839 | } | ||
2840 | |||
2841 | flagDirty(); | ||
2842 | return true; | ||
2843 | } | ||
2844 | else { | ||
2845 | return false; | ||
2846 | } | ||
2847 | } | ||
2848 | |||
2849 | //called by the syncmanager to indicate that the work has to marked as dirty. | ||
2850 | void PwMDoc::sync_setModified() | ||
2851 | { | ||
2852 | flagDirty(); | ||
2853 | } | ||
2854 | |||
2855 | //called by the syncmanager to ask if the dirty flag is set. | ||
2856 | bool PwMDoc::sync_isModified() | ||
2857 | { | ||
2858 | return isDirty(); | ||
2859 | } | ||
2860 | |||
2861 | //called by the syncmanager to indicate that the work has to be saved. | ||
2862 | void PwMDoc::sync_save() | ||
2863 | { | ||
2864 | PwMerror ret = saveDoc(conf()->confGlobCompression()); | ||
2865 | } | ||
2866 | |||
2867 | #endif | ||
2868 | |||
2869 | |||
2870 | |||
2871 | |||
2872 | |||
2873 | |||
2874 | |||
2875 | |||
2784 | #ifndef PWM_EMBEDDED | 2876 | #ifndef PWM_EMBEDDED |
2785 | #include "pwmdoc.moc" | 2877 | #include "pwmdoc.moc" |
2786 | #endif | 2878 | #endif |
diff --git a/pwmanager/pwmanager/pwmdoc.h b/pwmanager/pwmanager/pwmdoc.h index 193247e..ea4d687 100644 --- a/pwmanager/pwmanager/pwmdoc.h +++ b/pwmanager/pwmanager/pwmdoc.h | |||
@@ -38,48 +38,49 @@ | |||
38 | #define PWM_CRYPT_TWOFISH(static_cast<char>(0x06)) | 38 | #define PWM_CRYPT_TWOFISH(static_cast<char>(0x06)) |
39 | #define PWM_CRYPT_TWOFISH128(static_cast<char>(0x07)) | 39 | #define PWM_CRYPT_TWOFISH128(static_cast<char>(0x07)) |
40 | 40 | ||
41 | #define PWM_COMPRESS_NONE(static_cast<char>(0x00)) | 41 | #define PWM_COMPRESS_NONE(static_cast<char>(0x00)) |
42 | #define PWM_COMPRESS_GZIP(static_cast<char>(0x01)) | 42 | #define PWM_COMPRESS_GZIP(static_cast<char>(0x01)) |
43 | #define PWM_COMPRESS_BZIP2(static_cast<char>(0x02)) | 43 | #define PWM_COMPRESS_BZIP2(static_cast<char>(0x02)) |
44 | 44 | ||
45 | #define DEFAULT_MAX_ENTRIES(~(static_cast<unsigned int>(0))) | 45 | #define DEFAULT_MAX_ENTRIES(~(static_cast<unsigned int>(0))) |
46 | #define FILE_ID_HEADER "PWM_PASSWORD_FILE" | 46 | #define FILE_ID_HEADER "PWM_PASSWORD_FILE" |
47 | 47 | ||
48 | 48 | ||
49 | #include "pwmexception.h" | 49 | #include "pwmexception.h" |
50 | #include "pwmdocui.h" | 50 | #include "pwmdocui.h" |
51 | 51 | ||
52 | #include <qobject.h> | 52 | #include <qobject.h> |
53 | #include <qtimer.h> | 53 | #include <qtimer.h> |
54 | #include <qdatetime.h> | 54 | #include <qdatetime.h> |
55 | 55 | ||
56 | #include <kprocess.h> | 56 | #include <kprocess.h> |
57 | 57 | ||
58 | #ifndef PWM_EMBEDDED | 58 | #ifndef PWM_EMBEDDED |
59 | #include "configuration.h" | 59 | #include "configuration.h" |
60 | #else | 60 | #else |
61 | #include <kapplication.h> | 61 | #include <kapplication.h> |
62 | #include <ksyncmanager.h> | ||
62 | #endif | 63 | #endif |
63 | 64 | ||
64 | #include <string> | 65 | #include <string> |
65 | #include <vector> | 66 | #include <vector> |
66 | #include <utility> | 67 | #include <utility> |
67 | 68 | ||
68 | using std::vector; | 69 | using std::vector; |
69 | using std::string; | 70 | using std::string; |
70 | using std::pair; | 71 | using std::pair; |
71 | 72 | ||
72 | /* used in findEntry() function */ | 73 | /* used in findEntry() function */ |
73 | #define SEARCH_IN_DESC (1) | 74 | #define SEARCH_IN_DESC (1) |
74 | #define SEARCH_IN_NAME (1 << 1) | 75 | #define SEARCH_IN_NAME (1 << 1) |
75 | #define SEARCH_IN_PW (1 << 2) | 76 | #define SEARCH_IN_PW (1 << 2) |
76 | #define SEARCH_IN_COMMENT(1 << 3) | 77 | #define SEARCH_IN_COMMENT(1 << 3) |
77 | #define SEARCH_IN_URL (1 << 4) | 78 | #define SEARCH_IN_URL (1 << 4) |
78 | #define SEARCH_IN_LAUNCHER(1 << 5) | 79 | #define SEARCH_IN_LAUNCHER(1 << 5) |
79 | #define SEARCH_IN_ALL (SEARCH_IN_DESC | SEARCH_IN_NAME| \ | 80 | #define SEARCH_IN_ALL (SEARCH_IN_DESC | SEARCH_IN_NAME| \ |
80 | SEARCH_IN_PW | SEARCH_IN_COMMENT| \ | 81 | SEARCH_IN_PW | SEARCH_IN_COMMENT| \ |
81 | SEARCH_IN_URL| SEARCH_IN_LAUNCHER) | 82 | SEARCH_IN_URL| SEARCH_IN_LAUNCHER) |
82 | 83 | ||
83 | /** document deeplocked. Data is out for lunch to disk */ | 84 | /** document deeplocked. Data is out for lunch to disk */ |
84 | #define DOC_STAT_DEEPLOCKED (1) | 85 | #define DOC_STAT_DEEPLOCKED (1) |
85 | /** encrypted document on disk is dirty. data has to go to disk. */ | 86 | /** encrypted document on disk is dirty. data has to go to disk. */ |
@@ -314,49 +315,52 @@ protected slots: | |||
314 | void mpwTimeout(); | 315 | void mpwTimeout(); |
315 | /** timeout slot for the autoLock timer */ | 316 | /** timeout slot for the autoLock timer */ |
316 | void autoLockTimeout(); | 317 | void autoLockTimeout(); |
317 | /** timeout slot for the metaCheck timer */ | 318 | /** timeout slot for the metaCheck timer */ |
318 | void metaCheckTimeout(); | 319 | void metaCheckTimeout(); |
319 | 320 | ||
320 | protected: | 321 | protected: |
321 | /** pointer to the document associated with this timer. */ | 322 | /** pointer to the document associated with this timer. */ |
322 | PwMDoc *doc; | 323 | PwMDoc *doc; |
323 | /** timer object for mpw timer */ | 324 | /** timer object for mpw timer */ |
324 | QTimer *mpwTimer; | 325 | QTimer *mpwTimer; |
325 | /** timer object for the autoLock timer */ | 326 | /** timer object for the autoLock timer */ |
326 | QTimer *autoLockTimer; | 327 | QTimer *autoLockTimer; |
327 | /** timer object for the metaCheck timer */ | 328 | /** timer object for the metaCheck timer */ |
328 | QTimer *metaCheckTimer; | 329 | QTimer *metaCheckTimer; |
329 | /** lock counter for the mpw timer */ | 330 | /** lock counter for the mpw timer */ |
330 | unsigned int mpwLock; | 331 | unsigned int mpwLock; |
331 | /** lock counter for the autoLock timer */ | 332 | /** lock counter for the autoLock timer */ |
332 | unsigned int autoLockLock; | 333 | unsigned int autoLockLock; |
333 | /** lock counter for the metaCheck timer */ | 334 | /** lock counter for the metaCheck timer */ |
334 | unsigned int metaCheckLock; | 335 | unsigned int metaCheckLock; |
335 | }; | 336 | }; |
336 | 337 | ||
337 | /** Document class for PwM */ | 338 | /** Document class for PwM */ |
338 | class PwMDoc : public PwMDocUi | 339 | //US ENH: derived from KSyncInterfaces, to get called by PwM when a sync is required. |
340 | // But PwMDoc is handling the sync by itself. | ||
341 | class PwMDoc : public PwMDocUi, public KSyncInterface | ||
342 | |||
339 | { | 343 | { |
340 | Q_OBJECT | 344 | Q_OBJECT |
341 | friend class DocTimer; | 345 | friend class DocTimer; |
342 | 346 | ||
343 | public: | 347 | public: |
344 | /** construtor */ | 348 | /** construtor */ |
345 | PwMDoc(QObject* parent = 0, const char *name = 0); | 349 | PwMDoc(QObject* parent = 0, const char *name = 0); |
346 | /** destructor */ | 350 | /** destructor */ |
347 | ~PwMDoc(); | 351 | ~PwMDoc(); |
348 | 352 | ||
349 | /** returns a pointer to a list of all open documents */ | 353 | /** returns a pointer to a list of all open documents */ |
350 | static PwMDocList* getOpenDocList() | 354 | static PwMDocList* getOpenDocList() |
351 | { return &openDocList; } | 355 | { return &openDocList; } |
352 | 356 | ||
353 | /** flag document dirty. dta changed */ | 357 | /** flag document dirty. dta changed */ |
354 | void flagDirty() | 358 | void flagDirty() |
355 | { | 359 | { |
356 | setDocStatFlag(DOC_STAT_DISK_DIRTY); | 360 | setDocStatFlag(DOC_STAT_DISK_DIRTY); |
357 | emitDataChanged(this); | 361 | emitDataChanged(this); |
358 | } | 362 | } |
359 | /** modified? */ | 363 | /** modified? */ |
360 | bool isDirty() | 364 | bool isDirty() |
361 | { return getDocStatFlag(DOC_STAT_DISK_DIRTY); } | 365 | { return getDocStatFlag(DOC_STAT_DISK_DIRTY); } |
362 | /** save document to disk */ | 366 | /** save document to disk */ |
@@ -675,27 +679,46 @@ protected: | |||
675 | bool exactWordMatch); | 679 | bool exactWordMatch); |
676 | /** clears all document-data */ | 680 | /** clears all document-data */ |
677 | void clearDoc(); | 681 | void clearDoc(); |
678 | /** delete all empty categories */ | 682 | /** delete all empty categories */ |
679 | void delAllEmptyCat(bool dontFlagDirty); | 683 | void delAllEmptyCat(bool dontFlagDirty); |
680 | /** set a document status flag */ | 684 | /** set a document status flag */ |
681 | void setDocStatFlag(unsigned int statFlag) | 685 | void setDocStatFlag(unsigned int statFlag) |
682 | { curDocStat |= statFlag; } | 686 | { curDocStat |= statFlag; } |
683 | /** unset a document status flag */ | 687 | /** unset a document status flag */ |
684 | void unsetDocStatFlag(unsigned int statFlag) | 688 | void unsetDocStatFlag(unsigned int statFlag) |
685 | { curDocStat &= ~statFlag; } | 689 | { curDocStat &= ~statFlag; } |
686 | /** get a document status flag */ | 690 | /** get a document status flag */ |
687 | bool getDocStatFlag(unsigned int statFlag) const | 691 | bool getDocStatFlag(unsigned int statFlag) const |
688 | { return (curDocStat & statFlag); } | 692 | { return (curDocStat & statFlag); } |
689 | /** set the "currentPassword" */ | 693 | /** set the "currentPassword" */ |
690 | void setCurrentPw(const QString &pw) | 694 | void setCurrentPw(const QString &pw) |
691 | { | 695 | { |
692 | currentPw = pw; | 696 | currentPw = pw; |
693 | setDocStatFlag(DOC_STAT_DISK_DIRTY); | 697 | setDocStatFlag(DOC_STAT_DISK_DIRTY); |
694 | } | 698 | } |
695 | /** make a backup-copy of the given file */ | 699 | /** make a backup-copy of the given file */ |
696 | bool backupFile(const QString &filePath); | 700 | bool backupFile(const QString &filePath); |
697 | /** copy a file from src to dst */ | 701 | /** copy a file from src to dst */ |
698 | bool copyFile(const QString &src, const QString &dst); | 702 | bool copyFile(const QString &src, const QString &dst); |
703 | |||
704 | |||
705 | public: | ||
706 | #ifdef PWM_EMBEDDED | ||
707 | //US ENH: this is the magic function that syncronizes the local doc with the remote doc. | ||
708 | PwMerror syncronize(KSyncManager* manager, PwMDoc* syncLocal, PwMDoc* syncRemote, int mode ); | ||
709 | |||
710 | |||
711 | //the following methods are the overwritten callbackmethods from the syncinterface | ||
712 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | ||
713 | |||
714 | //called by the syncmanager to indicate that the work has to be marked as dirty. | ||
715 | virtual void sync_setModified(); | ||
716 | //called by the syncmanager to ask if the dirty flag is set. | ||
717 | virtual bool sync_isModified(); | ||
718 | //called by the syncmanager to indicate that the work has to be saved. | ||
719 | virtual void sync_save(); | ||
720 | #endif | ||
721 | |||
699 | }; | 722 | }; |
700 | 723 | ||
701 | #endif | 724 | #endif |