author | zcarsten <zcarsten> | 2003-07-31 16:28:04 (UTC) |
---|---|---|
committer | zcarsten <zcarsten> | 2003-07-31 16:28:04 (UTC) |
commit | 274bfafbda8d1d9af6cc5d1ced828a97a47c3f55 (patch) (side-by-side diff) | |
tree | fce22d8d08ddccfe828009ca2fe9f66dfd268d55 /noncore/apps | |
parent | e5bed303e50298d91a6adf9e0b5cf7dd3d975ed3 (diff) | |
download | opie-274bfafbda8d1d9af6cc5d1ced828a97a47c3f55.zip opie-274bfafbda8d1d9af6cc5d1ced828a97a47c3f55.tar.gz opie-274bfafbda8d1d9af6cc5d1ced828a97a47c3f55.tar.bz2 |
usage of OFileDialog
-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 @@ -2,4 +2,4 @@ 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 @@ -10,5 +10,6 @@ ** ** Compile Flags: -** Zaurus arm : none +** Zaurus arm : -DNO_OPIE +** Zaurus Opie arm: none ** Linux Desktop : -DDESKTOP ** Windows Desktop: -DDESKTOP -DWIN32 @@ -25,6 +26,10 @@ #ifndef DESKTOP +#ifndef NO_OPIE +#include <opie/ofiledialog.h> +#else #include "scqtfileedit.h" #endif +#endif #include <qclipboard.h> @@ -1196,4 +1201,7 @@ 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)) @@ -1208,8 +1216,20 @@ void ZSafe::removeAsciiFile() // 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( @@ -1246,8 +1266,20 @@ 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( @@ -1329,8 +1361,20 @@ 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( @@ -3142,8 +3186,20 @@ 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( @@ -3190,5 +3246,5 @@ void ZSafe::newDocument() // m_password = ""; - // selectedItem = NULL; + selectedItem = NULL; filename = newFile; @@ -3218,8 +3274,20 @@ 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( @@ -3284,8 +3352,20 @@ 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 @@ -3305,4 +3385,5 @@ void ZSafe::saveDocumentAs() saveDocument(filename, FALSE); + selectedItem = NULL; filename = newFile; 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 @@ -15,5 +15,5 @@ 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 |