author | llornkcor <llornkcor> | 2004-07-13 10:35:23 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-07-13 10:35:23 (UTC) |
commit | 37e0e077b51841971c3d4c25b287f4d39e750e2d (patch) (side-by-side diff) | |
tree | c1b499dd6e544207c6ff7047acd8170d6ea63f94 | |
parent | 5d2ec2e9b1dce49e914c260fe16a82ddccbaa92d (diff) | |
download | opie-37e0e077b51841971c3d4c25b287f4d39e750e2d.zip opie-37e0e077b51841971c3d4c25b287f4d39e750e2d.tar.gz opie-37e0e077b51841971c3d4c25b287f4d39e750e2d.tar.bz2 |
fix ups, and move qsettings files away
-rw-r--r--[-rwxr-xr-x] | noncore/apps/zsafe/extra/qsettings.cpp (renamed from noncore/apps/zsafe/qsettings.cpp) | 308 | ||||
-rw-r--r--[-rwxr-xr-x] | noncore/apps/zsafe/extra/qsettings.h (renamed from noncore/apps/zsafe/qsettings.h) | 0 | ||||
-rw-r--r-- | noncore/apps/zsafe/zsafe.cpp | 147 |
3 files changed, 243 insertions, 212 deletions
diff --git a/noncore/apps/zsafe/qsettings.cpp b/noncore/apps/zsafe/extra/qsettings.cpp index ee55339..def2e2d 100755..100644 --- a/noncore/apps/zsafe/qsettings.cpp +++ b/noncore/apps/zsafe/extra/qsettings.cpp @@ -1,152 +1,156 @@ -/*
-** $Id$
-*/
-
-#include "qsettings.h"
-#include <stdio.h>
-#include <qfile.h>
-#include <qtextstream.h>
-
-
-QSettings::QSettings(const QString &_fn)
-{
- // read the prefs from the file
- fn = _fn;
-
- QFile f(_fn);
- if ( f.open(IO_ReadOnly) ) { // file opened successfully
- QTextStream t( &f ); // use a text stream
- QString s;
- while ( !t.eof() ) { // until end of file...
- s = t.readLine(); // line of text excluding '\n'
- char buf[256];
- sprintf (buf, "%s", (const char *) s);
- int pos = s.find (" = ");
- QString key = s.left (pos);
- QString val = s.right (s.length() - pos - 3);
- writeEntry (key, val);
-
- sprintf (buf, "%s|%s", (const char *)key, (const char *)val);
- }
- f.close();
- }
-
-
-}
-
-QSettings::~QSettings()
-{
- // write out the prefs to the file
- QAsciiDictIterator <QString> it( prefs ); // iterator for dict
- QFile f(fn);
- f.open(IO_WriteOnly);
- QTextStream ts( &f );
-
- while ( it.current() )
- {
- QString *key = new QString(it.currentKey());
- char buf[256];
- sprintf (buf, "%s", (const char *) *( it.current()));
- QString *val = new QString(buf);
- sprintf (buf, "%s %s", (const char *)*key, (const char *)*val);
- ts << *key << " = " << *val << endl;
- ++it;
- }
-
- f.close();
- prefs.clear();
-}
-
-void QSettings::insertSearchPath (System sys, const QString &str)
-{
- fn = str;
-}
-
-QString QSettings::readEntry (const QString &key, const QString &def)
-{
-
- QString *s = prefs.find((const char *)key);
- if (!s)
- return def;
- else
- return *s;
-
-}
-
-int QSettings::readNumEntry (const QString &key, int def)
-{
- QString *s = prefs[key];
- if (!s) return def;
- return s->toInt();
-}
-
-bool QSettings::readBoolEntry (const QString &key, bool def)
-{
- QString *s = prefs[key];
- if (!s) return def;
- if (*s == "1")
- return true;
- else
- return false;
-}
-
-bool QSettings::writeEntry (const QString &key, int val)
-{
- char buf[64];
- sprintf (buf, "%d", val);
- QString *v = new QString(buf);
- prefs.replace ((const char *)key, v);
- return true;
-}
-
-bool QSettings::writeEntry (const QString &key, bool val)
-{
- QString *v;
- if (val)
- v = new QString("1");
- else
- v = new QString("0");
- prefs.replace ((const char *)key, v);
- return true;
-}
-
-bool QSettings::writeEntry (const QString &key, const QString &val)
-{
- QString *v = new QString (val);
- prefs.replace ((const char *)key, v);
- return true;
-}
-
-bool QSettings::writeEntry (const QString &key, const char *val)
-{
- QString *v = new QString (val);
- prefs.replace ((const char *)key, v);
- return true;
-}
-
-bool QSettings::removeEntry (const QString &key)
-{
- prefs.remove (key);
- return true;
-}
-
-QStringList QSettings::entryList (const QString &key) const
-{
- QAsciiDictIterator <QString> it( prefs ); // iterator for dict
- QStringList list;
-
- while ( it.current() )
- {
- char buf[512];
- sprintf (buf, "%s", (const char *) *( it.current()));
- QString *val = new QString(buf);
- sprintf(buf, "%s -> %s\n", it.currentKey(), (const char *)*val );
- QString *cat = new QString(it.currentKey());
- if (cat->contains("-field", FALSE))
- list.append (it.currentKey());
- ++it;
-
- }
- return list;
-}
-
+/* +** $Id$ +*/ + +#include "qsettings.h" +#include <stdio.h> +#include <qfile.h> +#include <qtextstream.h> + + +QSettings::QSettings(const QString &_fn) +{ + qWarning("Settings "+_fn); + // read the prefs from the file + fn = _fn; + + QFile f(_fn); + if ( f.open(IO_ReadOnly) ) { // file opened successfully + QTextStream t( &f ); // use a text stream + QString s; + while ( !t.eof() ) { // until end of file... + s = t.readLine(); // line of text excluding '\n' + char buf[256]; + sprintf (buf, "%s", (const char *) s); + int pos = s.find (" = "); + QString key = s.left (pos); + QString val = s.right (s.length() - pos - 3); + writeEntry (key, val); + + sprintf (buf, "%s|%s", (const char *)key, (const char *)val); + } + f.close(); + } + + +} + +QSettings::~QSettings() +{ + // write out the prefs to the file + QAsciiDictIterator <QString> it( prefs ); // iterator for dict + QFile f(fn); + f.open(IO_WriteOnly); + QTextStream ts( &f ); + + while ( it.current() ) + { + QString *key = new QString(it.currentKey()); + char buf[256]; + sprintf (buf, "%s", (const char *) *( it.current())); + QString *val = new QString(buf); + sprintf (buf, "%s %s", (const char *)*key, (const char *)*val); + ts << *key << " = " << *val << endl; + ++it; + } + + f.close(); + prefs.clear(); +} + +void QSettings::insertSearchPath (System sys, const QString &str) +{ + fn = str; +} + +QString QSettings::readEntry (const QString &key, const QString &def) +{ + + QString *s = prefs.find((const char *)key); + if (!s) + return def; + else + return *s; + +} + +int QSettings::readNumEntry (const QString &key, int def) +{ + QString *s = prefs[key]; + if (!s) return def; + return s->toInt(); +} + +bool QSettings::readBoolEntry (const QString &key, bool def) +{ + QString *s = prefs[key]; + if (!s) return def; + if (*s == "1") + return true; + else + return false; +} + +bool QSettings::writeEntry (const QString &key, int val) +{ + char buf[64]; + sprintf (buf, "%d", val); + QString *v = new QString(buf); + prefs.replace ((const char *)key, v); + return true; +} + +bool QSettings::writeEntry (const QString &key, bool val) +{ + QString *v; + if (val) + v = new QString("1"); + else + v = new QString("0"); + prefs.replace ((const char *)key, v); + return true; +} + +bool QSettings::writeEntry (const QString &key, const QString &val) +{ + QString *v = new QString (val); + prefs.replace ((const char *)key, v); + return true; +} + +bool QSettings::writeEntry (const QString &key, const char *val) +{ + QString *v = new QString (val); + prefs.replace ((const char *)key, v); + return true; +} + +bool QSettings::removeEntry (const QString &key) +{ + prefs.remove (key); + return true; +} + +QStringList QSettings::entryList (const QString &key) const +{ + qDebug("entryList: "+key); + QStringList list; + if(!prefs.isEmpty()) { + QAsciiDictIterator <QString> it( prefs ); // iterator for dict + qDebug("ready"); + while ( it.current() ) + { + char buf[512]; + sprintf(buf, "%s", (const char *) *( it.current())); + QString *val = new QString(buf); + sprintf(buf, "%s -> %s\n", it.currentKey(), (const char *)*val ); + QString *cat = new QString(it.currentKey()); + if (cat->contains("-field", FALSE)) + list.append (it.currentKey()); + ++it; + } + } + qWarning("Return here"); + return list; +} + diff --git a/noncore/apps/zsafe/qsettings.h b/noncore/apps/zsafe/extra/qsettings.h index 95e87b5..95e87b5 100755..100644 --- a/noncore/apps/zsafe/qsettings.h +++ b/noncore/apps/zsafe/extra/qsettings.h diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp index 0864293..f3d57f8 100644 --- a/noncore/apps/zsafe/zsafe.cpp +++ b/noncore/apps/zsafe/zsafe.cpp @@ -1,74 +1,74 @@ /**************************************************************************** ** ** Created: Sat Apr 6 17:57:45 2002 ** ** Author: Carsten Schneider <CarstenSchneider@t-online.de> ** ** $Id$ ** ** 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 -** +** Linux Desktop : -DDESKTOP -DNO_OPIE +** Windows Desktop: -DDESKTOP -DNO_OPIE +** use qmake ** 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 <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdlib.h> -#ifndef WIN32 +#ifndef Q_WS_WIN #include <unistd.h> #endif #include <string.h> #include <errno.h> #include <qmenubar.h> #include <qpopupmenu.h> #ifdef DESKTOP #include <qfiledialog.h> #include <qdragobject.h> -#ifndef WIN32 +#ifndef Q_WS_WIN #include <qsettings.h> #else #include "qsettings.h" #endif #include <qapplication.h> #else #include <qfile.h> #include <qpe/fileselector.h> #include <qpe/global.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/config.h> #endif #include <qtimer.h> #include <qlayout.h> @@ -84,44 +84,44 @@ using namespace Opie::Ui; #include <qimage.h> #include <qpixmap.h> #include <qlineedit.h> #include <qmultilineedit.h> #include <qregexp.h> #include <qdir.h> #include <qtextbrowser.h> #include <qlabel.h> #include <qcombobox.h> #include "krc2.h" #include "wait.h" extern int DeskW, DeskH; #ifdef DESKTOP -extern QApplication *appl; +extern QApplication *appl; #else extern QPEApplication *appl; #endif #ifdef JPATCH_HDE #define tr(arg) arg #endif #ifdef DESKTOP -#ifndef WIN32 +#ifndef Q_WS_WIN const QString APP_KEY="/.zsafe/"; #else const QString APP_KEY=""; #endif #else const QString APP_KEY=""; #endif // include xmp images #include "pics/zsafe/copy.xpm" #include "pics/zsafe/cut.xpm" #include "pics/zsafe/edit.xpm" #include "pics/zsafe/editdelete.xpm" #include "pics/zsafe/find.xpm" #include "pics/zsafe/folder_open.xpm" #include "pics/zsafe/help_icon.xpm" @@ -352,33 +352,33 @@ static const char* const general_data[] = { { QClipboard *cb = QApplication::clipboard(); cb->clear(); exit (ec); } // save the configuration into the file void ZSafe::saveConf () { if (conf) { delete conf; #ifdef DESKTOP -#ifndef WIN32 +#ifndef Q_WS_WIN conf = new QSettings (); conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath()); #else conf = new QSettings (cfgFile); conf->insertSearchPath (QSettings::Unix, cfgFile); #endif #else conf = new Config (cfgFile, Config::File); conf->setGroup ("zsafe"); #endif } } /* * Constructs a ZSafe which is a child of 'parent', with the @@ -404,45 +404,45 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) QString qpedir ((const char *)getenv("QPEDIR")); #else QString qpedir ((const char *)getenv("OPIEDIR")); #endif #ifdef DESKTOP iconPath = QDir::homeDirPath() + "/pics/"; #else if (qpedir.isEmpty()) iconPath = "/home/QtPalmtop/pics/"; else iconPath = qpedir + "/pics/"; #endif // create a zsafe configuration object #ifdef DESKTOP -#ifndef WIN32 +#ifndef Q_WS_WIN conf = new QSettings (); conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath()); #else conf = new QSettings (cfgFile); conf->insertSearchPath (QSettings::Unix, cfgFile); #endif #else conf = new Config (cfgFile, Config::File); conf->setGroup ("zsafePrefs"); #endif #ifdef DESKTOP -// #ifndef WIN32 +// #ifndef Q_WS_WIN expandTree = conf->readBoolEntry(APP_KEY+"expandTree", false); // #endif #else expandTree = conf->readNumEntry(APP_KEY+"expandTree", 0); #endif #ifndef DESKTOP conf->setGroup ("zsafe"); #endif QPixmap copy_img((const char**) copy_xpm); QPixmap cut_img((const char**) cut_xpm); QPixmap edit_img((const char**) edit_xpm); QPixmap editdelete_img((const char**) editdelete_xpm); QPixmap find_img((const char**) find_xpm); QPixmap folder_open_img((const char**) folder_open_xpm); QPixmap help_icon_img((const char**) help_icon_xpm); @@ -451,33 +451,33 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) QPixmap quit_icon_img((const char**) quit_icon_xpm); QPixmap save_img((const char**) save_xpm); QPixmap trash_img((const char**) trash_xpm); QPixmap expand_img((const char**) expand_xpm); QPixmap export_img((const char**) export_xpm); QPixmap import_img((const char**) import_xpm); QPixmap bank_cards( ( const char** ) bank_cards_data ); QPixmap passwords( ( const char** ) passwords_data ); QPixmap software( ( const char** ) software_data ); QPixmap general( ( const char** ) general_data ); QPixmap image0( ( const char** ) zsafe_xpm ); if ( !name ) setName( "ZSafe" ); #ifdef DESKTOP -#ifdef WIN32 +#ifdef Q_WS_WIN setGeometry(100, 150, DeskW, DeskH-30 ); #else resize( DeskW, DeskH-30 ); #endif #else #ifdef JPATCH_HDE int DeskS; if(DeskW > DeskH) { DeskS = DeskW; } else { DeskS = DeskH; @@ -485,104 +485,104 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) resize( DeskW, DeskH ); setMinimumSize( QSize( DeskS, DeskS ) ); setMaximumSize( QSize( DeskS, DeskS ) ); #else resize( DeskW, DeskH-30 ); #endif #endif setCaption( tr( "ZSafe" ) ); QString zsafeAppDirPath = QDir::homeDirPath() + "/Documents/application/zsafe"; QString filename = conf->readEntry(APP_KEY+"document"); if (filename.isEmpty() || filename.isNull()) { // check if the directory application exists, if not // create it -// #ifndef WIN32 +// #ifndef Q_WS_WIN // QString d1("Documents/application"); // #else QString d1(QDir::homeDirPath() + "/Documents/application"); // #endif QDir pd1(d1); if (!pd1.exists()) { QDir pd2(QDir::homeDirPath() + "/Documents"); if (!pd2.exists()) { QDir pd3(QDir::homeDirPath()); if (!pd3.mkdir("Documents", FALSE)) { } } if (!pd2.mkdir("application", FALSE)) { QMessageBox::critical( 0, tr("ZSafe"), #ifdef JPATCH_HDE tr("<P>Can't create directory ..."+d1+"</P><P>ZSafe will now exit.</P>")); #else tr("<P>Can't create directory %1</P><P>ZSafe will now exit.</P>").arg(d1)); #endif exitZs (1); } } -// #ifndef WIN32 +// #ifndef Q_WS_WIN // QString d2("Documents/application/zsafe"); // #else QString d2(QDir::homeDirPath() + "/Documents/application/zsafe"); // #endif QDir pd2(d2); if (!pd2.exists()) { if (!pd1.mkdir("zsafe", FALSE)) { QMessageBox::critical( 0, tr("ZSafe"), #ifdef JPATCH_HDE tr("<P>Can't create directory ...//Documents/application/zsafe</P><P>ZSafe will now exit.</P")); #else tr("<P>Can't create directory %1</P><P>ZSafe will now exit.</P>").arg(d2)); #endif exitZs (1); } } // set the default filename filename = zsafeAppDirPath + "/passwords.zsf"; // save the current filename to the config file conf->writeEntry(APP_KEY+"document", filename); saveConf(); } //if (filename == "INVALIDPWD") //filename = ""; QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); -#ifdef WIN32 +#ifdef Q_WS_WIN this->setCaption("Qt ZSafe: " + ti); #else this->setCaption("ZSafe: " + ti); #endif selectedItem = NULL; lastSearchedCategory = NULL; lastSearchedItem = NULL; lastSearchedName = ""; lastSearchedUsername = ""; lastSearchedComment = ""; - infoForm = new InfoForm(); + infoForm = new InfoForm(this, "show_info", TRUE); categoryDialog = NULL; infoForm->setIcon( image0); // add a menu bar QMenuBar *menu = new QMenuBar( this ); // add file menu // QPopupMenu *file = new QPopupMenu( this ); file = new QPopupMenu( this ); // #ifdef DESKTOP file->insertItem( new_img, tr("&New document"), this, SLOT(newDocument()) ); file->insertItem( folder_open_img, tr("&Open document"), this, SLOT(loadDocument()) ); file->insertItem( save_img, tr("&Save document as .."), this, SLOT(saveDocumentAs()) ); file->insertSeparator(); // #endif @@ -757,61 +757,71 @@ void ZSafe::deletePwd() break; } } else { delCategory(); } } void ZSafe::editPwd() { if (!selectedItem) return; if (!isCategory(selectedItem)) { // open the 'New Entry' dialog - NewDialog *dialog = new NewDialog(this, tr("Edit Entry"), TRUE); -#ifdef WIN32 + NewDialog *dialog = new NewDialog(this, "edit_entry", TRUE); +#ifdef Q_WS_WIN dialog->setCaption ("Qt " + tr("Edit Entry")); dialog->setGeometry(200, 250, 220, 310 ); #endif // set the labels dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); // set the fields dialog->NameField->setText(selectedItem->text (0)); dialog->UsernameField->setText(selectedItem->text (1)); dialog->PasswordField->setText(selectedItem->text (2)); QString comment = selectedItem->text (3); comment.replace (QRegExp("<br>"), "\n"); dialog->Field5->setText(selectedItem->text (4)); dialog->Field6->setText(selectedItem->text (5)); dialog->CommentField->insertLine(comment); dialog->CommentField->setCursorPosition(0,0); +#ifdef Q_WS_QWS DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); - +#endif + #ifdef DESKTOP - result = Accepted; +#ifndef Q_QW_QWIN + dialog->show(); +#endif +#else + dialog->showMaximized(); +#endif + int result = dialog->exec(); +#ifdef DESKTOP +// result = QDialog::Accepted; #endif if (result == Accepted) { modified = true; // edit the selected item QString name = dialog->NameField->text(); selectedItem->setText (0, tr (name)); QString user = dialog->UsernameField->text(); selectedItem->setText (1, tr (user)); QString pwd = dialog->PasswordField->text(); selectedItem->setText (2, tr (pwd)); QString comment = dialog->CommentField->text(); comment.replace (QRegExp("\n"), "<br>"); selectedItem->setText (3, tr (comment)); QString f5 = dialog->Field5->text(); selectedItem->setText (4, tr (f5)); @@ -827,49 +837,60 @@ void ZSafe::editPwd() } } void ZSafe::newPwd() { if (!selectedItem) return; if (!isCategory(selectedItem)) selectedItem = selectedItem->parent(); if (isCategory(selectedItem)) { QString cat = selectedItem->text(0); // open the 'New Entry' dialog - NewDialog *dialog = new NewDialog(this, tr("New Entry"), TRUE); -#ifdef WIN32 + NewDialog *dialog = new NewDialog(this, "new_entry", TRUE); +#ifdef Q_WS_WIN dialog->setCaption ("Qt " + tr("New Entry")); dialog->setGeometry(200, 250, 220, 310 ); #endif // set the labels dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); retype: +#ifdef Q_WS_QWS DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); +#endif + #ifdef DESKTOP - result = Accepted; +#ifndef Q_QW_QWIN + dialog->show(); +#endif +#else + dialog->showMaximized(); +#endif +#ifdef DESKTOP + int result = dialog->exec(); +// result = QDialog::Accepted; #endif if (result == Accepted) { QString name = dialog->NameField->text(); if (cat == name) { QMessageBox::critical( 0, tr("ZSafe"), tr("Entry name must be different\nfrom the category name.") ); goto retype; // it's not a good programming style :-) } modified = true; // add the new item QListViewItem *i = new ShadedListItem (0, selectedItem); @@ -885,33 +906,33 @@ retype: i->setText (3, tr (comment)); QString f5 = dialog->Field5->text(); i->setText (4, tr (f5)); QString f6 = dialog->Field6->text(); i->setText (5, tr (f6)); } delete dialog; } } void ZSafe::findPwd() { // open the 'Search' dialog SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE); -#ifdef WIN32 +#ifdef Q_WS_WIN dialog->setCaption ("Qt " + tr("Search")); #endif #ifdef DESKTOP #endif if (lastSearchedName) dialog->NameField->setText(lastSearchedName); else dialog->NameField->setText(""); if (lastSearchedUsername) dialog->UsernameField->setText(lastSearchedUsername); else dialog->UsernameField->setText(""); if (lastSearchedComment) dialog->CommentField->setText(lastSearchedComment); else @@ -1065,63 +1086,63 @@ QString ZSafe::getFieldLabel (QListViewItem *_item, QString field, QString def) { category = _item->text(0); } else { QListViewItem *cat = _item->parent(); category = cat->text(0); } } else { return def; } QString app_key = APP_KEY; #ifndef DESKTOP -#ifndef WIN32 +#ifndef Q_WS_WIN conf->setGroup ("fieldDefs"); #endif #else -#ifndef WIN32 +#ifndef Q_WS_WIN app_key += "/fieldDefs/"; #endif #endif -// #ifndef WIN32 +// #ifndef Q_WS_WIN QString label = conf->readEntry(app_key+category+"-field"+field,def); // #else // QString label(def); // #endif #ifndef DESKTOP conf->setGroup ("zsafe"); #endif return label; } QString ZSafe::getFieldLabel (QString category, QString field, QString def) { QString app_key = APP_KEY; #ifndef DESKTOP conf->setGroup ("fieldDefs"); #else -#ifndef WIN32 +#ifndef Q_WS_WIN app_key += "/fieldDefs/"; #endif #endif -// #ifndef WIN32 +// #ifndef Q_WS_WIN QString label = conf->readEntry(app_key+category+"-field"+field, def); // #else // QString label(def); // #endif #ifndef DESKTOP conf->setGroup ("zsafe"); #endif return label; } void ZSafe::showInfo( QListViewItem *_item) { if (!_item) return; if (selectedItem != NULL) @@ -1195,56 +1216,62 @@ void ZSafe::showInfo( QListViewItem *_item) entry = selectedItem->text(3); if (!entry.isEmpty() && entry.compare(" ")) { text += "<u><b>"; text += getFieldLabel (selectedItem, "4", tr("Comment")); text += ":<br> </b></u>"; QString comment = selectedItem->text(3); comment.replace (QRegExp("\n"), "<br>"); text += comment; // text += "<br>"; } text += "</body></html>"; infoForm->InfoText->setText(text); - infoForm->hide(); +// infoForm->hide(); +#ifdef Q_WS_QWS QPEApplication::showDialog( infoForm ); +#endif + +#ifdef DESKTOP + infoForm->show(); +#endif } } void ZSafe::listViewSelected( QListViewItem *_item) { if (!_item) return; if (selectedItem != NULL) selectedItem->setSelected(FALSE); selectedItem = _item; #ifndef DESKTOP // set the column text dependent on the selected item ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name"))); ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2"))); ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3"))); ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment"))); ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4"))); ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5"))); #endif -#ifdef WIN32 +#ifdef Q_WS_WIN // set the column text dependent on the selected item ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name"))); ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2"))); ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3"))); ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment"))); ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4"))); ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5"))); #endif } bool ZSafe::isCategory(QListViewItem *_item) { if (_item == NULL) return FALSE; @@ -1473,33 +1500,33 @@ 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(); s.replace (QRegExp("\";\""), "\"|\""); // char buffer[1024]; -#ifndef WIN32 +#ifndef Q_WS_WIN char buffer[s.length()+1]; #else char buffer[4048]; #endif /* modify QString -> QCString::utf8 */ strcpy (buffer, s.utf8()); QString name; QString user; QString password; QString comment; QString field5=""; QString field6=""; @@ -1572,33 +1599,33 @@ void ZSafe::readAllEntries() QListViewItem * item = new ShadedListItem( 0, catI ); 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 ) ); catI->setOpen( TRUE ); Category *c1 = new Category(); c1->setCategoryName(category); QString icon; QString fullIconPath; QPixmap *pix; -// #ifndef WIN32 +// #ifndef Q_WS_WIN icon = conf->readEntry(APP_KEY+category); // #endif bool isIconAv = false; if (!icon.isEmpty() && !icon.isNull()) { // build the full path fullIconPath = iconPath + icon; pix = new QPixmap (fullIconPath); if (!pix->isNull()) { QImage img = pix->convertToImage(); pix->convertFromImage(img.smoothScale(14,14)); c1->setIconName (icon); c1->setIcon (*pix); isIconAv = true; } @@ -1725,33 +1752,33 @@ 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(); s.replace (QRegExp("\";\""), "\"|\""); // char buffer[1024]; int len=s.length()+1; -#ifdef WIN32 +#ifdef Q_WS_WIN char buffer[512]; #else char buffer[len]; #endif strcpy (buffer, s); QString name; QString user; QString password; QString comment; // separete the entries char *i = strtok (buffer, "|"); QString category(&i[1]); category.truncate(category.length() -1); @@ -1805,33 +1832,33 @@ void ZSafe::readAllEntries() QListViewItem *catI = new ShadedListItem( 1, ListView ); // create and insert a new item QListViewItem * item = new ShadedListItem( 0, catI ); item->setText( 0, tr( name ) ); item->setText( 1, tr( user ) ); item->setText( 2, tr( password ) ); item->setText( 3, tr( comment ) ); catI->setOpen( TRUE ); Category *c1 = new Category(); c1->setCategoryName(category); QString icon; QString fullIconPath; QPixmap *pix; -// #ifndef WIN32 +// #ifndef Q_WS_WIN icon = conf->readEntry(APP_KEY+category); // #endif bool isIconAv = false; if (!icon.isEmpty() && !icon.isNull()) { // build the full path fullIconPath = iconPath + icon; pix = new QPixmap (fullIconPath); if (!pix->isNull()) { QImage img = pix->convertToImage(); pix->convertFromImage(img.smoothScale(14,14)); c1->setIconName (icon); c1->setIcon (*pix); isIconAv = true; } @@ -1883,33 +1910,33 @@ void ZSafe::resume(int) 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 +// #ifndef Q_WS_WIN 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) @@ -1924,33 +1951,33 @@ bool ZSafe::openDocument(const char* _filename, const char* ) exitZs (1); } retval = loadInit(_filename, m_password); if (retval != PWERR_GOOD) { #ifndef NO_OPIE owarn << "Error loading Document" << oendl; #else qWarning ("Error loading Document"); #endif return false; } } else { -#ifdef WIN32 +#ifdef Q_WS_WIN this->setCaption("Qt ZSafe"); #else this->setCaption("ZSafe"); #endif filename = ""; return false; } // load the validation entry if (validationFlag == 0) { pwdOk = 1; break; } @@ -2041,33 +2068,33 @@ bool ZSafe::openDocument(const char* _filename, const char* ) 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 ) ); if (expandTree) catI->setOpen( TRUE ); Category *c1 = new Category(); c1->setCategoryName(category); QString icon; QString fullIconPath; QPixmap *pix; -// #ifndef WIN32 +// #ifndef Q_WS_WIN icon = conf->readEntry(APP_KEY+category); // #endif bool isIconAv = false; if (!icon.isEmpty() && !icon.isNull()) { // build the full path fullIconPath = iconPath + icon; pix = new QPixmap (fullIconPath); if (!pix->isNull()) { QImage img = pix->convertToImage(); pix->convertFromImage(img.smoothScale(14,14)); c1->setIconName (icon); c1->setIcon (*pix); isIconAv = true; } @@ -2127,50 +2154,50 @@ int ZSafe::loadInit(const char* _filename, const char *password) 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 +#ifndef Q_WS_WIN size = read(fileno (fd), (unsigned char *) (charbuf + count), 8); #else 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 +#ifndef Q_WS_WIN while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) { while (count < 8) { count2 = read (fileno (fd), (unsigned char *) (charbuf + count), 8); #else 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) { @@ -2326,33 +2353,33 @@ bool ZSafe::saveDocument(const char* _filename, 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) { #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 +// #ifndef Q_WS_WIN 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()) @@ -2421,33 +2448,33 @@ void ZSafe::getDocPassword(QString title) owarn << "getDocPassword" << oendl; #endif // open the 'Password' dialog PasswordForm *dialog = new PasswordForm(this, title, TRUE); newPwdDialog = dialog; newPwdDialogResult = false; QPixmap image0( ( const char** ) zsafe_xpm ); dialog->setIcon( image0); connect( dialog->PasswordField, SIGNAL( returnPressed() ), this, SLOT( setPasswordDialogDone() ) ); // CS: !!! // int pos = filename.findRev ('/'); QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); -#ifdef WIN32 +#ifdef Q_WS_WIN dialog->setCaption("Qt " + ti); #else dialog->setCaption(ti); #endif // dialog->setCaption(title); dialog->PasswordField->setFocus(); DialogCode result = (DialogCode) dialog->exec(); #ifdef DESKTOP result = Accepted; #endif QString password; if (result == Accepted || newPwdDialogResult) { m_password = dialog->PasswordField->text(); @@ -2651,44 +2678,44 @@ void ZSafe::addCategory() tr("No document defined.\nYou have to create a new document")); return; } else { // open the 'Category' dialog bool initIcons = false; // open the 'Category' dialog CategoryDialog *dialog; if (categoryDialog) { dialog = categoryDialog; } else { categoryDialog = new CategoryDialog(this, tr("Category"), TRUE); -#ifdef WIN32 +#ifdef Q_WS_WIN categoryDialog->setCaption ("Qt " + tr("Category")); #endif dialog = categoryDialog; connect( dialog->CategoryField, SIGNAL( activated(const QString&)), this, SLOT( categoryFieldActivated(const QString&) ) ); initIcons = true; } #ifdef DESKTOP -#ifndef WIN32 +#ifndef Q_WS_WIN QStringList list = conf->entryList( APP_KEY+"/fieldDefs" ); #else // read all categories from the config file and store // into a list QFile f (cfgFile); QStringList list; if ( f.open(IO_ReadOnly) ) { // file opened successfully QTextStream t( &f ); // use a text stream QString s; int n = 1; while ( !t.eof() ) { // until end of file... s = t.readLine(); // line of text excluding '\n' list.append(s); } f.close(); } @@ -2705,33 +2732,33 @@ void ZSafe::addCategory() s = t.readLine(); // line of text excluding '\n' list.append(s); } f.close(); } #endif QStringList::Iterator it = list.begin(); QString categ; QString firstCategory; dialog->CategoryField->clear(); // remove all items while( it != list.end() ) { QString *cat = new QString (*it); if (cat->contains("-field1", FALSE)) { #ifdef DESKTOP -#ifndef WIN32 +#ifndef Q_WS_WIN categ = cat->section ("-field1", 0, 0); #else int pos = cat->find ("-field1"); categ = cat->left (pos); #endif #else int pos = cat->find ("-field1"); cat->truncate(pos); categ = *cat; #endif if (!categ.isEmpty()) { dialog->CategoryField->insertItem (categ, -1); if (firstCategory.isEmpty()) firstCategory = categ; } @@ -2773,33 +2800,33 @@ void ZSafe::addCategory() #ifdef DESKTOP QPixmap imageOfFile; imageOfFile.load(iconPath + fi->fileName()); #else QPixmap imageOfFile(Resource::loadPixmap(fileName)); #endif QImage foo = imageOfFile.convertToImage(); foo = foo.smoothScale(16,16); imageOfFile.convertFromImage(foo); dialog->IconField->insertItem(imageOfFile,fileName); } ++it; } waitDialog.hide(); } -#ifndef WIN32 +#ifndef Q_WS_WIN dialog->show(); #endif #ifndef DESKTOP // dialog->move (20, 100); #endif DialogCode result = (DialogCode) dialog->exec(); #ifdef DESKTOP result = Accepted; #endif QString category; QString icon; QString fullIconPath; QPixmap *pix; if (result == Accepted) { @@ -2812,33 +2839,33 @@ void ZSafe::addCategory() #endif QListViewItem *li = new ShadedListItem( 1, ListView ); Category *c1 = new Category(); c1->setCategoryName(category); // if (!icon.isEmpty() && !icon.isNull()) if (icon != "predefined.png") { // build the full path fullIconPath = iconPath + icon; pix = new QPixmap (fullIconPath); // pix->resize(14, 14); if (!pix->isNull()) { // save the full pixmap name into the config file -// #ifndef WIN32 +// #ifndef Q_WS_WIN conf->writeEntry(APP_KEY+category, icon); // #endif saveConf(); QImage img = pix->convertToImage(); pix->convertFromImage(img.smoothScale(14,14)); c1->setIcon (*pix); c1->setIconName(icon); } else { QPixmap folder( ( const char** ) general_data ); c1->setIcon (folder); } } else { @@ -2864,33 +2891,33 @@ void ZSafe::addCategory() void ZSafe::delCategory() { if (!selectedItem) return; if (isCategory(selectedItem)) { switch( QMessageBox::information( this, tr("ZSafe"), tr("Do you want to delete?"), tr("&Delete"), tr("D&on't Delete"), 0 // Enter == button 0 ) ) { // Escape == button 2 case 0: // Delete clicked, Alt-S or Enter pressed. // Delete from the category list modified = true; categories.remove (selectedItem->text(0)); -// #ifndef WIN32 +// #ifndef Q_WS_WIN conf->removeEntry (selectedItem->text(0)); // #endif saveConf(); // Delete the selected item and all subitems // step through all subitems QListViewItem *si; for (si = selectedItem->firstChild(); si != NULL; ) { QListViewItem *_si = si; si = si->nextSibling(); selectedItem->takeItem(_si); // remove from view list if (_si) delete _si; } ListView->takeItem(selectedItem); @@ -3024,81 +3051,81 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category) dialog->IconField->setCurrentItem(i+1); break; } ++i; } ++it; } } } void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog) { QString app_key = APP_KEY; #ifndef DESKTOP conf->setGroup ("fieldDefs"); #else -#ifndef WIN32 +#ifndef Q_WS_WIN app_key += "/fieldDefs/"; #endif #endif QString category = dialog->CategoryField->currentText(); -// #ifndef WIN32 +// #ifndef Q_WS_WIN conf->writeEntry(app_key+category+"-field1", dialog->Field1->text()); conf->writeEntry(app_key+category+"-field2", dialog->Field2->text()); conf->writeEntry(app_key+category+"-field3", dialog->Field3->text()); conf->writeEntry(app_key+category+"-field4", dialog->Field4->text()); conf->writeEntry(app_key+category+"-field5", dialog->Field5->text()); conf->writeEntry(app_key+category+"-field6", dialog->Field6->text()); // #endif saveConf(); #ifndef DESKTOP conf->setGroup ("zsafe"); #endif } void ZSafe::editCategory() { if (!selectedItem) return; if (isCategory(selectedItem)) { QString category = selectedItem->text(0); bool initIcons = false; // open the 'Category' dialog CategoryDialog *dialog; if (categoryDialog) { dialog = categoryDialog; } else { categoryDialog = new CategoryDialog(this, tr("Category"), TRUE); -#ifdef WIN32 +#ifdef Q_WS_WIN categoryDialog->setCaption ("Qt " + tr("Category")); #endif dialog = categoryDialog; connect( dialog->CategoryField, SIGNAL( activated(const QString&)), this, SLOT( categoryFieldActivated(const QString&) ) ); initIcons = true; } setCategoryDialogFields(dialog); #ifdef DESKTOP -#ifndef WIN32 +#ifndef Q_WS_WIN QStringList list = conf->entryList( APP_KEY+"/fieldDefs" ); #else // read all categories from the config file and store // into a list QFile f (cfgFile); QStringList list; if ( f.open(IO_ReadOnly) ) { // file opened successfully QTextStream t( &f ); // use a text stream QString s; int n = 1; while ( !t.eof() ) { // until end of file... s = t.readLine(); // line of text excluding '\n' list.append(s); } f.close(); } @@ -3116,33 +3143,33 @@ void ZSafe::editCategory() list.append(s); } f.close(); } #endif QStringList::Iterator it = list.begin(); QString categ; dialog->CategoryField->clear(); // remove all items int i=0; bool foundCategory = false; while( it != list.end() ) { QString *cat = new QString (*it); if (cat->contains("-field1", FALSE)) { #ifdef DESKTOP -#ifndef WIN32 +#ifndef Q_WS_WIN categ = cat->section ("-field1", 0, 0); #else int pos = cat->find ("-field1"); categ = cat->left (pos); #endif #else int pos = cat->find ("-field1"); cat->truncate(pos); categ = *cat; #endif if (!categ.isEmpty()) { dialog->CategoryField->insertItem (categ, i); if (category.compare(categ) == 0) { dialog->CategoryField->setCurrentItem(i); @@ -3259,71 +3286,71 @@ void ZSafe::editCategory() #ifndef DESKTOP // dialog->move (20, 100); #endif 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 +// #ifndef Q_WS_WIN conf->removeEntry(category); // #endif saveConf(); } category = dialog->CategoryField->currentText(); 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") { // build the full path fullIconPath = iconPath + icon; pix = new QPixmap (fullIconPath); if (!pix->isNull()) { // save the full pixmap name into the config file -// #ifndef WIN32 +// #ifndef Q_WS_WIN 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 +// #ifndef Q_WS_WIN conf->removeEntry (category); // #endif saveConf(); cat->setIcon (*getPredefinedIcon(category)); } // 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 ) ); @@ -3476,33 +3503,33 @@ void ZSafe::newDocument() i->takeItem(_si); // remove from view list if (_si) delete _si; } } if (c) delete c; // delete the previous category categories.clear(); // m_password = ""; selectedItem = NULL; filename = newFile; // save the current filename to the config file conf->writeEntry(APP_KEY+"document", filename); saveConf(); QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); -#ifdef WIN32 +#ifdef Q_WS_WIN this->setCaption("Qt ZSafe: " + ti); #else this->setCaption("ZSafe: " + ti); #endif // openDocument(filename); QMessageBox::information( this, tr("ZSafe"), tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0); saveDocumentWithPwd(); } } void ZSafe::loadDocument() { @@ -3560,33 +3587,33 @@ void ZSafe::loadDocument() QListViewItem *_si = si; si = si->nextSibling(); i->takeItem(_si); // remove from view list if (_si) delete _si; } } if (c) delete c; // delete the previous category categories.clear(); m_password = ""; selectedItem = NULL; filename = newFile; // save the current filename to the config file conf->writeEntry(APP_KEY+"document", filename); saveConf(); QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); -#ifdef WIN32 +#ifdef Q_WS_WIN this->setCaption("Qt ZSafe: " + ti); #else this->setCaption("ZSafe: " + ti); #endif openDocument(filename); } } void ZSafe::saveDocumentAs() { #ifndef DESKTOP #ifndef NO_OPIE QMap<QString, QStringList> mimeTypes; mimeTypes.insert(tr("All"), QStringList() ); @@ -3614,33 +3641,33 @@ void ZSafe::saveDocumentAs() #endif // open the new document if (newFile && newFile.length() > 0 ) { // save the previous opened document if (!filename.isEmpty()) saveDocument(filename, FALSE); selectedItem = NULL; filename = newFile; // save the current filename to the config file conf->writeEntry(APP_KEY+"document", filename); saveConf(); QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); -#ifdef WIN32 +#ifdef Q_WS_WIN this->setCaption("Qt ZSafe: " + ti); #else this->setCaption("ZSafe: " + ti); #endif QMessageBox::information( this, tr("ZSafe"), tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0); saveDocumentWithPwd(); } } void ZSafe::saveDocumentWithoutPwd() { saveDocument(filename, FALSE); } @@ -3693,33 +3720,33 @@ void ZSafe::about() QMessageBox mb( this, tr("ZSafe")); mb.setText (info); mb.setButtonText (QMessageBox::Ok, tr ("&OK")); QPixmap zsafe_img((const char**) zsafe_xpm); mb.setIconPixmap (zsafe_img); mb.exec(); } void ZSafe::setExpandFlag() { expandTree = !expandTree; file->setItemChecked('o', expandTree); #ifndef DESKTOP conf->setGroup ("zsafePrefs"); #endif -// #ifndef WIN32 +// #ifndef Q_WS_WIN conf->writeEntry (APP_KEY+"expandTree", expandTree); // #endif saveConf(); } void ZSafe::paintEvent( QPaintEvent * ) { if (raiseFlag) { raiseFlag = false; raiseTimer.start (1, true); if (infoForm->isVisible()) infoForm->raise(); } } @@ -3778,33 +3805,33 @@ void ZSafe::setDocument(const QString& fileref) if ( link.isValid() ) { // if (filename != link.file()) // saveDocument(filename, FALSE); filename = link.file(); } else { // if (filename != fileref) // saveDocument(filename, FALSE); filename = fileref; } // save the current filename to the config file conf->writeEntry(APP_KEY+"document", filename); saveConf(); QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); -#ifdef WIN32 +#ifdef Q_WS_WIN this->setCaption("Qt ZSafe: " + ti); #else this->setCaption("ZSafe: " + ti); #endif // clear the password list QListViewItem *i; QListViewItem *c = NULL; // step through all categories for (i = ListView->firstChild(); i != NULL; i = i->nextSibling()) { if (c) delete c; // delete the previous category c = i; |