author | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
commit | 16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 (patch) (side-by-side diff) | |
tree | 0701eae15aa606a0211a2fccfde0eafdac69357c /noncore/apps/zsafe | |
parent | 8d2d2664e5f544b8292806e617deb7a0e4170dc0 (diff) | |
download | opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.zip opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.gz opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.bz2 |
convert to Opie Debugging Framework
-rw-r--r-- | noncore/apps/zsafe/config.in | 2 | ||||
-rw-r--r-- | noncore/apps/zsafe/scqtfiledlg.cpp | 29 | ||||
-rw-r--r-- | noncore/apps/zsafe/zsafe.cpp | 15 | ||||
-rw-r--r-- | noncore/apps/zsafe/zsafe.pro | 14 |
4 files changed, 27 insertions, 33 deletions
diff --git a/noncore/apps/zsafe/config.in b/noncore/apps/zsafe/config.in index 6e321f3..b6d3ffe 100644 --- a/noncore/apps/zsafe/config.in +++ b/noncore/apps/zsafe/config.in @@ -1,5 +1,5 @@ config ZSAFE boolean "zsafe (Zaurus Password Manager)" default "y" - depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI diff --git a/noncore/apps/zsafe/scqtfiledlg.cpp b/noncore/apps/zsafe/scqtfiledlg.cpp index 52b8d0d..c67bbd5 100644 --- a/noncore/apps/zsafe/scqtfiledlg.cpp +++ b/noncore/apps/zsafe/scqtfiledlg.cpp @@ -1,34 +1,31 @@ -/**************************************************************************** -** Form implementation generated from reading ui file 'scqtfiledlg.ui' -** -** Created: Sun Jun 8 15:51:12 2003 -** by: The User Interface Compiler (uic) -** -** WARNING! All changes made in this file will be lost! -****************************************************************************/ #include "scqtfiledlg.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qcombobox.h> #include <qlineedit.h> #include <qlistview.h> #include <qtoolbutton.h> #include <qlayout.h> #include <qtooltip.h> #include <qwhatsthis.h> static const char* const image0_data[] = { "24 16 3 1", ". c None", "# c #000040", "a c #808080", "........................", "........................", ".................####...", ".................####...", ".......##........#aa#...", "......###........#aa#...", ".....####........#aa#...", "....##############aa#...", "...###aaaaaaaaaaaaaa#...", "..####aaaaaaaaaaaaaa#...", "...###aaaaaaaaaaaaaa#...", @@ -195,62 +192,62 @@ ScQtFileDlg::ScQtFileDlg( QWidget* parent, const char* name, bool modal, WFlags // signals and slots connections connect( OkButton, SIGNAL( clicked() ), this, SLOT( slotOK() ) ); connect( DirComboBox, SIGNAL( activated(int) ), this, SLOT( slotDirComboBoxChanged(int) ) ); connect( TypeComboBox, SIGNAL( activated(int) ), this, SLOT( slotTypeComboBoxChanged(int) ) ); connect( CancelButton, SIGNAL( clicked() ), this, SLOT( slotCancel() ) ); connect( ListView, SIGNAL( returnPressed(QListViewItem*) ), this, SLOT( slotSelectionChanged(QListViewItem*) ) ); connect( ListView, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( slotSelectionChanged(QListViewItem*) ) ); connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( slotDoubleClicked(QListViewItem*) ) ); connect( FNameLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotFileTextChanged(const QString&) ) ); connect( FNameLineEdit, SIGNAL( returnPressed() ), this, SLOT( slotOK() ) ); connect( MkDirButton, SIGNAL( clicked() ), this, SLOT( slotMkDir() ) ); } /* * Destroys the object and frees any allocated resources */ ScQtFileDlg::~ScQtFileDlg() { // no need to delete child widgets, Qt does it all for us } void ScQtFileDlg::slotCancel() { - qWarning( "ScQtFileDlg::slotCancel(): Not implemented yet!" ); + owarn << "ScQtFileDlg::slotCancel(): Not implemented yet!" << oendl; } void ScQtFileDlg::slotDirComboBoxChanged( int ) { - qWarning( "ScQtFileDlg::slotDirComboBoxChanged( int ): Not implemented yet!" ); + owarn << "ScQtFileDlg::slotDirComboBoxChanged( int ): Not implemented yet!" << oendl; } void ScQtFileDlg::slotDoubleClicked(QListViewItem *) { - qWarning( "ScQtFileDlg::slotDoubleClicked(QListViewItem *): Not implemented yet!" ); + owarn << "ScQtFileDlg::slotDoubleClicked(QListViewItem *): Not implemented yet!" << oendl; } void ScQtFileDlg::slotFileTextChanged( const QString & ) { - qWarning( "ScQtFileDlg::slotFileTextChanged( const QString & ): Not implemented yet!" ); + owarn << "ScQtFileDlg::slotFileTextChanged( const QString & ): Not implemented yet!" << oendl; } void ScQtFileDlg::slotMkDir() { - qWarning( "ScQtFileDlg::slotMkDir(): Not implemented yet!" ); + owarn << "ScQtFileDlg::slotMkDir(): Not implemented yet!" << oendl; } void ScQtFileDlg::slotOK() { - qWarning( "ScQtFileDlg::slotOK(): Not implemented yet!" ); + owarn << "ScQtFileDlg::slotOK(): Not implemented yet!" << oendl; } void ScQtFileDlg::slotSelectionChanged(QListViewItem *) { - qWarning( "ScQtFileDlg::slotSelectionChanged(QListViewItem *): Not implemented yet!" ); + owarn << "ScQtFileDlg::slotSelectionChanged(QListViewItem *): Not implemented yet!" << oendl; } void ScQtFileDlg::slotTypeComboBoxChanged( int ) { - qWarning( "ScQtFileDlg::slotTypeComboBoxChanged( int ): Not implemented yet!" ); + owarn << "ScQtFileDlg::slotTypeComboBoxChanged( int ): Not implemented yet!" << oendl; } diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp index 3df55eb..bf8f7f4 100644 --- a/noncore/apps/zsafe/zsafe.cpp +++ b/noncore/apps/zsafe/zsafe.cpp @@ -8,59 +8,58 @@ ** ** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html ** ** Compile Flags: ** Zaurus arm : -DNO_OPIE ** Zaurus Opie arm: none ** Linux Desktop : -DDESKTOP ** Windows Desktop: -DDESKTOP -DWIN32 ** ** for japanese version additional use: -DJPATCH_HDE ** ****************************************************************************/ #include "zsafe.h" #include "newdialog.h" #include "searchdialog.h" #include "categorydialog.h" #include "passworddialog.h" #include "infoform.h" #include "zlistview.h" #include "shadedlistitem.h" #ifndef DESKTOP #ifndef NO_OPIE #include <opie2/ofiledialog.h> - +#include <opie2/odebug.h> +using namespace Opie::Core; using namespace Opie::Ui; #else #include "scqtfileedit.h" #endif #endif #include <qclipboard.h> -#include <stdio.h> - #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdlib.h> #ifndef WIN32 #include <unistd.h> #endif #include <string.h> #include <errno.h> #include <qmenubar.h> #include <qpopupmenu.h> #ifdef DESKTOP #include <qfiledialog.h> #ifndef WIN32 #include <qsettings.h> #else #include "qsettings.h" #endif #include <qapplication.h> #else #include <qfile.h> #include <qpe/fileselector.h> @@ -2048,69 +2047,67 @@ int ZSafe::loadInit(const char* _filename, const char *password) unsigned char charbuf[8]; unsigned short ciphertext[4]; char key[128]; Krc2* krc2 = new Krc2(); fd = fopen (_filename, "rb"); QFileInfo f (_filename); load_buffer_length = f.size(); load_buffer_length = ((load_buffer_length / 1024)+1) * 1024 * 2; if (fd == NULL) return PWERR_OPEN; buffer = (char *)malloc(load_buffer_length); for (j = 0; password[j] != '\0'; j++) { key[j] = password[j]; } keylength = j; krc2->rc2_expandkey (key, keylength, 128); #ifndef WIN32 size = read(fileno (fd), (unsigned char *) (charbuf + count), 8); #else - printf ("LoadInit() read1"); size = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd); #endif if (size < 8) return PWERR_DATA; for (count = 0; count < 4; count++) { count2 = count << 1; iv[count] = charbuf[count2] << 8; iv[count] += charbuf[count2 + 1]; } size = 0; bufferIndex = 0; #ifndef WIN32 while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) { while (count < 8) { count2 = read (fileno (fd), (unsigned char *) (charbuf + count), 8); #else - printf ("LoadInit() read2"); while ((count = fread ((unsigned char *) (charbuf), sizeof(unsigned char), 8, fd)) > 0) { while (count < 8) { count2 = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd); #endif if (count2 == 0) { return PWERR_DATA; } count += count2; } /* while (count < 8) */ size += 8; for (count2 = 0; count2 < 8; count2 += 2) { count3 = count2 >> 1; ciphertext[count3] = charbuf[count2] << 8; ciphertext[count3] += charbuf[count2 + 1]; plaintext[count3] = ciphertext[count3] ^ iv[count3]; iv[count3] = plaintext[count3]; } /* for (count2) */ krc2->rc2_decrypt (plaintext); memcpy ((unsigned char *) (buffer + bufferIndex), plaintext, 8); bufferIndex += 8; buffer[bufferIndex + 1] = '\0'; @@ -2238,102 +2235,102 @@ bool ZSafe::saveDocument(const char* _filename, char* entry[FIELD_SIZE]; // save the validation entry { int i=0; entry[i] = (char*)malloc(strlen("ZSAFECATEGORY")+1); strcpy(entry[i++], "ZSAFECATEGORY"); entry[i] = (char*)malloc(strlen("name")+1); strcpy(entry[i++], "name"); entry[i] = (char*)malloc(strlen("username")+1); strcpy(entry[i++], "username"); entry[i] = (char*)malloc(strlen("password")+1); strcpy(entry[i++], "password"); entry[i] = (char*)malloc(strlen("comment")+1); strcpy(entry[i++], "comment"); entry[i] = (char*)malloc(strlen("field5")+1); strcpy(entry[i++], "field5"); entry[i] = (char*)malloc(strlen("field6")+1); strcpy(entry[i++], "field6"); retval = saveEntry(entry); for (int z=0; z<i; z++) free(entry[z]); if (retval == PWERR_DATA) { - qWarning("1: Error writing file, contents not saved"); + owarn << "1: Error writing file, contents not saved" << oendl; saveFinalize(); return false; } // #ifndef WIN32 conf->writeEntry(APP_KEY+"valzsafe", 1); // #endif saveConf(); } 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; si = si->nextSibling()) { int j=0; entry[j] = (char*)malloc(strlen(i->text(0).utf8())+1); strcpy(entry[j++], i->text(0).utf8()); entry[j] = (char*)malloc(strlen(si->text(0).utf8())+1); strcpy(entry[j++], si->text(0).utf8()); entry[j] = (char*)malloc(strlen(si->text(1).utf8())+1); strcpy(entry[j++], si->text(1).utf8()); entry[j] = (char*)malloc(strlen(si->text(2).utf8())+1); strcpy(entry[j++], si->text(2).utf8()); entry[j] = (char*)malloc(strlen(si->text(3).utf8())+1); strcpy(entry[j++], si->text(3).utf8()); entry[j] = (char*)malloc(strlen(si->text(4).utf8())+1); strcpy(entry[j++], si->text(4).utf8()); entry[j] = (char*)malloc(strlen(si->text(5).utf8())+1); strcpy(entry[j++], si->text(5).utf8()); retval = saveEntry(entry); for (int z=0; z<j; z++) { free(entry[z]); } if (retval == PWERR_DATA) { - qWarning("1: Error writing file, contents not saved"); + owarn << "1: Error writing file, contents not saved" << oendl; saveFinalize(); return false; } } } if (saveFinalize() == PWERR_DATA) { - qWarning("2: Error writing file, contents not saved"); + owarn << "2: Error writing file, contents not saved" << oendl; return false; } else { #ifndef DESKTOP Global::statusMessage (tr("Password file saved.")); #endif modified = false; return true; } } PasswordForm *newPwdDialog; bool newPwdDialogResult = false; void ZSafe::setPasswordDialogDone() { newPwdDialogResult = true; newPwdDialog->close(); } void ZSafe::getDocPassword(QString title) { qWarning ("getDocPassword"); // open the 'Password' dialog PasswordForm *dialog = new PasswordForm(this, title, TRUE); newPwdDialog = dialog; @@ -3169,49 +3166,49 @@ void ZSafe::editCategory() DialogCode result = (DialogCode) dialog->exec(); #ifdef DESKTOP result = Accepted; #endif QString fullIconPath; QPixmap *pix; if (result == Accepted) { modified = true; if (category != dialog->CategoryField->currentText()) { categories.remove (category); // #ifndef WIN32 conf->removeEntry(category); // #endif saveConf(); } category = dialog->CategoryField->currentText(); icon = dialog->IconField->currentText()+".png"; if (cat) { - qWarning("Category found"); + owarn << "Category found" << oendl; // if (!icon.isEmpty() && !icon.isNull()) if (icon != "predefined.png") { // build the full path fullIconPath = iconPath + icon; pix = new QPixmap (fullIconPath); if (pix) { // save the full pixmap name into the config file // #ifndef WIN32 conf->writeEntry(APP_KEY+category, icon); // #endif saveConf(); QImage img = pix->convertToImage(); pix->convertFromImage(img.smoothScale(14,14)); cat->setIconName (icon); cat->setIcon (*pix); } } else { // #ifndef WIN32 conf->removeEntry (category); diff --git a/noncore/apps/zsafe/zsafe.pro b/noncore/apps/zsafe/zsafe.pro index 72c8fe9..3cae706 100644 --- a/noncore/apps/zsafe/zsafe.pro +++ b/noncore/apps/zsafe/zsafe.pro @@ -1,17 +1,17 @@ -TEMPLATE = app -CONFIG = qt warn_on +TEMPLATE = app +CONFIG = qt warn_on DESTDIR = $(OPIEDIR)/bin HEADERS = zsafe.h krc2.h category.h categorylist.h zlistview.h \ scqtfiledlg.h SOURCES = main.cpp zsafe.cpp krc2.cpp category.cpp \ categorylist.cpp zlistview.cpp shadedlistitem.cpp\ scqtfileedit.cpp scqtfileedit.moc.cpp \ scqtfiledlg.cpp -INTERFACES = newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui infoform.ui wait.ui -INCLUDEPATH += $(OPIEDIR)/include -DEPENDPATH += $(OPIEDIR)/include -LIBS += -Wl,-rpath,$(OPIEDIR)/lib -L$(OPIEDIR)/lib -lqpe -lopiecore2 -lopieui2 -TARGET = zsafe +INTERFACES = newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui infoform.ui wait.ui +INCLUDEPATH += $(OPIEDIR)/include +DEPENDPATH += $(OPIEDIR)/include +LIBS += -lqpe -lopiecore2 -lopieui2 +TARGET = zsafe include ( $(OPIEDIR)/include.pro ) |