author | mickeyl <mickeyl> | 2004-05-26 16:17:16 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-05-26 16:17:16 (UTC) |
commit | 9a79c3bb271234396696dc54ee52f2a0c2a461d6 (patch) (side-by-side diff) | |
tree | feedc8e51e45f24fbfe376dd18523c14a1c30433 | |
parent | 2b7ebd326a7e6456471bb973b14b4ad7affb9a9d (diff) | |
download | opie-9a79c3bb271234396696dc54ee52f2a0c2a461d6.zip opie-9a79c3bb271234396696dc54ee52f2a0c2a461d6.tar.gz opie-9a79c3bb271234396696dc54ee52f2a0c2a461d6.tar.bz2 |
BUGFIX: Fixed ZSafe not starting up (Bug #1324)
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | noncore/apps/zsafe/zsafe.cpp | 59 |
2 files changed, 16 insertions, 44 deletions
@@ -1,26 +1,27 @@ 2004-??-?? The Opie Team <opie@handhelds.org> + * Fixed ZSafe not starting up (Bug #1324) (mickeyl) * Fixed Drawpad initialization (Bug #1314) (mickeyl) * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle) * Added Conversion tool for pim-data (eilers) * Modifcation of the PIM API for providing generic use of OPimRecords. (eilers) 2004-25-04 The Opie Team <opie@handhelds.org> * Released as Version 1.1.3 (devel) * Introduced first implementation of SQL-Support using SQLite (eilers) * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp) * Added a real system graffiti character set (brad) * Added Generic Keyconfig Widget (zecke) * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke) * Added new Bible reader app - opie-dagger (drw) * Added a new Image Viewer. Work is ongoing (zecke,alwin) * Added namespace usage in libopie2 and everywhere (zecke,alwin) * Enabled the possibility to pass command line arguments to applications (mickeyl) * Added an about applet showing some credits and information about Opie (mickeyl) * Added benchmarking functionality to sysinfo (mickeyl) * Added applet and configuration application for switching hardware keyboard layouts (alwin) * Ported applications from libopie1 to libopie2* (drw,ar,alwin) * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe) * Clean-up of package information in control files (drw) * Repaired mediummount which was broken since integrating the quicklauncher (alwin) 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 @@ -466,101 +466,72 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) #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" ) ); - - filename = conf->readEntry(APP_KEY+"document"); + setCaption( tr( "ZSafe" ) ); + QString zsafeAppDirPath = QDir::homeDirPath() + "/Documents/application/zsafe"; + QString filename = conf->readEntry(APP_KEY+"document"); if (filename.isEmpty() || filename.isNull()) { - - // check if the directory application exists, if not - // create it -// #ifndef WIN32 - // QString d1("Documents/application"); -// #else - QString d1(QDir::homeDirPath() + "/Documents/application"); -// #endif - QDir pd1(d1); - if (!pd1.exists()) - { - QDir pd1("Documents"); - if (!pd1.mkdir("application", FALSE)) + if ( !QDir( zsafeAppDirPath ).exists() ) { - QMessageBox::critical( 0, tr("ZSafe"), -#ifdef JPATCH_HDE - tr("Can't create directory\n.../Documents/application\n\nZSafe will now exit.")); -#else - tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d1)); -#endif - exitZs (1); + //FIXME: Pending someone to look into why QDir.mkdir does not work as expected + QString cmdline = QString().sprintf( "mkdir -p %s", (const char*) zsafeAppDirPath ); + ::system( cmdline ); } - } - QString d2(QDir::homeDirPath() + "/Documents/application/zsafe"); - QDir pd2(d2); - if (!pd2.exists()) - { - QDir pd2(QDir::homeDirPath() + "Documents/application"); - if (!pd2.mkdir("zsafe", FALSE)) + if ( !QDir( zsafeAppDirPath ).exists() ) { - QMessageBox::critical( 0, tr("ZSafe"), -#ifdef JPATCH_HDE - tr("Can't create directory\n...//Documents/application/zsafe\n\nZSafe will now exit.")); -#else - tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d2)); -#endif - exitZs (1); + QMessageBox::critical( 0, "ZSafe", tr("Can't create application data directory.\nZSafe will now exit.")); + exitZs (1); } } - // set the default filename - filename=d2 + "/passwords.zsf"; + filename = zsafeAppDirPath + "/passwords.zsf"; // save the current filename to the config file conf->writeEntry(APP_KEY+"document", filename); saveConf(); - } //if (filename == "INVALIDPWD") //filename = ""; QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); #ifdef WIN32 this->setCaption("Qt ZSafe: " + ti); #else this->setCaption("ZSafe: " + ti); #endif selectedItem = NULL; lastSearchedCategory = NULL; lastSearchedItem = NULL; lastSearchedName = ""; lastSearchedUsername = ""; lastSearchedComment = ""; infoForm = new InfoForm(); categoryDialog = NULL; // add a menu bar QMenuBar *menu = new QMenuBar( this ); @@ -2235,102 +2206,102 @@ bool ZSafe::saveDocument(const char* _filename, char* entry[FIELD_SIZE]; // save the validation entry { int i=0; entry[i] = (char*)malloc(strlen("ZSAFECATEGORY")+1); strcpy(entry[i++], "ZSAFECATEGORY"); entry[i] = (char*)malloc(strlen("name")+1); strcpy(entry[i++], "name"); entry[i] = (char*)malloc(strlen("username")+1); strcpy(entry[i++], "username"); entry[i] = (char*)malloc(strlen("password")+1); strcpy(entry[i++], "password"); entry[i] = (char*)malloc(strlen("comment")+1); strcpy(entry[i++], "comment"); entry[i] = (char*)malloc(strlen("field5")+1); strcpy(entry[i++], "field5"); entry[i] = (char*)malloc(strlen("field6")+1); strcpy(entry[i++], "field6"); retval = saveEntry(entry); for (int z=0; z<i; z++) free(entry[z]); if (retval == PWERR_DATA) { - owarn << "1: Error writing file, contents not saved" << oendl; + owarn << "1: Error writing file, contents not saved" << oendl; saveFinalize(); return false; } // #ifndef WIN32 conf->writeEntry(APP_KEY+"valzsafe", 1); // #endif saveConf(); } QListViewItem *i; // step through all categories for (i = ListView->firstChild(); i != NULL; i = i->nextSibling()) { // step through all subitems QListViewItem *si; for (si = i->firstChild(); si != NULL; si = si->nextSibling()) { int j=0; entry[j] = (char*)malloc(strlen(i->text(0).utf8())+1); strcpy(entry[j++], i->text(0).utf8()); entry[j] = (char*)malloc(strlen(si->text(0).utf8())+1); strcpy(entry[j++], si->text(0).utf8()); entry[j] = (char*)malloc(strlen(si->text(1).utf8())+1); strcpy(entry[j++], si->text(1).utf8()); entry[j] = (char*)malloc(strlen(si->text(2).utf8())+1); strcpy(entry[j++], si->text(2).utf8()); entry[j] = (char*)malloc(strlen(si->text(3).utf8())+1); strcpy(entry[j++], si->text(3).utf8()); entry[j] = (char*)malloc(strlen(si->text(4).utf8())+1); strcpy(entry[j++], si->text(4).utf8()); entry[j] = (char*)malloc(strlen(si->text(5).utf8())+1); strcpy(entry[j++], si->text(5).utf8()); retval = saveEntry(entry); for (int z=0; z<j; z++) { free(entry[z]); } if (retval == PWERR_DATA) { - owarn << "1: Error writing file, contents not saved" << oendl; + owarn << "1: Error writing file, contents not saved" << oendl; saveFinalize(); return false; } } } if (saveFinalize() == PWERR_DATA) { - owarn << "2: Error writing file, contents not saved" << oendl; + owarn << "2: Error writing file, contents not saved" << oendl; return false; } else { #ifndef DESKTOP Global::statusMessage (tr("Password file saved.")); #endif modified = false; return true; } } PasswordForm *newPwdDialog; bool newPwdDialogResult = false; void ZSafe::setPasswordDialogDone() { newPwdDialogResult = true; newPwdDialog->close(); } void ZSafe::getDocPassword(QString title) { qWarning ("getDocPassword"); // open the 'Password' dialog PasswordForm *dialog = new PasswordForm(this, title, TRUE); newPwdDialog = dialog; @@ -3166,49 +3137,49 @@ void ZSafe::editCategory() DialogCode result = (DialogCode) dialog->exec(); #ifdef DESKTOP result = Accepted; #endif QString fullIconPath; QPixmap *pix; if (result == Accepted) { modified = true; if (category != dialog->CategoryField->currentText()) { categories.remove (category); // #ifndef WIN32 conf->removeEntry(category); // #endif saveConf(); } category = dialog->CategoryField->currentText(); icon = dialog->IconField->currentText()+".png"; if (cat) { - owarn << "Category found" << oendl; + owarn << "Category found" << oendl; // if (!icon.isEmpty() && !icon.isNull()) if (icon != "predefined.png") { // build the full path fullIconPath = iconPath + icon; pix = new QPixmap (fullIconPath); if (pix) { // save the full pixmap name into the config file // #ifndef WIN32 conf->writeEntry(APP_KEY+category, icon); // #endif saveConf(); QImage img = pix->convertToImage(); pix->convertFromImage(img.smoothScale(14,14)); cat->setIconName (icon); cat->setIcon (*pix); } } else { // #ifndef WIN32 conf->removeEntry (category); |