summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/zsafe/zsafe.cpp86
1 files changed, 85 insertions, 1 deletions
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index 5cad7cb..824b841 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -928,9 +928,13 @@ void ZSafe::findPwd()
{
name = dialog->NameField->text();
username = dialog->UsernameField->text();
comment = dialog->CommentField->text();
+#ifndef NO_OPIE
owarn << name << oendl;
+#else
+ qWarning (name);
+#endif
}
else
{
delete dialog;
@@ -974,9 +978,11 @@ void ZSafe::findPwd()
for (;
i != NULL;
i = i->nextSibling())
{
+#ifndef NO_OPIE
owarn << i->text(0) << oendl;
+#endif
i->setSelected(FALSE);
// step through all subitems
QListViewItem *si;
@@ -988,9 +994,13 @@ void ZSafe::findPwd()
for (;
si != NULL;
si = si->nextSibling())
{
+#ifndef NO_OPIE
owarn << si->text(0) << oendl;
+#else
+ qWarning (si->text(0));
+#endif
if (si->isSelected())
si->setSelected(FALSE);
// ListView->repaintItem(si);
@@ -1005,9 +1015,13 @@ void ZSafe::findPwd()
c = (si->text(3)).contains (comment, FALSE);
if ((n && u && c ) && !found)
{
+#ifndef NO_OPIE
owarn << "Found" << oendl;
+#else
+ qWarning ("Found");
+#endif
selectedItem = si;
si->setSelected(TRUE);
ListView->setCurrentItem(si);
ListView->ensureItemVisible(si);
@@ -1275,9 +1289,13 @@ void ZSafe::removeAsciiFile()
{
QFile f( fn );
if ( !f.remove() )
{
+#ifndef NO_OPIE
owarn << "Could not remove file " << fn << oendl;
+#else
+ qWarning( QString("Could not remove file %1").arg(fn),2000 );
+#endif
QMessageBox::critical( 0, tr("ZSafe"),
tr("Could not remove text file.") );
return;
}
@@ -1324,9 +1342,13 @@ void ZSafe::writeAllEntries()
if (fn && fn.length() > 0 )
{
QFile f( fn );
if ( !f.open( IO_WriteOnly ) ) {
+#ifndef NO_OPIE
owarn << "Could not write to file " << fn << oendl;
+#else
+ qWarning( QString("Could not write to file %1").arg(fn),2000 );
+#endif
QMessageBox::critical( 0, "ZSafe",
QString("Could not export to text file.") );
return;
}
@@ -1418,9 +1440,13 @@ void ZSafe::readAllEntries()
{
QFile f( fn );
if ( !f.open( IO_ReadOnly ) )
{
+#ifndef NO_OPIE
owarn << "Could not read file " << fn << oendl;
+#else
+ qWarning( QString("Could not read file %1").arg(fn), 2000 );
+#endif
QMessageBox::critical( 0, "ZSafe",
QString("Could not import text file.") );
return;
}
@@ -1447,9 +1473,13 @@ void ZSafe::readAllEntries()
if (_si) delete _si;
}
}
+#ifndef NO_OPIE
owarn << "ReadAllEntries(): " << oendl;
+#else
+ qWarning ("ReadAllEntries(): ");
+#endif
QTextStream t(&f);
while ( !t.eof() )
{
@@ -1594,13 +1624,24 @@ void ZSafe::readAllEntries()
#ifdef UNUSED
void ZSafe::writeAllEntries()
{
+ if (filename.isEmpty())
+ {
+ QMessageBox::critical( 0, tr("ZSafe"),
+ tr("<P>No document defined. You have to create a new document</P>"));
+ return;
+ }
+
// open the file for writing
QString fn = filename + ".txt";
QFile f( fn );
if ( !f.open( IO_WriteOnly ) ) {
+#ifndef NO_OPIE
owarn << "Could not write to file " << fn << oendl;
+#else
+ qWarning( QString("Could not write to file %1").arg(fn), 2000 );
+#endif
QMessageBox::critical( 0, tr("ZSafe"),
tr("Could not export to text file.") );
return;
}
@@ -1651,9 +1692,13 @@ void ZSafe::readAllEntries()
QString fn = filename + ".txt";
QFile f( fn );
if ( !f.open( IO_ReadOnly ) )
{
+#ifndef NO_OPIE
owarn << "Could not read file " << fn << oendl;
+#else
+ qWarning( QString("Could not read file %1").arg(fn), 2000 );
+#endif
QMessageBox::critical( 0, tr("ZSafe"),
tr("Could not import text file.") );
return;
}
@@ -1680,10 +1725,13 @@ void ZSafe::readAllEntries()
if (_si) delete _si;
}
}
+#ifndef NO_OPIE
owarn << "ReadAllEntries(): " << oendl;
-
+#else
+ qWarning ("ReadAllEntries(): ");
+#endif
QTextStream t(&f);
while ( !t.eof() )
{
QString s = t.readLine();
@@ -1804,9 +1852,11 @@ void ZSafe::readAllEntries()
#endif // UNUSED
void ZSafe::resume(int)
{
+#ifndef NO_OPIE
owarn << "Resume" << oendl;
+#endif
// hide the main window
if ( !showpwd )
{
@@ -1863,18 +1913,26 @@ bool ZSafe::openDocument(const char* _filename, const char* )
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
+ qWarning ("Error loading Document");
+#endif
return false;
}
}
else
@@ -2272,9 +2330,13 @@ bool ZSafe::saveDocument(const char* _filename,
retval = saveEntry(entry);
for (int z=0; z<i; z++) free(entry[z]);
if (retval == PWERR_DATA) {
+#ifndef NO_OPIE
owarn << "1: Error writing file, contents not saved" << oendl;
+#else
+ qWarning("1: Error writing file, contents not saved");
+#endif
saveFinalize();
return false;
}
// #ifndef WIN32
@@ -2316,18 +2378,26 @@ bool ZSafe::saveDocument(const char* _filename,
{
free(entry[z]);
}
if (retval == PWERR_DATA) {
+#ifndef NO_OPIE
owarn << "1: Error writing file, contents not saved" << oendl;
+#else
+ qWarning("1: Error writing file, contents not saved");
+#endif
saveFinalize();
return false;
}
}
}
if (saveFinalize() == PWERR_DATA) {
+#ifndef NO_OPIE
owarn << "2: Error writing file, contents not saved" << oendl;
+#else
+ qWarning("2: Error writing file, contents not saved");
+#endif
return false;
} else {
#ifndef DESKTOP
Global::statusMessage (tr("Password file saved."));
@@ -2346,9 +2416,11 @@ void ZSafe::setPasswordDialogDone()
}
void ZSafe::getDocPassword(QString title)
{
+#ifndef NO_OPIE
owarn << "getDocPassword" << oendl;
+#endif
// open the 'Password' dialog
PasswordForm *dialog = new PasswordForm(this, title, TRUE);
newPwdDialog = dialog;
newPwdDialogResult = false;
@@ -2528,9 +2600,11 @@ int ZSafe::saveFinalize(void)
}
void ZSafe::quitMe ()
{
+#ifndef NO_OPIE
owarn << "QUIT..." << oendl;
+#endif
if (modified)
{
switch( QMessageBox::information( this, tr("ZSafe"),
@@ -2732,9 +2806,11 @@ void ZSafe::addCategory()
modified = true;
category = dialog->CategoryField->currentText();
icon = dialog->IconField->currentText()+".png";
+#ifndef NO_OPIE
owarn << category << oendl;
+#endif
QListViewItem *li = new ShadedListItem( 1, ListView );
Category *c1 = new Category();
c1->setCategoryName(category);
@@ -3206,9 +3282,13 @@ void ZSafe::editCategory()
icon = dialog->IconField->currentText()+".png";
if (cat)
{
+#ifndef NO_OPIE
owarn << "Category found" << oendl;
+#else
+ qWarning("Category found");
+#endif
// if (!icon.isEmpty() && !icon.isNull())
if (icon != "predefined.png")
{
@@ -3240,9 +3320,13 @@ void ZSafe::editCategory()
// change the category name of the selected category
QListViewItem *catItem = cat->getListItem();
if (catItem)
{
+#ifndef NO_OPIE
owarn << category << oendl;
+#else
+ qWarning (category);
+#endif
catItem->setText( 0, tr( category ) );
cat->setCategoryName (tr(category));
cat->initListItem();