summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwm.cpp10
-rw-r--r--pwmanager/pwmanager/pwmdocui.cpp10
-rw-r--r--pwmanager/pwmanager/serializer.cpp8
3 files changed, 18 insertions, 10 deletions
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp
index 9798e8e..b7b5307 100644
--- a/pwmanager/pwmanager/pwm.cpp
+++ b/pwmanager/pwmanager/pwm.cpp
@@ -3,48 +3,50 @@
* copyright (C) 2003, 2004 by Michael Buesch *
* email: mbuesch@freenet.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation. *
* *
***************************************************************************/
/***************************************************************************
* copyright (C) 2004 by Ulf Schenk
* This file is originaly based on version 1.0.1 of pwmanager
* and was modified to run on embedded devices that run microkde
*
* $Id$
**************************************************************************/
#include <klocale.h>
#include <klistview.h>
#include <ktoolbar.h>
#include <kfiledialog.h>
#include <kiconloader.h>
#include <kmessagebox.h>
+#include <qstatusbar.h>
+
#ifndef PWM_EMBEDDED
#include <kmenubar.h>
#include <kstatusbar.h>
#include <dcopclient.h>
#include "configwndimpl.h"
#include "configuration.h"
#else
#include <qmenubar.h>
#include <qmessagebox.h>
#include <pwmprefs.h>
#include <kpimglobalprefs.h>
#include <kcmconfigs/kcmpwmconfig.h>
#include <kcmconfigs/kcmkdepimconfig.h>
#include <kcmultidialog.h>
#endif
#ifndef DESKTOP_VERSION
#include <qpe/global.h>
#endif
#include <qpixmap.h>
#include <qcheckbox.h>
#include <qspinbox.h>
@@ -1337,59 +1339,57 @@ void PwM::goToURL_slot()
if (!view->getCurEntryIndex(&curEntryIndex))
return;
bool ret = curDoc()->goToURL(view->getCurrentCategory(),
curEntryIndex);
if (ret)
showStatMsg(i18n("started browser with current URL."));
else
showStatMsg(i18n("ERROR: Couldn't start browser! Maybe invalid URL?"));
}
void PwM::copyToClipboard(const QString &s)
{
QClipboard *cb = QApplication::clipboard();
#ifndef PWM_EMBEDDED
if (cb->supportsSelection())
cb->setText(s, QClipboard::Selection);
cb->setText(s, QClipboard::Clipboard);
#else
cb->setText(s);
#endif
}
+
void PwM::showStatMsg(const QString &msg)
{
-#ifndef PWM_EMBEDDED
- KStatusBar *statBar = statusBar();
- statBar->message(msg, STATUSBAR_MSG_TIMEOUT * 1000);
+#ifdef DESKTOP_VERSION
+ statusBar()->message(msg, STATUSBAR_MSG_TIMEOUT * 1000);
#else
qDebug("Statusbar : %s",msg.latin1());
-#ifndef DESKTOP_VERSION
Global::statusMessage(msg);
#endif
-#endif
}
void PwM::focusInEvent(QFocusEvent *e)
{
if (e->gotFocus()) {
emit gotFocus(this);
} else if (e->lostFocus()) {
emit lostFocus(this);
}
}
#ifdef PWM_EMBEDDED
void PwM::whatsnew_slot()
{
KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
}
void PwM::showLicense_slot()
{
KApplication::showLicence();
}
diff --git a/pwmanager/pwmanager/pwmdocui.cpp b/pwmanager/pwmanager/pwmdocui.cpp
index 6ddb6f5..71b4a8d 100644
--- a/pwmanager/pwmanager/pwmdocui.cpp
+++ b/pwmanager/pwmanager/pwmdocui.cpp
@@ -358,90 +358,90 @@ bool PwMDocUi::openDocUi(PwMDoc *doc,
#endif
}
if (filename.isEmpty())
goto cancelOpen;
PwMerror ret;
while (true) {
int lockStat = -1;
if (openDeepLocked) {
lockStat = 2;
} else {
if (conf()->confGlobUnlockOnOpen()) {
lockStat = 0;
} else {
lockStat = 1;
}
}
ret = doc->openDoc(&filename, lockStat);
//qDebug("pwmdocui::OpenDocui %i", ret);
if (ret != e_success) {
if (ret == e_readFile || ret == e_openFile) {
KMessageBox::error(getCurrentView(),
i18n("Could not read file!")
+ "\n"
+ filename,
- i18n("file error"));
+ i18n("File error"));
goto cancelOpen;
}
if (ret == e_alreadyOpen) {
KMessageBox::error(getCurrentView(),
i18n("This file is already open."),
- i18n("already open"));
+ i18n("Already open"));
goto cancelOpen;
}
if (ret == e_fileVer) {
KMessageBox::error(getCurrentView(),
i18n
("File-version is not supported!\n"
"Did you create this file with an\nolder or newer version of PwM?"),
i18n
- ("incompatible version"));
+ ("Incompatible version"));
goto cancelOpen;
}
if (ret == e_wrongPw) {
continue;
}
if (ret == e_noPw) {
goto cancelOpen;
}
if (ret == e_fileFormat) {
KMessageBox::error(getCurrentView(),
i18n
("Sorry, this file has not been recognized\n"
"as a PwM Password file.\n"
"Probably you have selected the wrong file."),
i18n
- ("no PwM password-file"));
+ ("No PwM password-file"));
goto cancelOpen;
}
if (ret == e_fileCorrupt) {
KMessageBox::error(getCurrentView(),
i18n
("File corrupt!\n"
"Maybe the media, you stored this file on,\n"
"had bad sectors?"),
i18n
- ("checksum error"));
+ ("Checksum error"));
goto cancelOpen;
}
}
break;
}
return true;
cancelOpen:
return false;
}
QString PwMDocUi::string_defaultCategory()
{
return i18n("Default");
}
QString PwMDocUi::string_locked()
{
return i18n("<LOCKED>");
}
QString PwMDocUi::string_deepLockedShort()
{
return i18n("DEEP-LOCKED");
diff --git a/pwmanager/pwmanager/serializer.cpp b/pwmanager/pwmanager/serializer.cpp
index ed0f754..5753c1d 100644
--- a/pwmanager/pwmanager/serializer.cpp
+++ b/pwmanager/pwmanager/serializer.cpp
@@ -144,48 +144,50 @@ Serializer::Serializer(const QCString &buffer)
if (!parseXml(buffer)) {
delete domDoc;
#ifndef PWM_EMBEDDED
throw PwMException(PwMException::EX_PARSE);
#else
qDebug("Serializer::Serializer : Parse Exception ");
#endif
}
}
Serializer::~Serializer()
{
delete_ifnot_null(domDoc);
}
void Serializer::clear()
{
delete_ifnot_null(domDoc);
domDoc = new QDomDocument;
}
bool Serializer::parseXml(const QCString &buffer)
{
+ //abort();
+ //qDebug("parse %s ", buffer.data());
PWM_ASSERT(domDoc);
#ifndef PWM_EMBEDDED
if (!domDoc->setContent(buffer, true))
return false;
#else
#ifdef DESKTOP_VERSION
if (!domDoc->setContent(buffer, true))
#else
if (!domDoc->setContent(buffer))
#endif
return false;
#endif
if (!checkValid())
return false;
return true;
}
QCString Serializer::getXml()
{
PWM_ASSERT(domDoc);
#ifndef PWM_EMBEDDED
#if defined(PWM_DEBUG) && SERIALIZER_DEBUG != 0
QCString tmp(domDoc->toCString(8));
@@ -335,48 +337,49 @@ bool Serializer::extractEntry(const QDomNode &n,
QDomNodeList nl(n.childNodes());
QDomNode cur, cdata;
unsigned int cnt = nl.count(), i;
QString name, text;
if (!cnt) {
printDebug("Serializer::extractEntry(): empty");
return false;
}
dta->clear();
for (i = 0; i < cnt; ++i) {
cur = nl.item(i);
name = cur.nodeName();
cdata = cur.firstChild();
if (unlikely(cdata.isCDATASection())) {
text = cdata.toCDATASection().data();
} else if (likely(cur.isElement())) {
text = cur.toElement().text();
} else {
printDebug("Serializer::extractEntry(): neither CDATA nor element.");
return false;
}
if (text == " ")
text = ""; // for backward compatibility.
+ //qDebug("entry %s ",unescapeEntryData(text).latin1());
if (name == ENTRY_DESC_NEW ||
name == ENTRY_DESC_OLD) {
dta->desc = unescapeEntryData(text).latin1();
} else if (name == ENTRY_NAME_NEW ||
name == ENTRY_NAME_OLD) {
dta->name = unescapeEntryData(text).latin1();
} else if (name == ENTRY_PW_NEW ||
name == ENTRY_PW_OLD) {
dta->pw = unescapeEntryData(text).latin1();
} else if (name == ENTRY_COMMENT_NEW ||
name == ENTRY_COMMENT_OLD) {
dta->comment = unescapeEntryData(text).latin1();
} else if (name == ENTRY_URL_NEW ||
name == ENTRY_URL_OLD) {
dta->url = unescapeEntryData(text).latin1();
} else if (name == ENTRY_LAUNCHER_NEW ||
name == ENTRY_LAUNCHER_OLD) {
dta->launcher = unescapeEntryData(text).latin1();
} else if (name == ENTRY_LVP_NEW ||
name == ENTRY_LVP_OLD) {
dta->listViewPos = strtol(text.latin1(), 0, 10);
} else if (name == ENTRY_BIN_NEW) {
// ENTRY_BIN_NEW == ENTRY_BIN_OLD
if (text == "0") {
@@ -680,51 +683,56 @@ bool Serializer::writeMeta(QDomElement *e,
e->appendChild(tag);
#undef new_text
return true;
}
QString Serializer::escapeEntryData(QString dta)
{
#ifndef PWM_EMBEDDED
dta.replace('\n', "$>--endl--<$");
dta.replace("]]>", "||>");
#else
dta.replace(QRegExp("\n"), "$>--endl--<$");
dta.replace(QRegExp("]]>"), "||>");
#endif
return dta;
}
QString Serializer::unescapeEntryData(QString dta)
{
#ifndef PWM_EMBEDDED
dta.replace("$>--endl--<$", "\n");
dta.replace("||>", "]]>");
#else
+#ifdef DESKTOP_VERSION
+ dta.replace("$>--endl--<$", "\n");
+ dta.replace("||>", "]]>");
+#else
dta.replace(QRegExp("\\$>--endl--<\\$"), "\n");
dta.replace(QRegExp("||>"), "]]>");
#endif
+#endif
return dta;
}
//US ENH: the following methods are getting used to write/read sync entries
/** read the syncentries in the node "n" */
bool Serializer::readSyncData(const QDomNode &n, vector<PwMSyncItem> *dta)
{
QDomNodeList nl(n.childNodes());
QDomNode cur;
QString devicename, val;
unsigned int numSync = nl.count(), i;
PwMSyncItem curSync;
bool ok = true;
if (!numSync) {
//no sync entries is a possible result
printDebug("Serializer::readSyncData(): empty");
return true;
}
for (i = 0; i < numSync; ++i) {
cur = nl.item(i);
if (cur.nodeName().left(1) == SYNC_TARGET_PREFIX) {