summaryrefslogtreecommitdiff
path: root/noncore/apps/zsafe
Side-by-side diff
Diffstat (limited to 'noncore/apps/zsafe') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/zsafe/main.cpp15
-rw-r--r--noncore/apps/zsafe/zlistview.cpp11
-rw-r--r--noncore/apps/zsafe/zsafe.cpp51
3 files changed, 40 insertions, 37 deletions
diff --git a/noncore/apps/zsafe/main.cpp b/noncore/apps/zsafe/main.cpp
index 4fe319b..5f48f77 100644
--- a/noncore/apps/zsafe/main.cpp
+++ b/noncore/apps/zsafe/main.cpp
@@ -5,17 +5,25 @@
**
** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html
*/
#include "zsafe.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
+/* QT */
#ifdef DESKTOP
#include <qapplication.h>
#else
#include <qpe/qpeapplication.h>
#endif
+
+/* STD */
#include <stdio.h>
#include <signal.h>
ZSafe *zs;
#ifdef DESKTOP
QApplication *appl;
@@ -71,25 +79,22 @@ int main( int argc, char ** argv )
DeskH = 400;
}
#else
DeskW = a.desktop()->width();
DeskH = a.desktop()->height();
- char buf[128];
- sprintf (buf, "Width: %d Height: %d\n", DeskW, DeskH);
- qWarning (buf);
+ owarn << "Width: " << DeskW << " Height: " << DeskH << oendl;
#ifdef JPATCH_HDE
// nothings
#else
if (DeskW > 240)
{
DeskW -= 20;
DeskH += 25;
- sprintf (buf, "Changed width: %d Height: %d\n", DeskW, DeskH);
- qWarning (buf);
+ owarn << "Changed width: " << DeskW << " Height: " << DeskH << oendl;
}
#endif
#endif
ZSafe mw;
diff --git a/noncore/apps/zsafe/zlistview.cpp b/noncore/apps/zsafe/zlistview.cpp
index ba02a15..7d0b8c2 100644
--- a/noncore/apps/zsafe/zlistview.cpp
+++ b/noncore/apps/zsafe/zlistview.cpp
@@ -1,29 +1,32 @@
/*
** $Id$
*/
#include "zlistview.h"
-#include <stdio.h>
#include "zsafe.h"
+/* OPIE */
+//#include <opie2/odebug.h>
+
+/* STD */
+#include <stdio.h>
+
ZListView::ZListView (ZSafe *zsafe, const char *id) : QListView(zsafe, id)
{
zs = zsafe;
}
ZListView::~ZListView()
{
}
void ZListView::keyPressEvent ( QKeyEvent *e )
{
/*
- char buf[64];
- sprintf (buf, "key: %d\n", e->key());
- qWarning (buf);
+ owarn << "key: " << e->key() << oendl;
*/
switch (e->key())
{
case 32: // middle cursor key pressed
zs->showInfo (zs->selectedItem);
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index 6ff05ac..ca3ff52 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -878,13 +878,13 @@ void ZSafe::findPwd()
QString comment;
if (result == Accepted)
{
name = dialog->NameField->text();
username = dialog->UsernameField->text();
comment = dialog->CommentField->text();
- qWarning (name);
+ owarn << name << oendl;
}
else
{
delete dialog;
return;
}
@@ -924,13 +924,13 @@ void ZSafe::findPwd()
else
i = ListView->firstChild();
for (;
i != NULL;
i = i->nextSibling())
{
- qWarning (i->text(0));
+ owarn << i->text(0) << oendl;
i->setSelected(FALSE);
// step through all subitems
QListViewItem *si;
if (lastSearchedItem)
si = lastSearchedItem;
@@ -938,13 +938,13 @@ void ZSafe::findPwd()
si = i->firstChild();
// for (si = i->firstChild();
for (;
si != NULL;
si = si->nextSibling())
{
- qWarning (si->text(0));
+ owarn << si->text(0) << oendl;
if (si->isSelected())
si->setSelected(FALSE);
// ListView->repaintItem(si);
bool n=TRUE;
bool u=TRUE;
@@ -955,13 +955,13 @@ void ZSafe::findPwd()
u = (si->text(1)).contains (username, FALSE);
if (!comment.isEmpty())
c = (si->text(3)).contains (comment, FALSE);
if ((n && u && c ) && !found)
{
- qWarning ("Found");
+ owarn << "Found" << oendl;
selectedItem = si;
si->setSelected(TRUE);
ListView->setCurrentItem(si);
ListView->ensureItemVisible(si);
ListView->triggerUpdate();
@@ -1225,14 +1225,13 @@ void ZSafe::removeAsciiFile()
if (fn && fn.length() > 0 )
{
QFile f( fn );
if ( !f.remove() )
{
- qWarning( QString("Could not remove file %1").arg(fn),
- 2000 );
+ owarn << "Could not remove file " << fn << oendl;
QMessageBox::critical( 0, tr("ZSafe"),
tr("Could not remove text file.") );
return;
}
}
}
@@ -1275,14 +1274,13 @@ void ZSafe::writeAllEntries()
// open the new document
if (fn && fn.length() > 0 )
{
QFile f( fn );
if ( !f.open( IO_WriteOnly ) ) {
- qWarning( QString("Could not write to file %1").arg(fn),
- 2000 );
+ owarn << "Could not write to file " << fn << oendl;
QMessageBox::critical( 0, "ZSafe",
QString("Could not export to text file.") );
return;
}
QTextStream t( &f );
@@ -1319,16 +1317,16 @@ void ZSafe::writeAllEntries()
oneEntry += "\"";
oneEntry += si->text(4);
oneEntry += "\";";
oneEntry += "\"";
oneEntry += si->text(5);
oneEntry += "\"";
- // qWarning (oneEntry);
+ // owarn << oneEntry << oendl;
t << oneEntry << endl;
- // qWarning (si->text(0));
+ // owarn << si->text(0) << oendl;
}
}
f.close();
}
}
@@ -1370,14 +1368,13 @@ void ZSafe::readAllEntries()
if (fn && fn.length() > 0 )
{
QFile f( fn );
if ( !f.open( IO_ReadOnly ) )
{
- qWarning( QString("Could not read file %1").arg(fn),
- 2000 );
+ owarn << "Could not read file " << fn << oendl;
QMessageBox::critical( 0, "ZSafe",
QString("Could not import text file.") );
return;
}
modified = true;
@@ -1400,13 +1397,13 @@ void ZSafe::readAllEntries()
si = si->nextSibling();
i->takeItem(_si); // remove from view list
if (_si) delete _si;
}
}
- qWarning ("ReadAllEntries(): ");
+ owarn << "ReadAllEntries(): " << oendl;
QTextStream t(&f);
while ( !t.eof() )
{
QString s = t.readLine();
s.replace (QRegExp("\";\""), "\"|\"");
@@ -1551,14 +1548,13 @@ void ZSafe::readAllEntries()
void ZSafe::writeAllEntries()
{
// open the file for writing
QString fn = filename + ".txt";
QFile f( fn );
if ( !f.open( IO_WriteOnly ) ) {
- qWarning( QString("Could not write to file %1").arg(fn),
- 2000 );
+ owarn << "Could not write to file " << fn << oendl;
QMessageBox::critical( 0, tr("ZSafe"),
tr("Could not export to text file.") );
return;
}
QTextStream t( &f );
@@ -1590,29 +1586,28 @@ void ZSafe::writeAllEntries()
oneEntry += "\"";
// oneEntry += si->text(3);
QString comment = si->text(3);
comment.replace (QRegExp("\n"), "<br>");
oneEntry += comment;
oneEntry += "\"";
- // qWarning (oneEntry);
+ // owarn << oneEntry << oendl;
t << oneEntry << endl;
- // qWarning (si->text(0));
+ // owarn << si->text(0) << oendl;
}
}
f.close();
}
void ZSafe::readAllEntries()
{
QString fn = filename + ".txt";
QFile f( fn );
if ( !f.open( IO_ReadOnly ) )
{
- qWarning( QString("Could not read file %1").arg(fn),
- 2000 );
+ owarn << "Could not read file " << fn << oendl;
QMessageBox::critical( 0, tr("ZSafe"),
tr("Could not import text file.") );
return;
}
modified = true;
@@ -1635,13 +1630,13 @@ void ZSafe::readAllEntries()
si = si->nextSibling();
i->takeItem(_si); // remove from view list
if (_si) delete _si;
}
}
- qWarning ("ReadAllEntries(): ");
+ owarn << "ReadAllEntries(): " << oendl;
QTextStream t(&f);
while ( !t.eof() )
{
QString s = t.readLine();
s.replace (QRegExp("\";\""), "\"|\"");
@@ -1759,13 +1754,13 @@ void ZSafe::readAllEntries()
}
#endif // UNUSED
void ZSafe::resume(int)
{
- qWarning ("Resume");
+ owarn << "Resume" << oendl;
// hide the main window
infoForm->hide();
// open zsafe again
m_password = "";
selectedItem = NULL;
@@ -1815,22 +1810,22 @@ bool ZSafe::openDocument(const char* _filename, const char* )
{
// ask with a dialog for the password
if (m_password.isEmpty())
getDocPassword(tr("Enter Password"));
if (m_password.isEmpty() && validationFlag == 0)
{
- qWarning ("Wrong password");
+ owarn << "Wrong password" << oendl;
QMessageBox::critical( 0, tr("ZSafe"),
tr("Wrong password.\n\nZSafe will now exit.") );
exitZs (1);
}
retval = loadInit(_filename, m_password);
if (retval != PWERR_GOOD)
{
- qWarning ("Error loading Document");
+ owarn << "Error loading Document" << oendl;
return false;
}
}
else
{
#ifdef WIN32
@@ -2298,13 +2293,13 @@ void ZSafe::setPasswordDialogDone()
newPwdDialogResult = true;
newPwdDialog->close();
}
void ZSafe::getDocPassword(QString title)
{
-qWarning ("getDocPassword");
+ owarn << "getDocPassword" << oendl;
// open the 'Password' dialog
PasswordForm *dialog = new PasswordForm(this, title, TRUE);
newPwdDialog = dialog;
newPwdDialogResult = false;
connect( dialog->PasswordField, SIGNAL( returnPressed() ),
@@ -2477,13 +2472,13 @@ int ZSafe::saveFinalize(void)
free(buffer);
return retval;
}
void ZSafe::quitMe ()
{
- qWarning ("QUIT...");
+ owarn << "QUIT..." << oendl;
if (modified)
{
switch( QMessageBox::information( this, tr("ZSafe"),
tr("Do you want to save\nbefore exiting?"),
tr("&Save"),
@@ -2681,13 +2676,13 @@ void ZSafe::addCategory()
if (result == Accepted)
{
modified = true;
category = dialog->CategoryField->currentText();
icon = dialog->IconField->currentText()+".png";
- qWarning (category);
+ owarn << category << oendl;
QListViewItem *li = new ShadedListItem( 1, ListView );
Category *c1 = new Category();
c1->setCategoryName(category);
// if (!icon.isEmpty() && !icon.isNull())
@@ -3189,13 +3184,13 @@ void ZSafe::editCategory()
}
// change the category name of the selected category
QListViewItem *catItem = cat->getListItem();
if (catItem)
{
- qWarning (category);
+ owarn << category << oendl;
catItem->setText( 0, tr( category ) );
cat->setCategoryName (tr(category));
cat->initListItem();
categories.insert (category, cat);
}
@@ -3590,13 +3585,13 @@ void ZSafe::paintEvent( QPaintEvent * )
infoForm->raise();
}
}
void ZSafe::resizeEvent ( QResizeEvent * )
{
- // qWarning ("resizeEvent");
+ // owarn << "resizeEvent" << oendl;
#ifndef DESKTOP
DeskW = appl->desktop()->width();
DeskH = appl->desktop()->height();
#else
DeskW = this->width();
DeskH = this->height();