author | llornkcor <llornkcor> | 2004-07-13 10:35:23 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-07-13 10:35:23 (UTC) |
commit | 37e0e077b51841971c3d4c25b287f4d39e750e2d (patch) (side-by-side diff) | |
tree | c1b499dd6e544207c6ff7047acd8170d6ea63f94 | |
parent | 5d2ec2e9b1dce49e914c260fe16a82ddccbaa92d (diff) | |
download | opie-37e0e077b51841971c3d4c25b287f4d39e750e2d.zip opie-37e0e077b51841971c3d4c25b287f4d39e750e2d.tar.gz opie-37e0e077b51841971c3d4c25b287f4d39e750e2d.tar.bz2 |
fix ups, and move qsettings files away
-rw-r--r--[-rwxr-xr-x] | noncore/apps/zsafe/extra/qsettings.cpp (renamed from noncore/apps/zsafe/qsettings.cpp) | 10 | ||||
-rw-r--r--[-rwxr-xr-x] | noncore/apps/zsafe/extra/qsettings.h (renamed from noncore/apps/zsafe/qsettings.h) | 0 | ||||
-rw-r--r-- | noncore/apps/zsafe/zsafe.cpp | 143 |
3 files changed, 92 insertions, 61 deletions
diff --git a/noncore/apps/zsafe/qsettings.cpp b/noncore/apps/zsafe/extra/qsettings.cpp index ee55339..def2e2d 100755..100644 --- a/noncore/apps/zsafe/qsettings.cpp +++ b/noncore/apps/zsafe/extra/qsettings.cpp @@ -11,4 +11,5 @@ QSettings::QSettings(const QString &_fn)
{
+ qWarning("Settings "+_fn); // read the prefs from the file
fn = _fn;
@@ -133,7 +134,9 @@ bool QSettings::removeEntry (const QString &key) QStringList QSettings::entryList (const QString &key) const
{
- QAsciiDictIterator <QString> it( prefs ); // iterator for dict
+ qDebug("entryList: "+key); QStringList list;
-
+ if(!prefs.isEmpty()) { + QAsciiDictIterator <QString> it( prefs ); // iterator for dict + qDebug("ready"); while ( it.current() )
{
@@ -146,6 +149,7 @@ QStringList QSettings::entryList (const QString &key) const list.append (it.currentKey());
++it;
-
}
+ } + qWarning("Return here"); return list;
}
diff --git a/noncore/apps/zsafe/qsettings.h b/noncore/apps/zsafe/extra/qsettings.h index 95e87b5..95e87b5 100755..100644 --- a/noncore/apps/zsafe/qsettings.h +++ b/noncore/apps/zsafe/extra/qsettings.h diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp index 0864293..f3d57f8 100644 --- a/noncore/apps/zsafe/zsafe.cpp +++ b/noncore/apps/zsafe/zsafe.cpp @@ -12,7 +12,7 @@ ** Zaurus arm : -DNO_OPIE ** Zaurus Opie arm: none -** Linux Desktop : -DDESKTOP -** Windows Desktop: -DDESKTOP -DWIN32 -** +** Linux Desktop : -DDESKTOP -DNO_OPIE +** Windows Desktop: -DDESKTOP -DNO_OPIE +** use qmake ** for japanese version additional use: -DJPATCH_HDE ** @@ -44,5 +44,5 @@ using namespace Opie::Ui; #include <fcntl.h> #include <stdlib.h> -#ifndef WIN32 +#ifndef Q_WS_WIN #include <unistd.h> #endif @@ -56,5 +56,5 @@ using namespace Opie::Ui; #include <qfiledialog.h> #include <qdragobject.h> -#ifndef WIN32 +#ifndef Q_WS_WIN #include <qsettings.h> #else @@ -109,5 +109,5 @@ extern QPEApplication *appl; #ifdef DESKTOP -#ifndef WIN32 +#ifndef Q_WS_WIN const QString APP_KEY="/.zsafe/"; #else @@ -366,5 +366,5 @@ static const char* const general_data[] = { #ifdef DESKTOP -#ifndef WIN32 +#ifndef Q_WS_WIN conf = new QSettings (); conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath()); @@ -418,5 +418,5 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) // create a zsafe configuration object #ifdef DESKTOP -#ifndef WIN32 +#ifndef Q_WS_WIN conf = new QSettings (); conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath()); @@ -430,5 +430,5 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) #endif #ifdef DESKTOP -// #ifndef WIN32 +// #ifndef Q_WS_WIN expandTree = conf->readBoolEntry(APP_KEY+"expandTree", false); // #endif @@ -465,5 +465,5 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) #ifdef DESKTOP -#ifdef WIN32 +#ifdef Q_WS_WIN setGeometry(100, 150, DeskW, DeskH-30 ); #else @@ -499,5 +499,5 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) // check if the directory application exists, if not // create it -// #ifndef WIN32 +// #ifndef Q_WS_WIN // QString d1("Documents/application"); // #else @@ -526,5 +526,5 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) } } -// #ifndef WIN32 +// #ifndef Q_WS_WIN // QString d2("Documents/application/zsafe"); // #else @@ -557,5 +557,5 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); -#ifdef WIN32 +#ifdef Q_WS_WIN this->setCaption("Qt ZSafe: " + ti); #else @@ -570,5 +570,5 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) lastSearchedComment = ""; - infoForm = new InfoForm(); + infoForm = new InfoForm(this, "show_info", TRUE); categoryDialog = NULL; infoForm->setIcon( image0); @@ -771,6 +771,6 @@ void ZSafe::editPwd() { // open the 'New Entry' dialog - NewDialog *dialog = new NewDialog(this, tr("Edit Entry"), TRUE); -#ifdef WIN32 + NewDialog *dialog = new NewDialog(this, "edit_entry", TRUE); +#ifdef Q_WS_WIN dialog->setCaption ("Qt " + tr("Edit Entry")); dialog->setGeometry(200, 250, 220, 310 ); @@ -796,8 +796,18 @@ void ZSafe::editPwd() dialog->CommentField->setCursorPosition(0,0); +#ifdef Q_WS_QWS DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); +#endif #ifdef DESKTOP - result = Accepted; +#ifndef Q_QW_QWIN + dialog->show(); +#endif +#else + dialog->showMaximized(); +#endif + int result = dialog->exec(); +#ifdef DESKTOP +// result = QDialog::Accepted; #endif if (result == Accepted) @@ -841,6 +851,6 @@ void ZSafe::newPwd() // open the 'New Entry' dialog - NewDialog *dialog = new NewDialog(this, tr("New Entry"), TRUE); -#ifdef WIN32 + NewDialog *dialog = new NewDialog(this, "new_entry", TRUE); +#ifdef Q_WS_WIN dialog->setCaption ("Qt " + tr("New Entry")); dialog->setGeometry(200, 250, 220, 310 ); @@ -855,7 +865,18 @@ void ZSafe::newPwd() retype: +#ifdef Q_WS_QWS DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); +#endif + #ifdef DESKTOP - result = Accepted; +#ifndef Q_QW_QWIN + dialog->show(); +#endif +#else + dialog->showMaximized(); +#endif +#ifdef DESKTOP + int result = dialog->exec(); +// result = QDialog::Accepted; #endif @@ -899,5 +920,5 @@ void ZSafe::findPwd() // open the 'Search' dialog SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE); -#ifdef WIN32 +#ifdef Q_WS_WIN dialog->setCaption ("Qt " + tr("Search")); #endif @@ -1079,13 +1100,13 @@ QString ZSafe::getFieldLabel (QListViewItem *_item, QString field, QString def) QString app_key = APP_KEY; #ifndef DESKTOP -#ifndef WIN32 +#ifndef Q_WS_WIN conf->setGroup ("fieldDefs"); #endif #else -#ifndef WIN32 +#ifndef Q_WS_WIN app_key += "/fieldDefs/"; #endif #endif -// #ifndef WIN32 +// #ifndef Q_WS_WIN QString label = conf->readEntry(app_key+category+"-field"+field,def); // #else @@ -1105,9 +1126,9 @@ QString ZSafe::getFieldLabel (QString category, QString field, QString def) conf->setGroup ("fieldDefs"); #else -#ifndef WIN32 +#ifndef Q_WS_WIN app_key += "/fieldDefs/"; #endif #endif -// #ifndef WIN32 +// #ifndef Q_WS_WIN QString label = conf->readEntry(app_key+category+"-field"+field, def); @@ -1209,6 +1230,12 @@ void ZSafe::showInfo( QListViewItem *_item) infoForm->InfoText->setText(text); - infoForm->hide(); +// infoForm->hide(); +#ifdef Q_WS_QWS QPEApplication::showDialog( infoForm ); +#endif + +#ifdef DESKTOP + infoForm->show(); +#endif } } @@ -1232,5 +1259,5 @@ void ZSafe::listViewSelected( QListViewItem *_item) ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5"))); #endif -#ifdef WIN32 +#ifdef Q_WS_WIN // set the column text dependent on the selected item ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name"))); @@ -1487,5 +1514,5 @@ void ZSafe::readAllEntries() s.replace (QRegExp("\";\""), "\"|\""); // char buffer[1024]; -#ifndef WIN32 +#ifndef Q_WS_WIN char buffer[s.length()+1]; #else @@ -1586,5 +1613,5 @@ void ZSafe::readAllEntries() QString fullIconPath; QPixmap *pix; -// #ifndef WIN32 +// #ifndef Q_WS_WIN icon = conf->readEntry(APP_KEY+category); // #endif @@ -1739,5 +1766,5 @@ void ZSafe::readAllEntries() // char buffer[1024]; int len=s.length()+1; -#ifdef WIN32 +#ifdef Q_WS_WIN char buffer[512]; #else @@ -1819,5 +1846,5 @@ void ZSafe::readAllEntries() QString fullIconPath; QPixmap *pix; -// #ifndef WIN32 +// #ifndef Q_WS_WIN icon = conf->readEntry(APP_KEY+category); // #endif @@ -1897,5 +1924,5 @@ bool ZSafe::openDocument(const char* _filename, const char* ) int retval; char* entry[FIELD_SIZE]; -// #ifndef WIN32 +// #ifndef Q_WS_WIN int validationFlag = conf->readNumEntry(APP_KEY+"valzsafe", 1); // #else @@ -1938,5 +1965,5 @@ bool ZSafe::openDocument(const char* _filename, const char* ) else { -#ifdef WIN32 +#ifdef Q_WS_WIN this->setCaption("Qt ZSafe"); #else @@ -2055,5 +2082,5 @@ bool ZSafe::openDocument(const char* _filename, const char* ) QString fullIconPath; QPixmap *pix; -// #ifndef WIN32 +// #ifndef Q_WS_WIN icon = conf->readEntry(APP_KEY+category); // #endif @@ -2141,5 +2168,5 @@ int ZSafe::loadInit(const char* _filename, const char *password) krc2->rc2_expandkey (key, keylength, 128); -#ifndef WIN32 +#ifndef Q_WS_WIN size = read(fileno (fd), (unsigned char *) (charbuf + count), 8); #else @@ -2158,5 +2185,5 @@ int ZSafe::loadInit(const char* _filename, const char *password) size = 0; bufferIndex = 0; -#ifndef WIN32 +#ifndef Q_WS_WIN while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) { while (count < 8) { @@ -2340,5 +2367,5 @@ bool ZSafe::saveDocument(const char* _filename, return false; } -// #ifndef WIN32 +// #ifndef Q_WS_WIN conf->writeEntry(APP_KEY+"valzsafe", 1); // #endif @@ -2435,5 +2462,5 @@ void ZSafe::getDocPassword(QString title) // int pos = filename.findRev ('/'); QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); -#ifdef WIN32 +#ifdef Q_WS_WIN dialog->setCaption("Qt " + ti); #else @@ -2665,5 +2692,5 @@ void ZSafe::addCategory() { categoryDialog = new CategoryDialog(this, tr("Category"), TRUE); -#ifdef WIN32 +#ifdef Q_WS_WIN categoryDialog->setCaption ("Qt " + tr("Category")); #endif @@ -2676,5 +2703,5 @@ void ZSafe::addCategory() #ifdef DESKTOP -#ifndef WIN32 +#ifndef Q_WS_WIN QStringList list = conf->entryList( APP_KEY+"/fieldDefs" ); #else @@ -2719,5 +2746,5 @@ void ZSafe::addCategory() { #ifdef DESKTOP -#ifndef WIN32 +#ifndef Q_WS_WIN categ = cat->section ("-field1", 0, 0); #else @@ -2787,5 +2814,5 @@ void ZSafe::addCategory() } -#ifndef WIN32 +#ifndef Q_WS_WIN dialog->show(); #endif @@ -2826,5 +2853,5 @@ void ZSafe::addCategory() { // save the full pixmap name into the config file -// #ifndef WIN32 +// #ifndef Q_WS_WIN conf->writeEntry(APP_KEY+category, icon); // #endif @@ -2878,5 +2905,5 @@ void ZSafe::delCategory() modified = true; categories.remove (selectedItem->text(0)); -// #ifndef WIN32 +// #ifndef Q_WS_WIN conf->removeEntry (selectedItem->text(0)); // #endif @@ -3038,10 +3065,10 @@ void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog) conf->setGroup ("fieldDefs"); #else -#ifndef WIN32 +#ifndef Q_WS_WIN app_key += "/fieldDefs/"; #endif #endif QString category = dialog->CategoryField->currentText(); -// #ifndef WIN32 +// #ifndef Q_WS_WIN conf->writeEntry(app_key+category+"-field1", dialog->Field1->text()); conf->writeEntry(app_key+category+"-field2", dialog->Field2->text()); @@ -3074,5 +3101,5 @@ void ZSafe::editCategory() { categoryDialog = new CategoryDialog(this, tr("Category"), TRUE); -#ifdef WIN32 +#ifdef Q_WS_WIN categoryDialog->setCaption ("Qt " + tr("Category")); #endif @@ -3086,5 +3113,5 @@ void ZSafe::editCategory() #ifdef DESKTOP -#ifndef WIN32 +#ifndef Q_WS_WIN QStringList list = conf->entryList( APP_KEY+"/fieldDefs" ); #else @@ -3130,5 +3157,5 @@ void ZSafe::editCategory() { #ifdef DESKTOP -#ifndef WIN32 +#ifndef Q_WS_WIN categ = cat->section ("-field1", 0, 0); #else @@ -3273,5 +3300,5 @@ void ZSafe::editCategory() { categories.remove (category); -// #ifndef WIN32 +// #ifndef Q_WS_WIN conf->removeEntry(category); // #endif @@ -3299,5 +3326,5 @@ void ZSafe::editCategory() { // save the full pixmap name into the config file -// #ifndef WIN32 +// #ifndef Q_WS_WIN conf->writeEntry(APP_KEY+category, icon); // #endif @@ -3311,5 +3338,5 @@ void ZSafe::editCategory() else { -// #ifndef WIN32 +// #ifndef Q_WS_WIN conf->removeEntry (category); // #endif @@ -3490,5 +3517,5 @@ void ZSafe::newDocument() saveConf(); QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); -#ifdef WIN32 +#ifdef Q_WS_WIN this->setCaption("Qt ZSafe: " + ti); #else @@ -3574,5 +3601,5 @@ void ZSafe::loadDocument() saveConf(); QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); -#ifdef WIN32 +#ifdef Q_WS_WIN this->setCaption("Qt ZSafe: " + ti); #else @@ -3628,5 +3655,5 @@ void ZSafe::saveDocumentAs() saveConf(); QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); -#ifdef WIN32 +#ifdef Q_WS_WIN this->setCaption("Qt ZSafe: " + ti); #else @@ -3707,5 +3734,5 @@ void ZSafe::setExpandFlag() conf->setGroup ("zsafePrefs"); #endif -// #ifndef WIN32 +// #ifndef Q_WS_WIN conf->writeEntry (APP_KEY+"expandTree", expandTree); // #endif @@ -3792,5 +3819,5 @@ void ZSafe::setDocument(const QString& fileref) saveConf(); QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); -#ifdef WIN32 +#ifdef Q_WS_WIN this->setCaption("Qt ZSafe: " + ti); #else |