From 274bfafbda8d1d9af6cc5d1ced828a97a47c3f55 Mon Sep 17 00:00:00 2001 From: zcarsten Date: Thu, 31 Jul 2003 16:28:04 +0000 Subject: usage of OFileDialog --- (limited to 'noncore/apps') 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 @@ -9,7 +9,8 @@ ** 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 ** @@ -24,8 +25,12 @@ #include "shadedlistitem.h" #ifndef DESKTOP +#ifndef NO_OPIE +#include +#else #include "scqtfileedit.h" #endif +#endif #include @@ -1195,6 +1200,9 @@ 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; @@ -1207,10 +1215,22 @@ void ZSafe::removeAsciiFile() // QString fn = filename + ".txt"; // open the file dialog #ifndef DESKTOP +#ifndef NO_OPIE + QMap 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", @@ -1245,10 +1265,22 @@ void ZSafe::writeAllEntries() // open the file dialog #ifndef DESKTOP +#ifndef NO_OPIE + QMap 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", @@ -1328,10 +1360,22 @@ void ZSafe::readAllEntries() // open the file dialog #ifndef DESKTOP +#ifndef NO_OPIE + QMap 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", @@ -3141,10 +3185,22 @@ void ZSafe::newDocument() // open the file dialog #ifndef DESKTOP +#ifndef NO_OPIE + QMap 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", @@ -3189,7 +3245,7 @@ void ZSafe::newDocument() categories.clear(); // m_password = ""; - // selectedItem = NULL; + selectedItem = NULL; filename = newFile; @@ -3217,10 +3273,22 @@ void ZSafe::loadDocument() // open the file dialog #ifndef DESKTOP +#ifndef NO_OPIE + QMap 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", @@ -3283,10 +3351,22 @@ void ZSafe::saveDocumentAs() { #ifndef DESKTOP +#ifndef NO_OPIE + QMap 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( @@ -3304,6 +3384,7 @@ void ZSafe::saveDocumentAs() if (!filename.isEmpty()) saveDocument(filename, FALSE); + selectedItem = NULL; filename = newFile; // save the current filename to the config file 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 @@ -14,7 +14,7 @@ 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 -- cgit v0.9.0.2