summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-23 17:05:41 (UTC)
committer zautrix <zautrix>2004-10-23 17:05:41 (UTC)
commit13d274c37baaae48a1c93081077cf3035459c6a8 (patch) (unidiff)
treecf49d1c5bec1fb4cd8bbd7fc9a007304634676a8
parentfbdad188bd7048148cc60c90325efcccb0417060 (diff)
downloadkdepimpi-13d274c37baaae48a1c93081077cf3035459c6a8.zip
kdepimpi-13d274c37baaae48a1c93081077cf3035459c6a8.tar.gz
kdepimpi-13d274c37baaae48a1c93081077cf3035459c6a8.tar.bz2
made pwm compile on windows. now the cryptolibs are still missing
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/blowfish.h11
-rw-r--r--pwmanager/pwmanager/gpasmanfile.cpp16
-rw-r--r--pwmanager/pwmanager/htmlgen.cpp2
-rw-r--r--pwmanager/pwmanager/ipc.cpp7
-rw-r--r--pwmanager/pwmanager/ipc.h5
-rw-r--r--pwmanager/pwmanager/libgcryptif.h7
-rw-r--r--pwmanager/pwmanager/pwm.cpp1
-rw-r--r--pwmanager/pwmanager/pwmanager.pro2
-rw-r--r--pwmanager/pwmanager/pwmdoc.cpp9
-rw-r--r--pwmanager/pwmanager/spinforsignal.h2
10 files changed, 50 insertions, 12 deletions
diff --git a/pwmanager/pwmanager/blowfish.h b/pwmanager/pwmanager/blowfish.h
index c05de77..5129eab 100644
--- a/pwmanager/pwmanager/blowfish.h
+++ b/pwmanager/pwmanager/blowfish.h
@@ -3,58 +3,67 @@
3 * copyright (C) 2003, 2004 by Michael Buesch * 3 * copyright (C) 2003, 2004 by Michael Buesch *
4 * email: mbuesch@freenet.de * 4 * email: mbuesch@freenet.de *
5 * * 5 * *
6 * blowfish.c - Blowfish encryption * 6 * blowfish.c - Blowfish encryption *
7 * Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc. * 7 * Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc. *
8 * * 8 * *
9 * This program is free software; you can redistribute it and/or modify * 9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License version 2 * 10 * it under the terms of the GNU General Public License version 2 *
11 * as published by the Free Software Foundation. * 11 * as published by the Free Software Foundation. *
12 * * 12 * *
13 ***************************************************************************/ 13 ***************************************************************************/
14 14
15/*************************************************************************** 15/***************************************************************************
16 * copyright (C) 2004 by Ulf Schenk 16 * copyright (C) 2004 by Ulf Schenk
17 * This file is originaly based on version 1.0.1 of pwmanager 17 * This file is originaly based on version 1.0.1 of pwmanager
18 * and was modified to run on embedded devices that run microkde 18 * and was modified to run on embedded devices that run microkde
19 * 19 *
20 * $Id$ 20 * $Id$
21 **************************************************************************/ 21 **************************************************************************/
22 22
23#ifndef BLOWFISH_H 23#ifndef BLOWFISH_H
24#define BLOWFISH_H 24#define BLOWFISH_H
25 25
26#include "pwmexception.h" 26#include "pwmexception.h"
27 27#ifndef _WIN32_
28#include <stdint.h> 28#include <stdint.h>
29#else
30
31#endif
29#include <string> 32#include <string>
30using std::string; 33using std::string;
31 34
32 #define BLOWFISH_BLOCKSIZE8 35 #define BLOWFISH_BLOCKSIZE8
33 #define BLOWFISH_ROUNDS 16 36 #define BLOWFISH_ROUNDS 16
34 #define CIPHER_ALGO_BLOWFISH 4/* blowfish 128 bit key */ 37 #define CIPHER_ALGO_BLOWFISH 4/* blowfish 128 bit key */
35 38
39#ifndef _WIN32_
36 typedef uint8_t byte; 40 typedef uint8_t byte;
41#else
42#define uint8_t Q_UINT8
43#define byte Q_UINT8
44#define uint32_t Q_UINT32
45#endif
37 46
38/** blowfish encryption algorithm. 47/** blowfish encryption algorithm.
39 * Derived from libgcrypt-1.1.12 48 * Derived from libgcrypt-1.1.12
40 */ 49 */
41class Blowfish 50class Blowfish
42{ 51{
43 struct BLOWFISH_context 52 struct BLOWFISH_context
44 { 53 {
45 uint32_t s0[256]; 54 uint32_t s0[256];
46 uint32_t s1[256]; 55 uint32_t s1[256];
47 uint32_t s2[256]; 56 uint32_t s2[256];
48 uint32_t s3[256]; 57 uint32_t s3[256];
49 uint32_t p[BLOWFISH_ROUNDS+2]; 58 uint32_t p[BLOWFISH_ROUNDS+2];
50 }; 59 };
51 60
52public: 61public:
53 Blowfish() {} 62 Blowfish() {}
54 static bool selfTest(); 63 static bool selfTest();
55 64
56 /** set key to encrypt. if return == 1, it is a weak key. */ 65 /** set key to encrypt. if return == 1, it is a weak key. */
57 int bf_setkey( byte *key, unsigned int keylen ); 66 int bf_setkey( byte *key, unsigned int keylen );
58 /** encrypt inbuf and return it in outbuf. 67 /** encrypt inbuf and return it in outbuf.
59 * inbuf and outbuf have to be: buf % 8 == 0 68 * inbuf and outbuf have to be: buf % 8 == 0
60 * You may check this with getPaddedLen() and pad with NULL. 69 * You may check this with getPaddedLen() and pad with NULL.
diff --git a/pwmanager/pwmanager/gpasmanfile.cpp b/pwmanager/pwmanager/gpasmanfile.cpp
index f80bc13..ae34c83 100644
--- a/pwmanager/pwmanager/gpasmanfile.cpp
+++ b/pwmanager/pwmanager/gpasmanfile.cpp
@@ -23,72 +23,82 @@
23 23
24 You should have received a copy of the GNU General Public License 24 You should have received a copy of the GNU General Public License
25 along with this program; if not, write to the Free Software 25 along with this program; if not, write to the Free Software
26 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27*/ 27*/
28 28
29/* 2003/06/10: 29/* 2003/06/10:
30 * modified by Michael Buesch to work together 30 * modified by Michael Buesch to work together
31 * with PwM as import/export module. 31 * with PwM as import/export module.
32 */ 32 */
33 33
34/*************************************************************************** 34/***************************************************************************
35 * copyright (C) 2004 by Ulf Schenk 35 * copyright (C) 2004 by Ulf Schenk
36 * This file is originaly based on version 1.0.1 of pwmanager 36 * This file is originaly based on version 1.0.1 of pwmanager
37 * and was modified to run on embedded devices that run microkde 37 * and was modified to run on embedded devices that run microkde
38 * 38 *
39 * $Id$ 39 * $Id$
40 **************************************************************************/ 40 **************************************************************************/
41 41
42#include <sys/types.h> 42#include <sys/types.h>
43#include <sys/stat.h> 43#include <sys/stat.h>
44#include <stdio.h> 44#include <stdio.h>
45#include <fcntl.h> 45#include <fcntl.h>
46#include <stdlib.h> 46#include <stdlib.h>
47#ifndef _WIN32_
47#include <unistd.h> 48#include <unistd.h>
49#else
50#include <io.h>
51#define S_IRUSR _S_IREAD
52#define S_IWUSR _S_IWRITE
53#define creat _creat
54#endif
48#include <string.h> 55#include <string.h>
49#include <errno.h> 56#include <errno.h>
50 57
51#include "gpasmanfile.h" 58#include "gpasmanfile.h"
52#include "globalstuff.h" 59#include "globalstuff.h"
53 60
54#define SAVE_BUFFER_LENGTH 1024 61#define SAVE_BUFFER_LENGTH 1024
55#define LOAD_BUFFER_LENGTH 2048 62#define LOAD_BUFFER_LENGTH 2048
56 63
57#ifndef S_IAMB 64#ifndef S_IAMB
58#define S_IAMB 00777 65#define S_IAMB 00777
59#endif 66#endif
60 67
61// enable/disable debug output 68// enable/disable debug output
62//#define GPASMANFILE_DEBUG 69//#define GPASMANFILE_DEBUG
63#undef GPASMANFILE_DEBUG 70#undef GPASMANFILE_DEBUG
64 71
65 72#ifndef _WIN32_
66#if defined(PWM_DEBUG) && defined(GPASMANFILE_DEBUG) 73#if defined(PWM_DEBUG) && defined(GPASMANFILE_DEBUG)
67 # define DBG(msg,x...)do { fprintf(stderr, msg "\n" , ##x); } while (0) 74 # define DBG(msg,x...)do { fprintf(stderr, msg "\n" , ##x); } while (0)
68#else 75#else
69 # define DBG(msg,x...)do { } while (0) 76 # define DBG(msg,x...)do { } while (0)
70#endif 77#endif
78#else
79# define DBG
80#endif
71 81
72#ifdef BIG_ENDIAN_HOST 82#ifdef BIG_ENDIAN_HOST
73# define WORDS_BIGENDIAN 83# define WORDS_BIGENDIAN
74#else 84#else
75# undef WORDS_BIGENDIAN 85# undef WORDS_BIGENDIAN
76#endif 86#endif
77 87
78 88
79GpasmanFile::GpasmanFile() 89GpasmanFile::GpasmanFile()
80{ 90{
81} 91}
82 92
83GpasmanFile::~GpasmanFile() 93GpasmanFile::~GpasmanFile()
84{ 94{
85} 95}
86 96
87int GpasmanFile::save_init(const char *filename, const char *password) 97int GpasmanFile::save_init(const char *filename, const char *password)
88{ 98{
89 99
90/* 100/*
91 * returncodes: 101 * returncodes:
92 * 1 = success 102 * 1 = success
93 * 0 = can't open filedescriptor / can't create file 103 * 0 = can't open filedescriptor / can't create file
94 * -1 = permissions are bad 104 * -1 = permissions are bad
@@ -389,49 +399,49 @@ int GpasmanFile::load_entry(char *entry[4])
389 DBG("%s", "load_entry, ended no entry anymore"); 399 DBG("%s", "load_entry, ended no entry anymore");
390 return 2; 400 return 2;
391} 401}
392 402
393void GpasmanFile::load_finalize(void) 403void GpasmanFile::load_finalize(void)
394{ 404{
395 fclose(fd); 405 fclose(fd);
396 free(buffer); 406 free(buffer);
397} 407}
398 408
399int GpasmanFile::check_file(const char *filename) 409int GpasmanFile::check_file(const char *filename)
400{ 410{
401 struct stat naamstat; 411 struct stat naamstat;
402 412
403 if (stat(filename, &naamstat) == -1) { 413 if (stat(filename, &naamstat) == -1) {
404 return (-3); 414 return (-3);
405 } 415 }
406 416
407 if (((naamstat.st_mode & S_IAMB) | (S_IRUSR | S_IWUSR)) != (S_IRUSR | 417 if (((naamstat.st_mode & S_IAMB) | (S_IRUSR | S_IWUSR)) != (S_IRUSR |
408 S_IWUSR)) { 418 S_IWUSR)) {
409 DBG("%s perms are bad, they are: %ld, should be -rw------", 419 DBG("%s perms are bad, they are: %ld, should be -rw------",
410 filename, (naamstat.st_mode & (S_IREAD | S_IWRITE))); 420 filename, (naamstat.st_mode & (S_IREAD | S_IWRITE)));
411 return (-1); 421 return (-1);
412 } 422 }
413 423#ifndef _WIN32_
414 if (!S_ISREG(naamstat.st_mode)) { 424 if (!S_ISREG(naamstat.st_mode)) {
415 lstat(filename, &naamstat); 425 lstat(filename, &naamstat);
416 if (S_ISLNK(naamstat.st_mode)) { 426 if (S_ISLNK(naamstat.st_mode)) {
417 DBG("%s is a symlink", filename); 427 DBG("%s is a symlink", filename);
418 return (-2); 428 return (-2);
419 } 429 }
420 } 430 }
421 431#endif
422 return (1); 432 return (1);
423} 433}
424 434
425int GpasmanFile::file_exists(const char *tfile) 435int GpasmanFile::file_exists(const char *tfile)
426{ 436{
427 struct stat naamstat; 437 struct stat naamstat;
428 438
429 if ((stat(tfile, &naamstat) == -1) && (errno == ENOENT)) { 439 if ((stat(tfile, &naamstat) == -1) && (errno == ENOENT)) {
430 DBG("file_exists, %s does NOT exist", tfile); 440 DBG("file_exists, %s does NOT exist", tfile);
431 return (0); 441 return (0);
432 } else { 442 } else {
433 DBG("file_exists, %s DOES exist", tfile); 443 DBG("file_exists, %s DOES exist", tfile);
434 return (1); 444 return (1);
435 } 445 }
436} 446}
437 447
diff --git a/pwmanager/pwmanager/htmlgen.cpp b/pwmanager/pwmanager/htmlgen.cpp
index 166b987..bee8198 100644
--- a/pwmanager/pwmanager/htmlgen.cpp
+++ b/pwmanager/pwmanager/htmlgen.cpp
@@ -39,49 +39,49 @@
39 #define HTML_VALUE_CLASS"\"value\"" 39 #define HTML_VALUE_CLASS"\"value\""
40 #define PATH_COMMENTSTYLE_CSS"pwmanager/html/htmlcomment_style.css" 40 #define PATH_COMMENTSTYLE_CSS"pwmanager/html/htmlcomment_style.css"
41#if defined(PWM_DEBUG) && HTMLGEN_DEBUG != 0 41#if defined(PWM_DEBUG) && HTMLGEN_DEBUG != 0
42 #define HTML_ENDL "\n" 42 #define HTML_ENDL "\n"
43#else // defined(PWM_DEBUG) && ... 43#else // defined(PWM_DEBUG) && ...
44 #define HTML_ENDL "" 44 #define HTML_ENDL ""
45#endif // defined(PWM_DEBUG) && ... 45#endif // defined(PWM_DEBUG) && ...
46 46
47 47
48HtmlGen::HtmlGen() 48HtmlGen::HtmlGen()
49{ 49{
50 useSSDummy = true; 50 useSSDummy = true;
51} 51}
52 52
53HtmlGen::~HtmlGen() 53HtmlGen::~HtmlGen()
54{ 54{
55} 55}
56 56
57QString HtmlGen::escapeHtmlText(const QString &str) 57QString HtmlGen::escapeHtmlText(const QString &str)
58{ 58{
59 QString ret; 59 QString ret;
60 unsigned int len = str.length(), i; 60 unsigned int len = str.length(), i;
61 char c; 61 char c;
62 for (i = 0; i < len; ++i) { 62 for (i = 0; i < len; ++i) {
63 c = str[i]; 63 c = str.at(i);
64 switch (c) { 64 switch (c) {
65 case '<': 65 case '<':
66 ret.append("&lt;"); 66 ret.append("&lt;");
67 break; 67 break;
68 case '>': 68 case '>':
69 ret.append("&gt;"); 69 ret.append("&gt;");
70 break; 70 break;
71 case '&': 71 case '&':
72 ret.append("&amp;"); 72 ret.append("&amp;");
73 break; 73 break;
74 case '\"': 74 case '\"':
75 ret.append("&quot;"); 75 ret.append("&quot;");
76 break; 76 break;
77 case 'ä': 77 case 'ä':
78 ret.append("&auml;"); 78 ret.append("&auml;");
79 break; 79 break;
80 case 'Ä': 80 case 'Ä':
81 ret.append("&Auml;"); 81 ret.append("&Auml;");
82 break; 82 break;
83 case 'ü': 83 case 'ü':
84 ret.append("&uuml;"); 84 ret.append("&uuml;");
85 break; 85 break;
86 case 'Ü': 86 case 'Ü':
87 ret.append("&Uuml;"); 87 ret.append("&Uuml;");
diff --git a/pwmanager/pwmanager/ipc.cpp b/pwmanager/pwmanager/ipc.cpp
index b1d2c68..643b022 100644
--- a/pwmanager/pwmanager/ipc.cpp
+++ b/pwmanager/pwmanager/ipc.cpp
@@ -1,102 +1,103 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * copyright (C) 2004 by Michael Buesch * 3 * copyright (C) 2004 by Michael Buesch *
4 * email: mbuesch@freenet.de * 4 * email: mbuesch@freenet.de *
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License version 2 * 7 * it under the terms of the GNU General Public License version 2 *
8 * as published by the Free Software Foundation. * 8 * as published by the Free Software Foundation. *
9 * * 9 * *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12/*************************************************************************** 12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk 13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.0.1 of pwmanager 14 * This file is originaly based on version 1.0.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde 15 * and was modified to run on embedded devices that run microkde
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#include "ipc.h" 20#include "ipc.h"
21#include "pwmexception.h" 21#include "pwmexception.h"
22 22
23#include <qsocketnotifier.h> 23#include <qsocketnotifier.h>
24 24#ifndef _WIN32_
25#include <sys/socket.h> 25#include <sys/socket.h>
26 26#endif
27#ifndef PWM_EMBEDDED 27#ifndef PWM_EMBEDDED
28#include <sys/types.h> 28#include <sys/types.h>
29#include <stdio.h> 29#include <stdio.h>
30#else 30#else
31#include <qsocket.h> 31#include <qsocket.h>
32#endif 32#endif
33 33
34 #define END_OF_LINE '\n' 34 #define END_OF_LINE '\n'
35 #define INIT_LINEBUF_LEN64 /* byte */ 35 #define INIT_LINEBUF_LEN64 /* byte */
36 36
37#ifndef PWM_EMBEDDED 37#ifndef PWM_EMBEDDED
38 38
39Ipc::Ipc() 39Ipc::Ipc()
40 : stream (0) 40 : stream (0)
41 , notifier (0) 41 , notifier (0)
42 , rdBuf (0) 42 , rdBuf (0)
43{ 43{
44 if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sock)) { 44 if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sock)) {
45 throw PwMException(PwMException::EX_GENERIC, 45 throw PwMException(PwMException::EX_GENERIC,
46 "Ipc: socketpair() failed"); 46 "Ipc: socketpair() failed");
47 } 47 }
48 rdBufSize = INIT_LINEBUF_LEN; 48 rdBufSize = INIT_LINEBUF_LEN;
49 rdBuf = static_cast<char *>(malloc(rdBufSize)); 49 rdBuf = static_cast<char *>(malloc(rdBufSize));
50 if (!rdBuf) { 50 if (!rdBuf) {
51 close(sock[0]); 51 close(sock[0]);
52 close(sock[1]); 52 close(sock[1]);
53 throw PwMException(PwMException::EX_GENERIC, 53 throw PwMException(PwMException::EX_GENERIC,
54 "Ipc: OOM"); 54 "Ipc: OOM");
55 } 55 }
56 stream = fdopen(sock[0], "r"); 56 stream = fdopen(sock[0], "r");
57 if (!stream) { 57 if (!stream) {
58 close(sock[0]); 58 close(sock[0]);
59 close(sock[1]); 59 close(sock[1]);
60 free(rdBuf); 60 free(rdBuf);
61 throw PwMException(PwMException::EX_GENERIC, 61 throw PwMException(PwMException::EX_GENERIC,
62 "Ipc: fdopen() failed"); 62 "Ipc: fdopen() failed");
63 } 63 }
64 64
65 notifier = new QSocketNotifier(sock[0], QSocketNotifier::Read); 65 notifier = new QSocketNotifier(sock[0], QSocketNotifier::Read);
66 connect(notifier, SIGNAL(activated(int)), 66 connect(notifier, SIGNAL(activated(int)),
67 this, SLOT(receiveData(int))); 67 this, SLOT(receiveData(int)));
68 host = true; 68 host = true;
69} 69}
70#else 70#else
71Ipc::Ipc() 71Ipc::Ipc()
72 : notifier (0) 72 : notifier (0)
73 , rdBuf (0) 73 , rdBuf (0)
74{ 74{
75#ifndef _WIN32_
75 if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sock)) { 76 if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sock)) {
76 qDebug("Ipc: socketpair() failed"); 77 qDebug("Ipc: socketpair() failed");
77 } 78 }
78 79#endif
79 QSocket* qsock = new QSocket(); 80 QSocket* qsock = new QSocket();
80 qsock->setSocket(sock[0]); 81 qsock->setSocket(sock[0]);
81 82
82 rdBufSize = INIT_LINEBUF_LEN; 83 rdBufSize = INIT_LINEBUF_LEN;
83 rdBuf = (char *)(malloc(rdBufSize)); 84 rdBuf = (char *)(malloc(rdBufSize));
84 if (!rdBuf) { 85 if (!rdBuf) {
85 close(sock[0]); 86 close(sock[0]);
86 close(sock[1]); 87 close(sock[1]);
87 qDebug("Ipc: OOM"); 88 qDebug("Ipc: OOM");
88 } 89 }
89 90
90 qsock = new QSocket(); 91 qsock = new QSocket();
91 qsock->setSocket(sock[0]); 92 qsock->setSocket(sock[0]);
92 93
93 /*US 94 /*US
94 stream = fdopen(sock[0], "r"); 95 stream = fdopen(sock[0], "r");
95 if (!stream) { 96 if (!stream) {
96 close(sock[0]); 97 close(sock[0]);
97 close(sock[1]); 98 close(sock[1]);
98 free(rdBuf); 99 free(rdBuf);
99 qDebug("Ipc: fdopen() failed"); 100 qDebug("Ipc: fdopen() failed");
100 } 101 }
101 */ 102 */
102 103
diff --git a/pwmanager/pwmanager/ipc.h b/pwmanager/pwmanager/ipc.h
index e5a496d..7bfca02 100644
--- a/pwmanager/pwmanager/ipc.h
+++ b/pwmanager/pwmanager/ipc.h
@@ -1,49 +1,52 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * copyright (C) 2004 by Michael Buesch * 3 * copyright (C) 2004 by Michael Buesch *
4 * email: mbuesch@freenet.de * 4 * email: mbuesch@freenet.de *
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License version 2 * 7 * it under the terms of the GNU General Public License version 2 *
8 * as published by the Free Software Foundation. * 8 * as published by the Free Software Foundation. *
9 * * 9 * *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12/*************************************************************************** 12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk 13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.0.1 of pwmanager 14 * This file is originaly based on version 1.0.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde 15 * and was modified to run on embedded devices that run microkde
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#ifndef __PWM_IPC_H 20#ifndef __PWM_IPC_H
21#define __PWM_IPC_H 21#define __PWM_IPC_H
22 22
23#include <qobject.h> 23#include <qobject.h>
24#ifndef _WIN32_
24#include <unistd.h> 25#include <unistd.h>
25 26#else
27#include <io.h>
28#endif
26#ifndef PWM_EMBEDDED 29#ifndef PWM_EMBEDDED
27#include <stdio.h> 30#include <stdio.h>
28#else 31#else
29#include <qsocket.h> 32#include <qsocket.h>
30#endif 33#endif
31 34
32class QSocketNotifier; 35class QSocketNotifier;
33 36
34/** very simple interprocess communication class */ 37/** very simple interprocess communication class */
35class Ipc : public QObject 38class Ipc : public QObject
36{ 39{
37 Q_OBJECT 40 Q_OBJECT
38public: 41public:
39 /** create a new Ipc communication object */ 42 /** create a new Ipc communication object */
40 Ipc(); 43 Ipc();
41 /** create a new Ipc communication object and 44 /** create a new Ipc communication object and
42 * connect it to "ipc" 45 * connect it to "ipc"
43 */ 46 */
44 Ipc(const Ipc *ipc); 47 Ipc(const Ipc *ipc);
45 /** destructor */ 48 /** destructor */
46 ~Ipc(); 49 ~Ipc();
47 50
48 /** send data to the other socket end 51 /** send data to the other socket end
49 * (To the connected ipc object) 52 * (To the connected ipc object)
diff --git a/pwmanager/pwmanager/libgcryptif.h b/pwmanager/pwmanager/libgcryptif.h
index dffd55b..1a7b658 100644
--- a/pwmanager/pwmanager/libgcryptif.h
+++ b/pwmanager/pwmanager/libgcryptif.h
@@ -10,50 +10,55 @@
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License version 2 * 11 * it under the terms of the GNU General Public License version 2 *
12 * as published by the Free Software Foundation. * 12 * as published by the Free Software Foundation. *
13 * * 13 * *
14 ***************************************************************************/ 14 ***************************************************************************/
15 15
16/*************************************************************************** 16/***************************************************************************
17 * copyright (C) 2004 by Ulf Schenk 17 * copyright (C) 2004 by Ulf Schenk
18 * This file is originaly based on version 1.1 of pwmanager 18 * This file is originaly based on version 1.1 of pwmanager
19 * and was modified to run on embedded devices that run microkde 19 * and was modified to run on embedded devices that run microkde
20 * 20 *
21 * $Id$ 21 * $Id$
22 **************************************************************************/ 22 **************************************************************************/
23 23
24#ifndef __LIBGCRYPTIF_H 24#ifndef __LIBGCRYPTIF_H
25#define __LIBGCRYPTIF_H 25#define __LIBGCRYPTIF_H
26 26
27#include "pwmexception.h" 27#include "pwmexception.h"
28 28
29//#undef CONFIG_PWMANAGER_GCRY // for debugging only. 29//#undef CONFIG_PWMANAGER_GCRY // for debugging only.
30#ifdef CONFIG_PWMANAGER_GCRY 30#ifdef CONFIG_PWMANAGER_GCRY
31 31
32#include <stddef.h> 32#include <stddef.h>
33#include <sys/types.h> 33#include <sys/types.h>
34#ifndef _WIN32_
34#include <stdint.h> 35#include <stdint.h>
35 36#else
37#define uint8_t Q_UINT8
38#define byte Q_UINT8
39#define uint32_t Q_UINT32
40#endif
36 #define STRING2KEY_SALTLEN8 41 #define STRING2KEY_SALTLEN8
37 42
38/** interface class for the libgcrypt cipher and hash algorithms 43/** interface class for the libgcrypt cipher and hash algorithms
39 * NOTE: Always allocate 1024 extra bytes for the inBuf (for padding) 44 * NOTE: Always allocate 1024 extra bytes for the inBuf (for padding)
40 */ 45 */
41class LibGCryptIf 46class LibGCryptIf
42{ 47{
43protected: 48protected:
44 struct STRING2KEY 49 struct STRING2KEY
45 { 50 {
46 int mode; 51 int mode;
47 int hash_algo; 52 int hash_algo;
48 uint8_t salt[STRING2KEY_SALTLEN]; 53 uint8_t salt[STRING2KEY_SALTLEN];
49 uint32_t count; 54 uint32_t count;
50 }; 55 };
51 struct DEK 56 struct DEK
52 { 57 {
53 size_t keylen; 58 size_t keylen;
54 uint8_t key[32]; // this is the largest used keylen (256 bit) 59 uint8_t key[32]; // this is the largest used keylen (256 bit)
55 }; 60 };
56 61
57public: 62public:
58 LibGCryptIf() { } 63 LibGCryptIf() { }
59 /** is libgcrypt available? */ 64 /** is libgcrypt available? */
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp
index d92c90d..1ab2b71 100644
--- a/pwmanager/pwmanager/pwm.cpp
+++ b/pwmanager/pwmanager/pwm.cpp
@@ -1389,48 +1389,49 @@ void PwM::whatsnew_slot()
1389{ 1389{
1390 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1390 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1391} 1391}
1392 1392
1393void PwM::showLicense_slot() 1393void PwM::showLicense_slot()
1394{ 1394{
1395 KApplication::showLicence(); 1395 KApplication::showLicence();
1396} 1396}
1397 1397
1398void PwM::faq_slot() 1398void PwM::faq_slot()
1399{ 1399{
1400 KApplication::showFile( "PWM/Pi FAQ", "kdepim/pwmanager/pwmanagerFAQ.txt" ); 1400 KApplication::showFile( "PWM/Pi FAQ", "kdepim/pwmanager/pwmanagerFAQ.txt" );
1401} 1401}
1402 1402
1403void PwM::syncHowTo_slot() 1403void PwM::syncHowTo_slot()
1404{ 1404{
1405 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1405 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1406} 1406}
1407 1407
1408 1408
1409void PwM::createAboutData_slot() 1409void PwM::createAboutData_slot()
1410{ 1410{
1411 QString version; 1411 QString version;
1412#include <../version> 1412#include <../version>
1413;
1413 QMessageBox::about( this, "About PwManager/Pi", 1414 QMessageBox::about( this, "About PwManager/Pi",
1414 "PwManager/Platform-independent\n" 1415 "PwManager/Platform-independent\n"
1415 "(PWM/Pi) " +version + " - " + 1416 "(PWM/Pi) " +version + " - " +
1416#ifdef DESKTOP_VERSION 1417#ifdef DESKTOP_VERSION
1417 "Desktop Edition\n" 1418 "Desktop Edition\n"
1418#else 1419#else
1419 "PDA-Edition\n" 1420 "PDA-Edition\n"
1420 "for: Zaurus 5500 / 7x0 / 8x0\n" 1421 "for: Zaurus 5500 / 7x0 / 8x0\n"
1421#endif 1422#endif
1422 1423
1423 "(c) 2004 Ulf Schenk\n" 1424 "(c) 2004 Ulf Schenk\n"
1424 "(c) 2004 Lutz Rogowski\n" 1425 "(c) 2004 Lutz Rogowski\n"
1425 "(c) 1997-2004, The KDE PIM Team\n" 1426 "(c) 1997-2004, The KDE PIM Team\n"
1426 1427
1427 "(c) Michael Buesch - main programming\nand current maintainer\nmbuesch@freenet.de\n" 1428 "(c) Michael Buesch - main programming\nand current maintainer\nmbuesch@freenet.de\n"
1428 "Matt Scifo - mscifo@o1.com\n" 1429 "Matt Scifo - mscifo@o1.com\n"
1429 "Elias Probst - elias.probst@gmx.de\n" 1430 "Elias Probst - elias.probst@gmx.de\n"
1430 "George Staikos - staikos@kde.org\n" 1431 "George Staikos - staikos@kde.org\n"
1431 "Matthew Palmer - mjp16@uow.edu.au\n" 1432 "Matthew Palmer - mjp16@uow.edu.au\n"
1432 "Olivier Sessink - gpasman@nl.linux.org\n" 1433 "Olivier Sessink - gpasman@nl.linux.org\n"
1433 "The libgcrypt developers -\nBlowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n" 1434 "The libgcrypt developers -\nBlowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n"
1434 "Troy Engel - tengel@sonic.net\n" 1435 "Troy Engel - tengel@sonic.net\n"
1435 "Wickey - wickey@gmx.at\n" 1436 "Wickey - wickey@gmx.at\n"
1436 "Ian MacGregor - original documentation author.\n" 1437 "Ian MacGregor - original documentation author.\n"
diff --git a/pwmanager/pwmanager/pwmanager.pro b/pwmanager/pwmanager/pwmanager.pro
index 80b2519..fbc0554 100644
--- a/pwmanager/pwmanager/pwmanager.pro
+++ b/pwmanager/pwmanager/pwmanager.pro
@@ -1,31 +1,31 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG += qt warn_off 2 CONFIG += qt warn_off
3DESTDIR= ../../bin 3DESTDIR= ../../bin
4 TARGET = pwmpi 4 TARGET = pwmpi
5include( ../../variables.pri ) 5include( ../../variables.pri )
6 6
7INCLUDEPATH += . ../../ ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils 7INCLUDEPATH += . ../../ ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils ../libcrypt/crypt ../libcrypt/error ../libcrypt/zlib
8DEFINES += PWM_EMBEDDED CONFIG_PWMANAGER_GCRY DESKTOP_VERSION 8DEFINES += PWM_EMBEDDED CONFIG_PWMANAGER_GCRY DESKTOP_VERSION
9 9
10#enable this setting if you want debugoutput for pwmanager 10#enable this setting if you want debugoutput for pwmanager
11#DEFINES += CONFIG_DEBUG 11#DEFINES += CONFIG_DEBUG
12LIBS += -L../libcrypt/ 12LIBS += -L../libcrypt/
13LIBS += -L../../bin/ 13LIBS += -L../../bin/
14LIBS += -lmicrokde 14LIBS += -lmicrokde
15LIBS += -lmicrokdepim 15LIBS += -lmicrokdepim
16LIBS += -lzlib 16LIBS += -lzlib
17LIBS += -lkpmicrocipher 17LIBS += -lkpmicrocipher
18LIBS += -lkpmicroerror 18LIBS += -lkpmicroerror
19LIBS += -lkpmicrompi 19LIBS += -lkpmicrompi
20LIBS += -lstdc++ 20LIBS += -lstdc++
21 21
22unix:{ 22unix:{
23OBJECTS_DIR = obj/unix 23OBJECTS_DIR = obj/unix
24MOC_DIR = moc/unix 24MOC_DIR = moc/unix
25 25
26} 26}
27win32:{ 27win32:{
28 28
29DEFINES += _WIN32_ 29DEFINES += _WIN32_
30OBJECTS_DIR = obj/win 30OBJECTS_DIR = obj/win
31MOC_DIR = moc/win 31MOC_DIR = moc/win
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp
index 86b6273..129bf7b 100644
--- a/pwmanager/pwmanager/pwmdoc.cpp
+++ b/pwmanager/pwmanager/pwmdoc.cpp
@@ -34,51 +34,52 @@
34#include "kglobal.h" 34#include "kglobal.h"
35#endif 35#endif
36 36
37#include <kmessagebox.h> 37#include <kmessagebox.h>
38#include <libkcal/syncdefines.h> 38#include <libkcal/syncdefines.h>
39 39
40 40
41#ifdef CONFIG_KWALLETIF 41#ifdef CONFIG_KWALLETIF
42# include "kwalletemu.h" 42# include "kwalletemu.h"
43#endif // CONFIG_KWALLETIF 43#endif // CONFIG_KWALLETIF
44 44
45#include <qdatetime.h> 45#include <qdatetime.h>
46#include <qsize.h> 46#include <qsize.h>
47#include <qfileinfo.h> 47#include <qfileinfo.h>
48#include <qfile.h> 48#include <qfile.h>
49 49
50#include <stdio.h> 50#include <stdio.h>
51#include <stdlib.h> 51#include <stdlib.h>
52#include <errno.h> 52#include <errno.h>
53#include <string.h> 53#include <string.h>
54//US#include <iostream> 54//US#include <iostream>
55#include <algorithm> 55#include <algorithm>
56#include <sys/types.h> 56#include <sys/types.h>
57#include <sys/stat.h> 57#include <sys/stat.h>
58#ifndef _WIN32_
58#include <unistd.h> 59#include <unistd.h>
59#include <stdint.h> 60#include <stdint.h>
60 61#endif
61 62
62#ifdef PWM_EMBEDDED 63#ifdef PWM_EMBEDDED
63#ifndef Q_LONG 64#ifndef Q_LONG
64#define Q_LONG long 65#define Q_LONG long
65#endif 66#endif
66 67
67#ifndef Q_ULONG 68#ifndef Q_ULONG
68#define Q_ULONG unsigned long 69#define Q_ULONG unsigned long
69#endif 70#endif
70#endif //PWM_EMBEDDED 71#endif //PWM_EMBEDDED
71 72
72 73
73//TODO: reset to its normal value. 74//TODO: reset to its normal value.
74 #define META_CHECK_TIMER_INTERVAL10/*300*/ /* sek */ 75 #define META_CHECK_TIMER_INTERVAL10/*300*/ /* sek */
75 76
76using namespace std; 77using namespace std;
77 78
78 79
79void PwMDocList::add(PwMDoc *doc, const string &id) 80void PwMDocList::add(PwMDoc *doc, const string &id)
80{ 81{
81#ifdef PWM_DEBUG 82#ifdef PWM_DEBUG
82 // check for existance of object in debug mode only. 83 // check for existance of object in debug mode only.
83 vector<listItem>::iterator begin = docList.begin(), 84 vector<listItem>::iterator begin = docList.begin(),
84 end = docList.end(), 85 end = docList.end(),
@@ -484,52 +485,54 @@ PwMerror PwMDoc::saveDoc(char compress, const QString *file)
484 printDebug("PwMDoc::saveDoc(): compressDta() failed"); 485 printDebug("PwMDoc::saveDoc(): compressDta() failed");
485 f.close(); 486 f.close();
486 ret = e_enc; 487 ret = e_enc;
487 goto out_moveback; 488 goto out_moveback;
488 } 489 }
489 e = encrypt(&serialized, &currentPw, &f, cryptAlgo); 490 e = encrypt(&serialized, &currentPw, &f, cryptAlgo);
490 if (e == e_weakPw) { 491 if (e == e_weakPw) {
491 printDebug("PwMDoc::saveDoc(): encrypt() failed: e_weakPw"); 492 printDebug("PwMDoc::saveDoc(): encrypt() failed: e_weakPw");
492 f.close(); 493 f.close();
493 ret = e_weakPw; 494 ret = e_weakPw;
494 goto out_moveback; 495 goto out_moveback;
495 } else if (e == e_cryptNotImpl) { 496 } else if (e == e_cryptNotImpl) {
496 printDebug("PwMDoc::saveDoc(): encrypt() failed: e_cryptNotImpl"); 497 printDebug("PwMDoc::saveDoc(): encrypt() failed: e_cryptNotImpl");
497 f.close(); 498 f.close();
498 ret = e_cryptNotImpl; 499 ret = e_cryptNotImpl;
499 goto out_moveback; 500 goto out_moveback;
500 } else if (e != e_success) { 501 } else if (e != e_success) {
501 printDebug("PwMDoc::saveDoc(): encrypt() failed"); 502 printDebug("PwMDoc::saveDoc(): encrypt() failed");
502 f.close(); 503 f.close();
503 ret = e_enc; 504 ret = e_enc;
504 goto out_moveback; 505 goto out_moveback;
505 } 506 }
506 unsetDocStatFlag(DOC_STAT_DISK_DIRTY); 507 unsetDocStatFlag(DOC_STAT_DISK_DIRTY);
507 f.close(); 508 f.close();
509#ifndef _WIN32_
508 if (chmod(filename.latin1(), 510 if (chmod(filename.latin1(),
509 conf()->confGlobFilePermissions())) { 511 conf()->confGlobFilePermissions())) {
510 printWarn(string("chmod failed: ") + strerror(errno)); 512 printWarn(string("chmod failed: ") + strerror(errno));
511 } 513 }
514#endif
512 openDocList.edit(this, getTitle().latin1()); 515 openDocList.edit(this, getTitle().latin1());
513 if (wasDeepLocked) { 516 if (wasDeepLocked) {
514 /* Do _not_ save the data with the deepLock() 517 /* Do _not_ save the data with the deepLock()
515 * call, because this will recurse 518 * call, because this will recurse
516 * into saveDoc() 519 * into saveDoc()
517 */ 520 */
518 deepLock(true, false); 521 deepLock(true, false);
519 /* We don't check return value here, because 522 /* We don't check return value here, because
520 * it won't fail. See NOTE in deepLock() 523 * it won't fail. See NOTE in deepLock()
521 */ 524 */
522 } 525 }
523 if (tmpFileMoved != QString::null) { 526 if (tmpFileMoved != QString::null) {
524 // now remove the moved file. 527 // now remove the moved file.
525 if (!QFile::remove(tmpFileMoved)) { 528 if (!QFile::remove(tmpFileMoved)) {
526 printWarn(string("removing file ") 529 printWarn(string("removing file ")
527 + tmpFileMoved.latin1() 530 + tmpFileMoved.latin1()
528 + " failed!"); 531 + " failed!");
529 } 532 }
530 } 533 }
531 ret = e_success; 534 ret = e_success;
532 printDebug(string("writing file { name: ") 535 printDebug(string("writing file { name: ")
533 + filename.latin1() + " compress: " 536 + filename.latin1() + " compress: "
534 + tostr(static_cast<int>(compress)) + " cryptAlgo: " 537 + tostr(static_cast<int>(compress)) + " cryptAlgo: "
535 + tostr(static_cast<int>(cryptAlgo)) + " hashAlgo: " 538 + tostr(static_cast<int>(cryptAlgo)) + " hashAlgo: "
@@ -2197,104 +2200,108 @@ void PwMDoc::getEntryList(unsigned int category, QStringList *list)
2197 end = dti.dta[category].d.end(), 2200 end = dti.dta[category].d.end(),
2198 i = begin; 2201 i = begin;
2199 while (i != end) { 2202 while (i != end) {
2200#ifndef PWM_EMBEDDED 2203#ifndef PWM_EMBEDDED
2201 list->push_back(i->desc.c_str()); 2204 list->push_back(i->desc.c_str());
2202#else 2205#else
2203 list->append(i->desc.c_str()); 2206 list->append(i->desc.c_str());
2204#endif 2207#endif
2205 ++i; 2208 ++i;
2206 } 2209 }
2207} 2210}
2208 2211
2209bool PwMDoc::execLauncher(const QString &category, unsigned int entryIndex) 2212bool PwMDoc::execLauncher(const QString &category, unsigned int entryIndex)
2210{ 2213{
2211 unsigned int cat = 0; 2214 unsigned int cat = 0;
2212 2215
2213 if (!findCategory(category, &cat)) 2216 if (!findCategory(category, &cat))
2214 return false; 2217 return false;
2215 2218
2216 return execLauncher(cat, entryIndex); 2219 return execLauncher(cat, entryIndex);
2217} 2220}
2218 2221
2219bool PwMDoc::execLauncher(unsigned int category, unsigned int entryIndex) 2222bool PwMDoc::execLauncher(unsigned int category, unsigned int entryIndex)
2220{ 2223{
2224#ifndef _WIN32_
2221 if (geteuid() == 0) { 2225 if (geteuid() == 0) {
2222 rootAlertMsgBox(); 2226 rootAlertMsgBox();
2223 return false; 2227 return false;
2224 } 2228 }
2229#endif
2225 QString command(dti.dta[category].d[entryIndex].launcher.c_str()); 2230 QString command(dti.dta[category].d[entryIndex].launcher.c_str());
2226 bool wasLocked = isLocked(category, entryIndex); 2231 bool wasLocked = isLocked(category, entryIndex);
2227 2232
2228 if (command.find("$p") != -1) { 2233 if (command.find("$p") != -1) {
2229 /* the user requested the password to be included 2234 /* the user requested the password to be included
2230 * into the command. We have to ask for the password, 2235 * into the command. We have to ask for the password,
2231 * if it's locked. We do that by unlocking the entry 2236 * if it's locked. We do that by unlocking the entry
2232 */ 2237 */
2233 if (!lockAt(category, entryIndex, false)) 2238 if (!lockAt(category, entryIndex, false))
2234 return false; 2239 return false;
2235 } 2240 }
2236#ifndef PWM_EMBEDDED 2241#ifndef PWM_EMBEDDED
2237 command.replace("$d", dti.dta[category].d[entryIndex].desc.c_str()); 2242 command.replace("$d", dti.dta[category].d[entryIndex].desc.c_str());
2238 command.replace("$n", dti.dta[category].d[entryIndex].name.c_str()); 2243 command.replace("$n", dti.dta[category].d[entryIndex].name.c_str());
2239 command.replace("$p", dti.dta[category].d[entryIndex].pw.c_str()); 2244 command.replace("$p", dti.dta[category].d[entryIndex].pw.c_str());
2240 command.replace("$u", dti.dta[category].d[entryIndex].url.c_str()); 2245 command.replace("$u", dti.dta[category].d[entryIndex].url.c_str());
2241 command.replace("$c", dti.dta[category].d[entryIndex].comment.c_str()); 2246 command.replace("$c", dti.dta[category].d[entryIndex].comment.c_str());
2242#else 2247#else
2243 command.replace(QRegExp("$d"), dti.dta[category].d[entryIndex].desc.c_str()); 2248 command.replace(QRegExp("$d"), dti.dta[category].d[entryIndex].desc.c_str());
2244 command.replace(QRegExp("$n"), dti.dta[category].d[entryIndex].name.c_str()); 2249 command.replace(QRegExp("$n"), dti.dta[category].d[entryIndex].name.c_str());
2245 command.replace(QRegExp("$p"), dti.dta[category].d[entryIndex].pw.c_str()); 2250 command.replace(QRegExp("$p"), dti.dta[category].d[entryIndex].pw.c_str());
2246 command.replace(QRegExp("$u"), dti.dta[category].d[entryIndex].url.c_str()); 2251 command.replace(QRegExp("$u"), dti.dta[category].d[entryIndex].url.c_str());
2247 command.replace(QRegExp("$c"), dti.dta[category].d[entryIndex].comment.c_str()); 2252 command.replace(QRegExp("$c"), dti.dta[category].d[entryIndex].comment.c_str());
2248#endif 2253#endif
2249 command.append(" &"); 2254 command.append(" &");
2250 2255
2251 QString customXterm(conf()->confGlobXtermCommand()); 2256 QString customXterm(conf()->confGlobXtermCommand());
2252 if (!customXterm.isEmpty()) 2257 if (!customXterm.isEmpty())
2253 command = customXterm + " " + command; 2258 command = customXterm + " " + command;
2254 2259
2255 system(command.latin1()); 2260 system(command.latin1());
2256 2261
2257 lockAt(category, entryIndex, wasLocked); 2262 lockAt(category, entryIndex, wasLocked);
2258 return true; 2263 return true;
2259} 2264}
2260 2265
2261bool PwMDoc::goToURL(const QString &category, unsigned int entryIndex) 2266bool PwMDoc::goToURL(const QString &category, unsigned int entryIndex)
2262{ 2267{
2263 unsigned int cat = 0; 2268 unsigned int cat = 0;
2264 2269
2265 if (!findCategory(category, &cat)) 2270 if (!findCategory(category, &cat))
2266 return false; 2271 return false;
2267 2272
2268 return goToURL(cat, entryIndex); 2273 return goToURL(cat, entryIndex);
2269} 2274}
2270 2275
2271bool PwMDoc::goToURL(unsigned int category, unsigned int entryIndex) 2276bool PwMDoc::goToURL(unsigned int category, unsigned int entryIndex)
2272{ 2277{
2278#ifndef _WIN32_
2273 if (geteuid() == 0) { 2279 if (geteuid() == 0) {
2274 rootAlertMsgBox(); 2280 rootAlertMsgBox();
2275 return false; 2281 return false;
2276 } 2282 }
2283#endif
2277 QString url(dti.dta[category].d[entryIndex].url.c_str()); 2284 QString url(dti.dta[category].d[entryIndex].url.c_str());
2278 if (url.isEmpty()) 2285 if (url.isEmpty())
2279 return false; 2286 return false;
2280 2287
2281 QString customBrowser(conf()->confGlobBrowserCommand()); 2288 QString customBrowser(conf()->confGlobBrowserCommand());
2282 if (!customBrowser.isEmpty()) { 2289 if (!customBrowser.isEmpty()) {
2283 browserProc.clearArguments(); 2290 browserProc.clearArguments();
2284 browserProc << customBrowser << url; 2291 browserProc << customBrowser << url;
2285 if (browserProc.start(KProcess::DontCare)) 2292 if (browserProc.start(KProcess::DontCare))
2286 return true; 2293 return true;
2287 } 2294 }
2288 2295
2289 browserProc.clearArguments(); 2296 browserProc.clearArguments();
2290 browserProc << "konqueror" << url; 2297 browserProc << "konqueror" << url;
2291 if (browserProc.start(KProcess::DontCare)) 2298 if (browserProc.start(KProcess::DontCare))
2292 return true; 2299 return true;
2293 2300
2294 browserProc.clearArguments(); 2301 browserProc.clearArguments();
2295 browserProc << "mozilla" << url; 2302 browserProc << "mozilla" << url;
2296 if (browserProc.start(KProcess::DontCare)) 2303 if (browserProc.start(KProcess::DontCare))
2297 return true; 2304 return true;
2298 2305
2299 browserProc.clearArguments(); 2306 browserProc.clearArguments();
2300 browserProc << "opera" << url; 2307 browserProc << "opera" << url;
diff --git a/pwmanager/pwmanager/spinforsignal.h b/pwmanager/pwmanager/spinforsignal.h
index ec6103b..f3cabee 100644
--- a/pwmanager/pwmanager/spinforsignal.h
+++ b/pwmanager/pwmanager/spinforsignal.h
@@ -1,49 +1,51 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * copyright (C) 2003, 2004 by Michael Buesch * 3 * copyright (C) 2003, 2004 by Michael Buesch *
4 * email: mbuesch@freenet.de * 4 * email: mbuesch@freenet.de *
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License version 2 * 7 * it under the terms of the GNU General Public License version 2 *
8 * as published by the Free Software Foundation. * 8 * as published by the Free Software Foundation. *
9 * * 9 * *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12/*************************************************************************** 12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk 13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.0.1 of pwmanager 14 * This file is originaly based on version 1.0.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde 15 * and was modified to run on embedded devices that run microkde
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#ifndef SPINFORSIGNAL_H 20#ifndef SPINFORSIGNAL_H
21#define SPINFORSIGNAL_H 21#define SPINFORSIGNAL_H
22 22
23#include <qobject.h> 23#include <qobject.h>
24 24
25#ifndef _WIN32_
25#include <stdint.h> 26#include <stdint.h>
27#endif
26#include <string> 28#include <string>
27using std::string; 29using std::string;
28 30
29/** non-ui-blocking spin for a QT-signal */ 31/** non-ui-blocking spin for a QT-signal */
30class SpinForSignal : public QObject 32class SpinForSignal : public QObject
31{ 33{
32 Q_OBJECT 34 Q_OBJECT
33public: 35public:
34 SpinForSignal(); 36 SpinForSignal();
35 ~SpinForSignal() {} 37 ~SpinForSignal() {}
36 38
37 /** do spin for signal */ 39 /** do spin for signal */
38 void spin(uint32_t *u32, string *str); 40 void spin(uint32_t *u32, string *str);
39 /** cancel spinning */ 41 /** cancel spinning */
40 void cancelSpin(); 42 void cancelSpin();
41 43
42public slots: 44public slots:
43 void u32_str_slot(uint32_t u32, const string &str); 45 void u32_str_slot(uint32_t u32, const string &str);
44 46
45protected: 47protected:
46 volatile bool doSpin; 48 volatile bool doSpin;
47 uint32_t u32_storage; 49 uint32_t u32_storage;
48 string str_storage; 50 string str_storage;
49 51