summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (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
@@ -1,40 +1,45 @@
/****************************************************************************
**
** Created: Sat Apr 6 17:57:45 2002
**
** Author: Carsten Schneider <CarstenSchneider@t-online.de>
**
** $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"
#include "searchdialog.h"
#include "categorydialog.h"
#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>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#ifndef WIN32
#include <unistd.h>
#endif
@@ -1186,40 +1191,55 @@ void ZSafe::listViewSelected( QListViewItem *_item)
ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name")));
ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2")));
ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3")));
ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment")));
ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4")));
ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5")));
#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"
"Choose a text file" );
#endif
if (fn && fn.length() > 0 )
{
QFile f( fn );
@@ -1236,28 +1256,40 @@ void ZSafe::removeAsciiFile()
void ZSafe::writeAllEntries()
{
if (filename.isEmpty())
{
QMessageBox::critical( 0, tr("ZSafe"),
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"
"Choose a text file" );
#endif
// open the new document
if (fn && fn.length() > 0 )
{
@@ -1319,28 +1351,40 @@ void ZSafe::writeAllEntries()
void ZSafe::readAllEntries()
{
if (filename.isEmpty())
{
QMessageBox::critical( 0, tr("ZSafe"),
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"
"Choose a text file" );
#endif
if (fn && fn.length() > 0 )
{
QFile f( fn );
@@ -3132,28 +3176,40 @@ void ZSafe::pasteItem()
}
}
}
IsCut = false;
IsCopy = false;
}
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"
"Choose a ZSafe file" );
#endif
// open the new document
if (newFile && newFile.length() > 0 )
{
@@ -3180,25 +3236,25 @@ void ZSafe::newDocument()
si != NULL; )
{
QListViewItem *_si = si;
si = si->nextSibling();
i->takeItem(_si); // remove from view list
if (_si) delete _si;
}
}
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();
QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
#ifdef WIN32
this->setCaption("Qt ZSafe: " + ti);
#else
this->setCaption("ZSafe: " + ti);
#endif
@@ -3208,28 +3264,40 @@ void ZSafe::newDocument()
QMessageBox::information( this, tr("ZSafe"),
tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0);
saveDocumentWithPwd();
}
}
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"
"Choose a ZSafe file" );
#endif
// open the new document
if (newFile && newFile.length() > 0 )
{
@@ -3274,45 +3342,58 @@ void ZSafe::loadDocument()
#else
this->setCaption("ZSafe: " + ti);
#endif
openDocument(filename);
}
}
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,
"ZSafe File Dialog"
"Choose a ZSafe file" );
#endif
// open the new document
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);
#ifdef WIN32
this->setCaption("Qt ZSafe: " + ti);
#else
this->setCaption("ZSafe: " + ti);
#endif
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
@@ -5,18 +5,18 @@ HEADERS = zsafe.h krc2.h category.h categorylist.h zlistview.h \
scqtfiledlg.h
SOURCES = main.cpp zsafe.cpp krc2.cpp category.cpp \
categorylist.cpp zlistview.cpp shadedlistitem.cpp\
scqtfileedit.cpp scqtfileedit.moc.cpp \
scqtfiledlg.cpp
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 )