author | zautrix <zautrix> | 2004-10-19 23:38:16 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-19 23:38:16 (UTC) |
commit | f013ff3c0108100c6dbf037a05502ed493361fbf (patch) (unidiff) | |
tree | bf274ac58b55cea0e2f609db8ae5f27f4418a2df /pwmanager | |
parent | f605b2d40ff0f90b132ca880afa83ac751162a2e (diff) | |
download | kdepimpi-f013ff3c0108100c6dbf037a05502ed493361fbf.zip kdepimpi-f013ff3c0108100c6dbf037a05502ed493361fbf.tar.gz kdepimpi-f013ff3c0108100c6dbf037a05502ed493361fbf.tar.bz2 |
desktop fixes
-rw-r--r-- | pwmanager/pwmanager/main.cpp | 1 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwm.cpp | 12 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwm.h | 8 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmanager.pro | 33 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmdoc.cpp | 8 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwminit.cpp | 16 | ||||
-rw-r--r-- | pwmanager/pwmanager/serializer.cpp | 6 |
7 files changed, 52 insertions, 32 deletions
diff --git a/pwmanager/pwmanager/main.cpp b/pwmanager/pwmanager/main.cpp index 3f2d055..9d1d863 100644 --- a/pwmanager/pwmanager/main.cpp +++ b/pwmanager/pwmanager/main.cpp | |||
@@ -182,32 +182,33 @@ int main(int argc, char *argv[]) | |||
182 | #else | 182 | #else |
183 | QString fileName ; | 183 | QString fileName ; |
184 | fileName = qApp->applicationDirPath () + "/kdepim/pwmanager/icons22/"; | 184 | fileName = qApp->applicationDirPath () + "/kdepim/pwmanager/icons22/"; |
185 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 185 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
186 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); | 186 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); |
187 | 187 | ||
188 | #endif | 188 | #endif |
189 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "pwmanager"))); | 189 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "pwmanager"))); |
190 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 190 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
191 | 191 | ||
192 | a.newInstance(); | 192 | a.newInstance(); |
193 | 193 | ||
194 | //US KAddressBookMain m ; | 194 | //US KAddressBookMain m ; |
195 | 195 | ||
196 | //US QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 196 | //US QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
197 | /*US | 197 | /*US |
198 | #ifndef DESKTOP_VERSION | 198 | #ifndef DESKTOP_VERSION |
199 | a.showMainWidget( &m ); | 199 | a.showMainWidget( &m ); |
200 | #else | 200 | #else |
201 | a.setMainWidget( &m ); | 201 | a.setMainWidget( &m ); |
202 | m.resize (640, 480 ); | 202 | m.resize (640, 480 ); |
203 | m.show(); | 203 | m.show(); |
204 | #endif | 204 | #endif |
205 | */ | 205 | */ |
206 | qDebug("exec "); | ||
206 | a.exec(); | 207 | a.exec(); |
207 | 208 | ||
208 | } | 209 | } |
209 | qDebug("PWMPI: Bye! "); | 210 | qDebug("PWMPI: Bye! "); |
210 | 211 | ||
211 | #endif | 212 | #endif |
212 | 213 | ||
213 | } | 214 | } |
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp index 26a44b1..c511661 100644 --- a/pwmanager/pwmanager/pwm.cpp +++ b/pwmanager/pwmanager/pwm.cpp | |||
@@ -565,52 +565,52 @@ bool PwM::save() | |||
565 | if (!curDoc()->saveDocUi(curDoc())) | 565 | if (!curDoc()->saveDocUi(curDoc())) |
566 | return false; | 566 | return false; |
567 | showStatMsg(i18n("Successfully saved data.")); | 567 | showStatMsg(i18n("Successfully saved data.")); |
568 | updateCaption(); | 568 | updateCaption(); |
569 | return true; | 569 | return true; |
570 | } | 570 | } |
571 | 571 | ||
572 | void PwM::saveAs_slot() | 572 | void PwM::saveAs_slot() |
573 | { | 573 | { |
574 | saveAs(); | 574 | saveAs(); |
575 | } | 575 | } |
576 | 576 | ||
577 | bool PwM::saveAs() | 577 | bool PwM::saveAs() |
578 | { | 578 | { |
579 | if (!curDoc()->saveAsDocUi(curDoc())) | 579 | if (!curDoc()->saveAsDocUi(curDoc())) |
580 | return false; | 580 | return false; |
581 | showStatMsg(i18n("Successfully saved data.")); | 581 | showStatMsg(i18n("Successfully saved data.")); |
582 | updateCaption(); | 582 | updateCaption(); |
583 | return true; | 583 | return true; |
584 | } | 584 | } |
585 | 585 | ||
586 | //US ENH : changed code to run with older MOC | 586 | //US ENH : changed code to run with older MOC |
587 | void PwM::addPwd_slot() | 587 | void PwM::addPwd_slot() |
588 | { | 588 | { |
589 | addPwd_slot(0, 0); | 589 | addPwd_slot1(0, 0); |
590 | } | 590 | } |
591 | 591 | ||
592 | void PwM::addPwd_slot(QString *pw, PwMDoc *_doc) | 592 | void PwM::addPwd_slot1(QString *pw, PwMDoc *_doc) |
593 | { | 593 | { |
594 | PwMDoc *doc; | 594 | PwMDoc *doc; |
595 | if (_doc) { | 595 | if (_doc) { |
596 | doc = _doc; | 596 | doc = _doc; |
597 | } else { | 597 | } else { |
598 | doc = curDoc(); | 598 | doc = curDoc(); |
599 | } | 599 | } |
600 | PWM_ASSERT(doc); | 600 | PWM_ASSERT(doc); |
601 | doc->timer()->getLock(DocTimer::id_autoLockTimer); | 601 | doc->timer()->getLock(DocTimer::id_autoLockTimer); |
602 | #ifndef PWM_EMBEDDED | 602 | #ifndef PWM_EMBEDDED |
603 | AddEntryWndImpl w; | 603 | AddEntryWndImpl w; |
604 | #else | 604 | #else |
605 | AddEntryWndImpl w(this, "addentrywndimpl"); | 605 | AddEntryWndImpl w(this, "addentrywndimpl"); |
606 | #endif | 606 | #endif |
607 | 607 | ||
608 | vector<string> catList; | 608 | vector<string> catList; |
609 | doc->getCategoryList(&catList); | 609 | doc->getCategoryList(&catList); |
610 | unsigned i, size = catList.size(); | 610 | unsigned i, size = catList.size(); |
611 | for (i = 0; i < size; ++i) { | 611 | for (i = 0; i < size; ++i) { |
612 | w.addCategory(catList[i].c_str()); | 612 | w.addCategory(catList[i].c_str()); |
613 | } | 613 | } |
614 | w.setCurrCategory(view->getCurrentCategory()); | 614 | w.setCurrCategory(view->getCurrentCategory()); |
615 | if (pw) | 615 | if (pw) |
616 | w.pwLineEdit->setText(*pw); | 616 | w.pwLineEdit->setText(*pw); |
@@ -634,57 +634,57 @@ void PwM::addPwd_slot(QString *pw, PwMDoc *_doc) | |||
634 | PwMerror ret = doc->addEntry(w.getCategory(), &d); | 634 | PwMerror ret = doc->addEntry(w.getCategory(), &d); |
635 | if (ret == e_entryExists) { | 635 | if (ret == e_entryExists) { |
636 | KMessageBox::error(this, | 636 | KMessageBox::error(this, |
637 | i18n | 637 | i18n |
638 | ("An entry with this \"Description\",\n" | 638 | ("An entry with this \"Description\",\n" |
639 | "does already exist.\n" | 639 | "does already exist.\n" |
640 | "Please select another description."), | 640 | "Please select another description."), |
641 | i18n("entry already exists.")); | 641 | i18n("entry already exists.")); |
642 | goto tryAgain; | 642 | goto tryAgain; |
643 | } else if (ret == e_maxAllowedEntr) { | 643 | } else if (ret == e_maxAllowedEntr) { |
644 | KMessageBox::error(this, i18n("The maximum possible number of\nentries" | 644 | KMessageBox::error(this, i18n("The maximum possible number of\nentries" |
645 | "has been reached.\nYou can't add more entries."), | 645 | "has been reached.\nYou can't add more entries."), |
646 | i18n("maximum number of entries")); | 646 | i18n("maximum number of entries")); |
647 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 647 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
648 | return; | 648 | return; |
649 | } | 649 | } |
650 | } | 650 | } |
651 | setVirgin(false); | 651 | setVirgin(false); |
652 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 652 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
653 | } | 653 | } |
654 | 654 | ||
655 | //US ENH : changed code to run with older MOC | 655 | //US ENH : changed code to run with older MOC |
656 | void PwM::editPwd_slot() | 656 | void PwM::editPwd_slot() |
657 | { | 657 | { |
658 | editPwd_slot(0,0,0); | 658 | editPwd_slot3(0,0,0); |
659 | } | 659 | } |
660 | 660 | ||
661 | void PwM::editPwd_slot(const QString *category) | 661 | void PwM::editPwd_slot1(const QString *category) |
662 | { | 662 | { |
663 | editPwd_slot(category, 0, 0); | 663 | editPwd_slot3(category, 0, 0); |
664 | } | 664 | } |
665 | 665 | ||
666 | void PwM::editPwd_slot(const QString *category, const int *index, | 666 | void PwM::editPwd_slot3(const QString *category, const int *index, |
667 | PwMDoc *_doc) | 667 | PwMDoc *_doc) |
668 | { | 668 | { |
669 | PwMDoc *doc; | 669 | PwMDoc *doc; |
670 | if (_doc) { | 670 | if (_doc) { |
671 | doc = _doc; | 671 | doc = _doc; |
672 | } else { | 672 | } else { |
673 | doc = curDoc(); | 673 | doc = curDoc(); |
674 | } | 674 | } |
675 | PWM_ASSERT(doc); | 675 | PWM_ASSERT(doc); |
676 | if (doc->isDocEmpty()) | 676 | if (doc->isDocEmpty()) |
677 | return; | 677 | return; |
678 | if (doc->isDeepLocked()) | 678 | if (doc->isDeepLocked()) |
679 | return; | 679 | return; |
680 | doc->timer()->getLock(DocTimer::id_autoLockTimer); | 680 | doc->timer()->getLock(DocTimer::id_autoLockTimer); |
681 | unsigned int curEntryIndex; | 681 | unsigned int curEntryIndex; |
682 | if (index) { | 682 | if (index) { |
683 | curEntryIndex = *index; | 683 | curEntryIndex = *index; |
684 | } else { | 684 | } else { |
685 | if (!(view->getCurEntryIndex(&curEntryIndex))) { | 685 | if (!(view->getCurEntryIndex(&curEntryIndex))) { |
686 | printDebug("couldn't get index. Maybe we have a binary entry here."); | 686 | printDebug("couldn't get index. Maybe we have a binary entry here."); |
687 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 687 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
688 | return; | 688 | return; |
689 | } | 689 | } |
690 | } | 690 | } |
diff --git a/pwmanager/pwmanager/pwm.h b/pwmanager/pwmanager/pwm.h index fe1f7a1..116bc66 100644 --- a/pwmanager/pwmanager/pwm.h +++ b/pwmanager/pwmanager/pwm.h | |||
@@ -113,56 +113,58 @@ public slots: | |||
113 | /** file/close triggered */ | 113 | /** file/close triggered */ |
114 | void close_slot(); | 114 | void close_slot(); |
115 | /** file/quit triggered */ | 115 | /** file/quit triggered */ |
116 | void quitButton_slot(); | 116 | void quitButton_slot(); |
117 | /** file/save triggered */ | 117 | /** file/save triggered */ |
118 | void save_slot(); | 118 | void save_slot(); |
119 | /** file/saveAs triggered */ | 119 | /** file/saveAs triggered */ |
120 | void saveAs_slot(); | 120 | void saveAs_slot(); |
121 | /** file/export/text triggered */ | 121 | /** file/export/text triggered */ |
122 | void exportToText(); | 122 | void exportToText(); |
123 | /** file/export/gpasman triggered */ | 123 | /** file/export/gpasman triggered */ |
124 | void exportToGpasman(); | 124 | void exportToGpasman(); |
125 | /** file/export/kwallet triggered */ | 125 | /** file/export/kwallet triggered */ |
126 | void exportToKWallet(); | 126 | void exportToKWallet(); |
127 | /** file/import/text triggered */ | 127 | /** file/import/text triggered */ |
128 | bool importFromText(); | 128 | bool importFromText(); |
129 | /** file/import/gpasman triggered */ | 129 | /** file/import/gpasman triggered */ |
130 | bool importFromGpasman(); | 130 | bool importFromGpasman(); |
131 | /** file/import/kwallet triggered */ | 131 | /** file/import/kwallet triggered */ |
132 | bool importKWallet(); | 132 | bool importKWallet(); |
133 | /** file/print triggered */ | 133 | /** file/print triggered */ |
134 | void print_slot(); | 134 | void print_slot(); |
135 | /** manage/add triggered */ | 135 | /** manage/add triggered */ |
136 | //US ENH : changed code to run with older MOC | 136 | //US ENH : changed code to run with older MOC |
137 | |||
137 | void addPwd_slot(); | 138 | void addPwd_slot(); |
138 | void addPwd_slot(QString *pw, PwMDoc *_doc); | 139 | void addPwd_slot1(QString *pw, PwMDoc *_doc); |
139 | /** manage/edit triggered */ | 140 | /** manage/edit triggered */ |
140 | //US ENH : changed code to run with older MOC | 141 | //US ENH : changed code to run with older MOC |
141 | void editPwd_slot(); | 142 | void editPwd_slot(); |
142 | void editPwd_slot(const QString *category); | 143 | void editPwd_slot1(const QString *category); |
143 | void editPwd_slot(const QString *category = 0, const int *index = 0, | 144 | void editPwd_slot3(const QString *category = 0, const int *index = 0, |
144 | PwMDoc *_doc = 0); | 145 | PwMDoc *_doc = 0); |
146 | |||
145 | /** manage/delete triggered */ | 147 | /** manage/delete triggered */ |
146 | void deletePwd_slot(); | 148 | void deletePwd_slot(); |
147 | /** execute the "Launcher" entry */ | 149 | /** execute the "Launcher" entry */ |
148 | void execLauncher_slot(); | 150 | void execLauncher_slot(); |
149 | /** open browser with URL entry */ | 151 | /** open browser with URL entry */ |
150 | void goToURL_slot(); | 152 | void goToURL_slot(); |
151 | /** manage/changeMasterPwd triggered */ | 153 | /** manage/changeMasterPwd triggered */ |
152 | void changeMasterPwd_slot(); | 154 | void changeMasterPwd_slot(); |
153 | /** lock current document */ | 155 | /** lock current document */ |
154 | void lockWnd_slot(); | 156 | void lockWnd_slot(); |
155 | /** deeplock current document */ | 157 | /** deeplock current document */ |
156 | void deepLockWnd_slot(); | 158 | void deepLockWnd_slot(); |
157 | /** window/unlock triggered */ | 159 | /** window/unlock triggered */ |
158 | void unlockWnd_slot(); | 160 | void unlockWnd_slot(); |
159 | /** find item */ | 161 | /** find item */ |
160 | void find_slot(); | 162 | void find_slot(); |
161 | /** configure clicked */ | 163 | /** configure clicked */ |
162 | void config_slot(); | 164 | void config_slot(); |
163 | /** (de)activate the "change master pw" button in the menu-bar */ | 165 | /** (de)activate the "change master pw" button in the menu-bar */ |
164 | void activateMpButton(bool activate = true); | 166 | void activateMpButton(bool activate = true); |
165 | /** generate a new chipcard */ | 167 | /** generate a new chipcard */ |
166 | void genNewCard_slot(); | 168 | void genNewCard_slot(); |
167 | /** completely erase the current card */ | 169 | /** completely erase the current card */ |
168 | void eraseCard_slot(); | 170 | void eraseCard_slot(); |
diff --git a/pwmanager/pwmanager/pwmanager.pro b/pwmanager/pwmanager/pwmanager.pro index 34f7403..7f39c76 100644 --- a/pwmanager/pwmanager/pwmanager.pro +++ b/pwmanager/pwmanager/pwmanager.pro | |||
@@ -1,54 +1,59 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | 3 | DESTDIR= ../../bin | |
4 | |||
5 | TARGET = pwmpi | 4 | TARGET = pwmpi |
6 | OBJECTS_DIR = obj/$(PLATFORM) | 5 | include( ../../variables.pri ) |
7 | MOC_DIR = moc/$(PLATFORM) | ||
8 | DESTDIR=$(QPEDIR)/bin | ||
9 | 6 | ||
10 | INCLUDEPATH += . ../../ ../../qtcompat ../../qtcompat/xml ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils $(QPEDIR)/include | 7 | INCLUDEPATH += . ../../ ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils |
11 | DEFINES += PWM_EMBEDDED CONFIG_PWMANAGER_GCRY DESKTOP_VERSION | 8 | DEFINES += PWM_EMBEDDED CONFIG_PWMANAGER_GCRY DESKTOP_VERSION |
12 | 9 | ||
13 | #enable this setting if you want debugoutput for pwmanager | 10 | #enable this setting if you want debugoutput for pwmanager |
14 | #DEFINES += CONFIG_DEBUG | 11 | #DEFINES += CONFIG_DEBUG |
15 | LIBS += -L../libcrypt/$(PLATFORM) | 12 | LIBS += -L../libcrypt/ |
13 | LIBS += -L../../bin/ | ||
16 | LIBS += -lmicrokde | 14 | LIBS += -lmicrokde |
17 | LIBS += -lmicroqtcompat | ||
18 | LIBS += -lmicrokdepim | 15 | LIBS += -lmicrokdepim |
19 | LIBS += -L$(QPEDIR)/lib | ||
20 | LIBS += -lqpe | ||
21 | LIBS += -lzlib | 16 | LIBS += -lzlib |
22 | #LIBS += -lbz2 | ||
23 | #LIBS += -lkpmicrogcrypt | ||
24 | LIBS += -ljpeg | ||
25 | LIBS += $(QTOPIALIB) | ||
26 | LIBS += -lkpmicrocipher | 17 | LIBS += -lkpmicrocipher |
27 | LIBS += -lkpmicroerror | 18 | LIBS += -lkpmicroerror |
28 | LIBS += -lkpmicrompi | 19 | LIBS += -lkpmicrompi |
29 | LIBS += -lstdc++ | 20 | LIBS += -lstdc++ |
30 | 21 | ||
22 | unix:{ | ||
23 | OBJECTS_DIR = obj/unix | ||
24 | MOC_DIR = moc/unix | ||
25 | |||
26 | } | ||
27 | win32:{ | ||
28 | |||
29 | DEFINES += _WIN32_ | ||
30 | OBJECTS_DIR = obj/win | ||
31 | MOC_DIR = moc/win | ||
32 | QMAKE_LINK += /NODEFAULTLIB:LIBC | ||
33 | |||
34 | } | ||
35 | |||
31 | #INTERFACES = \ | 36 | #INTERFACES = \ |
32 | #addentrywnd.ui \ | 37 | #addentrywnd.ui \ |
33 | #configwnd.ui \ | 38 | #configwnd.ui \ |
34 | #findwnd.ui \ | 39 | #findwnd.ui \ |
35 | #getmasterpwwnd.ui \ | 40 | #getmasterpwwnd.ui \ |
36 | #pwgenwnd.ui \ | 41 | #pwgenwnd.ui \ |
37 | #setmasterpwwnd.ui \ | 42 | #setmasterpwwnd.ui \ |
38 | #subtbledit.ui | 43 | #subtbledit.ui |
39 | 44 | ||
40 | #INTERFACES = \ | 45 | #INTERFACES = \ |
41 | #subtbledit.ui \ | 46 | #subtbledit.ui \ |
42 | 47 | ||
43 | 48 | ||
44 | 49 | ||
45 | #HEADERS = \ | 50 | #HEADERS = \ |
46 | #configuration_31compat.h \ | 51 | #configuration_31compat.h \ |
47 | #configuration.h \ | 52 | #configuration.h \ |
48 | #configwnd.h \ | 53 | #configwnd.h \ |
49 | #configwndimpl.h \ | 54 | #configwndimpl.h \ |
50 | #selftest.h | 55 | #selftest.h |
51 | #subtbledit.h \ | 56 | #subtbledit.h \ |
52 | #subtbleditimpl.h \ | 57 | #subtbleditimpl.h \ |
53 | #compressbzip2.h \ | 58 | #compressbzip2.h \ |
54 | 59 | ||
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp index e29e3d1..8869f3a 100644 --- a/pwmanager/pwmanager/pwmdoc.cpp +++ b/pwmanager/pwmanager/pwmdoc.cpp | |||
@@ -2308,50 +2308,50 @@ PwMerror PwMDoc::exportToText(const QString *file) | |||
2308 | if (!f.open(IO_ReadWrite)) | 2308 | if (!f.open(IO_ReadWrite)) |
2309 | return e_openFile; | 2309 | return e_openFile; |
2310 | 2310 | ||
2311 | if (!unlockAll_tempoary()) { | 2311 | if (!unlockAll_tempoary()) { |
2312 | f.close(); | 2312 | f.close(); |
2313 | return e_lock; | 2313 | return e_lock; |
2314 | } | 2314 | } |
2315 | 2315 | ||
2316 | // write header | 2316 | // write header |
2317 | string header = i18n("Password table generated by\nPwM v").latin1(); | 2317 | string header = i18n("Password table generated by\nPwM v").latin1(); |
2318 | header += PACKAGE_VER; | 2318 | header += PACKAGE_VER; |
2319 | header += i18n("\non ").latin1(); | 2319 | header += i18n("\non ").latin1(); |
2320 | QDate currDate = QDate::currentDate(); | 2320 | QDate currDate = QDate::currentDate(); |
2321 | QTime currTime = QTime::currentTime(); | 2321 | QTime currTime = QTime::currentTime(); |
2322 | 2322 | ||
2323 | #ifndef PWM_EMBEDDED | 2323 | #ifndef PWM_EMBEDDED |
2324 | header += currDate.toString("ddd MMMM d ").latin1(); | 2324 | header += currDate.toString("ddd MMMM d ").latin1(); |
2325 | header += currTime.toString("hh:mm:ss ").latin1(); | 2325 | header += currTime.toString("hh:mm:ss ").latin1(); |
2326 | #else | 2326 | #else |
2327 | QString dfs = KGlobal::locale()->dateFormatShort(); | 2327 | QString dfs = KGlobal::locale()->dateFormatShort(); |
2328 | bool ampm = KGlobal::locale()->use12Clock(); | 2328 | bool ampm = KGlobal::locale()->use12Clock(); |
2329 | KGlobal::locale()->setDateFormatShort("%A %B %d"); | 2329 | KGlobal::locale()->setDateFormatShort("%A %B %d"); |
2330 | KGlobal::locale()->setHore24Format(true); | 2330 | KGlobal::locale()->setHore24Format(true); |
2331 | 2331 | ||
2332 | header += KGlobal::locale()->formatDate(currDate, true, KLocale::Userdefined); | 2332 | header += KGlobal::locale()->formatDate(currDate, true, KLocale::Userdefined).latin1(); |
2333 | header += KGlobal::locale()->formatTime(currTime, true); | 2333 | header += KGlobal::locale()->formatTime(currTime, true).latin1(); |
2334 | KGlobal::locale()->setDateFormatShort(dfs); | 2334 | KGlobal::locale()->setDateFormatShort(dfs); |
2335 | KGlobal::locale()->setHore24Format(!ampm); | 2335 | KGlobal::locale()->setHore24Format(!ampm); |
2336 | 2336 | ||
2337 | #endif | 2337 | #endif |
2338 | header += tostr(currDate.year()); | 2338 | header += tostr(currDate.year()); |
2339 | header += "\n==============================\n\n"; | 2339 | header += "\n==============================\n\n"; |
2340 | 2340 | ||
2341 | 2341 | ||
2342 | #ifndef PWM_EMBEDDED | 2342 | #ifndef PWM_EMBEDDED |
2343 | if (f.writeBlock(header.c_str(), header.length()) != (Q_LONG)header.length()) { | 2343 | if (f.writeBlock(header.c_str(), header.length()) != (Q_LONG)header.length()) { |
2344 | unlockAll_tempoary(true); | 2344 | unlockAll_tempoary(true); |
2345 | f.close(); | 2345 | f.close(); |
2346 | return e_writeFile; | 2346 | return e_writeFile; |
2347 | } | 2347 | } |
2348 | #else | 2348 | #else |
2349 | if (f.writeBlock(header.c_str(), header.length()) != (long)header.length()) { | 2349 | if (f.writeBlock(header.c_str(), header.length()) != (long)header.length()) { |
2350 | unlockAll_tempoary(true); | 2350 | unlockAll_tempoary(true); |
2351 | f.close(); | 2351 | f.close(); |
2352 | return e_writeFile; | 2352 | return e_writeFile; |
2353 | } | 2353 | } |
2354 | #endif | 2354 | #endif |
2355 | unsigned int i, numCat = numCategories(); | 2355 | unsigned int i, numCat = numCategories(); |
2356 | unsigned int j, numEnt; | 2356 | unsigned int j, numEnt; |
2357 | string exp; | 2357 | string exp; |
@@ -2997,69 +2997,69 @@ PwMerror PwMDoc::syncronize(KSyncManager* manager, PwMDoc* syncLocal , PwMDoc* s | |||
2997 | int addedPasswordsRemote = 0; | 2997 | int addedPasswordsRemote = 0; |
2998 | int deletedPasswordsRemote = 0; | 2998 | int deletedPasswordsRemote = 0; |
2999 | int deletedPasswordsLocal = 0; | 2999 | int deletedPasswordsLocal = 0; |
3000 | int changedLocal = 0; | 3000 | int changedLocal = 0; |
3001 | int changedRemote = 0; | 3001 | int changedRemote = 0; |
3002 | 3002 | ||
3003 | PwMSyncItem* syncItemLocal; | 3003 | PwMSyncItem* syncItemLocal; |
3004 | PwMSyncItem* syncItemRemote; | 3004 | PwMSyncItem* syncItemRemote; |
3005 | 3005 | ||
3006 | QString mCurrentSyncName = manager->getCurrentSyncName(); | 3006 | QString mCurrentSyncName = manager->getCurrentSyncName(); |
3007 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); | 3007 | QString mCurrentSyncDevice = manager->getCurrentSyncDevice(); |
3008 | 3008 | ||
3009 | bool fullDateRange = false; | 3009 | bool fullDateRange = false; |
3010 | int take; | 3010 | int take; |
3011 | // local->resetTempSyncStat(); | 3011 | // local->resetTempSyncStat(); |
3012 | QDateTime mLastSync = QDateTime::currentDateTime(); | 3012 | QDateTime mLastSync = QDateTime::currentDateTime(); |
3013 | QDateTime modifiedSync = mLastSync; | 3013 | QDateTime modifiedSync = mLastSync; |
3014 | 3014 | ||
3015 | unsigned int index; | 3015 | unsigned int index; |
3016 | //Step 1. Find syncinfo in Local file and create if not existent. | 3016 | //Step 1. Find syncinfo in Local file and create if not existent. |
3017 | bool found = syncLocal->findSyncData(mCurrentSyncDevice, &index); | 3017 | bool found = syncLocal->findSyncData(mCurrentSyncDevice, &index); |
3018 | if (found == false) | 3018 | if (found == false) |
3019 | { | 3019 | { |
3020 | PwMSyncItem newSyncItemLocal; | 3020 | PwMSyncItem newSyncItemLocal; |
3021 | newSyncItemLocal.syncName = mCurrentSyncDevice; | 3021 | newSyncItemLocal.syncName = mCurrentSyncDevice.latin1(); |
3022 | newSyncItemLocal.lastSyncDate = mLastSync; | 3022 | newSyncItemLocal.lastSyncDate = mLastSync; |
3023 | syncLocal->addSyncDataEntry(&newSyncItemLocal, true); | 3023 | syncLocal->addSyncDataEntry(&newSyncItemLocal, true); |
3024 | found = syncLocal->findSyncData(mCurrentSyncDevice, &index); | 3024 | found = syncLocal->findSyncData(mCurrentSyncDevice, &index); |
3025 | if (found == false) { | 3025 | if (found == false) { |
3026 | qDebug("PwMDoc::syncronize : newly created local sync data could not be found"); | 3026 | qDebug("PwMDoc::syncronize : newly created local sync data could not be found"); |
3027 | return e_syncError; | 3027 | return e_syncError; |
3028 | } | 3028 | } |
3029 | } | 3029 | } |
3030 | 3030 | ||
3031 | syncItemLocal = syncLocal->getSyncDataEntry(index); | 3031 | syncItemLocal = syncLocal->getSyncDataEntry(index); |
3032 | qDebug("Last Sync Local %s ", syncItemLocal->lastSyncDate.toString().latin1()); | 3032 | qDebug("Last Sync Local %s ", syncItemLocal->lastSyncDate.toString().latin1()); |
3033 | 3033 | ||
3034 | //Step 2. Find syncinfo in remote file and create if not existent. | 3034 | //Step 2. Find syncinfo in remote file and create if not existent. |
3035 | found = syncRemote->findSyncData(mCurrentSyncName, &index); | 3035 | found = syncRemote->findSyncData(mCurrentSyncName, &index); |
3036 | if (found == false) | 3036 | if (found == false) |
3037 | { | 3037 | { |
3038 | qDebug("FULLDATE 1"); | 3038 | qDebug("FULLDATE 1"); |
3039 | fullDateRange = true; | 3039 | fullDateRange = true; |
3040 | PwMSyncItem newSyncItemRemote; | 3040 | PwMSyncItem newSyncItemRemote; |
3041 | newSyncItemRemote.syncName = mCurrentSyncName; | 3041 | newSyncItemRemote.syncName = mCurrentSyncName.latin1(); |
3042 | newSyncItemRemote.lastSyncDate = mLastSync; | 3042 | newSyncItemRemote.lastSyncDate = mLastSync; |
3043 | syncRemote->addSyncDataEntry(&newSyncItemRemote, true); | 3043 | syncRemote->addSyncDataEntry(&newSyncItemRemote, true); |
3044 | found = syncRemote->findSyncData(mCurrentSyncName, &index); | 3044 | found = syncRemote->findSyncData(mCurrentSyncName, &index); |
3045 | if (found == false) { | 3045 | if (found == false) { |
3046 | qDebug("PwMDoc::syncronize : newly created remote sync data could not be found"); | 3046 | qDebug("PwMDoc::syncronize : newly created remote sync data could not be found"); |
3047 | return e_syncError; | 3047 | return e_syncError; |
3048 | } | 3048 | } |
3049 | } | 3049 | } |
3050 | 3050 | ||
3051 | syncItemRemote = syncRemote->getSyncDataEntry(index); | 3051 | syncItemRemote = syncRemote->getSyncDataEntry(index); |
3052 | qDebug("Last Sync Remote %s ", syncItemRemote->lastSyncDate.toString().latin1()); | 3052 | qDebug("Last Sync Remote %s ", syncItemRemote->lastSyncDate.toString().latin1()); |
3053 | //and remove the found entry here. We will reenter it later again. | 3053 | //and remove the found entry here. We will reenter it later again. |
3054 | //US syncRemote->delSyncDataEntry(index, true); | 3054 | //US syncRemote->delSyncDataEntry(index, true); |
3055 | 3055 | ||
3056 | 3056 | ||
3057 | if ( syncItemLocal->lastSyncDate == mLastSync ) { | 3057 | if ( syncItemLocal->lastSyncDate == mLastSync ) { |
3058 | qDebug("FULLDATE 2"); | 3058 | qDebug("FULLDATE 2"); |
3059 | fullDateRange = true; | 3059 | fullDateRange = true; |
3060 | } | 3060 | } |
3061 | 3061 | ||
3062 | if ( ! fullDateRange ) { | 3062 | if ( ! fullDateRange ) { |
3063 | if ( syncItemLocal->lastSyncDate != syncItemRemote->lastSyncDate ) { | 3063 | if ( syncItemLocal->lastSyncDate != syncItemRemote->lastSyncDate ) { |
3064 | 3064 | ||
3065 | fullDateRange = true; | 3065 | fullDateRange = true; |
diff --git a/pwmanager/pwmanager/pwminit.cpp b/pwmanager/pwmanager/pwminit.cpp index 8946443..ea9e330 100644 --- a/pwmanager/pwmanager/pwminit.cpp +++ b/pwmanager/pwmanager/pwminit.cpp | |||
@@ -1,45 +1,46 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2004 by Michael Buesch * | 3 | * copyright (C) 2004 by Michael Buesch * |
4 | * email: mbuesch@freenet.de * | 4 | * email: mbuesch@freenet.de * |
5 | * * | 5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * | 6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include "pwminit.h" | 20 | #include "pwminit.h" |
21 | #include "randomizer.h" | 21 | #include "randomizer.h" |
22 | #include <qdir.h> | ||
22 | 23 | ||
23 | #ifndef PWM_EMBEDDED | 24 | #ifndef PWM_EMBEDDED |
24 | #include "selftest.h" | 25 | #include "selftest.h" |
25 | #include "configuration.h" | 26 | #include "configuration.h" |
26 | #else | 27 | #else |
27 | #include "pwmprefs.h" | 28 | #include "pwmprefs.h" |
28 | #endif | 29 | #endif |
29 | 30 | ||
30 | #include "pwm.h" | 31 | #include "pwm.h" |
31 | #include "pwmexception.h" | 32 | #include "pwmexception.h" |
32 | #include "pwmtray.h" | 33 | #include "pwmtray.h" |
33 | #include "pwmdoc.h" | 34 | #include "pwmdoc.h" |
34 | 35 | ||
35 | #ifdef CONFIG_KWALLETIF | 36 | #ifdef CONFIG_KWALLETIF |
36 | # include "kwalletemu.h" | 37 | # include "kwalletemu.h" |
37 | #endif // CONFIG_KWALLETIF | 38 | #endif // CONFIG_KWALLETIF |
38 | #ifdef CONFIG_KEYCARD | 39 | #ifdef CONFIG_KEYCARD |
39 | # include "pwmkeycard.h" | 40 | # include "pwmkeycard.h" |
40 | #endif // CONFIG_KEYCARD | 41 | #endif // CONFIG_KEYCARD |
41 | 42 | ||
42 | #include <qmessagebox.h> | 43 | #include <qmessagebox.h> |
43 | 44 | ||
44 | #include <kmessagebox.h> | 45 | #include <kmessagebox.h> |
45 | #ifndef PWM_EMBEDDED | 46 | #ifndef PWM_EMBEDDED |
@@ -107,84 +108,89 @@ PwMInit::~PwMInit() | |||
107 | vector<PwMDocList::listItem> dl = *(_dl->getList()); | 108 | vector<PwMDocList::listItem> dl = *(_dl->getList()); |
108 | vector<PwMDocList::listItem>::iterator i2 = dl.begin(), | 109 | vector<PwMDocList::listItem>::iterator i2 = dl.begin(), |
109 | end2 = dl.end(); | 110 | end2 = dl.end(); |
110 | while (i2 != end2) { | 111 | while (i2 != end2) { |
111 | delete (*i2).doc; | 112 | delete (*i2).doc; |
112 | ++i2; | 113 | ++i2; |
113 | } | 114 | } |
114 | 115 | ||
115 | #ifdef CONFIG_KWALLETIF | 116 | #ifdef CONFIG_KWALLETIF |
116 | delete_ifnot_null(_kwalletEmu); | 117 | delete_ifnot_null(_kwalletEmu); |
117 | #endif // CONFIG_KWALLETIF | 118 | #endif // CONFIG_KWALLETIF |
118 | #ifdef CONFIG_KEYCARD | 119 | #ifdef CONFIG_KEYCARD |
119 | delete_ifnot_null(_keycard); | 120 | delete_ifnot_null(_keycard); |
120 | #endif // CONFIG_KEYCARD | 121 | #endif // CONFIG_KEYCARD |
121 | delete_ifnot_null(_tray); | 122 | delete_ifnot_null(_tray); |
122 | 123 | ||
123 | Randomizer::cleanup(); | 124 | Randomizer::cleanup(); |
124 | #ifndef PWM_EMBEDDED | 125 | #ifndef PWM_EMBEDDED |
125 | Configuration::cleanup(); | 126 | Configuration::cleanup(); |
126 | #endif | 127 | #endif |
127 | } | 128 | } |
128 | 129 | ||
129 | void PwMInit::initializeApp() | 130 | void PwMInit::initializeApp() |
130 | { | 131 | { |
132 | qDebug("PwMInit::initializeApp() "); | ||
131 | PWM_ASSERT(runStatus == unknown); | 133 | PWM_ASSERT(runStatus == unknown); |
132 | runStatus = init; | 134 | runStatus = init; |
133 | initPosixSignalHandler(); | 135 | initPosixSignalHandler(); |
134 | Randomizer::init(); | 136 | Randomizer::init(); |
135 | #ifndef PWM_EMBEDDED | 137 | #ifndef PWM_EMBEDDED |
136 | Configuration::init(); | 138 | Configuration::init(); |
137 | #endif | 139 | #endif |
138 | initDCOP(); | 140 | initDCOP(); |
139 | initKWalletEmu(); | 141 | initKWalletEmu(); |
140 | initKeycard(); | 142 | initKeycard(); |
141 | initTray(); | 143 | initTray(); |
142 | handleCmdLineArgs(); | 144 | handleCmdLineArgs(); |
143 | 145 | qDebug("handle "); | |
144 | bool openDeeplocked = false; | 146 | bool openDeeplocked = false; |
145 | if (conf()->confGlobAutostartDeepLocked() || | 147 | if (conf()->confGlobAutostartDeepLocked() || |
146 | savedCmd.open_deeplocked) | 148 | savedCmd.open_deeplocked) |
147 | openDeeplocked = true; | 149 | openDeeplocked = true; |
148 | if (conf()->confWndAutoMinimizeOnStart() || | 150 | if ( false ){ |
149 | savedCmd.minToTray) { | 151 | // LR is not working |
152 | //if (conf()->confWndAutoMinimizeOnStart() || | ||
153 | // savedCmd.minToTray) { | ||
150 | PwMDoc *newDoc = createDoc(); | 154 | PwMDoc *newDoc = createDoc(); |
155 | qDebug(" createDoc()"); | ||
151 | if (!newDoc->openDocUi(newDoc, | 156 | if (!newDoc->openDocUi(newDoc, |
152 | conf()->confGlobAutoStart(), | 157 | conf()->confGlobAutoStart(), |
153 | openDeeplocked)) { | 158 | openDeeplocked)) { |
154 | delete newDoc; | 159 | delete newDoc; |
160 | } | ||
155 | 161 | ||
156 | //US ENH for embedded devices: in the case of failure, open a document the default way | 162 | //US ENH for embedded devices: in the case of failure, open a document the default way |
157 | createMainWnd(conf()->confGlobAutoStart(), | 163 | createMainWnd(conf()->confGlobAutoStart(), |
158 | openDeeplocked, | 164 | openDeeplocked, |
159 | true, | 165 | true, |
160 | 0, | 166 | 0, |
161 | savedCmd.minimized); | 167 | savedCmd.minimized); |
162 | 168 | ||
163 | 169 | ||
164 | 170 | ||
165 | 171 | ||
166 | } | 172 | //} |
167 | } else { | 173 | } else { |
168 | createMainWnd(conf()->confGlobAutoStart(), | 174 | createMainWnd(conf()->confGlobAutoStart(), |
169 | openDeeplocked, | 175 | openDeeplocked, |
170 | true, | 176 | true, |
171 | 0, | 177 | 0, |
172 | savedCmd.minimized); | 178 | savedCmd.minimized); |
173 | } | 179 | } |
174 | 180 | ||
175 | runStatus = running; | 181 | runStatus = running; |
176 | } | 182 | } |
177 | 183 | ||
178 | void PwMInit::shutdownApp(int exitStatus) | 184 | void PwMInit::shutdownApp(int exitStatus) |
179 | { | 185 | { |
180 | printDebug(string("PwMInit::shutdownApp(") | 186 | printDebug(string("PwMInit::shutdownApp(") |
181 | + tostr(exitStatus) + ") called."); | 187 | + tostr(exitStatus) + ") called."); |
182 | PWM_ASSERT((runStatus == running) || (runStatus == init)); | 188 | PWM_ASSERT((runStatus == running) || (runStatus == init)); |
183 | runStatus = shutdown; | 189 | runStatus = shutdown; |
184 | QApplication::exit(exitStatus); | 190 | QApplication::exit(exitStatus); |
185 | /* The destructor of PwMInit is called when control | 191 | /* The destructor of PwMInit is called when control |
186 | * leaves main() | 192 | * leaves main() |
187 | */ | 193 | */ |
188 | } | 194 | } |
189 | 195 | ||
190 | void PwMInit::initPosixSignalHandler() | 196 | void PwMInit::initPosixSignalHandler() |
@@ -265,79 +271,81 @@ void PwMInit::initTray() | |||
265 | _tray->show(); | 271 | _tray->show(); |
266 | // connect the signals of all open documents. | 272 | // connect the signals of all open documents. |
267 | const vector<PwMDocList::listItem> *dl = PwMDoc::getOpenDocList()->getList(); | 273 | const vector<PwMDocList::listItem> *dl = PwMDoc::getOpenDocList()->getList(); |
268 | vector<PwMDocList::listItem>::const_iterator i = dl->begin(), | 274 | vector<PwMDocList::listItem>::const_iterator i = dl->begin(), |
269 | end = dl->end(); | 275 | end = dl->end(); |
270 | while (i != end) { | 276 | while (i != end) { |
271 | _tray->connectDocToTray((*i).doc); | 277 | _tray->connectDocToTray((*i).doc); |
272 | ++i; | 278 | ++i; |
273 | } | 279 | } |
274 | } | 280 | } |
275 | 281 | ||
276 | void PwMInit::removeTrayAndQuit() | 282 | void PwMInit::removeTrayAndQuit() |
277 | { | 283 | { |
278 | PWM_ASSERT(_tray); | 284 | PWM_ASSERT(_tray); |
279 | // _tray is deleted in ~PwMInit | 285 | // _tray is deleted in ~PwMInit |
280 | shutdownApp(0); | 286 | shutdownApp(0); |
281 | } | 287 | } |
282 | 288 | ||
283 | PwM * PwMInit::createMainWnd(const QString &loadFile, | 289 | PwM * PwMInit::createMainWnd(const QString &loadFile, |
284 | bool loadFileDeepLocked, | 290 | bool loadFileDeepLocked, |
285 | bool virginity, | 291 | bool virginity, |
286 | PwMDoc *doc, | 292 | PwMDoc *doc, |
287 | bool minimized) | 293 | bool minimized) |
288 | { | 294 | { |
295 | qDebug("PwMInit::createMainWnd "); | ||
289 | PwM *newWnd; | 296 | PwM *newWnd; |
290 | if (!doc) | 297 | if (!doc) |
291 | doc = createDoc(); | 298 | doc = createDoc(); |
292 | newWnd = new PwM(this, doc, virginity); | 299 | newWnd = new PwM(this, doc, virginity); |
293 | #ifndef PWM_EMBEDDED | 300 | #ifndef PWM_EMBEDDED |
294 | _mainWndList.push_back(newWnd); | 301 | _mainWndList.push_back(newWnd); |
295 | #else | 302 | #else |
296 | _mainWndList.append(newWnd); | 303 | _mainWndList.append(newWnd); |
297 | #endif | 304 | #endif |
298 | connect(newWnd, SIGNAL(closed(PwM *)), | 305 | connect(newWnd, SIGNAL(closed(PwM *)), |
299 | this, SLOT(mainWndClosed(PwM *))); | 306 | this, SLOT(mainWndClosed(PwM *))); |
300 | connect(newWnd, SIGNAL(gotFocus(PwM *)), | 307 | connect(newWnd, SIGNAL(gotFocus(PwM *)), |
301 | this, SLOT(setCurWidget(PwM *))); | 308 | this, SLOT(setCurWidget(PwM *))); |
302 | connect(newWnd, SIGNAL(lostFocus(PwM *)), | 309 | connect(newWnd, SIGNAL(lostFocus(PwM *)), |
303 | this, SLOT(resetCurWidget())); | 310 | this, SLOT(resetCurWidget())); |
304 | 311 | ||
305 | //US ENH | 312 | //US ENH |
306 | #ifndef PWM_EMBEDDED | 313 | #ifndef PWM_EMBEDDED |
307 | if (minimized) | 314 | if (minimized) |
308 | newWnd->showMinimized(); | 315 | newWnd->showMinimized(); |
309 | else | 316 | else |
310 | newWnd->show(); | 317 | newWnd->show(); |
311 | 318 | ||
312 | #else //PWM_EMBEDDED | 319 | #else //PWM_EMBEDDED |
313 | 320 | ||
314 | #ifndef DESKTOP_VERSION | 321 | #ifndef DESKTOP_VERSION |
315 | app->showMainWidget( newWnd ); | 322 | app->showMainWidget( newWnd ); |
316 | #else //DESKTOP_VERSION | 323 | #else //DESKTOP_VERSION |
317 | app->setMainWidget( newWnd ); | 324 | app->setMainWidget( newWnd ); |
318 | newWnd->resize (640, 480 ); | 325 | newWnd->resize (640, 480 ); |
319 | newWnd->show(); | 326 | newWnd->show(); |
327 | qDebug("show "); | ||
320 | #endif //DESKTOP_VERSION | 328 | #endif //DESKTOP_VERSION |
321 | 329 | ||
322 | #endif //PWM_EMBEDDED | 330 | #endif //PWM_EMBEDDED |
323 | 331 | ||
324 | if (loadFile != QString::null && | 332 | if (loadFile != QString::null && |
325 | loadFile != "") { | 333 | loadFile != "") { |
326 | newWnd->openDoc(loadFile, loadFileDeepLocked); | 334 | newWnd->openDoc(loadFile, loadFileDeepLocked); |
327 | } | 335 | } |
328 | return newWnd; | 336 | return newWnd; |
329 | } | 337 | } |
330 | 338 | ||
331 | PwMDoc * PwMInit::createDoc() | 339 | PwMDoc * PwMInit::createDoc() |
332 | { | 340 | { |
333 | PwMDoc *doc = new PwMDoc(this); | 341 | PwMDoc *doc = new PwMDoc(this); |
334 | #ifdef CONFIG_KEYCARD | 342 | #ifdef CONFIG_KEYCARD |
335 | doc->setPwMKeyCard(keycard()); | 343 | doc->setPwMKeyCard(keycard()); |
336 | #endif | 344 | #endif |
337 | #ifdef CONFIG_KWALLETIF | 345 | #ifdef CONFIG_KWALLETIF |
338 | if (kwalletEmu()) | 346 | if (kwalletEmu()) |
339 | kwalletEmu()->connectDocSignals(doc); | 347 | kwalletEmu()->connectDocSignals(doc); |
340 | #endif | 348 | #endif |
341 | 349 | ||
342 | if (_tray) | 350 | if (_tray) |
343 | _tray->connectDocToTray(doc); | 351 | _tray->connectDocToTray(doc); |
diff --git a/pwmanager/pwmanager/serializer.cpp b/pwmanager/pwmanager/serializer.cpp index 2d6498e..ed0f754 100644 --- a/pwmanager/pwmanager/serializer.cpp +++ b/pwmanager/pwmanager/serializer.cpp | |||
@@ -149,49 +149,53 @@ Serializer::Serializer(const QCString &buffer) | |||
149 | #else | 149 | #else |
150 | qDebug("Serializer::Serializer : Parse Exception "); | 150 | qDebug("Serializer::Serializer : Parse Exception "); |
151 | #endif | 151 | #endif |
152 | } | 152 | } |
153 | } | 153 | } |
154 | 154 | ||
155 | Serializer::~Serializer() | 155 | Serializer::~Serializer() |
156 | { | 156 | { |
157 | delete_ifnot_null(domDoc); | 157 | delete_ifnot_null(domDoc); |
158 | } | 158 | } |
159 | 159 | ||
160 | void Serializer::clear() | 160 | void Serializer::clear() |
161 | { | 161 | { |
162 | delete_ifnot_null(domDoc); | 162 | delete_ifnot_null(domDoc); |
163 | domDoc = new QDomDocument; | 163 | domDoc = new QDomDocument; |
164 | } | 164 | } |
165 | 165 | ||
166 | bool Serializer::parseXml(const QCString &buffer) | 166 | bool Serializer::parseXml(const QCString &buffer) |
167 | { | 167 | { |
168 | PWM_ASSERT(domDoc); | 168 | PWM_ASSERT(domDoc); |
169 | #ifndef PWM_EMBEDDED | 169 | #ifndef PWM_EMBEDDED |
170 | if (!domDoc->setContent(buffer, true)) | 170 | if (!domDoc->setContent(buffer, true)) |
171 | return false; | 171 | return false; |
172 | #else | 172 | #else |
173 | #ifdef DESKTOP_VERSION | ||
174 | if (!domDoc->setContent(buffer, true)) | ||
175 | #else | ||
173 | if (!domDoc->setContent(buffer)) | 176 | if (!domDoc->setContent(buffer)) |
177 | #endif | ||
174 | return false; | 178 | return false; |
175 | #endif | 179 | #endif |
176 | if (!checkValid()) | 180 | if (!checkValid()) |
177 | return false; | 181 | return false; |
178 | return true; | 182 | return true; |
179 | } | 183 | } |
180 | 184 | ||
181 | QCString Serializer::getXml() | 185 | QCString Serializer::getXml() |
182 | { | 186 | { |
183 | PWM_ASSERT(domDoc); | 187 | PWM_ASSERT(domDoc); |
184 | 188 | ||
185 | #ifndef PWM_EMBEDDED | 189 | #ifndef PWM_EMBEDDED |
186 | #if defined(PWM_DEBUG) && SERIALIZER_DEBUG != 0 | 190 | #if defined(PWM_DEBUG) && SERIALIZER_DEBUG != 0 |
187 | QCString tmp(domDoc->toCString(8)); | 191 | QCString tmp(domDoc->toCString(8)); |
188 | printDebug("<BEGIN Serializer::getXml() dump>\n"); | 192 | printDebug("<BEGIN Serializer::getXml() dump>\n"); |
189 | cout << tmp << endl; | 193 | cout << tmp << endl; |
190 | printDebug("<END Serializer::getXml() dump>"); | 194 | printDebug("<END Serializer::getXml() dump>"); |
191 | #endif // DEBUG | 195 | #endif // DEBUG |
192 | 196 | ||
193 | QCString ret(domDoc->toCString(0)); | 197 | QCString ret(domDoc->toCString(0)); |
194 | ret.replace('\n', ""); | 198 | ret.replace('\n', ""); |
195 | return ret; | 199 | return ret; |
196 | #else | 200 | #else |
197 | 201 | ||
@@ -711,49 +715,49 @@ bool Serializer::readSyncData(const QDomNode &n, vector<PwMSyncItem> *dta) | |||
711 | QDomNodeList nl(n.childNodes()); | 715 | QDomNodeList nl(n.childNodes()); |
712 | QDomNode cur; | 716 | QDomNode cur; |
713 | 717 | ||
714 | QString devicename, val; | 718 | QString devicename, val; |
715 | unsigned int numSync = nl.count(), i; | 719 | unsigned int numSync = nl.count(), i; |
716 | PwMSyncItem curSync; | 720 | PwMSyncItem curSync; |
717 | bool ok = true; | 721 | bool ok = true; |
718 | 722 | ||
719 | if (!numSync) { | 723 | if (!numSync) { |
720 | //no sync entries is a possible result | 724 | //no sync entries is a possible result |
721 | printDebug("Serializer::readSyncData(): empty"); | 725 | printDebug("Serializer::readSyncData(): empty"); |
722 | return true; | 726 | return true; |
723 | } | 727 | } |
724 | for (i = 0; i < numSync; ++i) { | 728 | for (i = 0; i < numSync; ++i) { |
725 | cur = nl.item(i); | 729 | cur = nl.item(i); |
726 | if (cur.nodeName().left(1) == SYNC_TARGET_PREFIX) { | 730 | if (cur.nodeName().left(1) == SYNC_TARGET_PREFIX) { |
727 | devicename = cur.toElement().attribute(SYNC_TARGET_NAME); | 731 | devicename = cur.toElement().attribute(SYNC_TARGET_NAME); |
728 | val = cur.toElement().text(); | 732 | val = cur.toElement().text(); |
729 | 733 | ||
730 | if ((val == "") || (devicename == QString::null)) { | 734 | if ((val == "") || (devicename == QString::null)) { |
731 | printDebug("Serializer::readSyncData(): empty synctarget name or syncdate"); | 735 | printDebug("Serializer::readSyncData(): empty synctarget name or syncdate"); |
732 | continue; | 736 | continue; |
733 | } | 737 | } |
734 | 738 | ||
735 | curSync.syncName = devicename; | 739 | curSync.syncName = devicename.latin1(); |
736 | #ifndef PWM_EMBEDDED | 740 | #ifndef PWM_EMBEDDED |
737 | curSync.lastSyncDate = QDateTime::fromString(val, Qt::ISODate); | 741 | curSync.lastSyncDate = QDateTime::fromString(val, Qt::ISODate); |
738 | #else | 742 | #else |
739 | curSync.lastSyncDate = KGlobal::locale()->readDateTime(val, KLocale::ISODate, &ok); | 743 | curSync.lastSyncDate = KGlobal::locale()->readDateTime(val, KLocale::ISODate, &ok); |
740 | if (ok == false) | 744 | if (ok == false) |
741 | qDebug("Serializer::readSyncData(): could not parse syncdate:%s",val.latin1()); | 745 | qDebug("Serializer::readSyncData(): could not parse syncdate:%s",val.latin1()); |
742 | 746 | ||
743 | #endif | 747 | #endif |
744 | dta->push_back(curSync); | 748 | dta->push_back(curSync); |
745 | } | 749 | } |
746 | } | 750 | } |
747 | return true; | 751 | return true; |
748 | 752 | ||
749 | } | 753 | } |
750 | 754 | ||
751 | 755 | ||
752 | 756 | ||
753 | bool Serializer::addSyncData(QDomElement *e, | 757 | bool Serializer::addSyncData(QDomElement *e, |
754 | const vector<PwMSyncItem> &dta) | 758 | const vector<PwMSyncItem> &dta) |
755 | { | 759 | { |
756 | unsigned int numSync = dta.size(), i; | 760 | unsigned int numSync = dta.size(), i; |
757 | QString curId, curDeviceName; | 761 | QString curId, curDeviceName; |
758 | QDomElement curSync; | 762 | QDomElement curSync; |
759 | QDomText text; | 763 | QDomText text; |