summaryrefslogtreecommitdiff
path: root/noncore/apps
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/apps
parente5bed303e50298d91a6adf9e0b5cf7dd3d975ed3 (diff)
downloadopie-274bfafbda8d1d9af6cc5d1ced828a97a47c3f55.zip
opie-274bfafbda8d1d9af6cc5d1ced828a97a47c3f55.tar.gz
opie-274bfafbda8d1d9af6cc5d1ced828a97a47c3f55.tar.bz2
usage of OFileDialog
Diffstat (limited to 'noncore/apps') (more/less context) (ignore 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
@@ -6,13 +6,14 @@
**
** $Id$
**
** 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
**
****************************************************************************/
#include "zsafe.h"
#include "newdialog.h"
@@ -21,14 +22,18 @@
#include "passworddialog.h"
#include "infoform.h"
#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>
#include <sys/types.h>
@@ -1192,28 +1197,43 @@ void ZSafe::listViewSelected( QListViewItem *_item)
#endif
}
bool ZSafe::isCategory(QListViewItem *_item)
{
+ if (_item == NULL)
+ return FALSE;
+
QString categoryName = _item->text (0);
if (categories.find ((const char *)categoryName))
return TRUE;
else
return FALSE;
}
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)",
this,
"ZSafe File Dialog"
@@ -1242,16 +1262,28 @@ void ZSafe::writeAllEntries()
tr("No document defined.\nYou have to create a new document"));
return;
}
// 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)",
this,
"ZSafe File Dialog"
@@ -1325,16 +1357,28 @@ void ZSafe::readAllEntries()
tr("No document defined.\nYou have to create a new document"));
return;
}
// 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)",
this,
"ZSafe File Dialog"
@@ -3138,16 +3182,28 @@ void ZSafe::pasteItem()
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)",
this,
"ZSafe File Dialog"
@@ -3186,13 +3242,13 @@ 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
conf->writeEntry(APP_KEY+"document", filename);
saveConf();
@@ -3214,16 +3270,28 @@ void ZSafe::newDocument()
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)",
this,
"ZSafe File Dialog"
@@ -3280,16 +3348,28 @@ 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",
"ZSafe (*.zsf)",
this,
@@ -3301,12 +3381,13 @@ void ZSafe::saveDocumentAs()
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);
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
@@ -11,12 +11,12 @@ INTERFACES = newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui
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 )