-rw-r--r-- | noncore/apps/zsafe/zsafe.cpp | 86 |
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 @@ -929,7 +929,11 @@ 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 { @@ -975,7 +979,9 @@ void ZSafe::findPwd() i != NULL; i = i->nextSibling()) { +#ifndef NO_OPIE owarn << i->text(0) << oendl; +#endif i->setSelected(FALSE); // step through all subitems @@ -989,7 +995,11 @@ void ZSafe::findPwd() 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); @@ -1006,7 +1016,11 @@ void ZSafe::findPwd() if ((n && u && c ) && !found) { +#ifndef NO_OPIE owarn << "Found" << oendl; +#else + qWarning ("Found"); +#endif selectedItem = si; si->setSelected(TRUE); ListView->setCurrentItem(si); @@ -1276,7 +1290,11 @@ 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; @@ -1325,7 +1343,11 @@ void ZSafe::writeAllEntries() { 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; @@ -1419,7 +1441,11 @@ 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; @@ -1448,7 +1474,11 @@ void ZSafe::readAllEntries() } } +#ifndef NO_OPIE owarn << "ReadAllEntries(): " << oendl; +#else + qWarning ("ReadAllEntries(): "); +#endif QTextStream t(&f); while ( !t.eof() ) @@ -1595,11 +1625,22 @@ 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; @@ -1652,7 +1693,11 @@ 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, tr("ZSafe"), tr("Could not import text file.") ); return; @@ -1681,8 +1726,11 @@ void ZSafe::readAllEntries() } } +#ifndef NO_OPIE owarn << "ReadAllEntries(): " << oendl; - +#else + qWarning ("ReadAllEntries(): "); +#endif QTextStream t(&f); while ( !t.eof() ) { @@ -1805,7 +1853,9 @@ void ZSafe::readAllEntries() void ZSafe::resume(int) { +#ifndef NO_OPIE owarn << "Resume" << oendl; +#endif // hide the main window if ( !showpwd ) @@ -1864,7 +1914,11 @@ bool ZSafe::openDocument(const char* _filename, const char* ) 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); @@ -1873,7 +1927,11 @@ bool ZSafe::openDocument(const char* _filename, const char* ) 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; } } @@ -2273,7 +2331,11 @@ 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; } @@ -2317,7 +2379,11 @@ 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; } @@ -2326,7 +2392,11 @@ bool ZSafe::saveDocument(const char* _filename, } 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 @@ -2347,7 +2417,9 @@ 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; @@ -2529,7 +2601,9 @@ int ZSafe::saveFinalize(void) void ZSafe::quitMe () { +#ifndef NO_OPIE owarn << "QUIT..." << oendl; +#endif if (modified) { @@ -2733,7 +2807,9 @@ void ZSafe::addCategory() 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(); @@ -3207,7 +3283,11 @@ void ZSafe::editCategory() if (cat) { +#ifndef NO_OPIE owarn << "Category found" << oendl; +#else + qWarning("Category found"); +#endif // if (!icon.isEmpty() && !icon.isNull()) if (icon != "predefined.png") @@ -3241,7 +3321,11 @@ void ZSafe::editCategory() 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)); |