summaryrefslogtreecommitdiff
authorzecke <zecke>2004-11-15 17:08:58 (UTC)
committer zecke <zecke>2004-11-15 17:08:58 (UTC)
commit6d7b1a9a5f32a0b69c5ee9cc963e8a43a76327cf (patch) (side-by-side diff)
tree45e30376ec8035174fc5fd9154ed35b4d405d5ed
parent97fb9b69240d0daa5222fa9264587cde8b25c117 (diff)
downloadopie-6d7b1a9a5f32a0b69c5ee9cc963e8a43a76327cf.zip
opie-6d7b1a9a5f32a0b69c5ee9cc963e8a43a76327cf.tar.gz
opie-6d7b1a9a5f32a0b69c5ee9cc963e8a43a76327cf.tar.bz2
Remove many many many #ifdefs
"I always knew it would come like this" -Make it a QWidget instead of a QDialog -Introduce appName
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/zsafe/zsafe.cpp671
-rw-r--r--noncore/apps/zsafe/zsafe.h10
2 files changed, 62 insertions, 619 deletions
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index 1ae3b15..2b182f9 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -9,11 +9,4 @@
** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html
**
-** Compile Flags:
-** Zaurus arm : -DNO_OPIE
-** Zaurus Opie arm: none
-** Linux Desktop : -DDESKTOP -DNO_OPIE
-** Windows Desktop: -DDESKTOP -DNO_OPIE
-** use qmake
-** for japanese version additional use: -DJPATCH_HDE
**
****************************************************************************/
@@ -27,14 +20,8 @@
#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>
@@ -44,7 +31,5 @@ using namespace Opie::Ui;
#include <fcntl.h>
#include <stdlib.h>
-#ifndef Q_WS_WIN
#include <unistd.h>
-#endif
#include <string.h>
#include <errno.h>
@@ -53,14 +38,4 @@ using namespace Opie::Ui;
#include <qpopupmenu.h>
-#ifdef DESKTOP
-#include <qfiledialog.h>
-#include <qdragobject.h>
-#ifndef Q_WS_WIN
-#include <qsettings.h>
-#else
-#include "qsettings.h"
-#endif
-#include <qapplication.h>
-#else
#include <qfile.h>
#include <qpe/fileselector.h>
@@ -69,5 +44,4 @@ using namespace Opie::Ui;
#include <qpe/resource.h>
#include <qpe/config.h>
-#endif
#include <qtimer.h>
@@ -96,25 +70,9 @@ using namespace Opie::Ui;
#include "wait.h"
-extern int DeskW, DeskH;
-#ifdef DESKTOP
-extern QApplication *appl;
-#else
-extern QPEApplication *appl;
-#endif
-
-#ifdef JPATCH_HDE
-#define tr(arg) arg
-#endif
-
+int DeskW, DeskH;
+QApplication *appl;
+ZSafe *zs;
-#ifdef DESKTOP
-#ifndef Q_WS_WIN
-const QString APP_KEY="/.zsafe/";
-#else
-const QString APP_KEY="";
-#endif
-#else
const QString APP_KEY="";
-#endif
// include xmp images
@@ -365,16 +323,6 @@ static const char* const general_data[] = {
delete conf;
-#ifdef DESKTOP
-#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
+ conf = new Config ("zsafe");
+ conf->setGroup ("zsafe");
}
}
@@ -388,8 +336,13 @@ static const char* const general_data[] = {
* TRUE to construct a modal dialog.
*/
-ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
- : QDialog( parent, name, modal, fl ),
+ZSafe::ZSafe( QWidget* parent, const char* name, WFlags fl )
+ : QWidget( parent, name, fl),
Edit(0l), Delete(0l), Find(0l), New(0l), ListView(0l)
{
+ zs = this;
+ appl = qApp;
+ DeskW = qApp->desktop()->width();
+ DeskH = qApp->desktop()->height();
+
IsCut = false;
IsCopy = false;
@@ -401,42 +354,12 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
cfgFile += "/.zsafe.cfg";
// set the icon path
-#ifdef NO_OPIE
- 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
+ QString qpeDir = QPEApplication::qpeDir();
- // create a zsafe configuration object
-#ifdef DESKTOP
-#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 = new Config ("zsafe");
conf->setGroup ("zsafePrefs");
-#endif
-#ifdef DESKTOP
-// #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);
@@ -461,36 +384,11 @@ 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 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;
- }
- 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";
+
filename = conf->readEntry(APP_KEY+"document");
if ( !QFileInfo(filename).exists() || !QDir(zsafeAppDirPath).exists() )
@@ -498,9 +396,5 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
// check if the directory application exists, if not
// create it
-// #ifndef Q_WS_WIN
- // QString d1("Documents/application");
-// #else
QString d1(QDir::homeDirPath() + "/Documents/application");
-// #endif
QDir pd1(d1);
if (!pd1.exists())
@@ -516,17 +410,9 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
{
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 Q_WS_WIN
- // QString d2("Documents/application/zsafe");
-// #else
QString d2(QDir::homeDirPath() + "/Documents/application/zsafe");
-// #endif
QDir pd2(d2);
if (!pd2.exists())
@@ -535,9 +421,5 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
{
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);
}
@@ -554,9 +436,5 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
-#ifdef Q_WS_WIN
- this->setCaption("Qt ZSafe: " + ti);
-#else
- this->setCaption("ZSafe: " + ti);
-#endif
+ this->setCaption(tr("ZSafe: ") + ti);
selectedItem = NULL;
@@ -578,10 +456,8 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
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
file->insertItem( save_img, tr("&Save document"), this, SLOT(saveDocumentWithoutPwd()) );
@@ -666,13 +542,8 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
ListView->setAllColumnsShowFocus(TRUE);
-#ifdef DESKTOP
- // ListView->setResizePolicy(QScrollView::AutoOneFit);
- // ListView->setGeometry( QRect( 0, 22, this->width(), this->height() - 30 ) );
-#else
ListView->setResizePolicy(QScrollView::AutoOneFit);
// ListView->setGeometry( QRect( 0, 22,
// this->width(), this->height() - 30 ) );
// ListView->setMaximumSize( QSize( 440, 290 ) );
-#endif
// ListView->setVScrollBarMode( QListView::Auto );
@@ -681,5 +552,4 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
l->addWidget (ListView);
-#ifndef DESKTOP
// start a timer (100 ms) to load the default document
docuTimer.start( 100, true );
@@ -687,8 +557,4 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
raiseFlag = true;
connect( &raiseTimer, SIGNAL(timeout()), SLOT( slotRaiseTimer() ) );
-#else
- // open the default document
- openDocument(filename);
-#endif
// signals and slots connections for QTollButton
@@ -705,15 +571,9 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
this, SLOT( showInfo(QListViewItem*) ) );
-#ifndef DESKTOP
QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold);
-#endif
connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) );
this->setIcon( image0);
-#ifdef Q_WS_WIN
- ListView->setSelected( ListView->firstChild() , true);
- ListView->setSelected( ListView->firstChild() , false);
-#endif
}
@@ -773,8 +633,4 @@ void ZSafe::editPwd()
// open the 'New Entry' dialog
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
@@ -797,20 +653,6 @@ void ZSafe::editPwd()
dialog->CommentField->setCursorPosition(0,0);
-#ifdef Q_WS_QWS
- DialogCode result = (DialogCode) QPEApplication::execDialog( dialog );
-#endif
-
-#ifdef DESKTOP
-#ifndef Q_QW_QWIN
- dialog->show();
-#endif
-#else
- dialog->showMaximized();
-#endif
-#ifdef DESKTOP
- int result = dialog->exec();
- result = QDialog::Accepted;
-#endif
- if (result == Accepted)
+ QDialog::DialogCode result = (QDialog::DialogCode) QPEApplication::execDialog( dialog );
+ if (result == QDialog::Accepted)
{
modified = true;
@@ -853,8 +695,4 @@ void ZSafe::newPwd()
// open the 'New Entry' dialog
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")));
@@ -867,20 +705,7 @@ retype:
#ifdef Q_WS_QWS
- DialogCode result = (DialogCode) QPEApplication::execDialog( dialog );
-#endif
-
-#ifdef DESKTOP
-#ifndef Q_QW_QWIN
- dialog->show();
-#endif
-#else
- dialog->showMaximized();
-#endif
-#ifdef DESKTOP
- int result = dialog->exec();
- result = QDialog::Accepted;
+ QDialog::DialogCode result = (QDialog::DialogCode) QPEApplication::execDialog( dialog );
#endif
-
- if (result == Accepted)
+ if (result == QDialog::Accepted)
{
@@ -921,10 +746,5 @@ void ZSafe::findPwd()
// open the 'Search' dialog
SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE);
-#ifdef Q_WS_WIN
- dialog->setCaption ("Qt " + tr("Search"));
-#endif
-#ifdef DESKTOP
-#endif
if (lastSearchedName)
dialog->NameField->setText(lastSearchedName);
@@ -939,22 +759,14 @@ void ZSafe::findPwd()
else
dialog->CommentField->setText("");
- DialogCode result = (DialogCode) dialog->exec();
-#ifdef DESKTOP
- result = Accepted;
-#endif
+ QDialog::DialogCode result = (QDialog::DialogCode) dialog->exec();
QString name;
QString username;
QString comment;
- if (result == Accepted)
+ if (result == QDialog::Accepted)
{
name = dialog->NameField->text();
username = dialog->UsernameField->text();
comment = dialog->CommentField->text();
-#ifndef NO_OPIE
- owarn << name << oendl;
-#else
- qWarning (name);
-#endif
}
else
@@ -1002,7 +814,4 @@ void ZSafe::findPwd()
i = i->nextSibling())
{
-#ifndef NO_OPIE
- owarn << i->text(0) << oendl;
-#endif
i->setSelected(FALSE);
@@ -1018,9 +827,4 @@ void ZSafe::findPwd()
si = si->nextSibling())
{
-#ifndef NO_OPIE
- owarn << si->text(0) << oendl;
-#else
- qWarning (si->text(0));
-#endif
if (si->isSelected())
si->setSelected(FALSE);
@@ -1039,9 +843,4 @@ void ZSafe::findPwd()
if ((n && u && c ) && !found)
{
-#ifndef NO_OPIE
- owarn << "Found" << oendl;
-#else
- qWarning ("Found");
-#endif
selectedItem = si;
si->setSelected(TRUE);
@@ -1100,22 +899,8 @@ QString ZSafe::getFieldLabel (QListViewItem *_item, QString field, QString def)
QString app_key = APP_KEY;
-#ifndef DESKTOP
-#ifndef Q_WS_WIN
+
conf->setGroup ("fieldDefs");
-#endif
-#else
-#ifndef Q_WS_WIN
- app_key += "/fieldDefs/";
-#endif
-#endif
-// #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;
}
@@ -1124,12 +909,6 @@ QString ZSafe::getFieldLabel (QString category, QString field, QString def)
{
QString app_key = APP_KEY;
-#ifndef DESKTOP
- conf->setGroup ("fieldDefs");
-#else
-#ifndef Q_WS_WIN
- app_key += "/fieldDefs/";
-#endif
-#endif
// #ifndef Q_WS_WIN
+ conf->setGroup( "fieldDefs" );
QString label = conf->readEntry(app_key+category+"-field"+field,
def);
@@ -1137,7 +916,5 @@ QString ZSafe::getFieldLabel (QString category, QString field, QString def)
// QString label(def);
// #endif
-#ifndef DESKTOP
conf->setGroup ("zsafe");
-#endif
return label;
}
@@ -1236,7 +1013,4 @@ void ZSafe::showInfo( QListViewItem *_item)
#endif
-#ifdef DESKTOP
- infoForm->show();
-#endif
}
}
@@ -1251,14 +1025,4 @@ void ZSafe::listViewSelected( QListViewItem *_item)
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 Q_WS_WIN
// set the column text dependent on the selected item
ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name")));
@@ -1268,6 +1032,4 @@ void ZSafe::listViewSelected( QListViewItem *_item)
ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4")));
ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5")));
-#endif
-
}
@@ -1288,6 +1050,4 @@ void ZSafe::removeAsciiFile()
// QString fn = filename + ".txt";
// open the file dialog
-#ifndef DESKTOP
-#ifndef NO_OPIE
QMap<QString, QStringList> mimeTypes;
mimeTypes.insert(tr("All"), QStringList() );
@@ -1299,18 +1059,4 @@ void ZSafe::removeAsciiFile()
this,
tr ("Remove text file"));
-#else
- QString fn = ScQtFileEdit::getOpenFileName(this,
- tr ("Remove text file"),
- QDir::homeDirPath() + "/Documents/application/zsafe",
- "*.txt");
-#endif
-#else
- QString fn = QFileDialog::getOpenFileName(
- QDir::homeDirPath() + "/Documents/application/zsafe",
- "ZSafe (*.txt)",
- this,
- "ZSafe File Dialog"
- "Choose a text file" );
-#endif
if (fn && fn.length() > 0 )
@@ -1319,9 +1065,4 @@ void ZSafe::removeAsciiFile()
if ( !f.remove() )
{
-#ifndef NO_OPIE
- owarn << "Could not remove file " << fn << oendl;
-#else
- qWarning( QString("Could not remove file %1").arg(fn),2000 );
-#endif
QMessageBox::critical( 0, tr("ZSafe"),
tr("Could not remove text file.") );
@@ -1347,9 +1088,4 @@ void ZSafe::writeAllEntries()
QFile f( fn );
if ( !f.open( IO_WriteOnly ) ) {
-#ifndef NO_OPIE
- owarn << "Could not write to file " << fn << oendl;
-#else
- qWarning( QString("Could not write to file %1").arg(fn),2000 );
-#endif
QMessageBox::critical( 0, "ZSafe",
QString("Could not export to text file.") );
@@ -1414,6 +1150,4 @@ void ZSafe::readAllEntries()
// open the file dialog
-#ifndef DESKTOP
-#ifndef NO_OPIE
QMap<QString, QStringList> mimeTypes;
mimeTypes.insert(tr("All"), QStringList() );
@@ -1425,18 +1159,4 @@ void ZSafe::readAllEntries()
this,
tr ("Import text file"));
-#else
- QString fn = ScQtFileEdit::getOpenFileName(this,
- tr ("Import text file"),
- QDir::homeDirPath() + "/Documents/application/zsafe",
- "*.txt");
-#endif
-#else
- QString fn = QFileDialog::getOpenFileName(
- QDir::homeDirPath() + "/Documents/application/zsafe",
- "ZSafe (*.txt)",
- this,
- "ZSafe File Dialog"
- "Choose a text file" );
-#endif
if (fn && fn.length() > 0 )
@@ -1445,9 +1165,4 @@ void ZSafe::readAllEntries()
if ( !f.open( IO_ReadOnly ) )
{
-#ifndef NO_OPIE
- owarn << "Could not read file " << fn << oendl;
-#else
- qWarning( QString("Could not read file %1").arg(fn), 2000 );
-#endif
QMessageBox::critical( 0, "ZSafe",
QString("Could not import text file.") );
@@ -1478,10 +1193,4 @@ void ZSafe::readAllEntries()
}
-#ifndef NO_OPIE
- owarn << "ReadAllEntries(): " << oendl;
-#else
- qWarning ("ReadAllEntries(): ");
-#endif
-
QTextStream t(&f);
while ( !t.eof() )
@@ -1490,9 +1199,5 @@ void ZSafe::readAllEntries()
s.replace (QRegExp("\";\""), "\"|\"");
// char buffer[1024];
-#ifndef Q_WS_WIN
char buffer[s.length()+1];
-#else
- char buffer[4048];
-#endif
@@ -1640,9 +1345,4 @@ void ZSafe::writeAllEntries()
QFile f( fn );
if ( !f.open( IO_WriteOnly ) ) {
-#ifndef NO_OPIE
- owarn << "Could not write to file " << fn << oendl;
-#else
- qWarning( QString("Could not write to file %1").arg(fn), 2000 );
-#endif
QMessageBox::critical( 0, tr("ZSafe"),
tr("Could not export to text file.") );
@@ -1697,9 +1397,4 @@ void ZSafe::readAllEntries()
if ( !f.open( IO_ReadOnly ) )
{
-#ifndef NO_OPIE
- owarn << "Could not read file " << fn << oendl;
-#else
- qWarning( QString("Could not read file %1").arg(fn), 2000 );
-#endif
QMessageBox::critical( 0, tr("ZSafe"),
tr("Could not import text file.") );
@@ -1730,9 +1425,4 @@ void ZSafe::readAllEntries()
}
-#ifndef NO_OPIE
- owarn << "ReadAllEntries(): " << oendl;
-#else
- qWarning ("ReadAllEntries(): ");
-#endif
QTextStream t(&f);
while ( !t.eof() )
@@ -1742,9 +1432,5 @@ void ZSafe::readAllEntries()
// char buffer[1024];
int len=s.length()+1;
-#ifdef Q_WS_WIN
- char buffer[512];
-#else
char buffer[len];
-#endif
strcpy (buffer, s);
@@ -1857,7 +1543,4 @@ void ZSafe::readAllEntries()
void ZSafe::resume(int)
{
-#ifndef NO_OPIE
- owarn << "Resume" << oendl;
-#endif
// hide the main window
@@ -1920,9 +1603,4 @@ bool ZSafe::openDocument(const char* _filename, const char* )
if (m_password.isEmpty() && validationFlag == 0)
{
-#ifndef NO_OPIE
- owarn << "Wrong password" << oendl;
-#else
- qWarning ("Wrong password");
-#endif
QMessageBox::critical( 0, tr("ZSafe"),
tr("Wrong password.\n\nZSafe will now exit.") );
@@ -1933,9 +1611,4 @@ bool ZSafe::openDocument(const char* _filename, const char* )
if (retval != PWERR_GOOD)
{
-#ifndef NO_OPIE
- owarn << "Error loading Document" << oendl;
-#else
- qWarning ("Error loading Document");
-#endif
return false;
}
@@ -1943,9 +1616,5 @@ bool ZSafe::openDocument(const char* _filename, const char* )
else
{
-#ifdef Q_WS_WIN
- this->setCaption("Qt ZSafe");
-#else
- this->setCaption("ZSafe");
-#endif
+ this->setCaption(tr("ZSafe"));
filename = "";
switch( QMessageBox::warning( this, tr("ZSafe"),
@@ -2437,7 +2106,4 @@ void ZSafe::setPasswordDialogDone()
void ZSafe::getDocPassword(QString title)
{
-#ifndef NO_OPIE
- owarn << "getDocPassword" << oendl;
-#endif
// open the 'Password' dialog
PasswordForm *dialog = new PasswordForm(this, title, TRUE);
@@ -2454,19 +2120,12 @@ void ZSafe::getDocPassword(QString title)
// int pos = filename.findRev ('/');
QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
-#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
+ QDialog::DialogCode result = (QDialog::DialogCode) dialog->exec();
QString password;
- if (result == Accepted || newPwdDialogResult)
+ if (result == QDialog::Accepted || newPwdDialogResult)
{
m_password = dialog->PasswordField->text();
@@ -2621,8 +2280,4 @@ int ZSafe::saveFinalize(void)
void ZSafe::quitMe ()
{
-#ifndef NO_OPIE
- owarn << "QUIT..." << oendl;
-#endif
-
if (modified)
{
@@ -2684,7 +2339,4 @@ void ZSafe::addCategory()
{
categoryDialog = new CategoryDialog(this, tr("Category"), TRUE);
-#ifdef Q_WS_WIN
- categoryDialog->setCaption ("Qt " + tr("Category"));
-#endif
dialog = categoryDialog;
connect( dialog->CategoryField,
@@ -2694,8 +2346,4 @@ void ZSafe::addCategory()
}
-#ifdef DESKTOP
-#ifndef Q_WS_WIN
- QStringList list = conf->entryList( APP_KEY+"/fieldDefs" );
-#else
// read all categories from the config file and store
// into a list
@@ -2705,5 +2353,4 @@ void ZSafe::addCategory()
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'
@@ -2712,20 +2359,4 @@ void ZSafe::addCategory()
f.close();
}
-#endif
-#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;
- while ( !t.eof() ) { // until end of file...
- s = t.readLine(); // line of text excluding '\n'
- list.append(s);
- }
- f.close();
- }
-#endif
QStringList::Iterator it = list.begin();
QString categ;
@@ -2737,16 +2368,7 @@ void ZSafe::addCategory()
if (cat->contains("-field1", FALSE))
{
-#ifdef DESKTOP
-#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())
{
@@ -2774,9 +2396,5 @@ void ZSafe::addCategory()
qApp->processEvents();
-#ifdef DESKTOP
- QDir d(iconPath);
-#else
QDir d(QPEApplication::qpeDir() + "pics/");
-#endif
d.setFilter( QDir::Files);
@@ -2790,10 +2408,5 @@ void ZSafe::addCategory()
if(fileName.right(4) == ".png"){
fileName = fileName.mid(0,fileName.length()-4);
-#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);
@@ -2806,20 +2419,10 @@ void ZSafe::addCategory()
}
-#ifndef Q_WS_WIN
- dialog->show();
-#endif
-#ifndef DESKTOP
- // dialog->move (20, 100);
-#endif
- DialogCode result = (DialogCode) dialog->exec();
-#ifdef DESKTOP
- result = Accepted;
-#endif
-
+ QDialog::DialogCode result = (QDialog::DialogCode) dialog->exec();
QString category;
QString icon;
QString fullIconPath;
QPixmap *pix;
- if (result == Accepted)
+ if (result == QDialog::Accepted)
{
modified = true;
@@ -2827,8 +2430,4 @@ void ZSafe::addCategory()
icon = dialog->IconField->currentText()+".png";
-#ifndef NO_OPIE
- owarn << category << oendl;
-#endif
-
QListViewItem *li = new ShadedListItem( 1, ListView );
Category *c1 = new Category();
@@ -2958,9 +2557,5 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog)
}
-#ifdef DESKTOP
- QDir d(iconPath);
-#else
QDir d(QPEApplication::qpeDir() + "pics/");
-#endif
d.setFilter( QDir::Files);
@@ -3015,9 +2610,5 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category)
icon = conf->readEntry(APP_KEY+category);
-#ifdef DESKTOP
- QDir d(iconPath);
-#else
QDir d(QPEApplication::qpeDir() + "pics/");
-#endif
d.setFilter( QDir::Files);
@@ -3054,11 +2645,5 @@ void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog)
{
QString app_key = APP_KEY;
-#ifndef DESKTOP
conf->setGroup ("fieldDefs");
-#else
-#ifndef Q_WS_WIN
- app_key += "/fieldDefs/";
-#endif
-#endif
QString category = dialog->CategoryField->currentText();
// #ifndef Q_WS_WIN
@@ -3071,7 +2656,5 @@ void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog)
// #endif
saveConf();
-#ifndef DESKTOP
conf->setGroup ("zsafe");
-#endif
}
@@ -3093,7 +2676,4 @@ void ZSafe::editCategory()
{
categoryDialog = new CategoryDialog(this, tr("Category"), TRUE);
-#ifdef Q_WS_WIN
- categoryDialog->setCaption ("Qt " + tr("Category"));
-#endif
dialog = categoryDialog;
connect( dialog->CategoryField,
@@ -3104,24 +2684,4 @@ void ZSafe::editCategory()
setCategoryDialogFields(dialog);
-#ifdef DESKTOP
-#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();
- }
-#endif
-#else
// read all categories from the config file and store
// into a list
@@ -3137,5 +2697,4 @@ void ZSafe::editCategory()
f.close();
}
-#endif
QStringList::Iterator it = list.begin();
QString categ;
@@ -3148,16 +2707,7 @@ void ZSafe::editCategory()
if (cat->contains("-field1", FALSE))
{
-#ifdef DESKTOP
-#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())
{
@@ -3194,9 +2744,5 @@ void ZSafe::editCategory()
qApp->processEvents();
-#ifdef DESKTOP
- QDir d(iconPath);
-#else
QDir d(QPEApplication::qpeDir() + "pics/");
-#endif
d.setFilter( QDir::Files);
@@ -3216,10 +2762,5 @@ void ZSafe::editCategory()
{
fileName = fileName.mid(0,fileName.length()-4);
-#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);
@@ -3236,10 +2777,5 @@ void ZSafe::editCategory()
else
{
-#ifdef DESKTOP
- // QDir d(QDir::homeDirPath() + "/pics/");
- QDir d(iconPath);
-#else
QDir d(QPEApplication::qpeDir() + "pics/");
-#endif
d.setFilter( QDir::Files);
@@ -3276,15 +2812,9 @@ void ZSafe::editCategory()
// dialog->show();
-#ifndef DESKTOP
- // dialog->move (20, 100);
-#endif
- DialogCode result = (DialogCode) dialog->exec();
-#ifdef DESKTOP
- result = Accepted;
-#endif
+ QDialog::DialogCode result = (QDialog::DialogCode) dialog->exec();
QString fullIconPath;
QPixmap *pix;
- if (result == Accepted)
+ if (result == QDialog::Accepted)
{
modified = true;
@@ -3303,10 +2833,4 @@ void ZSafe::editCategory()
if (cat)
{
-#ifndef NO_OPIE
- owarn << "Category found" << oendl;
-#else
- qWarning("Category found");
-#endif
-
// if (!icon.isEmpty() && !icon.isNull())
if (icon != "predefined.png")
@@ -3341,9 +2865,4 @@ void ZSafe::editCategory()
if (catItem)
{
-#ifndef NO_OPIE
- owarn << category << oendl;
-#else
- qWarning (category);
-#endif
catItem->setText( 0, tr( category ) );
cat->setCategoryName (tr(category));
@@ -3482,12 +3001,9 @@ void ZSafe::newDocument()
// save the current filename to the config file
+ conf->setGroup("zsafe");
conf->writeEntry(APP_KEY+"document", filename);
saveConf();
QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
-#ifdef Q_WS_WIN
- this->setCaption("Qt ZSafe: " + ti);
-#else
- this->setCaption("ZSafe: " + ti);
-#endif
+ this->setCaption(tr("ZSafe: ") + ti);
// openDocument(filename);
@@ -3504,6 +3020,4 @@ void ZSafe::loadDocument()
// open the file dialog
-#ifndef DESKTOP
-#ifndef NO_OPIE
QMap<QString, QStringList> mimeTypes;
mimeTypes.insert(tr("All"), QStringList() );
@@ -3515,18 +3029,4 @@ void ZSafe::loadDocument()
this,
tr ("Open ZSafe document"));
-#else
- QString newFile = ScQtFileEdit::getOpenFileName(this,
- tr ("Open ZSafe document"),
- QDir::homeDirPath() + "/Documents/application/zsafe",
- "*.zsf");
-#endif
-#else
- QString newFile = QFileDialog::getOpenFileName(
- QDir::homeDirPath() + "/Documents/application/zsafe",
- "ZSafe (*.zsf)",
- this,
- "ZSafe File Dialog"
- "Choose a ZSafe file" );
-#endif
// open the new document
@@ -3566,12 +3066,9 @@ void ZSafe::loadDocument()
// save the current filename to the config file
+ conf->setGroup("zsafe");
conf->writeEntry(APP_KEY+"document", filename);
saveConf();
QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
-#ifdef Q_WS_WIN
- this->setCaption("Qt ZSafe: " + ti);
-#else
- this->setCaption("ZSafe: " + ti);
-#endif
+ this->setCaption(tr("ZSafe: ") + ti);
openDocument(filename);
@@ -3594,12 +3091,9 @@ QString newFile = zsaveDialog();
// save the current filename to the config file
+ conf->setGroup("zsafe");
conf->writeEntry(APP_KEY+"document", filename);
saveConf();
QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
-#ifdef Q_WS_WIN
- this->setCaption("Qt ZSafe: " + ti);
-#else
- this->setCaption("ZSafe: " + ti);
-#endif
+ this->setCaption(tr("ZSafe: ") + ti);
QMessageBox::information( this, tr("ZSafe"),
@@ -3623,39 +3117,17 @@ void ZSafe::about()
{
QString info;
-#ifdef JPATCH_HDE
- info = "<html><body><div align=""center"">";
- info += "<b>";
- info += tr("Zaurus Password Manager<br>");
- info += tr("ZSafe version 2.1.2-jv01b<br>");
- info += "</b>";
- info += tr("by Carsten Schneider<br>");
- info += "zcarsten@gmx.net<br>";
- info += "http://z-soft.z-portal.info/zsafe";
- info += "<br>";
- info += tr("Translations by Robert Ernst<br>");
- info += "robert.ernst@linux-solutions.at<br>";
-
- info += "<br><br>";
- info += QString::fromUtf8("æ~W¥æ~\\¬èª~^/VGA Zaurus対å¿~\\ã~C~Qã~C~Cã~C~Aä½~\\æ ~H~P<br>");
- info += "HADECO R&D<br>";
- info += "r&d@hadeco.co.jp<br>";
- info += "http://www.hadeco.co.jp/r&d/<br>";
- info += "<br></div>";
- info += "</body></html>";
-#else
- info = "<html><body><div align=""center"">";
- info += "<b>";
- info += tr("Zaurus Password Manager<br>");
- info += tr("ZSafe version 2.1.2<br>");
- info += "</b>";
- info += tr("by Carsten Schneider<br>");
- info += "zcarsten@gmx.net<br>";
- info += "http://z-soft.z-portal.info/zsafe";
- info += "<br>";
- info += tr("Translations by Robert Ernst<br>");
- info += "robert.ernst@linux-solutions.at<br>";
- info += "<br></div>";
- info += "</body></html>";
-#endif
+ info = tr("<html><body><div align=""center"">"
+ "<b>"
+ "Zaurus Password Manager<br>"
+ "ZSafe version 2.1.2<br>"
+ "</b>"
+ "by Carsten Schneider<br>"
+ "zcarsten@gmx.net<br>"
+ "http://z-soft.z-portal.info/zsafe"
+ "<br>"
+ "Translations by Robert Ernst<br>"
+ "robert.ernst@linux-solutions.at<br>"
+ "<br></div>"
+ "</body></html>");
// QMessageBox::information( this, tr("ZSafe"), info, tr("&OK"), 0);
@@ -3673,7 +3145,5 @@ void ZSafe::setExpandFlag()
expandTree = !expandTree;
file->setItemChecked('o', expandTree);
-#ifndef DESKTOP
conf->setGroup ("zsafePrefs");
-#endif
// #ifndef Q_WS_WIN
conf->writeEntry (APP_KEY+"expandTree", expandTree);
@@ -3697,11 +3167,6 @@ void ZSafe::resizeEvent ( QResizeEvent * )
{
// owarn << "resizeEvent" << oendl;
-#ifndef DESKTOP
DeskW = appl->desktop()->width();
DeskH = appl->desktop()->height();
-#else
- DeskW = this->width();
- DeskH = this->height();
-#endif
if (New)
@@ -3740,5 +3205,4 @@ QPixmap * ZSafe::getPredefinedIcon(QString category)
void ZSafe::setDocument(const QString& fileref)
{
-#ifndef DESKTOP
// stop the timer to prevent loading of the default document
docuTimer.stop();
@@ -3758,12 +3222,9 @@ void ZSafe::setDocument(const QString& fileref)
}
// save the current filename to the config file
+ conf->setGroup("zsafe");
conf->writeEntry(APP_KEY+"document", filename);
saveConf();
QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
-#ifdef Q_WS_WIN
- this->setCaption("Qt ZSafe: " + ti);
-#else
- this->setCaption("ZSafe: " + ti);
-#endif
+ this->setCaption(tr("ZSafe: ") + ti);
// clear the password list
@@ -3796,7 +3257,4 @@ void ZSafe::setDocument(const QString& fileref)
openDocument(filename);
-#else
-Q_UNUSED(fileref);
-#endif
}
@@ -3806,10 +3264,4 @@ void ZSafe::ListPressed(int mouse, QListViewItem *item, const QPoint&, int colum
switch (mouse) {
case 1:
- {
-#ifdef DESKTOP
- QDragObject *d = new QTextDrag( item->text(column) , this );
- d->dragCopy();
-#endif
- }
break;
case 2:
@@ -3852,6 +3304,4 @@ QString ZSafe::zsaveDialog() {
QString fn;
-#ifndef DESKTOP
-#ifndef NO_OPIE
QMap<QString, QStringList> mimeTypes;
mimeTypes.insert(tr("All"), QStringList() );
@@ -3863,17 +3313,4 @@ QString ZSafe::zsaveDialog() {
this,
tr ("Export text file"));
-#else
- fn = ScQtFileEdit::getSaveAsFileName(this,
- tr ("Export text file"),
- QDir::homeDirPath() + "/Documents/application/zsafe",
- "*.txt");
-#endif
-#else
- fn = QFileDialog::getSaveFileName(
- QDir::homeDirPath() + "/Documents/application/zsafe",
- "ZSafe (*.txt)",
- this,
- "ZSafe");
-#endif
return fn;
}
diff --git a/noncore/apps/zsafe/zsafe.h b/noncore/apps/zsafe/zsafe.h
index 7419797..3d812f8 100644
--- a/noncore/apps/zsafe/zsafe.h
+++ b/noncore/apps/zsafe/zsafe.h
@@ -47,5 +47,5 @@ class QPixmap;
#define FIELD_SIZE 7
-class ZSafe : public QDialog
+class ZSafe : public QWidget
{
Q_OBJECT
@@ -59,6 +59,7 @@ protected:
public:
- ZSafe( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = WDestructiveClose );
+ ZSafe( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~ZSafe();
+ static QString appName() { return QString::fromLatin1( QUICKAPP_NAME ); }
static const QColor *evenRowColor;
@@ -196,3 +197,8 @@ private slots:
};
+
+extern ZSafe *zs;
+extern QApplication *appl;
+extern int DeskW;
+extern int DeskH;
#endif // ZSAFE_H