summaryrefslogtreecommitdiff
path: root/noncore/apps
authorzecke <zecke>2004-11-15 17:08:58 (UTC)
committer zecke <zecke>2004-11-15 17:08:58 (UTC)
commit6d7b1a9a5f32a0b69c5ee9cc963e8a43a76327cf (patch) (unidiff)
tree45e30376ec8035174fc5fd9154ed35b4d405d5ed /noncore/apps
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 (limited to 'noncore/apps') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/zsafe/zsafe.cpp691
-rw-r--r--noncore/apps/zsafe/zsafe.h10
2 files changed, 72 insertions, 629 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 @@
9** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html 9** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html
10** 10**
11** Compile Flags:
12** Zaurus arm : -DNO_OPIE
13** Zaurus Opie arm: none
14** Linux Desktop : -DDESKTOP -DNO_OPIE
15** Windows Desktop: -DDESKTOP -DNO_OPIE
16** use qmake
17** for japanese version additional use: -DJPATCH_HDE
18** 11**
19****************************************************************************/ 12****************************************************************************/
@@ -27,14 +20,8 @@
27#include "shadedlistitem.h" 20#include "shadedlistitem.h"
28 21
29#ifndef DESKTOP
30#ifndef NO_OPIE
31#include <opie2/ofiledialog.h> 22#include <opie2/ofiledialog.h>
32#include <opie2/odebug.h> 23#include <opie2/odebug.h>
33using namespace Opie::Core; 24using namespace Opie::Core;
34using namespace Opie::Ui; 25using namespace Opie::Ui;
35#else
36#include "scqtfileedit.h"
37#endif
38#endif
39 26
40#include <qclipboard.h> 27#include <qclipboard.h>
@@ -44,7 +31,5 @@ using namespace Opie::Ui;
44#include <fcntl.h> 31#include <fcntl.h>
45#include <stdlib.h> 32#include <stdlib.h>
46#ifndef Q_WS_WIN
47#include <unistd.h> 33#include <unistd.h>
48#endif
49#include <string.h> 34#include <string.h>
50#include <errno.h> 35#include <errno.h>
@@ -53,14 +38,4 @@ using namespace Opie::Ui;
53#include <qpopupmenu.h> 38#include <qpopupmenu.h>
54 39
55#ifdef DESKTOP
56#include <qfiledialog.h>
57#include <qdragobject.h>
58#ifndef Q_WS_WIN
59#include <qsettings.h>
60#else
61#include "qsettings.h"
62#endif
63#include <qapplication.h>
64#else
65#include <qfile.h> 40#include <qfile.h>
66#include <qpe/fileselector.h> 41#include <qpe/fileselector.h>
@@ -69,5 +44,4 @@ using namespace Opie::Ui;
69#include <qpe/resource.h> 44#include <qpe/resource.h>
70#include <qpe/config.h> 45#include <qpe/config.h>
71#endif
72 46
73#include <qtimer.h> 47#include <qtimer.h>
@@ -96,25 +70,9 @@ using namespace Opie::Ui;
96#include "wait.h" 70#include "wait.h"
97 71
98extern int DeskW, DeskH; 72int DeskW, DeskH;
99#ifdef DESKTOP 73QApplication *appl;
100extern QApplication *appl; 74ZSafe *zs;
101#else
102extern QPEApplication *appl;
103#endif
104
105#ifdef JPATCH_HDE
106#define tr(arg) arg
107#endif
108
109 75
110#ifdef DESKTOP 76const QString APP_KEY = "";
111#ifndef Q_WS_WIN
112const QString APP_KEY="/.zsafe/";
113#else
114const QString APP_KEY="";
115#endif
116#else
117const QString APP_KEY="";
118#endif
119 77
120// include xmp images 78// include xmp images
@@ -365,16 +323,6 @@ static const char* const general_data[] = {
365 delete conf; 323 delete conf;
366 324
367#ifdef DESKTOP 325 conf = new Config ("zsafe");
368#ifndef Q_WS_WIN 326 conf->setGroup ("zsafe");
369 conf = new QSettings();
370 conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath());
371#else
372 conf = new QSettings (cfgFile);
373 conf->insertSearchPath (QSettings::Unix, cfgFile);
374#endif
375#else
376 conf = new Config (cfgFile, Config::File);
377 conf->setGroup ("zsafePrefs");
378#endif
379 } 327 }
380 } 328 }
@@ -388,8 +336,13 @@ static const char* const general_data[] = {
388 * TRUE to construct a modal dialog. 336 * TRUE to construct a modal dialog.
389 */ 337 */
390ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) 338ZSafe::ZSafe( QWidget* parent, const char* name, WFlags fl )
391 : QDialog( parent, name, modal, fl ), 339 : QWidget( parent, name, fl),
392 Edit(0l), Delete(0l), Find(0l), New(0l), ListView(0l) 340 Edit(0l), Delete(0l), Find(0l), New(0l), ListView(0l)
393{ 341{
342 zs = this;
343 appl = qApp;
344 DeskW = qApp->desktop()->width();
345 DeskH = qApp->desktop()->height();
346
394 IsCut = false; 347 IsCut = false;
395 IsCopy = false; 348 IsCopy = false;
@@ -401,42 +354,12 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
401 cfgFile += "/.zsafe.cfg"; 354 cfgFile += "/.zsafe.cfg";
402 // set the icon path 355 // set the icon path
403#ifdef NO_OPIE
404 QString qpedir ((const char *)getenv("QPEDIR"));
405#else
406 QString qpedir ((const char *)getenv("OPIEDIR"));
407#endif
408 356
409#ifdef DESKTOP 357 QString qpeDir = QPEApplication::qpeDir();
410 iconPath = QDir::homeDirPath() + "/pics/";
411#else
412 if (qpedir.isEmpty())
413 iconPath = "/home/QtPalmtop/pics/";
414 else
415 iconPath = qpedir + "/pics/";
416#endif
417 358
418 // create a zsafe configuration object 359 conf = new Config ("zsafe");
419#ifdef DESKTOP
420#ifndef Q_WS_WIN
421 conf = new QSettings ();
422 conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath());
423#else
424 conf = new QSettings (cfgFile);
425 conf->insertSearchPath (QSettings::Unix, cfgFile);
426#endif
427#else
428 conf = new Config (cfgFile, Config::File);
429 conf->setGroup ("zsafePrefs"); 360 conf->setGroup ("zsafePrefs");
430#endif 361
431#ifdef DESKTOP
432// #ifndef Q_WS_WIN
433 expandTree = conf->readBoolEntry(APP_KEY+"expandTree", false);
434// #endif
435#else
436 expandTree = conf->readNumEntry(APP_KEY+"expandTree", 0); 362 expandTree = conf->readNumEntry(APP_KEY+"expandTree", 0);
437#endif
438#ifndef DESKTOP
439 conf->setGroup ("zsafe"); 363 conf->setGroup ("zsafe");
440#endif
441 364
442 QPixmap copy_img((const char**) copy_xpm); 365 QPixmap copy_img((const char**) copy_xpm);
@@ -461,36 +384,11 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
461 QPixmap general( ( const char** ) general_data ); 384 QPixmap general( ( const char** ) general_data );
462 QPixmap image0( ( const char** ) zsafe_xpm ); 385 QPixmap image0( ( const char** ) zsafe_xpm );
463 if ( !name )
464 setName( "ZSafe" );
465
466#ifdef DESKTOP
467#ifdef Q_WS_WIN
468 setGeometry(100, 150, DeskW, DeskH-30 );
469#else
470 resize( DeskW, DeskH-30 );
471#endif
472
473#else
474 386
475#ifdef JPATCH_HDE 387 if ( !name )
476 int DeskS; 388 setName( "ZSafe" );
477 if(DeskW > DeskH)
478 {
479 DeskS = DeskW;
480 }
481 else
482 {
483 DeskS = DeskH;
484 }
485 resize( DeskW, DeskH );
486 setMinimumSize( QSize( DeskS, DeskS ) );
487 setMaximumSize( QSize( DeskS, DeskS ) );
488#else
489 resize( DeskW, DeskH-30 );
490#endif
491 389
492#endif
493 setCaption( tr( "ZSafe" ) ); 390 setCaption( tr( "ZSafe" ) );
494 QString zsafeAppDirPath = QDir::homeDirPath() + "/Documents/application/zsafe"; 391 QString zsafeAppDirPath = QDir::homeDirPath() + "/Documents/application/zsafe";
392
495 filename = conf->readEntry(APP_KEY+"document"); 393 filename = conf->readEntry(APP_KEY+"document");
496 if ( !QFileInfo(filename).exists() || !QDir(zsafeAppDirPath).exists() ) 394 if ( !QFileInfo(filename).exists() || !QDir(zsafeAppDirPath).exists() )
@@ -498,9 +396,5 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
498 // check if the directory application exists, if not 396 // check if the directory application exists, if not
499 // create it 397 // create it
500// #ifndef Q_WS_WIN
501 // QString d1("Documents/application");
502// #else
503 QString d1(QDir::homeDirPath() + "/Documents/application"); 398 QString d1(QDir::homeDirPath() + "/Documents/application");
504// #endif
505 QDir pd1(d1); 399 QDir pd1(d1);
506 if (!pd1.exists()) 400 if (!pd1.exists())
@@ -512,21 +406,13 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
512 } 406 }
513 } 407 }
514 408
515 if (!pd2.mkdir("application", FALSE)) 409 if (!pd2.mkdir("application", FALSE))
516 { 410 {
517 QMessageBox::critical( 0, tr("ZSafe"), 411 QMessageBox::critical( 0, tr("ZSafe"),
518#ifdef JPATCH_HDE
519 tr("<P>Can't create directory ..."+d1+"</P><P>ZSafe will now exit.</P>"));
520#else
521 tr("<P>Can't create directory %1</P><P>ZSafe will now exit.</P>").arg(d1)); 412 tr("<P>Can't create directory %1</P><P>ZSafe will now exit.</P>").arg(d1));
522#endif
523 exitZs (1); 413 exitZs (1);
524 } 414 }
525 } 415 }
526// #ifndef Q_WS_WIN
527 // QString d2("Documents/application/zsafe");
528// #else
529 QString d2(QDir::homeDirPath() + "/Documents/application/zsafe"); 416 QString d2(QDir::homeDirPath() + "/Documents/application/zsafe");
530// #endif
531 QDir pd2(d2); 417 QDir pd2(d2);
532 if (!pd2.exists()) 418 if (!pd2.exists())
@@ -535,13 +421,9 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
535 { 421 {
536 QMessageBox::critical( 0, tr("ZSafe"), 422 QMessageBox::critical( 0, tr("ZSafe"),
537#ifdef JPATCH_HDE
538 tr("<P>Can't create directory ...//Documents/application/zsafe</P><P>ZSafe will now exit.</P"));
539#else
540 tr("<P>Can't create directory %1</P><P>ZSafe will now exit.</P>").arg(d2)); 423 tr("<P>Can't create directory %1</P><P>ZSafe will now exit.</P>").arg(d2));
541#endif
542 exitZs (1); 424 exitZs (1);
543 } 425 }
544 } 426 }
545 427
546 filename = zsafeAppDirPath + "/passwords.zsf"; 428 filename = zsafeAppDirPath + "/passwords.zsf";
547 429
@@ -554,9 +436,5 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
554 436
555 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 437 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
556#ifdef Q_WS_WIN 438 this->setCaption(tr("ZSafe: ") + ti);
557 this->setCaption("Qt ZSafe: " + ti);
558#else
559 this->setCaption("ZSafe: " + ti);
560#endif
561 439
562 selectedItem = NULL; 440 selectedItem = NULL;
@@ -578,10 +456,8 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
578 file = new QPopupMenu( this ); 456 file = new QPopupMenu( this );
579 457
580// #ifdef DESKTOP
581 file->insertItem( new_img, tr("&New document"), this, SLOT(newDocument()) ); 458 file->insertItem( new_img, tr("&New document"), this, SLOT(newDocument()) );
582 file->insertItem( folder_open_img, tr("&Open document"), this, SLOT(loadDocument()) ); 459 file->insertItem( folder_open_img, tr("&Open document"), this, SLOT(loadDocument()) );
583 file->insertItem( save_img, tr("&Save document as .."), this, SLOT(saveDocumentAs()) ); 460 file->insertItem( save_img, tr("&Save document as .."), this, SLOT(saveDocumentAs()) );
584 file->insertSeparator(); 461 file->insertSeparator();
585// #endif
586 462
587 file->insertItem( save_img, tr("&Save document"), this, SLOT(saveDocumentWithoutPwd()) ); 463 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 )
666 ListView->setAllColumnsShowFocus(TRUE); 542 ListView->setAllColumnsShowFocus(TRUE);
667 543
668#ifdef DESKTOP
669 // ListView->setResizePolicy(QScrollView::AutoOneFit);
670 // ListView->setGeometry( QRect( 0, 22, this->width(), this->height() - 30 ) );
671#else
672 ListView->setResizePolicy(QScrollView::AutoOneFit); 544 ListView->setResizePolicy(QScrollView::AutoOneFit);
673 // ListView->setGeometry( QRect( 0, 22, 545 // ListView->setGeometry( QRect( 0, 22,
674 // this->width(), this->height() - 30 ) ); 546 // this->width(), this->height() - 30 ) );
675 // ListView->setMaximumSize( QSize( 440, 290 ) ); 547 // ListView->setMaximumSize( QSize( 440, 290 ) );
676#endif
677 // ListView->setVScrollBarMode( QListView::Auto ); 548 // ListView->setVScrollBarMode( QListView::Auto );
678 549
@@ -681,5 +552,4 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
681 l->addWidget (ListView); 552 l->addWidget (ListView);
682 553
683#ifndef DESKTOP
684 // start a timer (100 ms) to load the default document 554 // start a timer (100 ms) to load the default document
685 docuTimer.start( 100, true ); 555 docuTimer.start( 100, true );
@@ -687,8 +557,4 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
687 raiseFlag = true; 557 raiseFlag = true;
688 connect( &raiseTimer, SIGNAL(timeout()), SLOT( slotRaiseTimer() ) ); 558 connect( &raiseTimer, SIGNAL(timeout()), SLOT( slotRaiseTimer() ) );
689#else
690 // open the default document
691 openDocument(filename);
692#endif
693 559
694 // signals and slots connections for QTollButton 560 // signals and slots connections for QTollButton
@@ -705,15 +571,9 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
705 this, SLOT( showInfo(QListViewItem*) ) ); 571 this, SLOT( showInfo(QListViewItem*) ) );
706 572
707 #ifndef DESKTOP 573 QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold);
708 QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold);
709#endif
710 connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 574 connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
711 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); 575 this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) );
712 576
713 this->setIcon( image0); 577 this->setIcon( image0);
714#ifdef Q_WS_WIN
715 ListView->setSelected( ListView->firstChild() , true);
716 ListView->setSelected( ListView->firstChild() , false);
717#endif
718} 578}
719 579
@@ -773,8 +633,4 @@ void ZSafe::editPwd()
773 // open the 'New Entry' dialog 633 // open the 'New Entry' dialog
774 NewDialog *dialog = new NewDialog(this, "edit_entry", TRUE); 634 NewDialog *dialog = new NewDialog(this, "edit_entry", TRUE);
775#ifdef Q_WS_WIN
776 dialog->setCaption ("Qt " + tr("Edit Entry"));
777 dialog->setGeometry(200, 250, 220, 310 );
778#endif
779 635
780 // set the labels 636 // set the labels
@@ -797,20 +653,6 @@ void ZSafe::editPwd()
797 dialog->CommentField->setCursorPosition(0,0); 653 dialog->CommentField->setCursorPosition(0,0);
798 654
799#ifdef Q_WS_QWS 655 QDialog::DialogCode result = (QDialog::DialogCode) QPEApplication::execDialog( dialog );
800 DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); 656 if (result == QDialog::Accepted)
801#endif
802
803#ifdef DESKTOP
804#ifndef Q_QW_QWIN
805 dialog->show();
806#endif
807#else
808 dialog->showMaximized();
809#endif
810#ifdef DESKTOP
811 int result = dialog->exec();
812 result = QDialog::Accepted;
813#endif
814 if (result == Accepted)
815 { 657 {
816 modified = true; 658 modified = true;
@@ -853,8 +695,4 @@ void ZSafe::newPwd()
853 // open the 'New Entry' dialog 695 // open the 'New Entry' dialog
854 NewDialog *dialog = new NewDialog(this, "new_entry", TRUE); 696 NewDialog *dialog = new NewDialog(this, "new_entry", TRUE);
855#ifdef Q_WS_WIN
856 dialog->setCaption ("Qt " + tr("New Entry"));
857 dialog->setGeometry(200, 250, 220, 310 );
858#endif
859 // set the labels 697 // set the labels
860 dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); 698 dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name")));
@@ -867,20 +705,7 @@ retype:
867 705
868#ifdef Q_WS_QWS 706#ifdef Q_WS_QWS
869 DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); 707 QDialog::DialogCode result = (QDialog::DialogCode) QPEApplication::execDialog( dialog );
870#endif
871
872#ifdef DESKTOP
873#ifndef Q_QW_QWIN
874 dialog->show();
875#endif
876#else
877 dialog->showMaximized();
878#endif
879#ifdef DESKTOP
880 int result = dialog->exec();
881 result = QDialog::Accepted;
882#endif 708#endif
883 709 if (result == QDialog::Accepted)
884 if (result == Accepted)
885 { 710 {
886 711
@@ -921,10 +746,5 @@ void ZSafe::findPwd()
921 // open the 'Search' dialog 746 // open the 'Search' dialog
922 SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE); 747 SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE);
923#ifdef Q_WS_WIN
924 dialog->setCaption ("Qt " + tr("Search"));
925#endif
926 748
927#ifdef DESKTOP
928#endif
929 if (lastSearchedName) 749 if (lastSearchedName)
930 dialog->NameField->setText(lastSearchedName); 750 dialog->NameField->setText(lastSearchedName);
@@ -939,22 +759,14 @@ void ZSafe::findPwd()
939 else 759 else
940 dialog->CommentField->setText(""); 760 dialog->CommentField->setText("");
941 DialogCode result = (DialogCode) dialog->exec(); 761 QDialog::DialogCode result = (QDialog::DialogCode) dialog->exec();
942#ifdef DESKTOP
943 result = Accepted;
944#endif
945 762
946 QString name; 763 QString name;
947 QString username; 764 QString username;
948 QString comment; 765 QString comment;
949 if (result == Accepted) 766 if (result == QDialog::Accepted)
950 { 767 {
951 name = dialog->NameField->text(); 768 name = dialog->NameField->text();
952 username = dialog->UsernameField->text(); 769 username = dialog->UsernameField->text();
953 comment = dialog->CommentField->text(); 770 comment = dialog->CommentField->text();
954#ifndef NO_OPIE
955 owarn << name << oendl;
956#else
957 qWarning (name);
958#endif
959 } 771 }
960 else 772 else
@@ -1002,7 +814,4 @@ void ZSafe::findPwd()
1002 i = i->nextSibling()) 814 i = i->nextSibling())
1003 { 815 {
1004#ifndef NO_OPIE
1005 owarn << i->text(0) << oendl;
1006#endif
1007 i->setSelected(FALSE); 816 i->setSelected(FALSE);
1008 817
@@ -1018,9 +827,4 @@ void ZSafe::findPwd()
1018 si = si->nextSibling()) 827 si = si->nextSibling())
1019 { 828 {
1020#ifndef NO_OPIE
1021 owarn << si->text(0) << oendl;
1022#else
1023 qWarning (si->text(0));
1024#endif
1025 if (si->isSelected()) 829 if (si->isSelected())
1026 si->setSelected(FALSE); 830 si->setSelected(FALSE);
@@ -1039,9 +843,4 @@ void ZSafe::findPwd()
1039 if ((n && u && c ) && !found) 843 if ((n && u && c ) && !found)
1040 { 844 {
1041#ifndef NO_OPIE
1042 owarn << "Found" << oendl;
1043#else
1044 qWarning ("Found");
1045#endif
1046 selectedItem = si; 845 selectedItem = si;
1047 si->setSelected(TRUE); 846 si->setSelected(TRUE);
@@ -1100,22 +899,8 @@ QString ZSafe::getFieldLabel (QListViewItem *_item, QString field, QString def)
1100 899
1101 QString app_key = APP_KEY; 900 QString app_key = APP_KEY;
1102#ifndef DESKTOP
1103#ifndef Q_WS_WIN
1104 conf->setGroup ("fieldDefs");
1105#endif
1106#else
1107#ifndef Q_WS_WIN
1108 app_key += "/fieldDefs/";
1109#endif
1110#endif
1111// #ifndef Q_WS_WIN
1112 QString label = conf->readEntry(app_key+category+"-field"+field,def);
1113// #else
1114// QString label(def);
1115// #endif
1116 901
1117#ifndef DESKTOP 902 conf->setGroup( "fieldDefs" );
903 QString label = conf->readEntry(app_key+category+"-field"+field,def);
1118 conf->setGroup ("zsafe"); 904 conf->setGroup ("zsafe");
1119#endif
1120 return label; 905 return label;
1121} 906}
@@ -1124,12 +909,6 @@ QString ZSafe::getFieldLabel (QString category, QString field, QString def)
1124{ 909{
1125 QString app_key = APP_KEY; 910 QString app_key = APP_KEY;
1126#ifndef DESKTOP
1127 conf->setGroup ("fieldDefs");
1128#else
1129#ifndef Q_WS_WIN
1130 app_key += "/fieldDefs/";
1131#endif
1132#endif
1133// #ifndef Q_WS_WIN 911// #ifndef Q_WS_WIN
912 conf->setGroup( "fieldDefs" );
1134 QString label = conf->readEntry(app_key+category+"-field"+field, 913 QString label = conf->readEntry(app_key+category+"-field"+field,
1135 def); 914 def);
@@ -1137,7 +916,5 @@ QString ZSafe::getFieldLabel (QString category, QString field, QString def)
1137 // QString label(def); 916 // QString label(def);
1138// #endif 917// #endif
1139#ifndef DESKTOP
1140 conf->setGroup ("zsafe"); 918 conf->setGroup ("zsafe");
1141#endif
1142 return label; 919 return label;
1143} 920}
@@ -1236,7 +1013,4 @@ void ZSafe::showInfo( QListViewItem *_item)
1236#endif 1013#endif
1237 1014
1238#ifdef DESKTOP
1239 infoForm->show();
1240 #endif
1241 } 1015 }
1242} 1016}
@@ -1251,14 +1025,4 @@ void ZSafe::listViewSelected( QListViewItem *_item)
1251 selectedItem = _item; 1025 selectedItem = _item;
1252 1026
1253#ifndef DESKTOP
1254 // set the column text dependent on the selected item
1255 ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name")));
1256 ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2")));
1257 ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3")));
1258 ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment")));
1259 ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4")));
1260 ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5")));
1261#endif
1262#ifdef Q_WS_WIN
1263 // set the column text dependent on the selected item 1027 // set the column text dependent on the selected item
1264 ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name"))); 1028 ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name")));
@@ -1268,6 +1032,4 @@ void ZSafe::listViewSelected( QListViewItem *_item)
1268 ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4"))); 1032 ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4")));
1269 ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5"))); 1033 ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5")));
1270#endif
1271
1272} 1034}
1273 1035
@@ -1288,6 +1050,4 @@ void ZSafe::removeAsciiFile()
1288 // QString fn = filename + ".txt"; 1050 // QString fn = filename + ".txt";
1289 // open the file dialog 1051 // open the file dialog
1290#ifndef DESKTOP
1291#ifndef NO_OPIE
1292 QMap<QString, QStringList> mimeTypes; 1052 QMap<QString, QStringList> mimeTypes;
1293 mimeTypes.insert(tr("All"), QStringList() ); 1053 mimeTypes.insert(tr("All"), QStringList() );
@@ -1299,18 +1059,4 @@ void ZSafe::removeAsciiFile()
1299 this, 1059 this,
1300 tr ("Remove text file")); 1060 tr ("Remove text file"));
1301#else
1302 QString fn = ScQtFileEdit::getOpenFileName(this,
1303 tr ("Remove text file"),
1304 QDir::homeDirPath() + "/Documents/application/zsafe",
1305 "*.txt");
1306#endif
1307#else
1308 QString fn = QFileDialog::getOpenFileName(
1309 QDir::homeDirPath() + "/Documents/application/zsafe",
1310 "ZSafe (*.txt)",
1311 this,
1312 "ZSafe File Dialog"
1313 "Choose a text file" );
1314#endif
1315 1061
1316 if (fn && fn.length() > 0 ) 1062 if (fn && fn.length() > 0 )
@@ -1319,9 +1065,4 @@ void ZSafe::removeAsciiFile()
1319 if ( !f.remove() ) 1065 if ( !f.remove() )
1320 { 1066 {
1321#ifndef NO_OPIE
1322 owarn << "Could not remove file " << fn << oendl;
1323#else
1324 qWarning( QString("Could not remove file %1").arg(fn),2000 );
1325#endif
1326 QMessageBox::critical( 0, tr("ZSafe"), 1067 QMessageBox::critical( 0, tr("ZSafe"),
1327 tr("Could not remove text file.") ); 1068 tr("Could not remove text file.") );
@@ -1347,9 +1088,4 @@ void ZSafe::writeAllEntries()
1347 QFile f( fn ); 1088 QFile f( fn );
1348 if ( !f.open( IO_WriteOnly ) ) { 1089 if ( !f.open( IO_WriteOnly ) ) {
1349#ifndef NO_OPIE
1350 owarn << "Could not write to file " << fn << oendl;
1351#else
1352 qWarning( QString("Could not write to file %1").arg(fn),2000 );
1353#endif
1354 QMessageBox::critical( 0, "ZSafe", 1090 QMessageBox::critical( 0, "ZSafe",
1355 QString("Could not export to text file.") ); 1091 QString("Could not export to text file.") );
@@ -1414,6 +1150,4 @@ void ZSafe::readAllEntries()
1414 1150
1415 // open the file dialog 1151 // open the file dialog
1416#ifndef DESKTOP
1417#ifndef NO_OPIE
1418 QMap<QString, QStringList> mimeTypes; 1152 QMap<QString, QStringList> mimeTypes;
1419 mimeTypes.insert(tr("All"), QStringList() ); 1153 mimeTypes.insert(tr("All"), QStringList() );
@@ -1425,18 +1159,4 @@ void ZSafe::readAllEntries()
1425 this, 1159 this,
1426 tr ("Import text file")); 1160 tr ("Import text file"));
1427#else
1428 QString fn = ScQtFileEdit::getOpenFileName(this,
1429 tr ("Import text file"),
1430 QDir::homeDirPath() + "/Documents/application/zsafe",
1431 "*.txt");
1432#endif
1433#else
1434 QString fn = QFileDialog::getOpenFileName(
1435 QDir::homeDirPath() + "/Documents/application/zsafe",
1436 "ZSafe (*.txt)",
1437 this,
1438 "ZSafe File Dialog"
1439 "Choose a text file" );
1440#endif
1441 1161
1442 if (fn && fn.length() > 0 ) 1162 if (fn && fn.length() > 0 )
@@ -1445,9 +1165,4 @@ void ZSafe::readAllEntries()
1445 if ( !f.open( IO_ReadOnly ) ) 1165 if ( !f.open( IO_ReadOnly ) )
1446 { 1166 {
1447#ifndef NO_OPIE
1448 owarn << "Could not read file " << fn << oendl;
1449#else
1450 qWarning( QString("Could not read file %1").arg(fn), 2000 );
1451#endif
1452 QMessageBox::critical( 0, "ZSafe", 1167 QMessageBox::critical( 0, "ZSafe",
1453 QString("Could not import text file.") ); 1168 QString("Could not import text file.") );
@@ -1478,10 +1193,4 @@ void ZSafe::readAllEntries()
1478 } 1193 }
1479 1194
1480#ifndef NO_OPIE
1481 owarn << "ReadAllEntries(): " << oendl;
1482#else
1483 qWarning ("ReadAllEntries(): ");
1484#endif
1485
1486 QTextStream t(&f); 1195 QTextStream t(&f);
1487 while ( !t.eof() ) 1196 while ( !t.eof() )
@@ -1490,9 +1199,5 @@ void ZSafe::readAllEntries()
1490 s.replace (QRegExp("\";\""), "\"|\""); 1199 s.replace (QRegExp("\";\""), "\"|\"");
1491 // char buffer[1024]; 1200 // char buffer[1024];
1492#ifndef Q_WS_WIN
1493 char buffer[s.length()+1]; 1201 char buffer[s.length()+1];
1494#else
1495 char buffer[4048];
1496#endif
1497 1202
1498 1203
@@ -1640,9 +1345,4 @@ void ZSafe::writeAllEntries()
1640 QFile f( fn ); 1345 QFile f( fn );
1641 if ( !f.open( IO_WriteOnly ) ) { 1346 if ( !f.open( IO_WriteOnly ) ) {
1642#ifndef NO_OPIE
1643 owarn << "Could not write to file " << fn << oendl;
1644#else
1645 qWarning( QString("Could not write to file %1").arg(fn), 2000 );
1646#endif
1647 QMessageBox::critical( 0, tr("ZSafe"), 1347 QMessageBox::critical( 0, tr("ZSafe"),
1648 tr("Could not export to text file.") ); 1348 tr("Could not export to text file.") );
@@ -1697,9 +1397,4 @@ void ZSafe::readAllEntries()
1697 if ( !f.open( IO_ReadOnly ) ) 1397 if ( !f.open( IO_ReadOnly ) )
1698 { 1398 {
1699#ifndef NO_OPIE
1700 owarn << "Could not read file " << fn << oendl;
1701#else
1702 qWarning( QString("Could not read file %1").arg(fn), 2000 );
1703#endif
1704 QMessageBox::critical( 0, tr("ZSafe"), 1399 QMessageBox::critical( 0, tr("ZSafe"),
1705 tr("Could not import text file.") ); 1400 tr("Could not import text file.") );
@@ -1730,9 +1425,4 @@ void ZSafe::readAllEntries()
1730 } 1425 }
1731 1426
1732#ifndef NO_OPIE
1733 owarn << "ReadAllEntries(): " << oendl;
1734#else
1735 qWarning ("ReadAllEntries(): ");
1736#endif
1737 QTextStream t(&f); 1427 QTextStream t(&f);
1738 while ( !t.eof() ) 1428 while ( !t.eof() )
@@ -1742,9 +1432,5 @@ void ZSafe::readAllEntries()
1742 // char buffer[1024]; 1432 // char buffer[1024];
1743 int len=s.length()+1; 1433 int len=s.length()+1;
1744#ifdef Q_WS_WIN
1745 char buffer[512];
1746#else
1747 char buffer[len]; 1434 char buffer[len];
1748#endif
1749 strcpy (buffer, s); 1435 strcpy (buffer, s);
1750 1436
@@ -1857,7 +1543,4 @@ void ZSafe::readAllEntries()
1857void ZSafe::resume(int) 1543void ZSafe::resume(int)
1858{ 1544{
1859#ifndef NO_OPIE
1860 owarn << "Resume" << oendl;
1861#endif
1862 // hide the main window 1545 // hide the main window
1863 1546
@@ -1920,9 +1603,4 @@ bool ZSafe::openDocument(const char* _filename, const char* )
1920 if (m_password.isEmpty() && validationFlag == 0) 1603 if (m_password.isEmpty() && validationFlag == 0)
1921 { 1604 {
1922#ifndef NO_OPIE
1923 owarn << "Wrong password" << oendl;
1924#else
1925 qWarning ("Wrong password");
1926#endif
1927 QMessageBox::critical( 0, tr("ZSafe"), 1605 QMessageBox::critical( 0, tr("ZSafe"),
1928 tr("Wrong password.\n\nZSafe will now exit.") ); 1606 tr("Wrong password.\n\nZSafe will now exit.") );
@@ -1933,9 +1611,4 @@ bool ZSafe::openDocument(const char* _filename, const char* )
1933 if (retval != PWERR_GOOD) 1611 if (retval != PWERR_GOOD)
1934 { 1612 {
1935#ifndef NO_OPIE
1936 owarn << "Error loading Document" << oendl;
1937#else
1938 qWarning ("Error loading Document");
1939#endif
1940 return false; 1613 return false;
1941 } 1614 }
@@ -1943,9 +1616,5 @@ bool ZSafe::openDocument(const char* _filename, const char* )
1943 else 1616 else
1944 { 1617 {
1945#ifdef Q_WS_WIN 1618 this->setCaption(tr("ZSafe"));
1946 this->setCaption("Qt ZSafe");
1947#else
1948 this->setCaption("ZSafe");
1949#endif
1950 filename = ""; 1619 filename = "";
1951 switch( QMessageBox::warning( this, tr("ZSafe"), 1620 switch( QMessageBox::warning( this, tr("ZSafe"),
@@ -1963,5 +1632,5 @@ bool ZSafe::openDocument(const char* _filename, const char* )
1963 break; 1632 break;
1964 } 1633 }
1965 1634
1966 } 1635 }
1967 1636
@@ -2437,7 +2106,4 @@ void ZSafe::setPasswordDialogDone()
2437void ZSafe::getDocPassword(QString title) 2106void ZSafe::getDocPassword(QString title)
2438{ 2107{
2439#ifndef NO_OPIE
2440 owarn << "getDocPassword" << oendl;
2441#endif
2442 // open the 'Password' dialog 2108 // open the 'Password' dialog
2443 PasswordForm *dialog = new PasswordForm(this, title, TRUE); 2109 PasswordForm *dialog = new PasswordForm(this, title, TRUE);
@@ -2454,19 +2120,12 @@ void ZSafe::getDocPassword(QString title)
2454 // int pos = filename.findRev ('/'); 2120 // int pos = filename.findRev ('/');
2455 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 2121 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
2456#ifdef Q_WS_WIN
2457 dialog->setCaption("Qt " + ti);
2458#else
2459 dialog->setCaption(ti); 2122 dialog->setCaption(ti);
2460#endif
2461 // dialog->setCaption(title); 2123 // dialog->setCaption(title);
2462 2124
2463 dialog->PasswordField->setFocus(); 2125 dialog->PasswordField->setFocus();
2464 DialogCode result = (DialogCode) dialog->exec(); 2126 QDialog::DialogCode result = (QDialog::DialogCode) dialog->exec();
2465#ifdef DESKTOP
2466 result = Accepted;
2467#endif
2468 2127
2469 QString password; 2128 QString password;
2470 if (result == Accepted || newPwdDialogResult) 2129 if (result == QDialog::Accepted || newPwdDialogResult)
2471 { 2130 {
2472 m_password = dialog->PasswordField->text(); 2131 m_password = dialog->PasswordField->text();
@@ -2621,8 +2280,4 @@ int ZSafe::saveFinalize(void)
2621void ZSafe::quitMe () 2280void ZSafe::quitMe ()
2622{ 2281{
2623#ifndef NO_OPIE
2624 owarn << "QUIT..." << oendl;
2625#endif
2626
2627 if (modified) 2282 if (modified)
2628 { 2283 {
@@ -2684,7 +2339,4 @@ void ZSafe::addCategory()
2684 { 2339 {
2685 categoryDialog = new CategoryDialog(this, tr("Category"), TRUE); 2340 categoryDialog = new CategoryDialog(this, tr("Category"), TRUE);
2686#ifdef Q_WS_WIN
2687 categoryDialog->setCaption ("Qt " + tr("Category"));
2688#endif
2689 dialog = categoryDialog; 2341 dialog = categoryDialog;
2690 connect( dialog->CategoryField, 2342 connect( dialog->CategoryField,
@@ -2694,8 +2346,4 @@ void ZSafe::addCategory()
2694 } 2346 }
2695 2347
2696#ifdef DESKTOP
2697#ifndef Q_WS_WIN
2698 QStringList list = conf->entryList( APP_KEY+"/fieldDefs" );
2699#else
2700 // read all categories from the config file and store 2348 // read all categories from the config file and store
2701 // into a list 2349 // into a list
@@ -2705,5 +2353,4 @@ void ZSafe::addCategory()
2705 QTextStream t( &f ); // use a text stream 2353 QTextStream t( &f ); // use a text stream
2706 QString s; 2354 QString s;
2707 int n = 1;
2708 while ( !t.eof() ) { // until end of file... 2355 while ( !t.eof() ) { // until end of file...
2709 s = t.readLine(); // line of text excluding '\n' 2356 s = t.readLine(); // line of text excluding '\n'
@@ -2712,20 +2359,4 @@ void ZSafe::addCategory()
2712 f.close(); 2359 f.close();
2713 } 2360 }
2714#endif
2715#else
2716 // read all categories from the config file and store
2717 // into a list
2718 QFile f (cfgFile);
2719 QStringList list;
2720 if ( f.open(IO_ReadOnly) ) { // file opened successfully
2721 QTextStream t( &f ); // use a text stream
2722 QString s;
2723 while ( !t.eof() ) { // until end of file...
2724 s = t.readLine(); // line of text excluding '\n'
2725 list.append(s);
2726 }
2727 f.close();
2728 }
2729#endif
2730 QStringList::Iterator it = list.begin(); 2361 QStringList::Iterator it = list.begin();
2731 QString categ; 2362 QString categ;
@@ -2737,16 +2368,7 @@ void ZSafe::addCategory()
2737 if (cat->contains("-field1", FALSE)) 2368 if (cat->contains("-field1", FALSE))
2738 { 2369 {
2739#ifdef DESKTOP
2740#ifndef Q_WS_WIN
2741 categ = cat->section ("-field1", 0, 0);
2742#else
2743 int pos = cat->find ("-field1");
2744 categ = cat->left (pos);
2745#endif
2746#else
2747 int pos = cat->find ("-field1"); 2370 int pos = cat->find ("-field1");
2748 cat->truncate(pos); 2371 cat->truncate(pos);
2749 categ = *cat; 2372 categ = *cat;
2750#endif
2751 if (!categ.isEmpty()) 2373 if (!categ.isEmpty())
2752 { 2374 {
@@ -2774,9 +2396,5 @@ void ZSafe::addCategory()
2774 qApp->processEvents(); 2396 qApp->processEvents();
2775 2397
2776#ifdef DESKTOP
2777 QDir d(iconPath);
2778#else
2779 QDir d(QPEApplication::qpeDir() + "pics/"); 2398 QDir d(QPEApplication::qpeDir() + "pics/");
2780#endif
2781 d.setFilter( QDir::Files); 2399 d.setFilter( QDir::Files);
2782 2400
@@ -2790,10 +2408,5 @@ void ZSafe::addCategory()
2790 if(fileName.right(4) == ".png"){ 2408 if(fileName.right(4) == ".png"){
2791 fileName = fileName.mid(0,fileName.length()-4); 2409 fileName = fileName.mid(0,fileName.length()-4);
2792#ifdef DESKTOP
2793 QPixmap imageOfFile;
2794 imageOfFile.load(iconPath + fi->fileName());
2795#else
2796 QPixmap imageOfFile(Resource::loadPixmap(fileName)); 2410 QPixmap imageOfFile(Resource::loadPixmap(fileName));
2797#endif
2798 QImage foo = imageOfFile.convertToImage(); 2411 QImage foo = imageOfFile.convertToImage();
2799 foo = foo.smoothScale(16,16); 2412 foo = foo.smoothScale(16,16);
@@ -2806,20 +2419,10 @@ void ZSafe::addCategory()
2806 } 2419 }
2807 2420
2808#ifndef Q_WS_WIN 2421 QDialog::DialogCode result = (QDialog::DialogCode) dialog->exec();
2809 dialog->show();
2810#endif
2811#ifndef DESKTOP
2812 // dialog->move (20, 100);
2813#endif
2814 DialogCode result = (DialogCode) dialog->exec();
2815#ifdef DESKTOP
2816 result = Accepted;
2817#endif
2818
2819 QString category; 2422 QString category;
2820 QString icon; 2423 QString icon;
2821 QString fullIconPath; 2424 QString fullIconPath;
2822 QPixmap *pix; 2425 QPixmap *pix;
2823 if (result == Accepted) 2426 if (result == QDialog::Accepted)
2824 { 2427 {
2825 modified = true; 2428 modified = true;
@@ -2827,8 +2430,4 @@ void ZSafe::addCategory()
2827 icon = dialog->IconField->currentText()+".png"; 2430 icon = dialog->IconField->currentText()+".png";
2828 2431
2829#ifndef NO_OPIE
2830 owarn << category << oendl;
2831#endif
2832
2833 QListViewItem *li = new ShadedListItem( 1, ListView ); 2432 QListViewItem *li = new ShadedListItem( 1, ListView );
2834 Category *c1 = new Category(); 2433 Category *c1 = new Category();
@@ -2958,9 +2557,5 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog)
2958 } 2557 }
2959 2558
2960#ifdef DESKTOP
2961 QDir d(iconPath);
2962#else
2963 QDir d(QPEApplication::qpeDir() + "pics/"); 2559 QDir d(QPEApplication::qpeDir() + "pics/");
2964#endif
2965 d.setFilter( QDir::Files); 2560 d.setFilter( QDir::Files);
2966 2561
@@ -3015,9 +2610,5 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category)
3015 icon = conf->readEntry(APP_KEY+category); 2610 icon = conf->readEntry(APP_KEY+category);
3016 2611
3017#ifdef DESKTOP
3018 QDir d(iconPath);
3019#else
3020 QDir d(QPEApplication::qpeDir() + "pics/"); 2612 QDir d(QPEApplication::qpeDir() + "pics/");
3021#endif
3022 d.setFilter( QDir::Files); 2613 d.setFilter( QDir::Files);
3023 2614
@@ -3054,11 +2645,5 @@ void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog)
3054{ 2645{
3055 QString app_key = APP_KEY; 2646 QString app_key = APP_KEY;
3056#ifndef DESKTOP 2647 conf->setGroup( "fieldDefs" );
3057 conf->setGroup ("fieldDefs");
3058#else
3059#ifndef Q_WS_WIN
3060 app_key += "/fieldDefs/";
3061#endif
3062#endif
3063 QString category = dialog->CategoryField->currentText(); 2648 QString category = dialog->CategoryField->currentText();
3064// #ifndef Q_WS_WIN 2649// #ifndef Q_WS_WIN
@@ -3071,7 +2656,5 @@ void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog)
3071// #endif 2656// #endif
3072 saveConf(); 2657 saveConf();
3073#ifndef DESKTOP
3074 conf->setGroup ("zsafe"); 2658 conf->setGroup ("zsafe");
3075#endif
3076} 2659}
3077 2660
@@ -3093,7 +2676,4 @@ void ZSafe::editCategory()
3093 { 2676 {
3094 categoryDialog = new CategoryDialog(this, tr("Category"), TRUE); 2677 categoryDialog = new CategoryDialog(this, tr("Category"), TRUE);
3095#ifdef Q_WS_WIN
3096 categoryDialog->setCaption ("Qt " + tr("Category"));
3097#endif
3098 dialog = categoryDialog; 2678 dialog = categoryDialog;
3099 connect( dialog->CategoryField, 2679 connect( dialog->CategoryField,
@@ -3104,24 +2684,4 @@ void ZSafe::editCategory()
3104 setCategoryDialogFields(dialog); 2684 setCategoryDialogFields(dialog);
3105 2685
3106#ifdef DESKTOP
3107#ifndef Q_WS_WIN
3108 QStringList list = conf->entryList( APP_KEY+"/fieldDefs" );
3109#else
3110 // read all categories from the config file and store
3111 // into a list
3112 QFile f (cfgFile);
3113 QStringList list;
3114 if ( f.open(IO_ReadOnly) ) { // file opened successfully
3115 QTextStream t( &f ); // use a text stream
3116 QString s;
3117 int n = 1;
3118 while ( !t.eof() ) { // until end of file...
3119 s = t.readLine(); // line of text excluding '\n'
3120 list.append(s);
3121 }
3122 f.close();
3123 }
3124#endif
3125#else
3126 // read all categories from the config file and store 2686 // read all categories from the config file and store
3127 // into a list 2687 // into a list
@@ -3137,5 +2697,4 @@ void ZSafe::editCategory()
3137 f.close(); 2697 f.close();
3138 } 2698 }
3139#endif
3140 QStringList::Iterator it = list.begin(); 2699 QStringList::Iterator it = list.begin();
3141 QString categ; 2700 QString categ;
@@ -3148,16 +2707,7 @@ void ZSafe::editCategory()
3148 if (cat->contains("-field1", FALSE)) 2707 if (cat->contains("-field1", FALSE))
3149 { 2708 {
3150#ifdef DESKTOP
3151#ifndef Q_WS_WIN
3152 categ = cat->section ("-field1", 0, 0);
3153#else
3154 int pos = cat->find ("-field1");
3155 categ = cat->left (pos);
3156#endif
3157#else
3158 int pos = cat->find ("-field1"); 2709 int pos = cat->find ("-field1");
3159 cat->truncate(pos); 2710 cat->truncate(pos);
3160 categ = *cat; 2711 categ = *cat;
3161#endif
3162 if (!categ.isEmpty()) 2712 if (!categ.isEmpty())
3163 { 2713 {
@@ -3194,9 +2744,5 @@ void ZSafe::editCategory()
3194 qApp->processEvents(); 2744 qApp->processEvents();
3195 2745
3196#ifdef DESKTOP
3197 QDir d(iconPath);
3198#else
3199 QDir d(QPEApplication::qpeDir() + "pics/"); 2746 QDir d(QPEApplication::qpeDir() + "pics/");
3200#endif
3201 d.setFilter( QDir::Files); 2747 d.setFilter( QDir::Files);
3202 2748
@@ -3216,10 +2762,5 @@ void ZSafe::editCategory()
3216 { 2762 {
3217 fileName = fileName.mid(0,fileName.length()-4); 2763 fileName = fileName.mid(0,fileName.length()-4);
3218#ifdef DESKTOP
3219 QPixmap imageOfFile;
3220 imageOfFile.load(iconPath + fi->fileName());
3221#else
3222 QPixmap imageOfFile(Resource::loadPixmap(fileName)); 2764 QPixmap imageOfFile(Resource::loadPixmap(fileName));
3223#endif
3224 QImage foo = imageOfFile.convertToImage(); 2765 QImage foo = imageOfFile.convertToImage();
3225 foo = foo.smoothScale(16,16); 2766 foo = foo.smoothScale(16,16);
@@ -3236,10 +2777,5 @@ void ZSafe::editCategory()
3236 else 2777 else
3237 { 2778 {
3238#ifdef DESKTOP
3239 // QDir d(QDir::homeDirPath() + "/pics/");
3240 QDir d(iconPath);
3241#else
3242 QDir d(QPEApplication::qpeDir() + "pics/"); 2779 QDir d(QPEApplication::qpeDir() + "pics/");
3243#endif
3244 d.setFilter( QDir::Files); 2780 d.setFilter( QDir::Files);
3245 2781
@@ -3276,15 +2812,9 @@ void ZSafe::editCategory()
3276 2812
3277 // dialog->show(); 2813 // dialog->show();
3278#ifndef DESKTOP 2814 QDialog::DialogCode result = (QDialog::DialogCode) dialog->exec();
3279 // dialog->move (20, 100);
3280#endif
3281 DialogCode result = (DialogCode) dialog->exec();
3282#ifdef DESKTOP
3283 result = Accepted;
3284#endif
3285 2815
3286 QString fullIconPath; 2816 QString fullIconPath;
3287 QPixmap *pix; 2817 QPixmap *pix;
3288 if (result == Accepted) 2818 if (result == QDialog::Accepted)
3289 { 2819 {
3290 modified = true; 2820 modified = true;
@@ -3303,10 +2833,4 @@ void ZSafe::editCategory()
3303 if (cat) 2833 if (cat)
3304 { 2834 {
3305#ifndef NO_OPIE
3306 owarn << "Category found" << oendl;
3307#else
3308 qWarning("Category found");
3309#endif
3310
3311 // if (!icon.isEmpty() && !icon.isNull()) 2835 // if (!icon.isEmpty() && !icon.isNull())
3312 if (icon != "predefined.png") 2836 if (icon != "predefined.png")
@@ -3341,9 +2865,4 @@ void ZSafe::editCategory()
3341 if (catItem) 2865 if (catItem)
3342 { 2866 {
3343#ifndef NO_OPIE
3344 owarn << category << oendl;
3345#else
3346 qWarning (category);
3347#endif
3348 catItem->setText( 0, tr( category ) ); 2867 catItem->setText( 0, tr( category ) );
3349 cat->setCategoryName (tr(category)); 2868 cat->setCategoryName (tr(category));
@@ -3482,12 +3001,9 @@ void ZSafe::newDocument()
3482 3001
3483 // save the current filename to the config file 3002 // save the current filename to the config file
3003 conf->setGroup("zsafe");
3484 conf->writeEntry(APP_KEY+"document", filename); 3004 conf->writeEntry(APP_KEY+"document", filename);
3485 saveConf(); 3005 saveConf();
3486 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 3006 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
3487#ifdef Q_WS_WIN 3007 this->setCaption(tr("ZSafe: ") + ti);
3488 this->setCaption("Qt ZSafe: " + ti);
3489#else
3490 this->setCaption("ZSafe: " + ti);
3491#endif
3492 3008
3493 // openDocument(filename); 3009 // openDocument(filename);
@@ -3504,6 +3020,4 @@ void ZSafe::loadDocument()
3504 3020
3505 // open the file dialog 3021 // open the file dialog
3506#ifndef DESKTOP
3507#ifndef NO_OPIE
3508 QMap<QString, QStringList> mimeTypes; 3022 QMap<QString, QStringList> mimeTypes;
3509 mimeTypes.insert(tr("All"), QStringList() ); 3023 mimeTypes.insert(tr("All"), QStringList() );
@@ -3515,18 +3029,4 @@ void ZSafe::loadDocument()
3515 this, 3029 this,
3516 tr ("Open ZSafe document")); 3030 tr ("Open ZSafe document"));
3517#else
3518 QString newFile = ScQtFileEdit::getOpenFileName(this,
3519 tr ("Open ZSafe document"),
3520 QDir::homeDirPath() + "/Documents/application/zsafe",
3521 "*.zsf");
3522#endif
3523#else
3524 QString newFile = QFileDialog::getOpenFileName(
3525 QDir::homeDirPath() + "/Documents/application/zsafe",
3526 "ZSafe (*.zsf)",
3527 this,
3528 "ZSafe File Dialog"
3529 "Choose a ZSafe file" );
3530#endif
3531 3031
3532 // open the new document 3032 // open the new document
@@ -3566,12 +3066,9 @@ void ZSafe::loadDocument()
3566 3066
3567 // save the current filename to the config file 3067 // save the current filename to the config file
3068 conf->setGroup("zsafe");
3568 conf->writeEntry(APP_KEY+"document", filename); 3069 conf->writeEntry(APP_KEY+"document", filename);
3569 saveConf(); 3070 saveConf();
3570 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 3071 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
3571#ifdef Q_WS_WIN 3072 this->setCaption(tr("ZSafe: ") + ti);
3572 this->setCaption("Qt ZSafe: " + ti);
3573#else
3574 this->setCaption("ZSafe: " + ti);
3575#endif
3576 3073
3577 openDocument(filename); 3074 openDocument(filename);
@@ -3594,12 +3091,9 @@ QString newFile = zsaveDialog();
3594 3091
3595 // save the current filename to the config file 3092 // save the current filename to the config file
3093 conf->setGroup("zsafe");
3596 conf->writeEntry(APP_KEY+"document", filename); 3094 conf->writeEntry(APP_KEY+"document", filename);
3597 saveConf(); 3095 saveConf();
3598 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 3096 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
3599#ifdef Q_WS_WIN 3097 this->setCaption(tr("ZSafe: ") + ti);
3600 this->setCaption("Qt ZSafe: " + ti);
3601#else
3602 this->setCaption("ZSafe: " + ti);
3603#endif
3604 3098
3605 QMessageBox::information( this, tr("ZSafe"), 3099 QMessageBox::information( this, tr("ZSafe"),
@@ -3623,39 +3117,17 @@ void ZSafe::about()
3623{ 3117{
3624 QString info; 3118 QString info;
3625#ifdef JPATCH_HDE 3119 info = tr("<html><body><div align=""center"">"
3626 info = "<html><body><div align=""center"">"; 3120 "<b>"
3627 info += "<b>"; 3121 "Zaurus Password Manager<br>"
3628 info += tr("Zaurus Password Manager<br>"); 3122 "ZSafe version 2.1.2<br>"
3629 info += tr("ZSafe version 2.1.2-jv01b<br>"); 3123 "</b>"
3630 info += "</b>"; 3124 "by Carsten Schneider<br>"
3631 info += tr("by Carsten Schneider<br>"); 3125 "zcarsten@gmx.net<br>"
3632 info += "zcarsten@gmx.net<br>"; 3126 "http://z-soft.z-portal.info/zsafe"
3633 info += "http://z-soft.z-portal.info/zsafe"; 3127 "<br>"
3634 info += "<br>"; 3128 "Translations by Robert Ernst<br>"
3635 info += tr("Translations by Robert Ernst<br>"); 3129 "robert.ernst@linux-solutions.at<br>"
3636 info += "robert.ernst@linux-solutions.at<br>"; 3130 "<br></div>"
3637 3131 "</body></html>");
3638 info += "<br><br>";
3639 info += QString::fromUtf8("æ~W¥æ~\\¬èª~^/VGA Zaurus対å¿~\\ã~C~Qã~C~Cã~C~Aä½~\\æ ~H~P<br>");
3640 info += "HADECO R&D<br>";
3641 info += "r&d@hadeco.co.jp<br>";
3642 info += "http://www.hadeco.co.jp/r&d/<br>";
3643 info += "<br></div>";
3644 info += "</body></html>";
3645#else
3646 info = "<html><body><div align=""center"">";
3647 info += "<b>";
3648 info += tr("Zaurus Password Manager<br>");
3649 info += tr("ZSafe version 2.1.2<br>");
3650 info += "</b>";
3651 info += tr("by Carsten Schneider<br>");
3652 info += "zcarsten@gmx.net<br>";
3653 info += "http://z-soft.z-portal.info/zsafe";
3654 info += "<br>";
3655 info += tr("Translations by Robert Ernst<br>");
3656 info += "robert.ernst@linux-solutions.at<br>";
3657 info += "<br></div>";
3658 info += "</body></html>";
3659#endif
3660 3132
3661 // QMessageBox::information( this, tr("ZSafe"), info, tr("&OK"), 0); 3133 // QMessageBox::information( this, tr("ZSafe"), info, tr("&OK"), 0);
@@ -3673,7 +3145,5 @@ void ZSafe::setExpandFlag()
3673 expandTree = !expandTree; 3145 expandTree = !expandTree;
3674 file->setItemChecked('o', expandTree); 3146 file->setItemChecked('o', expandTree);
3675#ifndef DESKTOP
3676 conf->setGroup ("zsafePrefs"); 3147 conf->setGroup ("zsafePrefs");
3677#endif
3678// #ifndef Q_WS_WIN 3148// #ifndef Q_WS_WIN
3679 conf->writeEntry (APP_KEY+"expandTree", expandTree); 3149 conf->writeEntry (APP_KEY+"expandTree", expandTree);
@@ -3697,11 +3167,6 @@ void ZSafe::resizeEvent ( QResizeEvent * )
3697{ 3167{
3698 // owarn << "resizeEvent" << oendl; 3168 // owarn << "resizeEvent" << oendl;
3699#ifndef DESKTOP
3700 DeskW = appl->desktop()->width(); 3169 DeskW = appl->desktop()->width();
3701 DeskH = appl->desktop()->height(); 3170 DeskH = appl->desktop()->height();
3702#else
3703 DeskW = this->width();
3704 DeskH = this->height();
3705#endif
3706 3171
3707 if (New) 3172 if (New)
@@ -3740,5 +3205,4 @@ QPixmap * ZSafe::getPredefinedIcon(QString category)
3740void ZSafe::setDocument(const QString& fileref) 3205void ZSafe::setDocument(const QString& fileref)
3741{ 3206{
3742#ifndef DESKTOP
3743 // stop the timer to prevent loading of the default document 3207 // stop the timer to prevent loading of the default document
3744 docuTimer.stop(); 3208 docuTimer.stop();
@@ -3758,12 +3222,9 @@ void ZSafe::setDocument(const QString& fileref)
3758 } 3222 }
3759 // save the current filename to the config file 3223 // save the current filename to the config file
3224 conf->setGroup("zsafe");
3760 conf->writeEntry(APP_KEY+"document", filename); 3225 conf->writeEntry(APP_KEY+"document", filename);
3761 saveConf(); 3226 saveConf();
3762 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 3227 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
3763#ifdef Q_WS_WIN 3228 this->setCaption(tr("ZSafe: ") + ti);
3764 this->setCaption("Qt ZSafe: " + ti);
3765#else
3766 this->setCaption("ZSafe: " + ti);
3767#endif
3768 3229
3769 // clear the password list 3230 // clear the password list
@@ -3796,7 +3257,4 @@ void ZSafe::setDocument(const QString& fileref)
3796 3257
3797 openDocument(filename); 3258 openDocument(filename);
3798#else
3799Q_UNUSED(fileref);
3800#endif
3801} 3259}
3802 3260
@@ -3806,10 +3264,4 @@ void ZSafe::ListPressed(int mouse, QListViewItem *item, const QPoint&, int colum
3806 switch (mouse) { 3264 switch (mouse) {
3807 case 1: 3265 case 1:
3808 {
3809#ifdef DESKTOP
3810 QDragObject *d = new QTextDrag( item->text(column) , this );
3811 d->dragCopy();
3812#endif
3813 }
3814 break; 3266 break;
3815 case 2: 3267 case 2:
@@ -3852,6 +3304,4 @@ QString ZSafe::zsaveDialog() {
3852 3304
3853 QString fn; 3305 QString fn;
3854#ifndef DESKTOP
3855#ifndef NO_OPIE
3856 QMap<QString, QStringList> mimeTypes; 3306 QMap<QString, QStringList> mimeTypes;
3857 mimeTypes.insert(tr("All"), QStringList() ); 3307 mimeTypes.insert(tr("All"), QStringList() );
@@ -3863,17 +3313,4 @@ QString ZSafe::zsaveDialog() {
3863 this, 3313 this,
3864 tr ("Export text file")); 3314 tr ("Export text file"));
3865#else 3315 return fn;
3866 fn = ScQtFileEdit::getSaveAsFileName(this,
3867 tr ("Export text file"),
3868 QDir::homeDirPath() + "/Documents/application/zsafe",
3869 "*.txt");
3870#endif
3871#else
3872 fn = QFileDialog::getSaveFileName(
3873 QDir::homeDirPath() + "/Documents/application/zsafe",
3874 "ZSafe (*.txt)",
3875 this,
3876 "ZSafe");
3877#endif
3878 return fn;
3879} 3316}
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;
47#define FIELD_SIZE 7 47#define FIELD_SIZE 7
48 48
49class ZSafe : public QDialog 49class ZSafe : public QWidget
50{ 50{
51 Q_OBJECT 51 Q_OBJECT
@@ -59,6 +59,7 @@ protected:
59 59
60public: 60public:
61 ZSafe( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = WDestructiveClose ); 61 ZSafe( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
62 ~ZSafe(); 62 ~ZSafe();
63 static QString appName() { return QString::fromLatin1( QUICKAPP_NAME ); }
63 64
64 static const QColor *evenRowColor; 65 static const QColor *evenRowColor;
@@ -196,3 +197,8 @@ private slots:
196}; 197};
197 198
199
200extern ZSafe *zs;
201extern QApplication *appl;
202extern int DeskW;
203extern int DeskH;
198#endif // ZSAFE_H 204#endif // ZSAFE_H