summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-07-13 10:35:23 (UTC)
committer llornkcor <llornkcor>2004-07-13 10:35:23 (UTC)
commit37e0e077b51841971c3d4c25b287f4d39e750e2d (patch) (side-by-side diff)
treec1b499dd6e544207c6ff7047acd8170d6ea63f94
parent5d2ec2e9b1dce49e914c260fe16a82ddccbaa92d (diff)
downloadopie-37e0e077b51841971c3d4c25b287f4d39e750e2d.zip
opie-37e0e077b51841971c3d4c25b287f4d39e750e2d.tar.gz
opie-37e0e077b51841971c3d4c25b287f4d39e750e2d.tar.bz2
fix ups, and move qsettings files away
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--[-rwxr-xr-x]noncore/apps/zsafe/extra/qsettings.cpp (renamed from noncore/apps/zsafe/qsettings.cpp)10
-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.cpp143
3 files changed, 92 insertions, 61 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
@@ -7,12 +7,13 @@
#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
@@ -129,24 +130,27 @@ 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
+ 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
@@ -8,15 +8,15 @@
**
** 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"
@@ -40,25 +40,25 @@ using namespace Opie::Ui;
#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
@@ -105,13 +105,13 @@ extern QPEApplication *appl;
#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="";
@@ -362,13 +362,13 @@ static const char* const general_data[] = {
{
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
@@ -414,25 +414,25 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
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
@@ -461,13 +461,13 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
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
@@ -495,13 +495,13 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
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())
@@ -522,13 +522,13 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
#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())
@@ -553,26 +553,26 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
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 );
@@ -767,14 +767,14 @@ 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")));
@@ -792,16 +792,26 @@ void ZSafe::editPwd()
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();
@@ -837,29 +847,40 @@ void ZSafe::newPwd()
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();
@@ -895,13 +916,13 @@ retype:
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)
@@ -1075,21 +1096,21 @@ QString ZSafe::getFieldLabel (QListViewItem *_item, QString field, QString def)
{
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
@@ -1101,17 +1122,17 @@ QString ZSafe::getFieldLabel (QListViewItem *_item, QString field, QString def)
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
@@ -1205,14 +1226,20 @@ void ZSafe::showInfo( QListViewItem *_item)
// 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)
@@ -1228,13 +1255,13 @@ void ZSafe::listViewSelected( QListViewItem *_item)
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")));
@@ -1483,13 +1510,13 @@ void ZSafe::readAllEntries()
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
@@ -1582,13 +1609,13 @@ void ZSafe::readAllEntries()
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
@@ -1735,13 +1762,13 @@ void ZSafe::readAllEntries()
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);
@@ -1815,13 +1842,13 @@ void ZSafe::readAllEntries()
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
@@ -1893,13 +1920,13 @@ 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
int pwdOk = 0;
@@ -1934,13 +1961,13 @@ bool ZSafe::openDocument(const char* _filename, const char* )
#endif
return false;
}
}
else
{
-#ifdef WIN32
+#ifdef Q_WS_WIN
this->setCaption("Qt ZSafe");
#else
this->setCaption("ZSafe");
#endif
filename = "";
return false;
@@ -2051,13 +2078,13 @@ bool ZSafe::openDocument(const char* _filename, const char* )
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
@@ -2137,13 +2164,13 @@ int ZSafe::loadInit(const char* _filename, const char *password)
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)
@@ -2154,13 +2181,13 @@ int ZSafe::loadInit(const char* _filename, const char *password)
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) {
@@ -2336,13 +2363,13 @@ bool ZSafe::saveDocument(const char* _filename,
#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;
@@ -2431,13 +2458,13 @@ void ZSafe::getDocPassword(QString title)
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);
@@ -2661,24 +2688,24 @@ void ZSafe::addCategory()
{
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;
@@ -2715,13 +2742,13 @@ void ZSafe::addCategory()
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
@@ -2783,13 +2810,13 @@ void ZSafe::addCategory()
}
++it;
}
waitDialog.hide();
}
-#ifndef WIN32
+#ifndef Q_WS_WIN
dialog->show();
#endif
#ifndef DESKTOP
// dialog->move (20, 100);
#endif
DialogCode result = (DialogCode) dialog->exec();
@@ -2822,13 +2849,13 @@ void ZSafe::addCategory()
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);
@@ -2874,13 +2901,13 @@ void ZSafe::delCategory()
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
@@ -3034,18 +3061,18 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category)
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());
@@ -3070,25 +3097,25 @@ void ZSafe::editCategory()
{
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;
@@ -3126,13 +3153,13 @@ void ZSafe::editCategory()
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
@@ -3269,13 +3296,13 @@ void ZSafe::editCategory()
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();
@@ -3295,25 +3322,25 @@ void ZSafe::editCategory()
// 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));
}
@@ -3486,13 +3513,13 @@ void ZSafe::newDocument()
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);
@@ -3570,13 +3597,13 @@ void ZSafe::loadDocument()
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);
@@ -3624,13 +3651,13 @@ void ZSafe::saveDocumentAs()
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"),
@@ -3703,13 +3730,13 @@ 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();
}
@@ -3788,13 +3815,13 @@ void ZSafe::setDocument(const QString& fileref)
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