summaryrefslogtreecommitdiff
authordrw <drw>2004-02-23 17:12:28 (UTC)
committer drw <drw>2004-02-23 17:12:28 (UTC)
commit2f11aa15eeb70dd8826523597adb8947fdffbaa7 (patch) (side-by-side diff)
treeacc6ceb27c67437734e94b39b06835edac5d5bad
parent20b0e62e6c23cdaed9a30d6fad73431edc60be53 (diff)
downloadopie-2f11aa15eeb70dd8826523597adb8947fdffbaa7.zip
opie-2f11aa15eeb70dd8826523597adb8947fdffbaa7.tar.gz
opie-2f11aa15eeb70dd8826523597adb8947fdffbaa7.tar.bz2
ZSafe: libopie->libopie2
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/zsafe/config.in2
-rw-r--r--noncore/apps/zsafe/opie-zsafe.control2
-rw-r--r--noncore/apps/zsafe/zsafe.cpp989
-rw-r--r--noncore/apps/zsafe/zsafe.pro16
4 files changed, 506 insertions, 503 deletions
diff --git a/noncore/apps/zsafe/config.in b/noncore/apps/zsafe/config.in
index 4b1e968..6e321f3 100644
--- a/noncore/apps/zsafe/config.in
+++ b/noncore/apps/zsafe/config.in
@@ -3,3 +3,3 @@ config ZSAFE
default "y"
- depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE
+ depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI
diff --git a/noncore/apps/zsafe/opie-zsafe.control b/noncore/apps/zsafe/opie-zsafe.control
index b58a987..6288fac 100644
--- a/noncore/apps/zsafe/opie-zsafe.control
+++ b/noncore/apps/zsafe/opie-zsafe.control
@@ -6,3 +6,3 @@ Version: $QPE_VERSION$EXTRAVERSION
Architecture: arm
-Depends: task-opie-minimal
+Depends: task-opie-minimal, libopieui2
Maintainer: Carsten Schneider <zcarsten@gmx.net>
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index bdd2aed..f43a206 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -30,3 +30,6 @@
#ifndef NO_OPIE
-#include <opie/ofiledialog.h>
+#include <opie2/ofiledialog.h>
+
+using Opie::OFileDialog;
+using Opie::OFileSelector;
#else
@@ -136,3 +139,3 @@ const QString APP_KEY="";
-static const char* const bank_cards_data[] = {
+static const char* const bank_cards_data[] = {
"14 14 16 1",
@@ -170,3 +173,3 @@ static const char* const bank_cards_data[] = {
-static const char* const passwords_data[] = {
+static const char* const passwords_data[] = {
"16 16 20 1",
@@ -209,3 +212,3 @@ static const char* const passwords_data[] = {
-static const char* const software_data[] = {
+static const char* const software_data[] = {
"16 16 5 1",
@@ -233,3 +236,3 @@ static const char* const software_data[] = {
-static const char* const general_data[] = {
+static const char* const general_data[] = {
"14 14 98 2",
@@ -381,5 +384,5 @@ static const char* const general_data[] = {
-/*
- * Constructs a ZSafe which is a child of 'parent', with the
- * name 'name' and widget flags set to 'f'
+/*
+ * Constructs a ZSafe which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'
*
@@ -389,3 +392,3 @@ static const char* const general_data[] = {
ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
- : QDialog( parent, name, modal, fl ),
+ : QDialog( parent, name, modal, fl ),
Edit(0l), Delete(0l), Find(0l), New(0l), ListView(0l)
@@ -411,3 +414,3 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
iconPath = "/home/QtPalmtop/pics/";
- else
+ else
iconPath = qpedir + "/pics/";
@@ -460,3 +463,3 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
if ( !name )
- setName( "ZSafe" );
+ setName( "ZSafe" );
@@ -464,5 +467,5 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
#ifdef WIN32
- setGeometry(100, 150, DeskW, DeskH-30 );
+ setGeometry(100, 150, DeskW, DeskH-30 );
#else
- resize( DeskW, DeskH-30 );
+ resize( DeskW, DeskH-30 );
#endif
@@ -500,3 +503,3 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
// #else
- QString d1(QDir::homeDirPath() + "/Documents/application");
+ QString d1(QDir::homeDirPath() + "/Documents/application");
// #endif
@@ -517,3 +520,3 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
}
- QString d2(QDir::homeDirPath() + "/Documents/application/zsafe");
+ QString d2(QDir::homeDirPath() + "/Documents/application/zsafe");
QDir pd2(d2);
@@ -533,3 +536,3 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
}
-
+
@@ -578,3 +581,3 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
file->insertItem( save_img, tr("&Save document"), this, SLOT(saveDocumentWithoutPwd()) );
- file->insertItem( save_img, tr("S&ave document with new Password"), this,
+ file->insertItem( save_img, tr("S&ave document with new Password"), this,
SLOT(saveDocumentWithPwd()) );
@@ -585,3 +588,3 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
file->insertSeparator();
- file->insertItem( expand_img, tr("&Open entries expanded"), this,
+ file->insertItem( expand_img, tr("&Open entries expanded"), this,
SLOT(setExpandFlag()), 0, 'o');
@@ -616,3 +619,3 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
New = new QToolButton( menu, "New" );
- New->setGeometry( QRect( DeskW-84, 2, 20, 20 ) );
+ New->setGeometry( QRect( DeskW-84, 2, 20, 20 ) );
New->setMouseTracking( TRUE );
@@ -623,3 +626,3 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
Edit = new QToolButton( menu, "Edit" );
- Edit->setGeometry( QRect( DeskW-64, 2, 20, 20 ) );
+ Edit->setGeometry( QRect( DeskW-64, 2, 20, 20 ) );
Edit->setText( tr( "" ) );
@@ -629,3 +632,3 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
Delete = new QToolButton( menu, "Delete" );
- Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) );
+ Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) );
Delete->setText( tr( "" ) );
@@ -635,3 +638,3 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
Find = new QToolButton( menu, "Find" );
- Find->setGeometry( QRect( DeskW-24, 2, 20, 20 ) );
+ Find->setGeometry( QRect( DeskW-24, 2, 20, 20 ) );
Find->setText( tr( "" ) );
@@ -660,7 +663,7 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
ListView->setResizePolicy(QScrollView::AutoOneFit);
- // ListView->setGeometry( QRect( 0, 22, this->width(), this->height() - 30 ) );
+ // ListView->setGeometry( QRect( 0, 22, this->width(), this->height() - 30 ) );
#else
ListView->setResizePolicy(QScrollView::AutoOneFit);
- // ListView->setGeometry( QRect( 0, 22,
- // this->width(), this->height() - 30 ) );
+ // ListView->setGeometry( QRect( 0, 22,
+ // this->width(), this->height() - 30 ) );
// ListView->setMaximumSize( QSize( 440, 290 ) );
@@ -703,3 +706,3 @@ const QColor *ZSafe::oddRowColor = new QColor(216,240,255);
-/*
+/*
* Destroys the object and frees any allocated resources
@@ -727,3 +730,3 @@ void ZSafe::deletePwd()
tr("Do you want to delete?"),
- tr("&Delete"), tr("D&on't Delete"),
+ tr("&Delete"), tr("D&on't Delete"),
0 // Enter == button 0
@@ -756,5 +759,5 @@ void ZSafe::editPwd()
dialog->setCaption ("Qt " + tr("Edit Entry"));
- dialog->setGeometry(200, 250, 220, 310 );
+ dialog->setGeometry(200, 250, 220, 310 );
#endif
-
+
// set the labels
@@ -787,14 +790,14 @@ void ZSafe::editPwd()
// edit the selected item
- QString name = dialog->NameField->text();
+ QString name = dialog->NameField->text();
selectedItem->setText (0, tr (name));
- QString user = dialog->UsernameField->text();
+ QString user = dialog->UsernameField->text();
selectedItem->setText (1, tr (user));
- QString pwd = dialog->PasswordField->text();
+ QString pwd = dialog->PasswordField->text();
selectedItem->setText (2, tr (pwd));
- QString comment = dialog->CommentField->text();
+ QString comment = dialog->CommentField->text();
comment.replace (QRegExp("\n"), "<br>");
selectedItem->setText (3, tr (comment));
- QString f5 = dialog->Field5->text();
+ QString f5 = dialog->Field5->text();
selectedItem->setText (4, tr (f5));
- QString f6 = dialog->Field6->text();
+ QString f6 = dialog->Field6->text();
selectedItem->setText (5, tr (f6));
@@ -804,3 +807,3 @@ void ZSafe::editPwd()
}
- else
+ else
{
@@ -826,3 +829,3 @@ void ZSafe::newPwd()
dialog->setCaption ("Qt " + tr("New Entry"));
- dialog->setGeometry(200, 250, 220, 310 );
+ dialog->setGeometry(200, 250, 220, 310 );
#endif
@@ -845,3 +848,3 @@ retype:
- QString name = dialog->NameField->text();
+ QString name = dialog->NameField->text();
if (cat == name)
@@ -859,12 +862,12 @@ retype:
i->setText (0, tr (name));
- QString user = dialog->UsernameField->text();
+ QString user = dialog->UsernameField->text();
i->setText (1, tr (user));
- QString pwd = dialog->PasswordField->text();
+ QString pwd = dialog->PasswordField->text();
i->setText (2, tr (pwd));
- QString comment = dialog->CommentField->text();
+ QString comment = dialog->CommentField->text();
comment.replace (QRegExp("\n"), "<br>");
i->setText (3, tr (comment));
- QString f5 = dialog->Field5->text();
+ QString f5 = dialog->Field5->text();
i->setText (4, tr (f5));
- QString f6 = dialog->Field6->text();
+ QString f6 = dialog->Field6->text();
i->setText (5, tr (f6));
@@ -954,3 +957,3 @@ void ZSafe::findPwd()
i = ListView->firstChild();
- for (;
+ for (;
i != NULL;
@@ -967,3 +970,3 @@ void ZSafe::findPwd()
si = i->firstChild();
- // for (si = i->firstChild();
+ // for (si = i->firstChild();
for (;
@@ -1020,5 +1023,5 @@ void ZSafe::findPwd()
update();
- QMessageBox::information( this, tr("ZSafe"),
+ QMessageBox::information( this, tr("ZSafe"),
tr("Entry not found"), tr("&OK"), 0);
-
+
}
@@ -1078,3 +1081,3 @@ QString ZSafe::getFieldLabel (QString category, QString field, QString def)
// #ifndef WIN32
- QString label = conf->readEntry(app_key+category+"-field"+field,
+ QString label = conf->readEntry(app_key+category+"-field"+field,
def);
@@ -1095,3 +1098,3 @@ void ZSafe::showInfo( QListViewItem *_item)
selectedItem->setSelected(FALSE);
-
+
selectedItem = _item;
@@ -1240,3 +1243,3 @@ void ZSafe::removeAsciiFile()
#else
- QString fn = ScQtFileEdit::getOpenFileName(this,
+ QString fn = ScQtFileEdit::getOpenFileName(this,
tr ("Remove text file"),
@@ -1247,3 +1250,3 @@ void ZSafe::removeAsciiFile()
QString fn = QFileDialog::getOpenFileName(
- QDir::homeDirPath() + "/Documents/application/zsafe",
+ QDir::homeDirPath() + "/Documents/application/zsafe",
"ZSafe (*.txt)",
@@ -1257,3 +1260,3 @@ void ZSafe::removeAsciiFile()
QFile f( fn );
- if ( !f.remove() )
+ if ( !f.remove() )
{
@@ -1290,3 +1293,3 @@ void ZSafe::writeAllEntries()
#else
- QString fn = ScQtFileEdit::getSaveAsFileName(this,
+ QString fn = ScQtFileEdit::getSaveAsFileName(this,
tr ("Export text file"),
@@ -1297,3 +1300,3 @@ void ZSafe::writeAllEntries()
QString fn = QFileDialog::getSaveFileName(
- QDir::homeDirPath() + "/Documents/application/zsafe",
+ QDir::homeDirPath() + "/Documents/application/zsafe",
"ZSafe (*.txt)",
@@ -1319,3 +1322,3 @@ void ZSafe::writeAllEntries()
// step through all categories
- for (i = ListView->firstChild();
+ for (i = ListView->firstChild();
i != NULL;
@@ -1325,3 +1328,3 @@ void ZSafe::writeAllEntries()
QListViewItem *si;
- for (si = i->firstChild();
+ for (si = i->firstChild();
si != NULL;
@@ -1385,3 +1388,3 @@ void ZSafe::readAllEntries()
#else
- QString fn = ScQtFileEdit::getOpenFileName(this,
+ QString fn = ScQtFileEdit::getOpenFileName(this,
tr ("Import text file"),
@@ -1392,3 +1395,3 @@ void ZSafe::readAllEntries()
QString fn = QFileDialog::getOpenFileName(
- QDir::homeDirPath() + "/Documents/application/zsafe",
+ QDir::homeDirPath() + "/Documents/application/zsafe",
"ZSafe (*.txt)",
@@ -1437,3 +1440,3 @@ void ZSafe::readAllEntries()
QTextStream t(&f);
- while ( !t.eof() )
+ while ( !t.eof() )
{
@@ -1443,5 +1446,5 @@ void ZSafe::readAllEntries()
#ifndef WIN32
- char buffer[s.length()+1];
+ char buffer[s.length()+1];
#else
- char buffer[4048];
+ char buffer[4048];
#endif
@@ -1450,3 +1453,3 @@ void ZSafe::readAllEntries()
/* modify QString -> QCString::utf8 */
-
+
strcpy (buffer, s.utf8());
@@ -1501,3 +1504,3 @@ void ZSafe::readAllEntries()
}
- idx++;
+ idx++;
}
@@ -1595,3 +1598,3 @@ void ZSafe::writeAllEntries()
// step through all categories
- for (i = ListView->firstChild();
+ for (i = ListView->firstChild();
i != NULL;
@@ -1601,3 +1604,3 @@ void ZSafe::writeAllEntries()
QListViewItem *si;
- for (si = i->firstChild();
+ for (si = i->firstChild();
si != NULL;
@@ -1672,3 +1675,3 @@ void ZSafe::readAllEntries()
QTextStream t(&f);
- while ( !t.eof() )
+ while ( !t.eof() )
{
@@ -1677,5 +1680,5 @@ void ZSafe::readAllEntries()
// char buffer[1024];
- int len=s.length()+1;
+ int len=s.length()+1;
#ifdef WIN32
- char buffer[512];
+ char buffer[512];
#else
@@ -1721,3 +1724,3 @@ void ZSafe::readAllEntries()
}
- idx++;
+ idx++;
}
@@ -1834,3 +1837,3 @@ bool ZSafe::openDocument(const char* _filename, const char* )
// #else
- // int validationFlag = 1;
+ // int validationFlag = 1;
// #endif
@@ -1845,5 +1848,5 @@ bool ZSafe::openDocument(const char* _filename, const char* )
// ask with a dialog for the password
- if (m_password.isEmpty())
- getDocPassword(tr("Enter Password"));
- if (m_password.isEmpty() && validationFlag == 0)
+ if (m_password.isEmpty())
+ getDocPassword(tr("Enter Password"));
+ if (m_password.isEmpty() && validationFlag == 0)
{
@@ -1855,8 +1858,8 @@ bool ZSafe::openDocument(const char* _filename, const char* )
- retval = loadInit(_filename, m_password);
- if (retval != PWERR_GOOD)
+ retval = loadInit(_filename, m_password);
+ if (retval != PWERR_GOOD)
{
qWarning ("Error loading Document");
- return false;
- }
+ return false;
+ }
}
@@ -1881,3 +1884,3 @@ bool ZSafe::openDocument(const char* _filename, const char* )
- retval = loadEntry(entry);
+ retval = loadEntry(entry);
if (retval == 1 &&
@@ -1889,3 +1892,3 @@ bool ZSafe::openDocument(const char* _filename, const char* )
{
- for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]);
+ for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]);
pwdOk = 1;
@@ -1894,4 +1897,4 @@ bool ZSafe::openDocument(const char* _filename, const char* )
else
- // for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]);
- fclose (fd);
+ // for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]);
+ fclose (fd);
m_password = "";
@@ -1902,6 +1905,6 @@ bool ZSafe::openDocument(const char* _filename, const char* )
tr("Wrong password.\nEnter again?"),
- tr("&Yes"), tr("&No."),
- 0
- ) )
- {
+ tr("&Yes"), tr("&No."),
+ 0
+ ) )
+ {
case 1: // No
@@ -1925,6 +1928,6 @@ bool ZSafe::openDocument(const char* _filename, const char* )
- retval = loadEntry(entry);
-
+ retval = loadEntry(entry);
+
int numberOfEntries=0;
- while (retval == 1) {
+ while (retval == 1) {
@@ -2010,10 +2013,10 @@ bool ZSafe::openDocument(const char* _filename, const char* )
- for (int count = 0; count < FIELD_SIZE; count++) {
- free(entry[count]);
- }
- retval = loadEntry(entry);
- if (retval == 2) {
- // m_parent->slotStatusHelpMsg("Last entry loaded");
- }
- } // end while
+ for (int count = 0; count < FIELD_SIZE; count++) {
+ free(entry[count]);
+ }
+ retval = loadEntry(entry);
+ if (retval == 2) {
+ // m_parent->slotStatusHelpMsg("Last entry loaded");
+ }
+ } // end while
@@ -2021,10 +2024,10 @@ bool ZSafe::openDocument(const char* _filename, const char* )
{
-
+
switch( QMessageBox::warning( this, tr("ZSafe"),
tr("Empty document or\nwrong password.\nContinue?"),
- tr("&No"), tr("&Yes."),
- 0
- ) ) {
+ tr("&No"), tr("&Yes."),
+ 0
+ ) ) {
case 0: // No
- retval = loadFinalize();
+ retval = loadFinalize();
exitZs (1);
@@ -2034,7 +2037,7 @@ bool ZSafe::openDocument(const char* _filename, const char* )
}
- }
+ }
- retval = loadFinalize();
+ retval = loadFinalize();
- return true;
+ return true;
}
@@ -2043,11 +2046,11 @@ int ZSafe::loadInit(const char* _filename, const char *password)
{
- unsigned int j = 0;
- unsigned int keylength=0;
- int count=0, count2=0, count3=0;
- unsigned char charbuf[8];
- unsigned short ciphertext[4];
- char key[128];
- Krc2* krc2 = new Krc2();
+ unsigned int j = 0;
+ unsigned int keylength=0;
+ int count=0, count2=0, count3=0;
+ unsigned char charbuf[8];
+ unsigned short ciphertext[4];
+ char key[128];
+ Krc2* krc2 = new Krc2();
- fd = fopen (_filename, "rb");
+ fd = fopen (_filename, "rb");
@@ -2057,16 +2060,16 @@ int ZSafe::loadInit(const char* _filename, const char *password)
- if (fd == NULL)
- return PWERR_OPEN;
+ if (fd == NULL)
+ return PWERR_OPEN;
- buffer = (char *)malloc(load_buffer_length);
- for (j = 0; password[j] != '\0'; j++) {
- key[j] = password[j];
- }
- keylength = j;
- krc2->rc2_expandkey (key, keylength, 128);
+ buffer = (char *)malloc(load_buffer_length);
+ for (j = 0; password[j] != '\0'; j++) {
+ key[j] = password[j];
+ }
+ keylength = j;
+ krc2->rc2_expandkey (key, keylength, 128);
#ifndef WIN32
- size = read(fileno (fd), (unsigned char *) (charbuf + count), 8);
+ size = read(fileno (fd), (unsigned char *) (charbuf + count), 8);
#else
- printf ("LoadInit() read1");
+ printf ("LoadInit() read1");
size = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd);
@@ -2074,50 +2077,50 @@ int ZSafe::loadInit(const char* _filename, const char *password)
- if (size < 8)
- return PWERR_DATA;
+ if (size < 8)
+ return PWERR_DATA;
- for (count = 0; count < 4; count++) {
- count2 = count << 1;
- iv[count] = charbuf[count2] << 8;
- iv[count] += charbuf[count2 + 1];
- }
+ for (count = 0; count < 4; count++) {
+ count2 = count << 1;
+ iv[count] = charbuf[count2] << 8;
+ iv[count] += charbuf[count2 + 1];
+ }
- size = 0;
- bufferIndex = 0;
+ size = 0;
+ bufferIndex = 0;
#ifndef WIN32
- while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) {
- while (count < 8) {
- count2 = read (fileno (fd), (unsigned char *) (charbuf + count), 8);
+ while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) {
+ while (count < 8) {
+ count2 = read (fileno (fd), (unsigned char *) (charbuf + count), 8);
#else
- printf ("LoadInit() read2");
+ printf ("LoadInit() read2");
while ((count = fread ((unsigned char *) (charbuf), sizeof(unsigned char), 8, fd)) > 0) {
- while (count < 8) {
- count2 = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd);
-#endif
- if (count2 == 0) {
- return PWERR_DATA;
- }
- count += count2;
- } /* while (count < 8) */
-
- size += 8;
- for (count2 = 0; count2 < 8; count2 += 2) {
- count3 = count2 >> 1;
- ciphertext[count3] = charbuf[count2] << 8;
- ciphertext[count3] += charbuf[count2 + 1];
-
- plaintext[count3] = ciphertext[count3] ^ iv[count3];
- iv[count3] = plaintext[count3];
- } /* for (count2) */
-
- krc2->rc2_decrypt (plaintext);
- memcpy ((unsigned char *) (buffer + bufferIndex), plaintext, 8);
- bufferIndex += 8;
- buffer[bufferIndex + 1] = '\0';
- } /* while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) */
- size -= buffer[size - 1];
- lastcount = 0;
-
- /* This will point to the starting index */
- bufferIndex = 0;
- return PWERR_GOOD;
+ while (count < 8) {
+ count2 = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd);
+#endif
+ if (count2 == 0) {
+ return PWERR_DATA;
+ }
+ count += count2;
+ } /* while (count < 8) */
+
+ size += 8;
+ for (count2 = 0; count2 < 8; count2 += 2) {
+ count3 = count2 >> 1;
+ ciphertext[count3] = charbuf[count2] << 8;
+ ciphertext[count3] += charbuf[count2 + 1];
+
+ plaintext[count3] = ciphertext[count3] ^ iv[count3];
+ iv[count3] = plaintext[count3];
+ } /* for (count2) */
+
+ krc2->rc2_decrypt (plaintext);
+ memcpy ((unsigned char *) (buffer + bufferIndex), plaintext, 8);
+ bufferIndex += 8;
+ buffer[bufferIndex + 1] = '\0';
+ } /* while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) */
+ size -= buffer[size - 1];
+ lastcount = 0;
+
+ /* This will point to the starting index */
+ bufferIndex = 0;
+ return PWERR_GOOD;
}
@@ -2126,26 +2129,26 @@ int ZSafe::loadEntry(char *entry[FIELD_SIZE])
{
- /* Strip off PKCS 5 padding
- * Should check to make sure it's good here
- */
- int count, count1=0;
-
- for (count = lastcount; count < size; count++) {
- if ((unsigned char) (buffer[count]) == 255) {
- if (buffer[bufferIndex] == '\0') {
- bufferIndex++;
- }
- entry[count1] = (char *) malloc (count - bufferIndex + 1);
- memcpy (entry[count1], (unsigned char *) (buffer + bufferIndex), count - bufferIndex);
- entry[count1][count - bufferIndex] = '\0';
- count++;
- bufferIndex = count;
- count1++;
- if (count1 == FIELD_SIZE) {
- lastcount = count;
- return 1;
- }
- } /* if ((unsigned char) (buffer[count]) == 255) */
- } /* for (count = 0; count < size; count++) */
-
- return 2;
+ /* Strip off PKCS 5 padding
+ * Should check to make sure it's good here
+ */
+ int count, count1=0;
+
+ for (count = lastcount; count < size; count++) {
+ if ((unsigned char) (buffer[count]) == 255) {
+ if (buffer[bufferIndex] == '\0') {
+ bufferIndex++;
+ }
+ entry[count1] = (char *) malloc (count - bufferIndex + 1);
+ memcpy (entry[count1], (unsigned char *) (buffer + bufferIndex), count - bufferIndex);
+ entry[count1][count - bufferIndex] = '\0';
+ count++;
+ bufferIndex = count;
+ count1++;
+ if (count1 == FIELD_SIZE) {
+ lastcount = count;
+ return 1;
+ }
+ } /* if ((unsigned char) (buffer[count]) == 255) */
+ } /* for (count = 0; count < size; count++) */
+
+ return 2;
}
@@ -2154,9 +2157,9 @@ int ZSafe::loadFinalize(void)
{
- fclose (fd);
+ fclose (fd);
if (buffer) free(buffer);
- return PWERR_GOOD;
+ return PWERR_GOOD;
}
-bool ZSafe::saveDocument(const char* _filename,
- bool withPwd,
+bool ZSafe::saveDocument(const char* _filename,
+ bool withPwd,
const char* )
@@ -2177,7 +2180,7 @@ bool ZSafe::saveDocument(const char* _filename,
{
- getDocPassword(tr("Enter Password"));
- if (m_password.isEmpty())
+ getDocPassword(tr("Enter Password"));
+ if (m_password.isEmpty())
{
-
- QMessageBox::critical( 0, tr("ZSafe"),
+
+ QMessageBox::critical( 0, tr("ZSafe"),
tr("Password is empty.\nPlease enter again."));
@@ -2185,9 +2188,9 @@ bool ZSafe::saveDocument(const char* _filename,
}
-
+
QString firstPasswd = m_password;
-
- getDocPassword(tr("Reenter Password"));
- if (m_password.isEmpty())
+
+ getDocPassword(tr("Reenter Password"));
+ if (m_password.isEmpty())
{
- QMessageBox::critical( 0, tr("ZSafe"),
+ QMessageBox::critical( 0, tr("ZSafe"),
tr("Password is empty.\nPlease enter again."));
@@ -2197,4 +2200,4 @@ bool ZSafe::saveDocument(const char* _filename,
{
-
- QMessageBox::critical( 0, tr("ZSafe"),
+
+ QMessageBox::critical( 0, tr("ZSafe"),
tr("Passwords must be identical.\nPlease enter again."));
@@ -2202,6 +2205,6 @@ bool ZSafe::saveDocument(const char* _filename,
}
- pwdOk = TRUE;
+ pwdOk = TRUE;
modified = false;
}
- }
+ }
else if (modified)
@@ -2212,6 +2215,6 @@ bool ZSafe::saveDocument(const char* _filename,
tr("Do you want to save ") + fns + tr("\nbefore continuing?"),
- tr("&Save"),
- tr("&Don't Save"),
+ tr("&Save"),
+ tr("&Don't Save"),
0 // Enter == button 0
- ) )
+ ) )
{ // Escape == button 2
@@ -2226,3 +2229,3 @@ bool ZSafe::saveDocument(const char* _filename,
modified = false;
-
+
if (m_password.isEmpty())
@@ -2231,8 +2234,8 @@ bool ZSafe::saveDocument(const char* _filename,
int retval = saveInit(_filename, m_password);
- // int retval = saveInit(_filename, "test");
- if (retval != PWERR_GOOD) {
- return false;
+ // int retval = saveInit(_filename, "test");
+ if (retval != PWERR_GOOD) {
+ return false;
}
-
- char* entry[FIELD_SIZE];
+
+ char* entry[FIELD_SIZE];
@@ -2241,19 +2244,19 @@ bool ZSafe::saveDocument(const char* _filename,
int i=0;
- entry[i] = (char*)malloc(strlen("ZSAFECATEGORY")+1);
- strcpy(entry[i++], "ZSAFECATEGORY");
- entry[i] = (char*)malloc(strlen("name")+1);
- strcpy(entry[i++], "name");
- entry[i] = (char*)malloc(strlen("username")+1);
- strcpy(entry[i++], "username");
- entry[i] = (char*)malloc(strlen("password")+1);
- strcpy(entry[i++], "password");
- entry[i] = (char*)malloc(strlen("comment")+1);
- strcpy(entry[i++], "comment");
-
- entry[i] = (char*)malloc(strlen("field5")+1);
- strcpy(entry[i++], "field5");
- entry[i] = (char*)malloc(strlen("field6")+1);
- strcpy(entry[i++], "field6");
-
- retval = saveEntry(entry);
+ entry[i] = (char*)malloc(strlen("ZSAFECATEGORY")+1);
+ strcpy(entry[i++], "ZSAFECATEGORY");
+ entry[i] = (char*)malloc(strlen("name")+1);
+ strcpy(entry[i++], "name");
+ entry[i] = (char*)malloc(strlen("username")+1);
+ strcpy(entry[i++], "username");
+ entry[i] = (char*)malloc(strlen("password")+1);
+ strcpy(entry[i++], "password");
+ entry[i] = (char*)malloc(strlen("comment")+1);
+ strcpy(entry[i++], "comment");
+
+ entry[i] = (char*)malloc(strlen("field5")+1);
+ strcpy(entry[i++], "field5");
+ entry[i] = (char*)malloc(strlen("field6")+1);
+ strcpy(entry[i++], "field6");
+
+ retval = saveEntry(entry);
for (int z=0; z<i; z++) free(entry[z]);
@@ -2298,3 +2301,3 @@ bool ZSafe::saveDocument(const char* _filename,
- retval = saveEntry(entry);
+ retval = saveEntry(entry);
for (int z=0; z<j; z++)
@@ -2312,6 +2315,6 @@ bool ZSafe::saveDocument(const char* _filename,
- if (saveFinalize() == PWERR_DATA) {
+ if (saveFinalize() == PWERR_DATA) {
qWarning("2: Error writing file, contents not saved");
- return false;
- } else {
+ return false;
+ } else {
#ifndef DESKTOP
@@ -2320,4 +2323,4 @@ bool ZSafe::saveDocument(const char* _filename,
modified = false;
- return true;
- }
+ return true;
+ }
}
@@ -2372,23 +2375,23 @@ int ZSafe::saveInit(const char *_filename, const char *password)
{
- char key[128];
- unsigned int j = 0;
- unsigned int keylength;
- // int val;
- int count2;
- Krc2* krc2 = new Krc2();
-
- /* first we should check the permissions of the filename */
+ char key[128];
+ unsigned int j = 0;
+ unsigned int keylength;
+ // int val;
+ int count2;
+ Krc2* krc2 = new Krc2();
+
+ /* first we should check the permissions of the filename */
/*
- if (QFile::exists(_filename)) {
- val = checkFile(_filename);
- if (val != PWERR_GOOD)
- return val;
- } else
+ if (QFile::exists(_filename)) {
+ val = checkFile(_filename);
+ if (val != PWERR_GOOD)
+ return val;
+ } else
{
- val = creat (_filename, (S_IRUSR | S_IWUSR));
- if (val == -1)
- return PWERR_OPEN;
- else
- close(val);
- }
+ val = creat (_filename, (S_IRUSR | S_IWUSR));
+ if (val == -1)
+ return PWERR_OPEN;
+ else
+ close(val);
+ }
*/
@@ -2398,24 +2401,24 @@ int ZSafe::saveInit(const char *_filename, const char *password)
- fd = fopen (_filename, "wb");
- if (fd == NULL)
- return PWERR_OPEN;
-
- buffer = (char*)malloc(save_buffer_length);
-
- /* make the key ready */
- for (j = 0; password[j] != '\0'; j++) {
- key[j] = password[j];
- }
- keylength = j;
- krc2->rc2_expandkey (key, keylength, 128);
-
- /* First, we make the IV */
- for (count2 = 0; count2 < 4; count2++) {
- iv[count2] = rand ();
- putc ((unsigned char) (iv[count2] >> 8), fd);
- putc ((unsigned char) (iv[count2] & 0xff), fd);
- }
-
- bufferIndex = 0;
- return PWERR_GOOD;
+ fd = fopen (_filename, "wb");
+ if (fd == NULL)
+ return PWERR_OPEN;
+
+ buffer = (char*)malloc(save_buffer_length);
+
+ /* make the key ready */
+ for (j = 0; password[j] != '\0'; j++) {
+ key[j] = password[j];
+ }
+ keylength = j;
+ krc2->rc2_expandkey (key, keylength, 128);
+
+ /* First, we make the IV */
+ for (count2 = 0; count2 < 4; count2++) {
+ iv[count2] = rand ();
+ putc ((unsigned char) (iv[count2] >> 8), fd);
+ putc ((unsigned char) (iv[count2] & 0xff), fd);
+ }
+
+ bufferIndex = 0;
+ return PWERR_GOOD;
}
@@ -2425,54 +2428,54 @@ int ZSafe::saveEntry(char *entry[FIELD_SIZE])
{
- char *text1;
- int count2, count3;
- unsigned short ciphertext[4];
- Krc2* krc2 = new Krc2();
-
- buffer = (char*)memset(buffer, '\0', save_buffer_length);
-
- for (count2 = 0; count2 < FIELD_SIZE; count2++) {
- text1 = entry[count2];
- if (strlen (text1) == 0) {
- strncat(buffer, " ", strlen(" "));
- } else {
- strncat(buffer, text1, strlen(text1));
- }
- /* Use 255 as the marker. \n is too tough to test for */
- buffer[strlen (buffer)] = 255;
- } /*for (count2 = 0; count2 < 5; count2++)*/
- count2 = 0;
- /* I'm using CBC mode and encrypting the data straight from top down.
- * At the bottom, encrypted, I will append an MD5 hash of the file, eventually.
- * PKCS 5 padding (explained at the code section
- */
- while (count2 < (int)strlen (buffer)) {
+ char *text1;
+ int count2, count3;
+ unsigned short ciphertext[4];
+ Krc2* krc2 = new Krc2();
+
+ buffer = (char*)memset(buffer, '\0', save_buffer_length);
+
+ for (count2 = 0; count2 < FIELD_SIZE; count2++) {
+ text1 = entry[count2];
+ if (strlen (text1) == 0) {
+ strncat(buffer, " ", strlen(" "));
+ } else {
+ strncat(buffer, text1, strlen(text1));
+ }
+ /* Use 255 as the marker. \n is too tough to test for */
+ buffer[strlen (buffer)] = 255;
+ } /*for (count2 = 0; count2 < 5; count2++)*/
+ count2 = 0;
+ /* I'm using CBC mode and encrypting the data straight from top down.
+ * At the bottom, encrypted, I will append an MD5 hash of the file, eventually.
+ * PKCS 5 padding (explained at the code section
+ */
+ while (count2 < (int)strlen (buffer)) {
#ifndef WORDS_BIGENDIAN
- plaintext[bufferIndex] = buffer[count2 + 1] << 8;
- plaintext[bufferIndex] += buffer[count2] & 0xff;
+ plaintext[bufferIndex] = buffer[count2 + 1] << 8;
+ plaintext[bufferIndex] += buffer[count2] & 0xff;
#endif
#ifdef WORDS_BIGENDIAN
- plaintext[bufferIndex] = buffer[count2] << 8;
- plaintext[bufferIndex] += buffer[count2 + 1] & 0xff;
-#endif
- bufferIndex++;
- if (bufferIndex == 4) {
- krc2->rc2_encrypt (plaintext);
-
- for (count3 = 0; count3 < 4; count3++) {
- ciphertext[count3] = iv[count3] ^ plaintext[count3];
-
- /* Now store the ciphertext as the iv */
- iv[count3] = plaintext[count3];
-
- /* reset the buffer index */
- bufferIndex = 0;
- if (putc ((unsigned char) (ciphertext[count3] >> 8), fd) == EOF) return PWERR_DATA;
- if (putc ((unsigned char) (ciphertext[count3] & 0xff), fd) == EOF) return PWERR_DATA;
- } /*for (count3 = 0; count3 < 5; count3++)*/
- } /*if (bufferIndex == 5)*/
- /* increment a short, not a byte */
- count2 += 2;
- } /*while (count2 < strlen (buffer))*/
+ plaintext[bufferIndex] = buffer[count2] << 8;
+ plaintext[bufferIndex] += buffer[count2 + 1] & 0xff;
+#endif
+ bufferIndex++;
+ if (bufferIndex == 4) {
+ krc2->rc2_encrypt (plaintext);
+
+ for (count3 = 0; count3 < 4; count3++) {
+ ciphertext[count3] = iv[count3] ^ plaintext[count3];
+
+ /* Now store the ciphertext as the iv */
+ iv[count3] = plaintext[count3];
+
+ /* reset the buffer index */
+ bufferIndex = 0;
+ if (putc ((unsigned char) (ciphertext[count3] >> 8), fd) == EOF) return PWERR_DATA;
+ if (putc ((unsigned char) (ciphertext[count3] & 0xff), fd) == EOF) return PWERR_DATA;
+ } /*for (count3 = 0; count3 < 5; count3++)*/
+ } /*if (bufferIndex == 5)*/
+ /* increment a short, not a byte */
+ count2 += 2;
+ } /*while (count2 < strlen (buffer))*/
int ret = PWERR_GOOD;
- return ret;
+ return ret;
}
@@ -2481,30 +2484,30 @@ int ZSafe::saveFinalize(void)
{
- int count1, retval = PWERR_GOOD;
- unsigned short ciphertext[4];
- Krc2* krc2 = new Krc2();
-
- /* Tack on the PKCS 5 padding
- * How it works is we fill up the last n bytes with the value n
- *
- * So, if we have, say, 13 bytes, 8 of which are used, we have 5 left
- * over, leaving us 3 short, so we fill it in with 3's.
- *
- * If we come out even, we fill it with 8 8s
- *
- * um, except that in this instance we are using 4 shorts instead of 8 bytes.
- * so, half everything
- */
- for (count1 = bufferIndex; count1 < 4; count1++) {
- plaintext[count1] = (4 - bufferIndex);
- }
- krc2->rc2_encrypt (plaintext);
- for (count1 = 0; count1 < 4; count1++) {
- ciphertext[count1] = iv[count1] ^ plaintext[count1];
- if (putc ((unsigned char) (ciphertext[count1] >> 8), fd) == EOF) retval = PWERR_DATA;
- if (putc ((unsigned char) (ciphertext[count1] & 0xff), fd) == EOF) retval = PWERR_DATA;
- }
-
- fclose (fd);
- free(buffer);
- return retval;
+ int count1, retval = PWERR_GOOD;
+ unsigned short ciphertext[4];
+ Krc2* krc2 = new Krc2();
+
+ /* Tack on the PKCS 5 padding
+ * How it works is we fill up the last n bytes with the value n
+ *
+ * So, if we have, say, 13 bytes, 8 of which are used, we have 5 left
+ * over, leaving us 3 short, so we fill it in with 3's.
+ *
+ * If we come out even, we fill it with 8 8s
+ *
+ * um, except that in this instance we are using 4 shorts instead of 8 bytes.
+ * so, half everything
+ */
+ for (count1 = bufferIndex; count1 < 4; count1++) {
+ plaintext[count1] = (4 - bufferIndex);
+ }
+ krc2->rc2_encrypt (plaintext);
+ for (count1 = 0; count1 < 4; count1++) {
+ ciphertext[count1] = iv[count1] ^ plaintext[count1];
+ if (putc ((unsigned char) (ciphertext[count1] >> 8), fd) == EOF) retval = PWERR_DATA;
+ if (putc ((unsigned char) (ciphertext[count1] & 0xff), fd) == EOF) retval = PWERR_DATA;
+ }
+
+ fclose (fd);
+ free(buffer);
+ return retval;
}
@@ -2519,7 +2522,7 @@ void ZSafe::quitMe ()
tr("Do you want to save\nbefore exiting?"),
- tr("&Save"),
+ tr("&Save"),
tr("S&ave with\nnew\npassword"),
- tr("&Don't Save"),
+ tr("&Don't Save"),
0 // Enter == button 0
- ) )
+ ) )
{ // Escape == button 2
@@ -2531,3 +2534,3 @@ void ZSafe::quitMe ()
break;
- case 1: //
+ case 1: //
// Save with new password
@@ -2578,3 +2581,3 @@ void ZSafe::addCategory()
dialog = categoryDialog;
- connect( dialog->CategoryField,
+ connect( dialog->CategoryField,
SIGNAL( activated ( const QString &)),
@@ -2603,3 +2606,3 @@ void ZSafe::addCategory()
#endif
-#else
+#else
// read all categories from the config file and store
@@ -2622,3 +2625,3 @@ void ZSafe::addCategory()
dialog->CategoryField->clear(); // remove all items
- while( it != list.end() )
+ while( it != list.end() )
{
@@ -2626,3 +2629,3 @@ void ZSafe::addCategory()
if (cat->contains("-field1", FALSE))
- {
+ {
#ifdef DESKTOP
@@ -2632,3 +2635,3 @@ void ZSafe::addCategory()
int pos = cat->find ("-field1");
- categ = cat->left (pos);
+ categ = cat->left (pos);
#endif
@@ -2659,39 +2662,39 @@ void ZSafe::addCategory()
{
- Wait waitDialog(this, tr("Wait dialog"));
- waitDialog.waitLabel->setText(tr("Gathering icons..."));
- waitDialog.show();
- qApp->processEvents();
+ Wait waitDialog(this, tr("Wait dialog"));
+ waitDialog.waitLabel->setText(tr("Gathering icons..."));
+ waitDialog.show();
+ qApp->processEvents();
#ifdef DESKTOP
- QDir d(iconPath);
+ QDir d(iconPath);
#else
- QDir d(QPEApplication::qpeDir() + "/pics/");
+ QDir d(QPEApplication::qpeDir() + "/pics/");
#endif
- d.setFilter( QDir::Files);
+ d.setFilter( QDir::Files);
- const QFileInfoList *list = d.entryInfoList();
- QFileInfoListIterator it( *list ); // create list iterator
- QFileInfo *fi; // pointer for traversing
+ const QFileInfoList *list = d.entryInfoList();
+ QFileInfoListIterator it( *list ); // create list iterator
+ QFileInfo *fi; // pointer for traversing
- dialog->IconField->insertItem("predefined");
- while ( (fi=it.current()) ) { // for each file...
- QString fileName = fi->fileName();
- if(fileName.right(4) == ".png"){
- fileName = fileName.mid(0,fileName.length()-4);
+ dialog->IconField->insertItem("predefined");
+ while ( (fi=it.current()) ) { // for each file...
+ QString fileName = fi->fileName();
+ if(fileName.right(4) == ".png"){
+ fileName = fileName.mid(0,fileName.length()-4);
#ifdef DESKTOP
- QPixmap imageOfFile;
+ QPixmap imageOfFile;
imageOfFile.load(iconPath + fi->fileName());
#else
- QPixmap imageOfFile(Resource::loadPixmap(fileName));
-#endif
- QImage foo = imageOfFile.convertToImage();
- foo = foo.smoothScale(16,16);
- imageOfFile.convertFromImage(foo);
- dialog->IconField->insertItem(imageOfFile,fileName);
- }
- ++it;
- }
- waitDialog.hide();
+ QPixmap imageOfFile(Resource::loadPixmap(fileName));
+#endif
+ QImage foo = imageOfFile.convertToImage();
+ foo = foo.smoothScale(16,16);
+ imageOfFile.convertFromImage(foo);
+ dialog->IconField->insertItem(imageOfFile,fileName);
+ }
+ ++it;
+ }
+ waitDialog.hide();
}
-
+
#ifndef WIN32
@@ -2729,3 +2732,3 @@ void ZSafe::addCategory()
pix = new QPixmap (fullIconPath);
- // pix->resize(14, 14);
+ // pix->resize(14, 14);
if (pix)
@@ -2778,3 +2781,3 @@ void ZSafe::delCategory()
tr("Do you want to delete?"),
- tr("&Delete"), tr("D&on't Delete"),
+ tr("&Delete"), tr("D&on't Delete"),
0 // Enter == button 0
@@ -2819,3 +2822,3 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog)
QString icon;
- if (selectedItem)
+ if (selectedItem)
{
@@ -2847,12 +2850,12 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog)
#ifdef DESKTOP
- QDir d(iconPath);
+ QDir d(iconPath);
#else
- QDir d(QPEApplication::qpeDir() + "/pics/");
+ QDir d(QPEApplication::qpeDir() + "/pics/");
#endif
- d.setFilter( QDir::Files);
+ d.setFilter( QDir::Files);
- const QFileInfoList *list = d.entryInfoList();
- int i=0;
- QFileInfoListIterator it( *list ); // create list iterator
- QFileInfo *fi; // pointer for traversing
+ const QFileInfoList *list = d.entryInfoList();
+ int i=0;
+ QFileInfoListIterator it( *list ); // create list iterator
+ QFileInfo *fi; // pointer for traversing
if (icon.isEmpty() || icon.isNull())
@@ -2863,10 +2866,10 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog)
{
- while ( (fi=it.current()) )
+ while ( (fi=it.current()) )
{ // for each file...
- QString fileName = fi->fileName();
- if(fileName.right(4) == ".png")
+ QString fileName = fi->fileName();
+ if(fileName.right(4) == ".png")
{
- fileName = fileName.mid(0,fileName.length()-4);
+ fileName = fileName.mid(0,fileName.length()-4);
- if(fileName+".png"==icon)
+ if(fileName+".png"==icon)
{
@@ -2875,7 +2878,7 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog)
}
- ++i;
- }
- ++it;
- }
- }
+ ++i;
+ }
+ ++it;
+ }
+ }
}
@@ -2904,12 +2907,12 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category)
#ifdef DESKTOP
- QDir d(iconPath);
+ QDir d(iconPath);
#else
- QDir d(QPEApplication::qpeDir() + "/pics/");
+ QDir d(QPEApplication::qpeDir() + "/pics/");
#endif
- d.setFilter( QDir::Files);
+ d.setFilter( QDir::Files);
- const QFileInfoList *list = d.entryInfoList();
- int i=0;
- QFileInfoListIterator it( *list ); // create list iterator
- QFileInfo *fi; // pointer for traversing
+ const QFileInfoList *list = d.entryInfoList();
+ int i=0;
+ QFileInfoListIterator it( *list ); // create list iterator
+ QFileInfo *fi; // pointer for traversing
if (icon.isEmpty() || icon.isNull())
@@ -2920,10 +2923,10 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category)
{
- while ( (fi=it.current()) )
+ while ( (fi=it.current()) )
{ // for each file...
- QString fileName = fi->fileName();
- if(fileName.right(4) == ".png")
+ QString fileName = fi->fileName();
+ if(fileName.right(4) == ".png")
{
- fileName = fileName.mid(0,fileName.length()-4);
+ fileName = fileName.mid(0,fileName.length()-4);
- if(fileName+".png"==icon)
+ if(fileName+".png"==icon)
{
@@ -2932,7 +2935,7 @@ void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category)
}
- ++i;
- }
- ++it;
- }
- }
+ ++i;
+ }
+ ++it;
+ }
+ }
}
@@ -2985,3 +2988,3 @@ void ZSafe::editCategory()
dialog = categoryDialog;
- connect( dialog->CategoryField,
+ connect( dialog->CategoryField,
SIGNAL( activated ( const QString &)),
@@ -3031,3 +3034,3 @@ void ZSafe::editCategory()
bool foundCategory = false;
- while( it != list.end() )
+ while( it != list.end() )
{
@@ -3035,3 +3038,3 @@ void ZSafe::editCategory()
if (cat->contains("-field1", FALSE))
- {
+ {
#ifdef DESKTOP
@@ -3040,4 +3043,4 @@ void ZSafe::editCategory()
#else
- int pos = cat->find ("-field1");
- categ = cat->left (pos);
+ int pos = cat->find ("-field1");
+ categ = cat->left (pos);
#endif
@@ -3077,18 +3080,18 @@ void ZSafe::editCategory()
- Wait waitDialog(this, tr("Wait dialog"));
- waitDialog.waitLabel->setText(tr("Gathering icons..."));
- waitDialog.show();
- qApp->processEvents();
+ Wait waitDialog(this, tr("Wait dialog"));
+ waitDialog.waitLabel->setText(tr("Gathering icons..."));
+ waitDialog.show();
+ qApp->processEvents();
#ifdef DESKTOP
- QDir d(iconPath);
+ QDir d(iconPath);
#else
- QDir d(QPEApplication::qpeDir() + "/pics/");
+ QDir d(QPEApplication::qpeDir() + "/pics/");
#endif
- d.setFilter( QDir::Files);
+ d.setFilter( QDir::Files);
- const QFileInfoList *list = d.entryInfoList();
- int i=0;
- QFileInfoListIterator it( *list ); // create list iterator
- QFileInfo *fi; // pointer for traversing
+ const QFileInfoList *list = d.entryInfoList();
+ int i=0;
+ QFileInfoListIterator it( *list ); // create list iterator
+ QFileInfo *fi; // pointer for traversing
if (icon.isEmpty() || icon.isNull())
@@ -3098,25 +3101,25 @@ void ZSafe::editCategory()
- dialog->IconField->insertItem("predefined");
- while ( (fi=it.current()) ) { // for each file...
- QString fileName = fi->fileName();
- if(fileName.right(4) == ".png")
+ dialog->IconField->insertItem("predefined");
+ while ( (fi=it.current()) ) { // for each file...
+ QString fileName = fi->fileName();
+ if(fileName.right(4) == ".png")
{
- fileName = fileName.mid(0,fileName.length()-4);
+ fileName = fileName.mid(0,fileName.length()-4);
#ifdef DESKTOP
- QPixmap imageOfFile;
+ QPixmap imageOfFile;
imageOfFile.load(iconPath + fi->fileName());
#else
- QPixmap imageOfFile(Resource::loadPixmap(fileName));
+ QPixmap imageOfFile(Resource::loadPixmap(fileName));
#endif
- QImage foo = imageOfFile.convertToImage();
- foo = foo.smoothScale(16,16);
- imageOfFile.convertFromImage(foo);
- dialog->IconField->insertItem(imageOfFile,fileName);
- if(fileName+".png"==icon)
+ QImage foo = imageOfFile.convertToImage();
+ foo = foo.smoothScale(16,16);
+ imageOfFile.convertFromImage(foo);
+ dialog->IconField->insertItem(imageOfFile,fileName);
+ if(fileName+".png"==icon)
dialog->IconField->setCurrentItem(i+1);
- ++i;
- }
- ++it;
- }
- waitDialog.hide();
+ ++i;
+ }
+ ++it;
+ }
+ waitDialog.hide();
}
@@ -3125,13 +3128,13 @@ void ZSafe::editCategory()
#ifdef DESKTOP
- // QDir d(QDir::homeDirPath() + "/pics/");
- QDir d(iconPath);
+ // QDir d(QDir::homeDirPath() + "/pics/");
+ QDir d(iconPath);
#else
- QDir d(QPEApplication::qpeDir() + "/pics/");
+ QDir d(QPEApplication::qpeDir() + "/pics/");
#endif
- d.setFilter( QDir::Files);
+ d.setFilter( QDir::Files);
- const QFileInfoList *list = d.entryInfoList();
- int i=0;
- QFileInfoListIterator it( *list ); // create list iterator
- QFileInfo *fi; // pointer for traversing
+ const QFileInfoList *list = d.entryInfoList();
+ int i=0;
+ QFileInfoListIterator it( *list ); // create list iterator
+ QFileInfo *fi; // pointer for traversing
if (icon.isEmpty() || icon.isNull())
@@ -3143,11 +3146,11 @@ void ZSafe::editCategory()
- while ( (fi=it.current()) )
+ while ( (fi=it.current()) )
{ // for each file...
- QString fileName = fi->fileName();
- if(fileName.right(4) == ".png")
+ QString fileName = fi->fileName();
+ if(fileName.right(4) == ".png")
{
- fileName = fileName.mid(0,fileName.length()-4);
+ fileName = fileName.mid(0,fileName.length()-4);
- if(fileName+".png"==icon)
+ if(fileName+".png"==icon)
{
@@ -3156,7 +3159,7 @@ void ZSafe::editCategory()
}
- ++i;
- }
- ++it;
- }
- }
+ ++i;
+ }
+ ++it;
+ }
+ }
}
@@ -3332,3 +3335,3 @@ void ZSafe::newDocument()
#else
- QString newFile = ScQtFileEdit::getSaveAsFileName(this,
+ QString newFile = ScQtFileEdit::getSaveAsFileName(this,
tr ("Create new ZSafe document"),
@@ -3339,3 +3342,3 @@ void ZSafe::newDocument()
QString newFile = QFileDialog::getSaveFileName(
- QDir::homeDirPath() + "/Documents/application/zsafe",
+ QDir::homeDirPath() + "/Documents/application/zsafe",
"ZSafe (*.zsf)",
@@ -3397,3 +3400,3 @@ void ZSafe::newDocument()
- QMessageBox::information( this, tr("ZSafe"),
+ QMessageBox::information( this, tr("ZSafe"),
tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0);
@@ -3420,3 +3423,3 @@ void ZSafe::loadDocument()
#else
- QString newFile = ScQtFileEdit::getOpenFileName(this,
+ QString newFile = ScQtFileEdit::getOpenFileName(this,
tr ("Open ZSafe document"),
@@ -3427,3 +3430,3 @@ void ZSafe::loadDocument()
QString newFile = QFileDialog::getOpenFileName(
- QDir::homeDirPath() + "/Documents/application/zsafe",
+ QDir::homeDirPath() + "/Documents/application/zsafe",
"ZSafe (*.zsf)",
@@ -3498,3 +3501,3 @@ void ZSafe::saveDocumentAs()
#else
- QString newFile = ScQtFileEdit::getSaveAsFileName(this,
+ QString newFile = ScQtFileEdit::getSaveAsFileName(this,
tr ("Save ZSafe document as.."),
@@ -3506,3 +3509,3 @@ void ZSafe::saveDocumentAs()
QString newFile = QFileDialog::getSaveFileName(
- QDir::homeDirPath() + "/Documents/application/zsafe",
+ QDir::homeDirPath() + "/Documents/application/zsafe",
"ZSafe (*.zsf)",
@@ -3533,3 +3536,3 @@ void ZSafe::saveDocumentAs()
- QMessageBox::information( this, tr("ZSafe"),
+ QMessageBox::information( this, tr("ZSafe"),
tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0);
@@ -3624,3 +3627,3 @@ void ZSafe::paintEvent( QPaintEvent * )
-void ZSafe::resizeEvent ( QResizeEvent * )
+void ZSafe::resizeEvent ( QResizeEvent * )
{
@@ -3636,9 +3639,9 @@ void ZSafe::resizeEvent ( QResizeEvent * )
if (New)
- New->setGeometry ( QRect( DeskW-84, 2, 20, 20 ) );
+ New->setGeometry ( QRect( DeskW-84, 2, 20, 20 ) );
if (Edit)
- Edit->setGeometry ( QRect( DeskW-64, 2, 20, 20 ) );
+ Edit->setGeometry ( QRect( DeskW-64, 2, 20, 20 ) );
if (Delete)
- Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) );
+ Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) );
if (Find)
- Find->setGeometry ( QRect( DeskW-24, 2, 20, 20 ) );
+ Find->setGeometry ( QRect( DeskW-24, 2, 20, 20 ) );
}
@@ -3724,3 +3727,3 @@ void ZSafe::setDocument(const QString& fileref)
selectedItem = NULL;
-
+
openDocument(filename);
diff --git a/noncore/apps/zsafe/zsafe.pro b/noncore/apps/zsafe/zsafe.pro
index 65bcb79..1e8e4ac 100644
--- a/noncore/apps/zsafe/zsafe.pro
+++ b/noncore/apps/zsafe/zsafe.pro
@@ -1,6 +1,6 @@
-TEMPLATE = app
-CONFIG = qt warn_on release
+TEMPLATE = app
+CONFIG = qt warn_on release
DESTDIR = $(OPIEDIR)/bin
HEADERS = zsafe.h krc2.h category.h categorylist.h zlistview.h \
- scqtfiledlg.h
+ scqtfiledlg.h
SOURCES = main.cpp zsafe.cpp krc2.cpp category.cpp \
@@ -9,7 +9,7 @@ SOURCES = main.cpp zsafe.cpp krc2.cpp category.cpp \
scqtfiledlg.cpp
-INTERFACES = newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui infoform.ui wait.ui
-INCLUDEPATH += $(OPIEDIR)/include
-DEPENDPATH += $(OPIEDIR)/include
-LIBS += -Wl,-rpath,$(OPIEDIR)/lib -L$(OPIEDIR)/lib -lqpe -lopie
-TARGET = zsafe
+INTERFACES = newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui infoform.ui wait.ui
+INCLUDEPATH += $(OPIEDIR)/include
+DEPENDPATH += $(OPIEDIR)/include
+LIBS += -Wl,-rpath,$(OPIEDIR)/lib -L$(OPIEDIR)/lib -lqpe -lopieui2
+TARGET = zsafe