author | zcarsten <zcarsten> | 2003-08-20 16:57:52 (UTC) |
---|---|---|
committer | zcarsten <zcarsten> | 2003-08-20 16:57:52 (UTC) |
commit | fb3e8cda0d2c929278c7ecbf829475f8b1c92956 (patch) (side-by-side diff) | |
tree | fa99523aecbfe5b1c7312a6f39aabfc5c727e4a2 | |
parent | 9845e740ab9707dc77165a236510a9103e372c26 (diff) | |
download | opie-fb3e8cda0d2c929278c7ecbf829475f8b1c92956.zip opie-fb3e8cda0d2c929278c7ecbf829475f8b1c92956.tar.gz opie-fb3e8cda0d2c929278c7ecbf829475f8b1c92956.tar.bz2 |
zecke's modifications added
-rw-r--r-- | noncore/apps/zsafe/zsafe.cpp | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp index 43565ee..ee1da77 100644 --- a/noncore/apps/zsafe/zsafe.cpp +++ b/noncore/apps/zsafe/zsafe.cpp @@ -198,515 +198,517 @@ static const char* const passwords_data[] = { "#eeff#..#add#...", "#eeff#######....", "#ccdbdd#........", "#dddbdd###......", "#gghihhjj#......", "#hhhihhjj###....", "#kklmllnnnn#....", "#lllmllnnnn#....", "#oopqpprprr#....", "#oopqpprprr#....", "############...."}; static const char* const software_data[] = { "16 16 5 1", ". c None", "# c #000000", "b c #838183", "c c #c5ffff", "a c #ffffff", "................", ".##############.", "#aaaaaaaaaaaaaa#", "#abbbbbbbbbbbbb#", "#ab##########ab#", "#ab#c########ab#", "#ab#c#c######ab#", "#ab##########ab#", "#ab##########ab#", "#ab##########ab#", "#ab##########ab#", "#ab##########ab#", "#aaaaaaaaaaaaab#", "#bbbbbbbbbbbbbb#", ".##############.", "................"}; static const char* const general_data[] = { "14 14 98 2", "Qt c None", ".k c #000000", "#x c #080808", "#F c #101008", "#q c #101010", "#i c #101410", "## c #101810", ".m c #181818", ".3 c #181c18", ".I c #182018", ".T c #202420", "#D c #202820", "#y c #292c29", ".c c #293029", ".d c #313031", "#E c #313429", "#r c #313831", ".j c #393c31", "#j c #394039", "#C c #414841", ".w c #4a554a", ".a c #4a594a", ".# c #525052", ".l c #52594a", "#f c #525952", "#v c #525d52", ".O c #5a4c4a", ".9 c #5a595a", ".A c #5a5d52", ".B c #624c52", ".0 c #625552", "#o c #626562", ".R c #626962", "#. c #626d5a", "#p c #626d62", ".2 c #627162", "#h c #6a6d62", "#z c #6a7562", "#w c #6a756a", ".C c #73656a", ".P c #73696a", "#a c #737d6a", ".U c #738573", ".E c #7b817b", "#B c #7b857b", "#s c #7b897b", "#n c #7b917b", ".b c #838d83", ".7 c #839583", ".n c #8b7d7b", "#g c #8b8583", ".g c #8b858b", ".r c #8b898b", ".s c #8b8d8b", ".i c #8b9183", ".8 c #8b918b", "#A c #8b9d8b", ".S c #8ba183", ".Z c #94918b", ".N c #949994", ".F c #949d94", ".x c #94a18b", ".v c #94a194", ".Y c #94aa94", ".h c #9c999c", ".Q c #9ca19c", "#u c #9ca59c", ".H c #9caa9c", "#e c #9cb29c", "#m c #a4b29c", "#t c #a4b2a4", ".M c #a4b69c", "#l c #a4b6a4", ".z c #a4baa4", ".f c #aca5ac", ".q c #acaaac", "#d c #acbeac", ".6 c #acc2ac", ".o c #b4b2b4", ".t c #b4beb4", "#k c #b4c2ac", ".5 c #b4cab4", ".D c #bdb6bd", ".G c #bdc6b4", "#c c #bdceb4", ".X c #bdd2bd", ".4 c #bdd6bd", ".1 c #c5bec5", ".e c #c5c2c5", ".u c #c5cac5", "#b c #c5d6c5", ".J c #c5dec5", ".p c #cdcacd", ".W c #cddecd", ".L c #cde2cd", ".K c #d5eacd", ".V c #d5ead5", ".y c #d5eed5", "QtQtQtQtQtQtQtQtQtQtQtQtQtQt", "QtQtQt.#.a.b.cQtQtQtQtQtQtQt", "QtQt.d.e.f.g.h.i.c.j.dQt.kQt", ".a.l.m.n.o.p.q.r.s.t.u.v.wQt", ".x.y.z.A.B.C.D.p.q.E.F.G.H.I", ".I.J.K.L.M.N.O.P.o.p.Q.R.S.T", "Qt.U.V.L.W.X.Y.Z.0.P.1.s.2.3", "Qt.3.X.W.4.X.5.6.7.8.9.s#.##", "QtQt#a.X#b#c.5.6#d#e#f#g#h#i", "QtQtQt#j.7#k.6#d#l#m#n#o#p#q", "QtQtQtQt.k#r#s#m#t.H#u#v#w#x", "QtQtQtQtQtQt.k#y#z.v#A#B#C#x", "QtQtQtQtQtQtQtQt.k#D.w#s#E.k", "QtQtQtQtQtQtQtQtQtQtQt#x#FQt"}; // exit ZSafe and clear the clipboard for security reasons void ZSafe::exitZs (int ec) { QClipboard *cb = QApplication::clipboard(); cb->clear(); exit (ec); } // save the configuration into the file void ZSafe::saveConf () { if (conf) { delete conf; #ifdef DESKTOP #ifndef WIN32 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"); #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 ) + : QDialog( parent, name, modal, fl ), + Edit(0l), Delete(0l), Find(0l), New(0l), ListView(0l) { IsCut = false; IsCopy = false; modified = false; // set the config file cfgFile=QDir::homeDirPath(); cfgFile += "/.zsafe.cfg"; // set the icon path +#ifdef NO_OPIE QString qpedir ((const char *)getenv("QPEDIR")); +#else + QString qpedir ((const char *)getenv("OPIEDIR")); +#endif + #ifdef DESKTOP iconPath = QDir::homeDirPath() + "/pics/"; #else if (qpedir.isEmpty()) iconPath = "/home/QtPalmtop/pics/"; else iconPath = qpedir + "/pics/"; #endif // create a zsafe configuration object #ifdef DESKTOP #ifndef WIN32 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 ("zsafePrefs"); #endif #ifdef DESKTOP // #ifndef WIN32 expandTree = conf->readBoolEntry(APP_KEY+"expandTree", false); // #endif #else expandTree = conf->readNumEntry(APP_KEY+"expandTree", 0); #endif #ifndef DESKTOP conf->setGroup ("zsafe"); #endif QPixmap copy_img((const char**) copy_xpm); QPixmap cut_img((const char**) cut_xpm); QPixmap edit_img((const char**) edit_xpm); QPixmap editdelete_img((const char**) editdelete_xpm); QPixmap find_img((const char**) find_xpm); QPixmap folder_open_img((const char**) folder_open_xpm); QPixmap help_icon_img((const char**) help_icon_xpm); QPixmap new_img((const char**) new_xpm); QPixmap paste_img((const char**) paste_xpm); QPixmap quit_icon_img((const char**) quit_icon_xpm); QPixmap save_img((const char**) save_xpm); QPixmap trash_img((const char**) trash_xpm); QPixmap expand_img((const char**) expand_xpm); QPixmap export_img((const char**) export_xpm); QPixmap import_img((const char**) import_xpm); QPixmap bank_cards( ( const char** ) bank_cards_data ); QPixmap passwords( ( const char** ) passwords_data ); QPixmap software( ( const char** ) software_data ); QPixmap general( ( const char** ) general_data ); if ( !name ) setName( "ZSafe" ); #ifdef DESKTOP #ifdef WIN32 setGeometry(100, 150, DeskW, DeskH-30 ); #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"); 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)) { 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); } } -// #ifndef WIN32 - // QString d2("Documents/application/zsafe"); -// #else - QString d2(QDir::homeDirPath() + "/Documents/application/zsafe"); -// #endif + QString d2(QDir::homeDirPath() + "/Documents/application/zsafe"); QDir pd2(d2); if (!pd2.exists()) { - QDir pd2("Documents/application"); + QDir pd2(QDir::homeDirPath() + "Documents/application"); if (!pd2.mkdir("zsafe", FALSE)) { 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); } } // set the default filename filename=d2 + "/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 ); // add file menu // QPopupMenu *file = new QPopupMenu( this ); file = new QPopupMenu( this ); // #ifdef DESKTOP file->insertItem( new_img, tr("&New document"), this, SLOT(newDocument()) ); file->insertItem( folder_open_img, tr("&Open document"), this, SLOT(loadDocument()) ); file->insertItem( save_img, tr("&Save document as .."), this, SLOT(saveDocumentAs()) ); file->insertSeparator(); // #endif file->insertItem( save_img, tr("&Save document"), this, SLOT(saveDocumentWithoutPwd()) ); file->insertItem( save_img, tr("S&ave document with new Password"), this, SLOT(saveDocumentWithPwd()) ); file->insertSeparator(); file->insertItem( export_img, tr("&Export text file"), this, SLOT(writeAllEntries()) ); file->insertItem( import_img, tr("&Import text file"), this, SLOT(readAllEntries()) ); file->insertItem( trash_img, tr("&Remove text file"), this, SLOT(removeAsciiFile()) ); file->insertSeparator(); file->insertItem( expand_img, tr("&Open entries expanded"), this, SLOT(setExpandFlag()), 0, 'o'); file->setItemChecked('o', expandTree); file->insertSeparator(); file->insertItem( quit_icon_img, tr("E&xit"), this, SLOT(quitMe()) ); menu->insertItem( tr("&File"), file ); QPopupMenu *cat = new QPopupMenu( this ); cat->insertItem( new_img, tr("&New"), this, SLOT(addCategory()) ); cat->insertItem( edit_img, tr("&Edit"), this, SLOT(editCategory()) ); cat->insertItem( trash_img, tr("&Delete"), this, SLOT(delCategory()) ); menu->insertItem( tr("&Category"), cat ); QPopupMenu *it = new QPopupMenu( this ); it->insertItem( cut_img, tr("&Cut"), this, SLOT(cutItem()) ); it->insertItem( copy_img, tr("C&opy"), this, SLOT(copyItem()) ); it->insertItem( paste_img, tr("&Paste"), this, SLOT(pasteItem()) ); it->insertSeparator(); it->insertItem( new_img, tr("&New"), this, SLOT(newPwd()) ); it->insertItem( edit_img, tr("&Edit"), this, SLOT(editPwd()) ); it->insertItem( trash_img, tr("&Delete"), this, SLOT(deletePwd()) ); it->insertItem( find_img, tr("&Search"), this, SLOT(findPwd()) ); menu->insertItem( tr("&Entry"), it ); QPopupMenu *help = new QPopupMenu( this ); help->insertItem( help_icon_img, tr("&About"), this, SLOT(about()) ); menu->insertItem( tr("&Help"), help ); // toolbar icons New = new QToolButton( menu, "New" ); New->setGeometry( QRect( DeskW-84, 2, 20, 20 ) ); New->setMouseTracking( TRUE ); New->setText( tr( "" ) ); New->setPixmap( new_img ); QToolTip::add( New, tr( "New entry" ) ); Edit = new QToolButton( menu, "Edit" ); Edit->setGeometry( QRect( DeskW-64, 2, 20, 20 ) ); Edit->setText( tr( "" ) ); Edit->setPixmap( edit_img ); QToolTip::add( Edit, tr( "Edit category or entry" ) ); Delete = new QToolButton( menu, "Delete" ); Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) ); Delete->setText( tr( "" ) ); Delete->setPixmap( trash_img ); QToolTip::add( Delete, tr( "Delete category or entry" ) ); Find = new QToolButton( menu, "Find" ); Find->setGeometry( QRect( DeskW-24, 2, 20, 20 ) ); Find->setText( tr( "" ) ); Find->setPixmap( find_img ); QToolTip::add( Find, tr( "Find entry" ) ); /* QBoxLayout * h = new QHBoxLayout( this ); h->addWidget (menu); h->addWidget (New); h->addWidget (Edit); h->addWidget (Delete); h->addWidget (Find); */ ListView = new ZListView( this, "ListView" ); ListView->addColumn( tr( "Name" ) ); ListView->addColumn( tr( "Field 2" ) ); ListView->addColumn( tr( "Field 3" ) ); ListView->addColumn( tr( "Comment" ) ); ListView->addColumn( tr( "Field 4" ) ); ListView->addColumn( tr( "Field 5" ) ); ListView->setAllColumnsShowFocus(TRUE); #ifdef DESKTOP ListView->setResizePolicy(QScrollView::AutoOneFit); // ListView->setGeometry( QRect( 0, 22, this->width(), this->height() - 30 ) ); #else ListView->setResizePolicy(QScrollView::AutoOneFit); // ListView->setGeometry( QRect( 0, 22, // this->width(), this->height() - 30 ) ); // ListView->setMaximumSize( QSize( 440, 290 ) ); #endif ListView->setVScrollBarMode( QListView::Auto ); QBoxLayout * l = new QVBoxLayout( this ); l->addWidget (menu); l->addWidget (ListView); #ifndef DESKTOP // start a timer (100 ms) to load the default document docuTimer.start( 100, true ); connect( &docuTimer, SIGNAL(timeout()), SLOT( slotLoadDocu() ) ); raiseFlag = true; connect( &raiseTimer, SIGNAL(timeout()), SLOT( slotRaiseTimer() ) ); #else // open the default document openDocument(filename); #endif // signals and slots connections for QTollButton connect( New, SIGNAL( clicked() ), this, SLOT( newPwd() ) ); connect( Edit, SIGNAL( clicked() ), this, SLOT( editPwd() ) ); connect( Delete, SIGNAL( clicked() ), this, SLOT( deletePwd() ) ); connect( Find, SIGNAL( clicked() ), this, SLOT( findPwd() ) ); // signals and slots connections for QListView connect( ListView, SIGNAL( selectionChanged( QListViewItem* ) ), this, SLOT( listViewSelected( QListViewItem* ) ) ); connect( ListView, SIGNAL( doubleClicked( QListViewItem* ) ), this, SLOT( showInfo( QListViewItem* ) ) ); connect( ListView, SIGNAL( returnPressed( QListViewItem* ) ), this, SLOT( showInfo( QListViewItem* ) ) ); } const QColor *ZSafe::evenRowColor = &Qt::white; // const QColor *ZSafe::oddRowColor = &Qt::lightGray; const QColor *ZSafe::oddRowColor = new QColor(216,240,255); /* * Destroys the object and frees any allocated resources */ ZSafe::~ZSafe() { // no need to delete child widgets, Qt does it all for us quitMe(); } // load the default document void ZSafe::slotLoadDocu() @@ -3458,287 +3460,289 @@ void ZSafe::loadDocument() QListViewItem *i; QListViewItem *c = NULL; // step through all categories for (i = ListView->firstChild(); i != NULL; i = i->nextSibling()) { if (c) delete c; // delete the previous category c = i; // step through all subitems QListViewItem *si; for (si = i->firstChild(); si != NULL; ) { QListViewItem *_si = si; si = si->nextSibling(); i->takeItem(_si); // remove from view list if (_si) delete _si; } } if (c) delete c; // delete the previous category categories.clear(); m_password = ""; selectedItem = NULL; filename = newFile; // save the current filename to the config file conf->writeEntry(APP_KEY+"document", filename); saveConf(); QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); #ifdef WIN32 this->setCaption("Qt ZSafe: " + ti); #else this->setCaption("ZSafe: " + ti); #endif openDocument(filename); } } void ZSafe::saveDocumentAs() { #ifndef DESKTOP #ifndef NO_OPIE QMap<QString, QStringList> mimeTypes; mimeTypes.insert(tr("All"), QStringList() ); mimeTypes.insert(tr("ZSafe"), "zsafe/*" ); QString newFile = OFileDialog::getSaveFileName( OFileSelector::EXTENDED_ALL, QDir::homeDirPath() + "/Documents/application/zsafe", QString::null, mimeTypes, this, tr ("Save ZSafe document as..")); #else QString newFile = ScQtFileEdit::getSaveAsFileName(this, tr ("Save ZSafe document as.."), QDir::homeDirPath() + "/Documents/application/zsafe", "*.zsf"); #endif #else // open the file dialog QString newFile = QFileDialog::getSaveFileName( QDir::homeDirPath() + "/Documents/application/zsafe", "ZSafe (*.zsf)", this, "ZSafe File Dialog" "Choose a ZSafe file" ); #endif // open the new document if (newFile && newFile.length() > 0 ) { // save the previous opened document if (!filename.isEmpty()) saveDocument(filename, FALSE); selectedItem = NULL; filename = newFile; // save the current filename to the config file conf->writeEntry(APP_KEY+"document", filename); saveConf(); QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); #ifdef WIN32 this->setCaption("Qt ZSafe: " + ti); #else this->setCaption("ZSafe: " + ti); #endif QMessageBox::information( this, tr("ZSafe"), tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0); saveDocumentWithPwd(); } } void ZSafe::saveDocumentWithoutPwd() { saveDocument(filename, FALSE); } void ZSafe::saveDocumentWithPwd() { saveDocument(filename, TRUE); } void ZSafe::about() { QString info; #ifdef JPATCH_HDE info = "<html><body><div align=""center"">"; info += "<b>"; info += tr("Zaurus Password Manager<br>"); info += tr("ZSafe version 2.1.2-jv01b<br>"); info += "</b>"; info += tr("by Carsten Schneider<br>"); info += "zcarsten@gmx.net<br>"; info += "http://z-soft.z-portal.info/zsafe"; info += "<br>"; info += tr("Translations by Robert Ernst<br>"); info += "robert.ernst@linux-solutions.at<br>"; info += "<br><br>"; info += QString::fromUtf8("æ~W¥æ~\\¬èª~^/VGA Zaurus対å¿~\\ã~C~Qã~C~Cã~C~Aä½~\\æ ~H~P<br>"); info += "HADECO R&D<br>"; info += "r&d@hadeco.co.jp<br>"; info += "http://www.hadeco.co.jp/r&d/<br>"; info += "<br></div>"; info += "</body></html>"; #else info = "<html><body><div align=""center"">"; info += "<b>"; info += tr("Zaurus Password Manager<br>"); info += tr("ZSafe version 2.1.2<br>"); info += "</b>"; info += tr("by Carsten Schneider<br>"); info += "zcarsten@gmx.net<br>"; info += "http://z-soft.z-portal.info/zsafe"; info += "<br>"; info += tr("Translations by Robert Ernst<br>"); info += "robert.ernst@linux-solutions.at<br>"; info += "<br></div>"; info += "</body></html>"; #endif // QMessageBox::information( this, tr("ZSafe"), info, tr("&OK"), 0); QMessageBox mb( this, tr("ZSafe")); mb.setText (info); mb.setButtonText (QMessageBox::Ok, tr ("&OK")); QPixmap zsafe_img((const char**) zsafe_xpm); mb.setIconPixmap (zsafe_img); mb.exec(); } void ZSafe::setExpandFlag() { expandTree = !expandTree; file->setItemChecked('o', expandTree); #ifndef DESKTOP conf->setGroup ("zsafePrefs"); #endif // #ifndef WIN32 conf->writeEntry (APP_KEY+"expandTree", expandTree); // #endif saveConf(); } void ZSafe::paintEvent( QPaintEvent * ) { if (raiseFlag) { raiseFlag = false; raiseTimer.start (1, true); if (infoForm->isVisible()) infoForm->raise(); } } void ZSafe::resizeEvent ( QResizeEvent * ) { // qWarning ("resizeEvent"); #ifndef DESKTOP DeskW = appl->desktop()->width(); DeskH = appl->desktop()->height(); #else DeskW = this->width(); DeskH = this->height(); #endif - qWarning( QString("Width : %1").arg(DeskW), 2000 ); - qWarning( QString("Height: %1").arg(DeskH), 2000 ); - New->setGeometry ( QRect( DeskW-84, 2, 20, 20 ) ); - Edit->setGeometry ( QRect( DeskW-64, 2, 20, 20 ) ); - Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) ); - Find->setGeometry ( QRect( DeskW-24, 2, 20, 20 ) ); + if (New) + New->setGeometry ( QRect( DeskW-84, 2, 20, 20 ) ); + if (Edit) + Edit->setGeometry ( QRect( DeskW-64, 2, 20, 20 ) ); + if (Delete) + Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) ); + if (Find) + Find->setGeometry ( QRect( DeskW-24, 2, 20, 20 ) ); } void ZSafe::slotRaiseTimer() { if (infoForm->isVisible()) infoForm->raise(); raiseFlag = true; } QPixmap * ZSafe::getPredefinedIcon(QString category) { QPixmap *pm; if (category == "Bank cards") pm = new QPixmap((const char**)bank_cards_data); else if (category == "Passwords") pm = new QPixmap((const char**)passwords_data); else if (category == "Software") pm = new QPixmap((const char**)software_data); else if (category == "General") pm = new QPixmap((const char**)general_data); else pm = new QPixmap((const char**)general_data); return pm; } void ZSafe::setDocument(const QString& fileref) { #ifndef DESKTOP // stop the timer to prevent loading of the default document docuTimer.stop(); DocLnk link(fileref); if ( link.isValid() ) { // if (filename != link.file()) // saveDocument(filename, FALSE); filename = link.file(); } else { // if (filename != fileref) // saveDocument(filename, FALSE); filename = fileref; } // save the current filename to the config file conf->writeEntry(APP_KEY+"document", filename); saveConf(); QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); #ifdef WIN32 this->setCaption("Qt ZSafe: " + ti); #else this->setCaption("ZSafe: " + ti); #endif // clear the password list QListViewItem *i; QListViewItem *c = NULL; // step through all categories for (i = ListView->firstChild(); i != NULL; i = i->nextSibling()) { if (c) delete c; // delete the previous category c = i; // step through all subitems QListViewItem *si; for (si = i->firstChild(); si != NULL; ) { QListViewItem *_si = si; si = si->nextSibling(); i->takeItem(_si); // remove from view list if (_si) delete _si; } } if (c) delete c; // delete the previous category categories.clear(); m_password = ""; selectedItem = NULL; openDocument(filename); #endif } |