-rw-r--r-- | noncore/apps/zsafe/main.cpp | 29 | ||||
-rw-r--r-- | noncore/apps/zsafe/zsafe.cpp | 20 | ||||
-rw-r--r-- | noncore/apps/zsafe/zsafe.pro | 14 | ||||
-rw-r--r-- | noncore/apps/zsafe/zsafe_win32.pro | 2 | ||||
-rw-r--r-- | noncore/apps/zsafe/zsafe_x86.pro | 21 |
5 files changed, 58 insertions, 28 deletions
diff --git a/noncore/apps/zsafe/main.cpp b/noncore/apps/zsafe/main.cpp index c187520..2707730 100644 --- a/noncore/apps/zsafe/main.cpp +++ b/noncore/apps/zsafe/main.cpp @@ -28,91 +28,96 @@ using namespace Opie::Core; ZSafe *zs; #ifdef DESKTOP QApplication *appl; #else QPEApplication *appl; #endif int DeskW; int DeskH; void suspend (int signum) { printf ("Suspend signal %d received\n", signum); } void resume (int signum) { printf ("Resume signal %d received\n", signum); zs->resume(signum); } int main( int argc, char ** argv ) { -#ifndef WIN32 +#ifndef Q_WS_WIN // install signal handler - signal (SIGSTOP, suspend); +// signal (SIGSTOP, suspend); #endif #ifdef DESKTOP QApplication a( argc, argv ); #else QPEApplication a( argc, argv ); #endif appl = &a; #ifdef DESKTOP if (argc >= 3) { -#ifndef WIN32 +#ifndef Q_WS_WIN DeskW = atoi(argv[1]); DeskH = atoi(argv[2]); #else int w, h; sscanf (argv[1], "%d", &w); sscanf (argv[2], "%d", &h); DeskW = w; DeskH = h; #endif } else { DeskW = 600; DeskH = 400; } #else DeskW = a.desktop()->width(); DeskH = a.desktop()->height(); +#ifndef NO_OPIE owarn << "Width: " << DeskW << " Height: " << DeskH << oendl; - +#endif #ifdef JPATCH_HDE // nothings #else if (DeskW > 240) { DeskW -= 20; DeskH += 25; +#ifndef NO_OPIE owarn << "Changed width: " << DeskW << " Height: " << DeskH << oendl; +#endif } #endif #endif - ZSafe mw; - zs = &mw; - -#ifndef WIN32 - signal (SIGCONT, resume); + ZSafe *mw = new ZSafe( 0, 0, QWidget::WDestructiveClose ); +// ZSafe mw; +// zs = &mw; + zs = mw; + +#ifndef Q_WS_WIN +// signal (SIGCONT, resume); #endif #ifdef DESKTOP - a.setMainWidget(&mw); - mw.show(); + a.setMainWidget(mw); + mw->show(); #else // a.showMainWidget( &mw ); - a.showMainDocumentWidget( &mw ); + a.showMainDocumentWidget( mw ); #endif int ret = a.exec(); return ret; } diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp index 1c15852..2dd94aa 100644 --- a/noncore/apps/zsafe/zsafe.cpp +++ b/noncore/apps/zsafe/zsafe.cpp @@ -353,49 +353,49 @@ 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 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"); + conf->setGroup ("zsafePrefs"); #endif } } /* * Constructs a ZSafe which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ), Edit(0l), Delete(0l), Find(0l), New(0l), ListView(0l) { IsCut = false; IsCopy = false; modified = false; showpwd = false; // set the config file cfgFile=QDir::homeDirPath(); cfgFile += "/.zsafe.cfg"; @@ -471,49 +471,49 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) #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"; - QString filename = conf->readEntry(APP_KEY+"document"); + filename = conf->readEntry(APP_KEY+"document"); if ( !QFileInfo(filename).exists() || !QDir(zsafeAppDirPath).exists() ) { // 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()) { 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>")); @@ -741,161 +741,161 @@ void ZSafe::deletePwd() { 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 modified = true; selectedItem->parent()->takeItem(selectedItem); selectedItem = NULL; break; case 1: // Don't delete break; } } else { delCategory(); } } void ZSafe::editPwd() { - if (!selectedItem) - return; + if (!selectedItem) + return; if (!isCategory(selectedItem)) { // 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 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 #ifndef Q_QW_QWIN dialog->show(); #endif #else dialog->showMaximized(); #endif #ifdef DESKTOP int result = dialog->exec(); -// result = QDialog::Accepted; + 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)); QString f6 = dialog->Field6->text(); selectedItem->setText (5, tr (f6)); } delete dialog; } else { editCategory(); } } void ZSafe::newPwd() { - if (!selectedItem) - return; - + if (!selectedItem) + return; + qWarning("new item"); if (!isCategory(selectedItem)) selectedItem = selectedItem->parent(); if (isCategory(selectedItem)) { QString cat = selectedItem->text(0); - + qWarning(cat); // 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"))); 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 #ifndef Q_QW_QWIN dialog->show(); #endif #else dialog->showMaximized(); #endif #ifdef DESKTOP int result = dialog->exec(); -// result = QDialog::Accepted; + 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); i->setOpen (TRUE); i->setText (0, tr (name)); QString user = dialog->UsernameField->text(); i->setText (1, tr (user)); QString pwd = dialog->PasswordField->text(); i->setText (2, tr (pwd)); QString comment = dialog->CommentField->text(); diff --git a/noncore/apps/zsafe/zsafe.pro b/noncore/apps/zsafe/zsafe.pro index 3cae706..236d11e 100644 --- a/noncore/apps/zsafe/zsafe.pro +++ b/noncore/apps/zsafe/zsafe.pro @@ -1,17 +1,31 @@ TEMPLATE = app CONFIG = qt warn_on DESTDIR = $(OPIEDIR)/bin HEADERS = zsafe.h krc2.h category.h categorylist.h zlistview.h \ scqtfiledlg.h SOURCES = main.cpp zsafe.cpp krc2.cpp category.cpp \ categorylist.cpp zlistview.cpp shadedlistitem.cpp\ scqtfileedit.cpp scqtfileedit.moc.cpp \ scqtfiledlg.cpp INTERFACES = newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui infoform.ui wait.ui INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopiecore2 -lopieui2 TARGET = zsafe include ( $(OPIEDIR)/include.pro ) +QWS { +message( "Configuring for multi-threaded Qt..." ) + +} + +win32 { + TEMPLATE = app + DEFINES += DESKTOP QT_DLL QT_THREAD_SUPPORT + SOURCES += extra/qsettings.cpp + HEADERS += extra/qsettings.h + INCLUDEPATH += extra + DEPENDPATH += extra + RC_FILE = zsafe.rc +} diff --git a/noncore/apps/zsafe/zsafe_win32.pro b/noncore/apps/zsafe/zsafe_win32.pro index 5bc2c9e..3289fa0 100644 --- a/noncore/apps/zsafe/zsafe_win32.pro +++ b/noncore/apps/zsafe/zsafe_win32.pro @@ -1,18 +1,18 @@ TEMPLATE = app
#CONFIG = qt warn_on thread debug
CONFIG = qt warn_on thread release
-DEFINES = DESKTOP WIN32
+DEFINES = DESKTOP
DEFINES += QT_DLL QT_THREAD_SUPPORT
HEADERS = zsafe.h krc2.h category.h categorylist.h zlistview.h qsettings.h shadedlistitem.h
SOURCES = main.cpp zsafe.cpp krc2.cpp category.cpp \
categorylist.cpp zlistview.cpp qsettings.cpp shadedlistitem.cpp
#INCLUDEPATH += $(QTDIR)/include
#INCLUDEPATH += .
#DEPENDPATH += $(QTDIR)/include
#LIBS += -lqt
INTERFACES = newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui
INTERFACES += infoform.ui wait.ui
TARGET = zsafe
#DESTDIR = ../bin
TRANSLATIONS = i18n/de/zsafe.ts
RC_FILE = zsafe.rc
diff --git a/noncore/apps/zsafe/zsafe_x86.pro b/noncore/apps/zsafe/zsafe_x86.pro index 95eb63f..6bffd23 100644 --- a/noncore/apps/zsafe/zsafe_x86.pro +++ b/noncore/apps/zsafe/zsafe_x86.pro @@ -1,16 +1,27 @@ TEMPLATE = app -#CONFIG = qt warn_on debug -CONFIG = qt warn_on release thread -DEFINES = DESKTOP QT_THREAD_SUPPORT +# CONFIG = qt warn_on debug +CONFIG = qt warn_on release +DEFINES = DESKTOP NO_OPIE HEADERS = zsafe.h krc2.h category.h categorylist.h zlistview.h shadedlistitem.h SOURCES = main.cpp zsafe.cpp krc2.cpp category.cpp categorylist.cpp zlistview.cpp shadedlistitem.cpp INCLUDEPATH += $(QTDIR)/include INCLUDEPATH += . DEPENDPATH += $(QTDIR)/include -#LIBS +=-L$(QPEDIR)/lib -lqt -LIBS +=-Wl,-rpath,/usr/lib/qt3/lib -L/usr/lib/qt3/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm INTERFACES = newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui INTERFACES += infoform.ui wait.ui TARGET = zsafe #DESTDIR = ../bin TRANSLATIONS = i18n/de/zsafe.ts +MOC_DIR=.x11 +OBJECTS_DIR=.x11 + +isEmpty(OPIEDIR) { + message( "Configuring for multi-threaded Qt..." ) +} + +win32 { +HEADERS+=extra/qsettings.h +SOURCES+=extra/qsettings.cpp +INCLUDEPATH += extra +DEPENDPATH += extra +} |