summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-07-14 07:17:17 (UTC)
committer llornkcor <llornkcor>2004-07-14 07:17:17 (UTC)
commitc70dbfde7f9605be295cdc7f789c7e3e8d823d39 (patch) (unidiff)
tree75c5fa13be08c30515685f1a6ef6b237809bbc71
parenta309681894af2632f9db2fcc252a058f218a82b2 (diff)
downloadopie-c70dbfde7f9605be295cdc7f789c7e3e8d823d39.zip
opie-c70dbfde7f9605be295cdc7f789c7e3e8d823d39.tar.gz
opie-c70dbfde7f9605be295cdc7f789c7e3e8d823d39.tar.bz2
allow new user to create new doc on first startup
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/zsafe/zsafe.cpp133
-rw-r--r--noncore/apps/zsafe/zsafe.h1
2 files changed, 52 insertions, 82 deletions
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index f3d57f8..41c572a 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -495,5 +495,4 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
495 QString filename = conf->readEntry(APP_KEY+"document"); 495 QString filename = conf->readEntry(APP_KEY+"document");
496 if (filename.isEmpty() || filename.isNull()) 496 if ( !QFileInfo(filename).exists() || !QDir(zsafeAppDirPath).exists() )
497 { 497 {
498
499 // check if the directory application exists, if not 498 // check if the directory application exists, if not
@@ -508,3 +507,2 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
508 { 507 {
509
510 QDir pd2(QDir::homeDirPath() + "/Documents"); 508 QDir pd2(QDir::homeDirPath() + "/Documents");
@@ -547,3 +545,2 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
547 545
548 // set the default filename
549 filename = zsafeAppDirPath + "/passwords.zsf"; 546 filename = zsafeAppDirPath + "/passwords.zsf";
@@ -1341,28 +1338,3 @@ void ZSafe::writeAllEntries()
1341 // open the file dialog 1338 // open the file dialog
1342#ifndef DESKTOP 1339 QString fn = zsaveDialog();
1343#ifndef NO_OPIE
1344 QMap<QString, QStringList> mimeTypes;
1345 mimeTypes.insert(tr("All"), QStringList() );
1346 mimeTypes.insert(tr("Text"), "text/*" );
1347 QString fn = OFileDialog::getSaveFileName( OFileSelector::EXTENDED_ALL,
1348 QDir::homeDirPath() + "/Documents/application/zsafe",
1349 QString::null,
1350 mimeTypes,
1351 this,
1352 tr ("Export text file"));
1353#else
1354 QString fn = ScQtFileEdit::getSaveAsFileName(this,
1355 tr ("Export text file"),
1356 QDir::homeDirPath() + "/Documents/application/zsafe",
1357 "*.txt");
1358#endif
1359#else
1360 QString fn = QFileDialog::getSaveFileName(
1361 QDir::homeDirPath() + "/Documents/application/zsafe",
1362 "ZSafe (*.txt)",
1363 this,
1364 "ZSafe File Dialog"
1365 "Choose a text file" );
1366#endif
1367
1368 // open the new document 1340 // open the new document
@@ -1923,2 +1895,4 @@ bool ZSafe::openDocument(const char* _filename, const char* )
1923{ 1895{
1896 QString name= _filename;
1897 qWarning("openDocument "+name);
1924 int retval; 1898 int retval;
@@ -1972,3 +1946,17 @@ bool ZSafe::openDocument(const char* _filename, const char* )
1972 filename = ""; 1946 filename = "";
1947 switch( QMessageBox::warning( this, tr("ZSafe"),
1948 tr("<P>You must create a new document first. Ok to create?</P>"),
1949 tr("&Yes"), tr("&No."),
1950 0
1951 ) )
1952 {
1953 case 1: // No
1973 return false; 1954 return false;
1955 break;
1956 case 0: // Yes
1957 newDocument();
1958 return false;
1959 break;
1960 }
1961
1974 } 1962 }
@@ -3449,27 +3437,3 @@ void ZSafe::newDocument()
3449 // open the file dialog 3437 // open the file dialog
3450#ifndef DESKTOP 3438 QString newFile = zsaveDialog();
3451#ifndef NO_OPIE
3452 QMap<QString, QStringList> mimeTypes;
3453 mimeTypes.insert(tr("All"), QStringList() );
3454 mimeTypes.insert(tr("ZSafe"), "zsafe/*" );
3455 QString newFile = OFileDialog::getSaveFileName( OFileSelector::EXTENDED_ALL,
3456 QDir::homeDirPath() + "/Documents/application/zsafe",
3457 QString::null,
3458 mimeTypes,
3459 this,
3460 tr ("Create new ZSafe document"));
3461#else
3462 QString newFile = ScQtFileEdit::getSaveAsFileName(this,
3463 tr ("Create new ZSafe document"),
3464 QDir::homeDirPath() + "/Documents/application/zsafe",
3465 "*.zsf");
3466#endif
3467#else
3468 QString newFile = QFileDialog::getSaveFileName(
3469 QDir::homeDirPath() + "/Documents/application/zsafe",
3470 "ZSafe (*.zsf)",
3471 this,
3472 "ZSafe File Dialog"
3473 "Choose a ZSafe file" );
3474#endif
3475 3439
@@ -3615,29 +3579,3 @@ void ZSafe::saveDocumentAs()
3615 3579
3616#ifndef DESKTOP 3580QString newFile = zsaveDialog();
3617#ifndef NO_OPIE
3618 QMap<QString, QStringList> mimeTypes;
3619 mimeTypes.insert(tr("All"), QStringList() );
3620 mimeTypes.insert(tr("ZSafe"), "zsafe/*" );
3621 QString newFile = OFileDialog::getSaveFileName( OFileSelector::EXTENDED_ALL,
3622 QDir::homeDirPath() + "/Documents/application/zsafe",
3623 QString::null,
3624 mimeTypes,
3625 this,
3626 tr ("Save ZSafe document as.."));
3627#else
3628 QString newFile = ScQtFileEdit::getSaveAsFileName(this,
3629 tr ("Save ZSafe document as.."),
3630 QDir::homeDirPath() + "/Documents/application/zsafe",
3631 "*.zsf");
3632#endif
3633#else
3634 // open the file dialog
3635 QString newFile = QFileDialog::getSaveFileName(
3636 QDir::homeDirPath() + "/Documents/application/zsafe",
3637 "ZSafe (*.zsf)",
3638 this,
3639 "ZSafe File Dialog"
3640 "Choose a ZSafe file" );
3641#endif
3642
3643 // open the new document 3581 // open the new document
@@ -3855,2 +3793,4 @@ void ZSafe::setDocument(const QString& fileref)
3855 openDocument(filename); 3793 openDocument(filename);
3794#else
3795Q_UNUSED(fileref);
3856#endif 3796#endif
@@ -3906 +3846,30 @@ void ZSafe::copyClip( const QString &text) {
3906 3846
3847QString ZSafe::zsaveDialog() {
3848
3849 QString fn;
3850#ifndef DESKTOP
3851#ifndef NO_OPIE
3852 QMap<QString, QStringList> mimeTypes;
3853 mimeTypes.insert(tr("All"), QStringList() );
3854 mimeTypes.insert(tr("Text"), "text/*" );
3855 fn = OFileDialog::getSaveFileName( OFileSelector::EXTENDED_ALL,
3856 QDir::homeDirPath() + "/Documents/application/zsafe",
3857 QString::null,
3858 mimeTypes,
3859 this,
3860 tr ("Export text file"));
3861#else
3862 fn = ScQtFileEdit::getSaveAsFileName(this,
3863 tr ("Export text file"),
3864 QDir::homeDirPath() + "/Documents/application/zsafe",
3865 "*.txt");
3866#endif
3867#else
3868 fn = QFileDialog::getSaveFileName(
3869 QDir::homeDirPath() + "/Documents/application/zsafe",
3870 "ZSafe (*.txt)",
3871 this,
3872 "ZSafe");
3873#endif
3874 return fn;
3875}
diff --git a/noncore/apps/zsafe/zsafe.h b/noncore/apps/zsafe/zsafe.h
index ca041ff..7419797 100644
--- a/noncore/apps/zsafe/zsafe.h
+++ b/noncore/apps/zsafe/zsafe.h
@@ -155,2 +155,3 @@ public:
155 155
156 QString zsaveDialog();
156 157