-rw-r--r-- | noncore/apps/zsafe/zsafe.cpp | 104 |
1 files changed, 94 insertions, 10 deletions
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp index 5cad7cb..824b841 100644 --- a/noncore/apps/zsafe/zsafe.cpp +++ b/noncore/apps/zsafe/zsafe.cpp | |||
@@ -929,7 +929,11 @@ void ZSafe::findPwd() | |||
929 | name = dialog->NameField->text(); | 929 | name = dialog->NameField->text(); |
930 | username = dialog->UsernameField->text(); | 930 | username = dialog->UsernameField->text(); |
931 | comment = dialog->CommentField->text(); | 931 | comment = dialog->CommentField->text(); |
932 | owarn << name << oendl; | 932 | #ifndef NO_OPIE |
933 | owarn << name << oendl; | ||
934 | #else | ||
935 | qWarning (name); | ||
936 | #endif | ||
933 | } | 937 | } |
934 | else | 938 | else |
935 | { | 939 | { |
@@ -975,7 +979,9 @@ void ZSafe::findPwd() | |||
975 | i != NULL; | 979 | i != NULL; |
976 | i = i->nextSibling()) | 980 | i = i->nextSibling()) |
977 | { | 981 | { |
982 | #ifndef NO_OPIE | ||
978 | owarn << i->text(0) << oendl; | 983 | owarn << i->text(0) << oendl; |
984 | #endif | ||
979 | i->setSelected(FALSE); | 985 | i->setSelected(FALSE); |
980 | 986 | ||
981 | // step through all subitems | 987 | // step through all subitems |
@@ -989,7 +995,11 @@ void ZSafe::findPwd() | |||
989 | si != NULL; | 995 | si != NULL; |
990 | si = si->nextSibling()) | 996 | si = si->nextSibling()) |
991 | { | 997 | { |
998 | #ifndef NO_OPIE | ||
992 | owarn << si->text(0) << oendl; | 999 | owarn << si->text(0) << oendl; |
1000 | #else | ||
1001 | qWarning (si->text(0)); | ||
1002 | #endif | ||
993 | if (si->isSelected()) | 1003 | if (si->isSelected()) |
994 | si->setSelected(FALSE); | 1004 | si->setSelected(FALSE); |
995 | // ListView->repaintItem(si); | 1005 | // ListView->repaintItem(si); |
@@ -1006,7 +1016,11 @@ void ZSafe::findPwd() | |||
1006 | 1016 | ||
1007 | if ((n && u && c ) && !found) | 1017 | if ((n && u && c ) && !found) |
1008 | { | 1018 | { |
1019 | #ifndef NO_OPIE | ||
1009 | owarn << "Found" << oendl; | 1020 | owarn << "Found" << oendl; |
1021 | #else | ||
1022 | qWarning ("Found"); | ||
1023 | #endif | ||
1010 | selectedItem = si; | 1024 | selectedItem = si; |
1011 | si->setSelected(TRUE); | 1025 | si->setSelected(TRUE); |
1012 | ListView->setCurrentItem(si); | 1026 | ListView->setCurrentItem(si); |
@@ -1276,7 +1290,11 @@ void ZSafe::removeAsciiFile() | |||
1276 | QFile f( fn ); | 1290 | QFile f( fn ); |
1277 | if ( !f.remove() ) | 1291 | if ( !f.remove() ) |
1278 | { | 1292 | { |
1293 | #ifndef NO_OPIE | ||
1279 | owarn << "Could not remove file " << fn << oendl; | 1294 | owarn << "Could not remove file " << fn << oendl; |
1295 | #else | ||
1296 | qWarning( QString("Could not remove file %1").arg(fn),2000 ); | ||
1297 | #endif | ||
1280 | QMessageBox::critical( 0, tr("ZSafe"), | 1298 | QMessageBox::critical( 0, tr("ZSafe"), |
1281 | tr("Could not remove text file.") ); | 1299 | tr("Could not remove text file.") ); |
1282 | return; | 1300 | return; |
@@ -1325,7 +1343,11 @@ void ZSafe::writeAllEntries() | |||
1325 | { | 1343 | { |
1326 | QFile f( fn ); | 1344 | QFile f( fn ); |
1327 | if ( !f.open( IO_WriteOnly ) ) { | 1345 | if ( !f.open( IO_WriteOnly ) ) { |
1346 | #ifndef NO_OPIE | ||
1328 | owarn << "Could not write to file " << fn << oendl; | 1347 | owarn << "Could not write to file " << fn << oendl; |
1348 | #else | ||
1349 | qWarning( QString("Could not write to file %1").arg(fn),2000 ); | ||
1350 | #endif | ||
1329 | QMessageBox::critical( 0, "ZSafe", | 1351 | QMessageBox::critical( 0, "ZSafe", |
1330 | QString("Could not export to text file.") ); | 1352 | QString("Could not export to text file.") ); |
1331 | return; | 1353 | return; |
@@ -1419,7 +1441,11 @@ void ZSafe::readAllEntries() | |||
1419 | QFile f( fn ); | 1441 | QFile f( fn ); |
1420 | if ( !f.open( IO_ReadOnly ) ) | 1442 | if ( !f.open( IO_ReadOnly ) ) |
1421 | { | 1443 | { |
1444 | #ifndef NO_OPIE | ||
1422 | owarn << "Could not read file " << fn << oendl; | 1445 | owarn << "Could not read file " << fn << oendl; |
1446 | #else | ||
1447 | qWarning( QString("Could not read file %1").arg(fn), 2000 ); | ||
1448 | #endif | ||
1423 | QMessageBox::critical( 0, "ZSafe", | 1449 | QMessageBox::critical( 0, "ZSafe", |
1424 | QString("Could not import text file.") ); | 1450 | QString("Could not import text file.") ); |
1425 | return; | 1451 | return; |
@@ -1448,8 +1474,12 @@ void ZSafe::readAllEntries() | |||
1448 | } | 1474 | } |
1449 | } | 1475 | } |
1450 | 1476 | ||
1477 | #ifndef NO_OPIE | ||
1451 | owarn << "ReadAllEntries(): " << oendl; | 1478 | owarn << "ReadAllEntries(): " << oendl; |
1452 | 1479 | #else | |
1480 | qWarning ("ReadAllEntries(): "); | ||
1481 | #endif | ||
1482 | |||
1453 | QTextStream t(&f); | 1483 | QTextStream t(&f); |
1454 | while ( !t.eof() ) | 1484 | while ( !t.eof() ) |
1455 | { | 1485 | { |
@@ -1595,11 +1625,22 @@ void ZSafe::readAllEntries() | |||
1595 | #ifdef UNUSED | 1625 | #ifdef UNUSED |
1596 | void ZSafe::writeAllEntries() | 1626 | void ZSafe::writeAllEntries() |
1597 | { | 1627 | { |
1628 | if (filename.isEmpty()) | ||
1629 | { | ||
1630 | QMessageBox::critical( 0, tr("ZSafe"), | ||
1631 | tr("<P>No document defined. You have to create a new document</P>")); | ||
1632 | return; | ||
1633 | } | ||
1634 | |||
1598 | // open the file for writing | 1635 | // open the file for writing |
1599 | QString fn = filename + ".txt"; | 1636 | QString fn = filename + ".txt"; |
1600 | QFile f( fn ); | 1637 | QFile f( fn ); |
1601 | if ( !f.open( IO_WriteOnly ) ) { | 1638 | if ( !f.open( IO_WriteOnly ) ) { |
1639 | #ifndef NO_OPIE | ||
1602 | owarn << "Could not write to file " << fn << oendl; | 1640 | owarn << "Could not write to file " << fn << oendl; |
1641 | #else | ||
1642 | qWarning( QString("Could not write to file %1").arg(fn), 2000 ); | ||
1643 | #endif | ||
1603 | QMessageBox::critical( 0, tr("ZSafe"), | 1644 | QMessageBox::critical( 0, tr("ZSafe"), |
1604 | tr("Could not export to text file.") ); | 1645 | tr("Could not export to text file.") ); |
1605 | return; | 1646 | return; |
@@ -1652,7 +1693,11 @@ void ZSafe::readAllEntries() | |||
1652 | QFile f( fn ); | 1693 | QFile f( fn ); |
1653 | if ( !f.open( IO_ReadOnly ) ) | 1694 | if ( !f.open( IO_ReadOnly ) ) |
1654 | { | 1695 | { |
1696 | #ifndef NO_OPIE | ||
1655 | owarn << "Could not read file " << fn << oendl; | 1697 | owarn << "Could not read file " << fn << oendl; |
1698 | #else | ||
1699 | qWarning( QString("Could not read file %1").arg(fn), 2000 ); | ||
1700 | #endif | ||
1656 | QMessageBox::critical( 0, tr("ZSafe"), | 1701 | QMessageBox::critical( 0, tr("ZSafe"), |
1657 | tr("Could not import text file.") ); | 1702 | tr("Could not import text file.") ); |
1658 | return; | 1703 | return; |
@@ -1681,8 +1726,11 @@ void ZSafe::readAllEntries() | |||
1681 | } | 1726 | } |
1682 | } | 1727 | } |
1683 | 1728 | ||
1729 | #ifndef NO_OPIE | ||
1684 | owarn << "ReadAllEntries(): " << oendl; | 1730 | owarn << "ReadAllEntries(): " << oendl; |
1685 | 1731 | #else | |
1732 | qWarning ("ReadAllEntries(): "); | ||
1733 | #endif | ||
1686 | QTextStream t(&f); | 1734 | QTextStream t(&f); |
1687 | while ( !t.eof() ) | 1735 | while ( !t.eof() ) |
1688 | { | 1736 | { |
@@ -1805,8 +1853,10 @@ void ZSafe::readAllEntries() | |||
1805 | 1853 | ||
1806 | void ZSafe::resume(int) | 1854 | void ZSafe::resume(int) |
1807 | { | 1855 | { |
1856 | #ifndef NO_OPIE | ||
1808 | owarn << "Resume" << oendl; | 1857 | owarn << "Resume" << oendl; |
1809 | // hide the main window | 1858 | #endif |
1859 | // hide the main window | ||
1810 | 1860 | ||
1811 | if ( !showpwd ) | 1861 | if ( !showpwd ) |
1812 | { | 1862 | { |
@@ -1864,7 +1914,11 @@ bool ZSafe::openDocument(const char* _filename, const char* ) | |||
1864 | getDocPassword(tr("Enter Password")); | 1914 | getDocPassword(tr("Enter Password")); |
1865 | if (m_password.isEmpty() && validationFlag == 0) | 1915 | if (m_password.isEmpty() && validationFlag == 0) |
1866 | { | 1916 | { |
1917 | #ifndef NO_OPIE | ||
1867 | owarn << "Wrong password" << oendl; | 1918 | owarn << "Wrong password" << oendl; |
1919 | #else | ||
1920 | qWarning ("Wrong password"); | ||
1921 | #endif | ||
1868 | QMessageBox::critical( 0, tr("ZSafe"), | 1922 | QMessageBox::critical( 0, tr("ZSafe"), |
1869 | tr("Wrong password.\n\nZSafe will now exit.") ); | 1923 | tr("Wrong password.\n\nZSafe will now exit.") ); |
1870 | exitZs (1); | 1924 | exitZs (1); |
@@ -1873,8 +1927,12 @@ bool ZSafe::openDocument(const char* _filename, const char* ) | |||
1873 | retval = loadInit(_filename, m_password); | 1927 | retval = loadInit(_filename, m_password); |
1874 | if (retval != PWERR_GOOD) | 1928 | if (retval != PWERR_GOOD) |
1875 | { | 1929 | { |
1930 | #ifndef NO_OPIE | ||
1876 | owarn << "Error loading Document" << oendl; | 1931 | owarn << "Error loading Document" << oendl; |
1877 | return false; | 1932 | #lese |
1933 | qWarning ("Error loading Document"); | ||
1934 | #endif | ||
1935 | return false; | ||
1878 | } | 1936 | } |
1879 | } | 1937 | } |
1880 | else | 1938 | else |
@@ -2273,7 +2331,11 @@ bool ZSafe::saveDocument(const char* _filename, | |||
2273 | retval = saveEntry(entry); | 2331 | retval = saveEntry(entry); |
2274 | for (int z=0; z<i; z++) free(entry[z]); | 2332 | for (int z=0; z<i; z++) free(entry[z]); |
2275 | if (retval == PWERR_DATA) { | 2333 | if (retval == PWERR_DATA) { |
2334 | #ifndef NO_OPIE | ||
2276 | owarn << "1: Error writing file, contents not saved" << oendl; | 2335 | owarn << "1: Error writing file, contents not saved" << oendl; |
2336 | #else | ||
2337 | qWarning("1: Error writing file, contents not saved"); | ||
2338 | #endif | ||
2277 | saveFinalize(); | 2339 | saveFinalize(); |
2278 | return false; | 2340 | return false; |
2279 | } | 2341 | } |
@@ -2317,7 +2379,11 @@ bool ZSafe::saveDocument(const char* _filename, | |||
2317 | free(entry[z]); | 2379 | free(entry[z]); |
2318 | } | 2380 | } |
2319 | if (retval == PWERR_DATA) { | 2381 | if (retval == PWERR_DATA) { |
2382 | #ifndef NO_OPIE | ||
2320 | owarn << "1: Error writing file, contents not saved" << oendl; | 2383 | owarn << "1: Error writing file, contents not saved" << oendl; |
2384 | #else | ||
2385 | qWarning("1: Error writing file, contents not saved"); | ||
2386 | #endif | ||
2321 | saveFinalize(); | 2387 | saveFinalize(); |
2322 | return false; | 2388 | return false; |
2323 | } | 2389 | } |
@@ -2326,8 +2392,12 @@ bool ZSafe::saveDocument(const char* _filename, | |||
2326 | } | 2392 | } |
2327 | 2393 | ||
2328 | if (saveFinalize() == PWERR_DATA) { | 2394 | if (saveFinalize() == PWERR_DATA) { |
2395 | #ifndef NO_OPIE | ||
2329 | owarn << "2: Error writing file, contents not saved" << oendl; | 2396 | owarn << "2: Error writing file, contents not saved" << oendl; |
2330 | return false; | 2397 | #else |
2398 | qWarning("2: Error writing file, contents not saved"); | ||
2399 | #endif | ||
2400 | return false; | ||
2331 | } else { | 2401 | } else { |
2332 | #ifndef DESKTOP | 2402 | #ifndef DESKTOP |
2333 | Global::statusMessage (tr("Password file saved.")); | 2403 | Global::statusMessage (tr("Password file saved.")); |
@@ -2347,8 +2417,10 @@ void ZSafe::setPasswordDialogDone() | |||
2347 | 2417 | ||
2348 | void ZSafe::getDocPassword(QString title) | 2418 | void ZSafe::getDocPassword(QString title) |
2349 | { | 2419 | { |
2420 | #ifndef NO_OPIE | ||
2350 | owarn << "getDocPassword" << oendl; | 2421 | owarn << "getDocPassword" << oendl; |
2351 | // open the 'Password' dialog | 2422 | #endif |
2423 | // open the 'Password' dialog | ||
2352 | PasswordForm *dialog = new PasswordForm(this, title, TRUE); | 2424 | PasswordForm *dialog = new PasswordForm(this, title, TRUE); |
2353 | newPwdDialog = dialog; | 2425 | newPwdDialog = dialog; |
2354 | newPwdDialogResult = false; | 2426 | newPwdDialogResult = false; |
@@ -2529,8 +2601,10 @@ int ZSafe::saveFinalize(void) | |||
2529 | 2601 | ||
2530 | void ZSafe::quitMe () | 2602 | void ZSafe::quitMe () |
2531 | { | 2603 | { |
2604 | #ifndef NO_OPIE | ||
2532 | owarn << "QUIT..." << oendl; | 2605 | owarn << "QUIT..." << oendl; |
2533 | 2606 | #endif | |
2607 | |||
2534 | if (modified) | 2608 | if (modified) |
2535 | { | 2609 | { |
2536 | switch( QMessageBox::information( this, tr("ZSafe"), | 2610 | switch( QMessageBox::information( this, tr("ZSafe"), |
@@ -2733,8 +2807,10 @@ void ZSafe::addCategory() | |||
2733 | category = dialog->CategoryField->currentText(); | 2807 | category = dialog->CategoryField->currentText(); |
2734 | icon = dialog->IconField->currentText()+".png"; | 2808 | icon = dialog->IconField->currentText()+".png"; |
2735 | 2809 | ||
2810 | #ifndef NO_OPIE | ||
2736 | owarn << category << oendl; | 2811 | owarn << category << oendl; |
2737 | 2812 | #endif | |
2813 | |||
2738 | QListViewItem *li = new ShadedListItem( 1, ListView ); | 2814 | QListViewItem *li = new ShadedListItem( 1, ListView ); |
2739 | Category *c1 = new Category(); | 2815 | Category *c1 = new Category(); |
2740 | c1->setCategoryName(category); | 2816 | c1->setCategoryName(category); |
@@ -3207,8 +3283,12 @@ void ZSafe::editCategory() | |||
3207 | 3283 | ||
3208 | if (cat) | 3284 | if (cat) |
3209 | { | 3285 | { |
3286 | #ifndef NO_OPIE | ||
3210 | owarn << "Category found" << oendl; | 3287 | owarn << "Category found" << oendl; |
3211 | 3288 | #else | |
3289 | qWarning("Category found"); | ||
3290 | #endif | ||
3291 | |||
3212 | // if (!icon.isEmpty() && !icon.isNull()) | 3292 | // if (!icon.isEmpty() && !icon.isNull()) |
3213 | if (icon != "predefined.png") | 3293 | if (icon != "predefined.png") |
3214 | { | 3294 | { |
@@ -3241,7 +3321,11 @@ void ZSafe::editCategory() | |||
3241 | QListViewItem *catItem = cat->getListItem(); | 3321 | QListViewItem *catItem = cat->getListItem(); |
3242 | if (catItem) | 3322 | if (catItem) |
3243 | { | 3323 | { |
3324 | #ifndef NO_OPIE | ||
3244 | owarn << category << oendl; | 3325 | owarn << category << oendl; |
3326 | #else | ||
3327 | qWarning (category); | ||
3328 | #endif | ||
3245 | catItem->setText( 0, tr( category ) ); | 3329 | catItem->setText( 0, tr( category ) ); |
3246 | cat->setCategoryName (tr(category)); | 3330 | cat->setCategoryName (tr(category)); |
3247 | 3331 | ||