summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/zsafe/zsafe.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index 824b841..0864293 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -1836,193 +1836,193 @@ void ZSafe::readAllEntries()
isIconAv = true;
}
}
if (!isIconAv)
{
c1->setIcon (*getPredefinedIcon(category));
}
c1->setListItem (catI);
c1->initListItem();
categories.insert (c1->getCategoryName(), c1);
}
}
f.close();
}
#endif // UNUSED
void ZSafe::resume(int)
{
#ifndef NO_OPIE
owarn << "Resume" << oendl;
#endif
// hide the main window
if ( !showpwd )
{
infoForm->hide();
// open zsafe again
m_password = "";
selectedItem = NULL;
// clear the password list
QListViewItem *i;
// step through all categories
for (i = ListView->firstChild();
i != NULL;
i = i->nextSibling())
{
// step through all subitems
QListViewItem *si;
for (si = i->firstChild();
si != NULL; )
{
QListViewItem *_si = si;
si = si->nextSibling();
i->takeItem(_si); // remove from view list
if (_si) delete _si;
}
}
// ask for password and read again
openDocument(filename);
}
}
//---------------------------------------------
bool ZSafe::openDocument(const char* _filename, const char* )
{
int retval;
char* entry[FIELD_SIZE];
// #ifndef WIN32
int validationFlag = conf->readNumEntry(APP_KEY+"valzsafe", 1);
// #else
// int validationFlag = 1;
// #endif
int pwdOk = 0;
int numberOfTries = 3;
for (int i=0; i < numberOfTries; i++)
{
QFile f(_filename);
if (f.exists())
{
// ask with a dialog for the password
if (m_password.isEmpty())
getDocPassword(tr("Enter Password"));
if (m_password.isEmpty() && validationFlag == 0)
{
#ifndef NO_OPIE
owarn << "Wrong password" << oendl;
#else
qWarning ("Wrong password");
#endif
QMessageBox::critical( 0, tr("ZSafe"),
tr("Wrong password.\n\nZSafe will now exit.") );
exitZs (1);
}
retval = loadInit(_filename, m_password);
if (retval != PWERR_GOOD)
{
#ifndef NO_OPIE
owarn << "Error loading Document" << oendl;
-#lese
+#else
qWarning ("Error loading Document");
#endif
return false;
}
}
else
{
#ifdef WIN32
this->setCaption("Qt ZSafe");
#else
this->setCaption("ZSafe");
#endif
filename = "";
return false;
}
// load the validation entry
if (validationFlag == 0)
{
pwdOk = 1;
break;
}
retval = loadEntry(entry);
if (retval == 1 &&
!strcmp (entry[0], "ZSAFECATEGORY") &&
!strcmp (entry[1], "name") &&
!strcmp (entry[2], "username") &&
!strcmp (entry[3], "password") &&
!strcmp (entry[4], "comment") )
{
for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]);
pwdOk = 1;
break;
}
else
// for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]);
fclose (fd);
m_password = "";
if (i < numberOfTries - 1)
{
switch( QMessageBox::warning( this, tr("ZSafe"),
tr("Wrong password.\nEnter again?"),
tr("&Yes"), tr("&No."),
0
) )
{
case 1: // No
exitZs (1);
break;
case 0: // Yes
continue;
}
}
}
if (pwdOk == 0)
{
// unset the document entry
conf->writeEntry(APP_KEY+"document", "INVALIDPWD");
if (conf)
delete conf;
exitZs (1);
}
retval = loadEntry(entry);
int numberOfEntries=0;
while (retval == 1) {
QString category( QString::fromUtf8(entry[0]) );
QString name( QString::fromUtf8(entry[1]) );
QString user( QString::fromUtf8(entry[2]) );
QString password( QString::fromUtf8(entry[3]) );
QString comment( QString::fromUtf8(entry[4]) );
QString field5( QString::fromUtf8(entry[5]) );
QString field6( QString::fromUtf8(entry[6]) );
// add the subitems to the categories
Category *cat= categories.find (category);
if (cat)
{
// use the existend item
QListViewItem *catItem = cat->getListItem();
if (catItem)
{
QListViewItem * item = new ShadedListItem( 0, catItem );
item->setText( 0, tr( name ) );
item->setText( 1, tr( user ) );
item->setText( 2, tr( password ) );
item->setText( 3, tr( comment ) );
item->setText( 4, tr( field5 ) );
item->setText( 5, tr( field6 ) );