-rw-r--r-- | noncore/apps/zsafe/config.in | 2 | ||||
-rw-r--r-- | noncore/apps/zsafe/zsafe.cpp | 85 | ||||
-rw-r--r-- | noncore/apps/zsafe/zsafe.pro | 2 |
3 files changed, 85 insertions, 4 deletions
diff --git a/noncore/apps/zsafe/config.in b/noncore/apps/zsafe/config.in index 53956ad..4b1e968 100644 --- a/noncore/apps/zsafe/config.in +++ b/noncore/apps/zsafe/config.in @@ -1,5 +1,5 @@ config ZSAFE boolean "zsafe (Zaurus Password Manager)" default "y" - depends ( LIBQPE || LIBQPE-X11 ) + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp index bd03031..abf6511 100644 --- a/noncore/apps/zsafe/zsafe.cpp +++ b/noncore/apps/zsafe/zsafe.cpp @@ -8,9 +8,10 @@ ** ** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html ** ** Compile Flags: -** Zaurus arm : none +** Zaurus arm : -DNO_OPIE +** Zaurus Opie arm: none ** Linux Desktop : -DDESKTOP ** Windows Desktop: -DDESKTOP -DWIN32 ** ****************************************************************************/ @@ -23,10 +24,14 @@ #include "zlistview.h" #include "shadedlistitem.h" #ifndef DESKTOP +#ifndef NO_OPIE +#include <opie/ofiledialog.h> +#else #include "scqtfileedit.h" #endif +#endif #include <qclipboard.h> #include <stdio.h> @@ -1194,8 +1199,11 @@ void ZSafe::listViewSelected( QListViewItem *_item) } bool ZSafe::isCategory(QListViewItem *_item) { + if (_item == NULL) + return FALSE; + QString categoryName = _item->text (0); if (categories.find ((const char *)categoryName)) return TRUE; else @@ -1206,12 +1214,24 @@ void ZSafe::removeAsciiFile() { // QString fn = filename + ".txt"; // open the file dialog #ifndef DESKTOP +#ifndef NO_OPIE + QMap<QString, QStringList> mimeTypes; + mimeTypes.insert(tr("All"), QStringList() ); + mimeTypes.insert(tr("Text"), "text/*" ); + QString fn = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, + QDir::homeDirPath() + "/Documents/application/zsafe", + QString::null, + mimeTypes, + this, + tr ("Remove text file")); +#else QString fn = ScQtFileEdit::getOpenFileName(this, tr ("Remove text file"), QDir::homeDirPath() + "/Documents/application/zsafe", "*.txt"); +#endif #else QString fn = QFileDialog::getOpenFileName( QDir::homeDirPath() + "/Documents/application/zsafe", "ZSafe (*.txt)", @@ -1244,12 +1264,24 @@ void ZSafe::writeAllEntries() } // open the file dialog #ifndef DESKTOP +#ifndef NO_OPIE + QMap<QString, QStringList> mimeTypes; + mimeTypes.insert(tr("All"), QStringList() ); + mimeTypes.insert(tr("Text"), "text/*" ); + QString fn = OFileDialog::getSaveFileName( OFileSelector::EXTENDED_ALL, + QDir::homeDirPath() + "/Documents/application/zsafe", + QString::null, + mimeTypes, + this, + tr ("Export text file")); +#else QString fn = ScQtFileEdit::getSaveAsFileName(this, tr ("Export text file"), QDir::homeDirPath() + "/Documents/application/zsafe", "*.txt"); +#endif #else QString fn = QFileDialog::getSaveFileName( QDir::homeDirPath() + "/Documents/application/zsafe", "ZSafe (*.txt)", @@ -1327,12 +1359,24 @@ void ZSafe::readAllEntries() } // open the file dialog #ifndef DESKTOP +#ifndef NO_OPIE + QMap<QString, QStringList> mimeTypes; + mimeTypes.insert(tr("All"), QStringList() ); + mimeTypes.insert(tr("Text"), "text/*" ); + QString fn = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, + QDir::homeDirPath() + "/Documents/application/zsafe", + QString::null, + mimeTypes, + this, + tr ("Import text file")); +#else QString fn = ScQtFileEdit::getOpenFileName(this, tr ("Import text file"), QDir::homeDirPath() + "/Documents/application/zsafe", "*.txt"); +#endif #else QString fn = QFileDialog::getOpenFileName( QDir::homeDirPath() + "/Documents/application/zsafe", "ZSafe (*.txt)", @@ -3140,12 +3184,24 @@ void ZSafe::newDocument() { // open the file dialog #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 ("Create new ZSafe document")); +#else QString newFile = ScQtFileEdit::getSaveAsFileName(this, tr ("Create new ZSafe document"), QDir::homeDirPath() + "/Documents/application/zsafe", "*.zsf"); +#endif #else QString newFile = QFileDialog::getSaveFileName( QDir::homeDirPath() + "/Documents/application/zsafe", "ZSafe (*.zsf)", @@ -3188,9 +3244,9 @@ void ZSafe::newDocument() if (c) delete c; // delete the previous category categories.clear(); // m_password = ""; - // selectedItem = NULL; + selectedItem = NULL; filename = newFile; // save the current filename to the config file @@ -3216,12 +3272,24 @@ void ZSafe::loadDocument() { // open the file dialog #ifndef DESKTOP +#ifndef NO_OPIE + QMap<QString, QStringList> mimeTypes; + mimeTypes.insert(tr("All"), QStringList() ); + mimeTypes.insert(tr("ZSafe"), "zsafe/*" ); + QString newFile = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, + QDir::homeDirPath() + "/Documents/application/zsafe", + QString::null, + mimeTypes, + this, + tr ("Open ZSafe document")); +#else QString newFile = ScQtFileEdit::getOpenFileName(this, tr ("Open ZSafe document"), QDir::homeDirPath() + "/Documents/application/zsafe", "*.zsf"); +#endif #else QString newFile = QFileDialog::getOpenFileName( QDir::homeDirPath() + "/Documents/application/zsafe", "ZSafe (*.zsf)", @@ -3282,12 +3350,24 @@ void ZSafe::loadDocument() 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", @@ -3303,8 +3383,9 @@ void ZSafe::saveDocumentAs() // 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); diff --git a/noncore/apps/zsafe/zsafe.pro b/noncore/apps/zsafe/zsafe.pro index ae4c793..5cb74dd 100644 --- a/noncore/apps/zsafe/zsafe.pro +++ b/noncore/apps/zsafe/zsafe.pro @@ -13,9 +13,9 @@ INTERFACES += infoform.ui wait.ui INCLUDEPATH += $(OPIEDIR)/include INCLUDEPATH += . INCLUDEPATH += $(OPIEDIR)/noncore/apps/zsafe DEPENDPATH += $(OPIEDIR)/include -LIBS += -Wl,-rpath,$(OPIEDIR)/lib -L$(OPIEDIR)/lib -lqpe +LIBS += -Wl,-rpath,$(OPIEDIR)/lib -L$(OPIEDIR)/lib -lqpe -lopie TARGET = zsafe TRANSLATIONS = $(OPIEDIR)/noncore/apps/zsafe/i18n/de/zsafe.ts #include ( $(OPIEDIR)/include.pro ) |