summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ChangeLog1
-rw-r--r--noncore/apps/zsafe/zsafe.cpp59
2 files changed, 16 insertions, 44 deletions
diff --git a/ChangeLog b/ChangeLog
index de27eb5..c8da96a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,14 +1,15 @@
1 2004-??-??The Opie Team <opie@handhelds.org> 1 2004-??-??The Opie Team <opie@handhelds.org>
2 2
3 * Fixed ZSafe not starting up (Bug #1324) (mickeyl)
3 * Fixed Drawpad initialization (Bug #1314) (mickeyl) 4 * Fixed Drawpad initialization (Bug #1314) (mickeyl)
4 * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle) 5 * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle)
5 * Added Conversion tool for pim-data (eilers) 6 * Added Conversion tool for pim-data (eilers)
6 * Modifcation of the PIM API for providing generic use of OPimRecords. (eilers) 7 * Modifcation of the PIM API for providing generic use of OPimRecords. (eilers)
7 8
8 2004-25-04The Opie Team <opie@handhelds.org> 9 2004-25-04The Opie Team <opie@handhelds.org>
9 10
10 * Released as Version 1.1.3 (devel) 11 * Released as Version 1.1.3 (devel)
11 * Introduced first implementation of SQL-Support using SQLite (eilers) 12 * Introduced first implementation of SQL-Support using SQLite (eilers)
12 * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp) 13 * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp)
13 * Added a real system graffiti character set (brad) 14 * Added a real system graffiti character set (brad)
14 * Added Generic Keyconfig Widget (zecke) 15 * Added Generic Keyconfig Widget (zecke)
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index bf8f7f4..6ff05ac 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -478,77 +478,48 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
478 else 478 else
479 { 479 {
480 DeskS = DeskH; 480 DeskS = DeskH;
481 } 481 }
482 resize( DeskW, DeskH ); 482 resize( DeskW, DeskH );
483 setMinimumSize( QSize( DeskS, DeskS ) ); 483 setMinimumSize( QSize( DeskS, DeskS ) );
484 setMaximumSize( QSize( DeskS, DeskS ) ); 484 setMaximumSize( QSize( DeskS, DeskS ) );
485#else 485#else
486 resize( DeskW, DeskH-30 ); 486 resize( DeskW, DeskH-30 );
487#endif 487#endif
488 488
489#endif 489#endif
490 // setCaption( tr( "ZSafe" ) ); 490 setCaption( tr( "ZSafe" ) );
491 491 QString zsafeAppDirPath = QDir::homeDirPath() + "/Documents/application/zsafe";
492 filename = conf->readEntry(APP_KEY+"document"); 492 QString filename = conf->readEntry(APP_KEY+"document");
493 if (filename.isEmpty() || filename.isNull()) 493 if (filename.isEmpty() || filename.isNull())
494 { 494 {
495 495 if ( !QDir( zsafeAppDirPath ).exists() )
496 // check if the directory application exists, if not
497 // create it
498// #ifndef WIN32
499 // QString d1("Documents/application");
500// #else
501 QString d1(QDir::homeDirPath() + "/Documents/application");
502// #endif
503 QDir pd1(d1);
504 if (!pd1.exists())
505 {
506 QDir pd1("Documents");
507 if (!pd1.mkdir("application", FALSE))
508 { 496 {
509 QMessageBox::critical( 0, tr("ZSafe"), 497 //FIXME: Pending someone to look into why QDir.mkdir does not work as expected
510#ifdef JPATCH_HDE 498 QString cmdline = QString().sprintf( "mkdir -p %s", (const char*) zsafeAppDirPath );
511 tr("Can't create directory\n.../Documents/application\n\nZSafe will now exit.")); 499 ::system( cmdline );
512#else
513 tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d1));
514#endif
515 exitZs (1);
516 } 500 }
517 } 501 if ( !QDir( zsafeAppDirPath ).exists() )
518 QString d2(QDir::homeDirPath() + "/Documents/application/zsafe");
519 QDir pd2(d2);
520 if (!pd2.exists())
521 {
522 QDir pd2(QDir::homeDirPath() + "Documents/application");
523 if (!pd2.mkdir("zsafe", FALSE))
524 { 502 {
525 QMessageBox::critical( 0, tr("ZSafe"), 503 QMessageBox::critical( 0, "ZSafe", tr("Can't create application data directory.\nZSafe will now exit."));
526#ifdef JPATCH_HDE 504 exitZs (1);
527 tr("Can't create directory\n...//Documents/application/zsafe\n\nZSafe will now exit."));
528#else
529 tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d2));
530#endif
531 exitZs (1);
532 } 505 }
533 } 506 }
534 507
535
536 // set the default filename 508 // set the default filename
537 filename=d2 + "/passwords.zsf"; 509 filename = zsafeAppDirPath + "/passwords.zsf";
538 510
539 // save the current filename to the config file 511 // save the current filename to the config file
540 conf->writeEntry(APP_KEY+"document", filename); 512 conf->writeEntry(APP_KEY+"document", filename);
541 saveConf(); 513 saveConf();
542 }
543 514
544 //if (filename == "INVALIDPWD") 515 //if (filename == "INVALIDPWD")
545 //filename = ""; 516 //filename = "";
546 517
547 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); 518 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
548#ifdef WIN32 519#ifdef WIN32
549 this->setCaption("Qt ZSafe: " + ti); 520 this->setCaption("Qt ZSafe: " + ti);
550#else 521#else
551 this->setCaption("ZSafe: " + ti); 522 this->setCaption("ZSafe: " + ti);
552#endif 523#endif
553 524
554 selectedItem = NULL; 525 selectedItem = NULL;
@@ -2247,25 +2218,25 @@ bool ZSafe::saveDocument(const char* _filename,
2247 strcpy(entry[i++], "password"); 2218 strcpy(entry[i++], "password");
2248 entry[i] = (char*)malloc(strlen("comment")+1); 2219 entry[i] = (char*)malloc(strlen("comment")+1);
2249 strcpy(entry[i++], "comment"); 2220 strcpy(entry[i++], "comment");
2250 2221
2251 entry[i] = (char*)malloc(strlen("field5")+1); 2222 entry[i] = (char*)malloc(strlen("field5")+1);
2252 strcpy(entry[i++], "field5"); 2223 strcpy(entry[i++], "field5");
2253 entry[i] = (char*)malloc(strlen("field6")+1); 2224 entry[i] = (char*)malloc(strlen("field6")+1);
2254 strcpy(entry[i++], "field6"); 2225 strcpy(entry[i++], "field6");
2255 2226
2256 retval = saveEntry(entry); 2227 retval = saveEntry(entry);
2257 for (int z=0; z<i; z++) free(entry[z]); 2228 for (int z=0; z<i; z++) free(entry[z]);
2258 if (retval == PWERR_DATA) { 2229 if (retval == PWERR_DATA) {
2259 owarn << "1: Error writing file, contents not saved" << oendl; 2230 owarn << "1: Error writing file, contents not saved" << oendl;
2260 saveFinalize(); 2231 saveFinalize();
2261 return false; 2232 return false;
2262 } 2233 }
2263// #ifndef WIN32 2234// #ifndef WIN32
2264 conf->writeEntry(APP_KEY+"valzsafe", 1); 2235 conf->writeEntry(APP_KEY+"valzsafe", 1);
2265// #endif 2236// #endif
2266 saveConf(); 2237 saveConf();
2267 } 2238 }
2268 2239
2269 QListViewItem *i; 2240 QListViewItem *i;
2270 // step through all categories 2241 // step through all categories
2271 for (i = ListView->firstChild(); 2242 for (i = ListView->firstChild();
@@ -2291,34 +2262,34 @@ bool ZSafe::saveDocument(const char* _filename,
2291 strcpy(entry[j++], si->text(3).utf8()); 2262 strcpy(entry[j++], si->text(3).utf8());
2292 entry[j] = (char*)malloc(strlen(si->text(4).utf8())+1); 2263 entry[j] = (char*)malloc(strlen(si->text(4).utf8())+1);
2293 strcpy(entry[j++], si->text(4).utf8()); 2264 strcpy(entry[j++], si->text(4).utf8());
2294 entry[j] = (char*)malloc(strlen(si->text(5).utf8())+1); 2265 entry[j] = (char*)malloc(strlen(si->text(5).utf8())+1);
2295 strcpy(entry[j++], si->text(5).utf8()); 2266 strcpy(entry[j++], si->text(5).utf8());
2296 2267
2297 retval = saveEntry(entry); 2268 retval = saveEntry(entry);
2298 for (int z=0; z<j; z++) 2269 for (int z=0; z<j; z++)
2299 { 2270 {
2300 free(entry[z]); 2271 free(entry[z]);
2301 } 2272 }
2302 if (retval == PWERR_DATA) { 2273 if (retval == PWERR_DATA) {
2303 owarn << "1: Error writing file, contents not saved" << oendl; 2274 owarn << "1: Error writing file, contents not saved" << oendl;
2304 saveFinalize(); 2275 saveFinalize();
2305 return false; 2276 return false;
2306 } 2277 }
2307 2278
2308 } 2279 }
2309 } 2280 }
2310 2281
2311 if (saveFinalize() == PWERR_DATA) { 2282 if (saveFinalize() == PWERR_DATA) {
2312 owarn << "2: Error writing file, contents not saved" << oendl; 2283 owarn << "2: Error writing file, contents not saved" << oendl;
2313 return false; 2284 return false;
2314 } else { 2285 } else {
2315#ifndef DESKTOP 2286#ifndef DESKTOP
2316 Global::statusMessage (tr("Password file saved.")); 2287 Global::statusMessage (tr("Password file saved."));
2317#endif 2288#endif
2318 modified = false; 2289 modified = false;
2319 return true; 2290 return true;
2320 } 2291 }
2321} 2292}
2322 2293
2323PasswordForm *newPwdDialog; 2294PasswordForm *newPwdDialog;
2324bool newPwdDialogResult = false; 2295bool newPwdDialogResult = false;
@@ -3178,25 +3149,25 @@ void ZSafe::editCategory()
3178 categories.remove (category); 3149 categories.remove (category);
3179// #ifndef WIN32 3150// #ifndef WIN32
3180 conf->removeEntry(category); 3151 conf->removeEntry(category);
3181// #endif 3152// #endif
3182 saveConf(); 3153 saveConf();
3183 } 3154 }
3184 3155
3185 category = dialog->CategoryField->currentText(); 3156 category = dialog->CategoryField->currentText();
3186 icon = dialog->IconField->currentText()+".png"; 3157 icon = dialog->IconField->currentText()+".png";
3187 3158
3188 if (cat) 3159 if (cat)
3189 { 3160 {
3190 owarn << "Category found" << oendl; 3161 owarn << "Category found" << oendl;
3191 3162
3192 // if (!icon.isEmpty() && !icon.isNull()) 3163 // if (!icon.isEmpty() && !icon.isNull())
3193 if (icon != "predefined.png") 3164 if (icon != "predefined.png")
3194 { 3165 {
3195 // build the full path 3166 // build the full path
3196 fullIconPath = iconPath + icon; 3167 fullIconPath = iconPath + icon;
3197 pix = new QPixmap (fullIconPath); 3168 pix = new QPixmap (fullIconPath);
3198 if (pix) 3169 if (pix)
3199 { 3170 {
3200 // save the full pixmap name into the config file 3171 // save the full pixmap name into the config file
3201// #ifndef WIN32 3172// #ifndef WIN32
3202 conf->writeEntry(APP_KEY+category, icon); 3173 conf->writeEntry(APP_KEY+category, icon);