-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 @@ -10,11 +10,11 @@ ** ** 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" @@ -42,9 +42,9 @@ using namespace Opie::Ui; #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> @@ -54,9 +54,9 @@ using namespace Opie::Ui; #ifdef DESKTOP #include <qfiledialog.h> #include <qdragobject.h> -#ifndef WIN32 +#ifndef Q_WS_WIN #include <qsettings.h> #else #include "qsettings.h" #endif @@ -96,9 +96,9 @@ using namespace Opie::Ui; #include "wait.h" extern int DeskW, DeskH; #ifdef DESKTOP -extern QApplication *appl; +extern QApplication *appl; #else extern QPEApplication *appl; #endif @@ -107,9 +107,9 @@ extern QPEApplication *appl; #endif #ifdef DESKTOP -#ifndef WIN32 +#ifndef Q_WS_WIN const QString APP_KEY="/.zsafe/"; #else const QString APP_KEY=""; #endif @@ -364,9 +364,9 @@ static const char* const general_data[] = { { delete conf; #ifdef DESKTOP -#ifndef WIN32 +#ifndef Q_WS_WIN conf = new QSettings (); conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath()); #else conf = new QSettings (cfgFile); @@ -416,9 +416,9 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) #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); @@ -428,9 +428,9 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) 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); @@ -463,9 +463,9 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) if ( !name ) setName( "ZSafe" ); #ifdef DESKTOP -#ifdef WIN32 +#ifdef Q_WS_WIN setGeometry(100, 150, DeskW, DeskH-30 ); #else resize( DeskW, DeskH-30 ); #endif @@ -497,9 +497,9 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) { // 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 @@ -524,9 +524,9 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) #endif exitZs (1); } } -// #ifndef WIN32 +// #ifndef Q_WS_WIN // QString d2("Documents/application/zsafe"); // #else QString d2(QDir::homeDirPath() + "/Documents/application/zsafe"); // #endif @@ -555,9 +555,9 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) //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 @@ -568,9 +568,9 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) lastSearchedName = ""; lastSearchedUsername = ""; lastSearchedComment = ""; - infoForm = new InfoForm(); + infoForm = new InfoForm(this, "show_info", TRUE); categoryDialog = NULL; infoForm->setIcon( image0); // add a menu bar @@ -769,10 +769,10 @@ void ZSafe::editPwd() 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 @@ -794,12 +794,22 @@ void ZSafe::editPwd() 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; @@ -839,10 +849,10 @@ void ZSafe::newPwd() { 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 @@ -853,11 +863,22 @@ void ZSafe::newPwd() 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) { @@ -897,9 +918,9 @@ 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 @@ -1077,17 +1098,17 @@ QString ZSafe::getFieldLabel (QListViewItem *_item, QString field, QString 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 @@ -1103,13 +1124,13 @@ 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); @@ -1207,10 +1228,16 @@ void ZSafe::showInfo( QListViewItem *_item) 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) @@ -1230,9 +1257,9 @@ void ZSafe::listViewSelected( QListViewItem *_item) 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"))); @@ -1485,9 +1512,9 @@ void ZSafe::readAllEntries() { 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 @@ -1584,9 +1611,9 @@ void ZSafe::readAllEntries() 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()) @@ -1737,9 +1764,9 @@ void ZSafe::readAllEntries() 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 @@ -1817,9 +1844,9 @@ void ZSafe::readAllEntries() 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()) @@ -1895,9 +1922,9 @@ void ZSafe::resume(int) 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 @@ -1936,9 +1963,9 @@ bool ZSafe::openDocument(const char* _filename, const char* ) } } else { -#ifdef WIN32 +#ifdef Q_WS_WIN this->setCaption("Qt ZSafe"); #else this->setCaption("ZSafe"); #endif @@ -2053,9 +2080,9 @@ bool ZSafe::openDocument(const char* _filename, const char* ) 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()) @@ -2139,9 +2166,9 @@ int ZSafe::loadInit(const char* _filename, const char *password) } 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 @@ -2156,9 +2183,9 @@ int ZSafe::loadInit(const char* _filename, const char *password) } 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 @@ -2338,9 +2365,9 @@ bool ZSafe::saveDocument(const char* _filename, #endif saveFinalize(); return false; } -// #ifndef WIN32 +// #ifndef Q_WS_WIN conf->writeEntry(APP_KEY+"valzsafe", 1); // #endif saveConf(); } @@ -2433,9 +2460,9 @@ void ZSafe::getDocPassword(QString title) // 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 @@ -2663,9 +2690,9 @@ void ZSafe::addCategory() } 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, @@ -2674,9 +2701,9 @@ void ZSafe::addCategory() 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 @@ -2717,9 +2744,9 @@ void ZSafe::addCategory() 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); @@ -2785,9 +2812,9 @@ void ZSafe::addCategory() } waitDialog.hide(); } -#ifndef WIN32 +#ifndef Q_WS_WIN dialog->show(); #endif #ifndef DESKTOP // dialog->move (20, 100); @@ -2824,9 +2851,9 @@ void ZSafe::addCategory() // 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(); @@ -2876,9 +2903,9 @@ void ZSafe::delCategory() 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(); @@ -3036,14 +3063,14 @@ 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()); @@ -3072,9 +3099,9 @@ void ZSafe::editCategory() } 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, @@ -3084,9 +3111,9 @@ void ZSafe::editCategory() } 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 @@ -3128,9 +3155,9 @@ void ZSafe::editCategory() 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); @@ -3271,9 +3298,9 @@ void ZSafe::editCategory() modified = true; if (category != dialog->CategoryField->currentText()) { categories.remove (category); -// #ifndef WIN32 +// #ifndef Q_WS_WIN conf->removeEntry(category); // #endif saveConf(); } @@ -3297,9 +3324,9 @@ void ZSafe::editCategory() 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(); @@ -3309,9 +3336,9 @@ void ZSafe::editCategory() } } else { -// #ifndef WIN32 +// #ifndef Q_WS_WIN conf->removeEntry (category); // #endif saveConf(); cat->setIcon (*getPredefinedIcon(category)); @@ -3488,9 +3515,9 @@ void ZSafe::newDocument() // 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 @@ -3572,9 +3599,9 @@ void ZSafe::loadDocument() // 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 @@ -3626,9 +3653,9 @@ void ZSafe::saveDocumentAs() // 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 @@ -3705,9 +3732,9 @@ void ZSafe::setExpandFlag() file->setItemChecked('o', expandTree); #ifndef DESKTOP conf->setGroup ("zsafePrefs"); #endif -// #ifndef WIN32 +// #ifndef Q_WS_WIN conf->writeEntry (APP_KEY+"expandTree", expandTree); // #endif saveConf(); @@ -3790,9 +3817,9 @@ void ZSafe::setDocument(const QString& 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 |