summaryrefslogtreecommitdiff
path: root/noncore
authorzcarsten <zcarsten>2003-07-31 16:28:04 (UTC)
committer zcarsten <zcarsten>2003-07-31 16:28:04 (UTC)
commit274bfafbda8d1d9af6cc5d1ced828a97a47c3f55 (patch) (side-by-side diff)
treefce22d8d08ddccfe828009ca2fe9f66dfd268d55 /noncore
parente5bed303e50298d91a6adf9e0b5cf7dd3d975ed3 (diff)
downloadopie-274bfafbda8d1d9af6cc5d1ced828a97a47c3f55.zip
opie-274bfafbda8d1d9af6cc5d1ced828a97a47c3f55.tar.gz
opie-274bfafbda8d1d9af6cc5d1ced828a97a47c3f55.tar.bz2
usage of OFileDialog
Diffstat (limited to 'noncore') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/zsafe/config.in2
-rw-r--r--noncore/apps/zsafe/zsafe.cpp85
-rw-r--r--noncore/apps/zsafe/zsafe.pro2
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
@@ -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 <opie/ofiledialog.h>
+#else
#include "scqtfileedit.h"
#endif
+#endif
#include <qclipboard.h>
@@ -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<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",
@@ -1245,10 +1265,22 @@ 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",
@@ -1328,10 +1360,22 @@ 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",
@@ -3141,10 +3185,22 @@ 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",
@@ -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<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",
@@ -3283,10 +3351,22 @@ 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(
@@ -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