summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kpimglobalprefs.cpp5
-rw-r--r--pwmanager/pwmanager/pwminit.cpp5
2 files changed, 7 insertions, 3 deletions
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index 0fdc3e4..e8fd2d1 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -1,204 +1,205 @@
1/* 1/*
2 This file is part of libkdepim. 2 This file is part of libkdepim.
3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include <kglobal.h> 31#include <kglobal.h>
32#include <kconfig.h> 32#include <kconfig.h>
33#include <klocale.h> 33#include <klocale.h>
34#include <kdebug.h> 34#include <kdebug.h>
35#include <kstaticdeleter.h> 35#include <kstaticdeleter.h>
36 36
37#include <qregexp.h> 37#include <qregexp.h>
38#include <qfile.h> 38#include <qfile.h>
39#include <stdlib.h>
39#include <qtextstream.h> 40#include <qtextstream.h>
40#include <qapplication.h> 41#include <qapplication.h>
41#include "kpimglobalprefs.h" 42#include "kpimglobalprefs.h"
42 43
43KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; 44KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0;
44static KStaticDeleter<KPimGlobalPrefs> staticDeleterGP; 45static KStaticDeleter<KPimGlobalPrefs> staticDeleterGP;
45 46
46 47
47KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) 48KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
48 : KPrefs("microkdeglobalrc") 49 : KPrefs("microkdeglobalrc")
49{ 50{
50 mLocaleDict = 0; 51 mLocaleDict = 0;
51 KPrefs::setCurrentGroup("Locale"); 52 KPrefs::setCurrentGroup("Locale");
52 addItemInt("PreferredLanguage",&mPreferredLanguage,0); 53 addItemInt("PreferredLanguage",&mPreferredLanguage,0);
53 addItemInt("PreferredTime",&mPreferredTime,0); 54 addItemInt("PreferredTime",&mPreferredTime,0);
54 addItemInt("PreferredDate",&mPreferredDate,0); 55 addItemInt("PreferredDate",&mPreferredDate,0);
55 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); 56 addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false);
56 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); 57 addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y");
57 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); 58 addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y");
58 59
59 KPrefs::setCurrentGroup("Time & Date"); 60 KPrefs::setCurrentGroup("Time & Date");
60 61
61 addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") ); 62 addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") );
62 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); 63 addItemBool("UseDaylightsaving",&mUseDaylightsaving,true);
63 addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false); 64 addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false);
64 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); 65 addItemInt("DaylightsavingStart",&mDaylightsavingStart,90);
65 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); 66 addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304);
66 67
67 KPrefs::setCurrentGroup( "ExternalApplications" ); 68 KPrefs::setCurrentGroup( "ExternalApplications" );
68 69
69 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); 70 addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC );
70 addItemString( "EmailChannel", &mEmailOtherChannel, "" ); 71 addItemString( "EmailChannel", &mEmailOtherChannel, "" );
71 addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); 72 addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" );
72 addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); 73 addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" );
73 addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); 74 addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" );
74 addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); 75 addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" );
75 76
76 addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); 77 addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC );
77 addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); 78 addItemString( "PhoneChannel", &mPhoneOtherChannel, "" );
78 addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); 79 addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" );
79 addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); 80 addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" );
80 81
81 addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); 82 addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC );
82 addItemString( "FaxChannel", &mFaxOtherChannel, "" ); 83 addItemString( "FaxChannel", &mFaxOtherChannel, "" );
83 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); 84 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" );
84 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); 85 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" );
85 86
86 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); 87 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC );
87 addItemString( "SMSChannel", &mSMSOtherChannel, "" ); 88 addItemString( "SMSChannel", &mSMSOtherChannel, "" );
88 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); 89 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" );
89 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); 90 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" );
90 91
91 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); 92 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC );
92 addItemString( "PagerChannel", &mPagerOtherChannel, "" ); 93 addItemString( "PagerChannel", &mPagerOtherChannel, "" );
93 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); 94 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" );
94 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); 95 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" );
95 96
96 addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC ); 97 addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC );
97 addItemString( "SIPChannel", &mSipOtherChannel, "" ); 98 addItemString( "SIPChannel", &mSipOtherChannel, "" );
98 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); 99 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" );
99 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); 100 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" );
100 101
101 KPrefs::setCurrentGroup( "PhoneAccess" ); 102 KPrefs::setCurrentGroup( "PhoneAccess" );
102 addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); 103 addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm");
103 addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); 104 addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda");
104 addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); 105 addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i");
105 106
106} 107}
107 108
108void KPimGlobalPrefs::setGlobalConfig() 109void KPimGlobalPrefs::setGlobalConfig()
109{ 110{
110 if ( mLocaleDict == 0 ) { 111 if ( mLocaleDict == 0 ) {
111 QString fileName ; 112 QString fileName ;
112 QString name = KGlobal::getAppName() +"/"; 113 QString name = KGlobal::getAppName() +"/";
113#ifndef DESKTOP_VERSION 114#ifndef DESKTOP_VERSION
114 fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name 115 fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name;
115#else 116#else
116 fileName = qApp->applicationDirPath () + "/kdepim/"+ name; 117 fileName = qApp->applicationDirPath () + "/kdepim/"+ name;
117#endif 118#endif
118 mLocaleDict = 0; 119 mLocaleDict = 0;
119 if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) { 120 if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) {
120 121
121 if ( mPreferredLanguage == 1 ) 122 if ( mPreferredLanguage == 1 )
122 fileName = fileName+"germantranslation.txt"; 123 fileName = fileName+"germantranslation.txt";
123 else if ( mPreferredLanguage == 4 ) 124 else if ( mPreferredLanguage == 4 )
124 fileName = fileName+"usertranslation.txt"; 125 fileName = fileName+"usertranslation.txt";
125 else if ( mPreferredLanguage == 2 ) 126 else if ( mPreferredLanguage == 2 )
126 fileName = fileName+"frenchtranslation.txt"; 127 fileName = fileName+"frenchtranslation.txt";
127 else if ( mPreferredLanguage == 3 ) 128 else if ( mPreferredLanguage == 3 )
128 fileName = fileName+"italiantranslation.txt"; 129 fileName = fileName+"italiantranslation.txt";
129 QFile file( fileName ); 130 QFile file( fileName );
130 if (file.open( IO_ReadOnly ) ) { 131 if (file.open( IO_ReadOnly ) ) {
131 QTextStream ts( &file ); 132 QTextStream ts( &file );
132 ts.setEncoding( QTextStream::Latin1 ); 133 ts.setEncoding( QTextStream::Latin1 );
133 //ts.setCodec( QTextCodec::latin1 ); 134 //ts.setCodec( QTextCodec::latin1 );
134 QString text = ts.read(); 135 QString text = ts.read();
135 file.close(); 136 file.close();
136 text.replace( QRegExp("\\\\n"), "\n" ); 137 text.replace( QRegExp("\\\\n"), "\n" );
137 QString line; 138 QString line;
138 QString we; 139 QString we;
139 QString wt; 140 QString wt;
140 int br = 0; 141 int br = 0;
141 int nbr; 142 int nbr;
142 nbr = text.find ( "},", br ); 143 nbr = text.find ( "},", br );
143 line = text.mid( br, nbr - br ); 144 line = text.mid( br, nbr - br );
144 br = nbr+1; 145 br = nbr+1;
145 int se, ee, st, et; 146 int se, ee, st, et;
146 mLocaleDict = new QDict<QString>; 147 mLocaleDict = new QDict<QString>;
147 mLocaleDict->setAutoDelete( true ); 148 mLocaleDict->setAutoDelete( true );
148 QString end = "{ \"\",\"\" }"; 149 QString end = "{ \"\",\"\" }";
149 while ( (line != end) && (br > 1) ) { 150 while ( (line != end) && (br > 1) ) {
150 //qDebug("%d *%s* ", br, line.latin1()); 151 //qDebug("%d *%s* ", br, line.latin1());
151 se = line.find("\"")+1; 152 se = line.find("\"")+1;
152 et = line.findRev("\"",-1); 153 et = line.findRev("\"",-1);
153 ee = line.find("\",\""); 154 ee = line.find("\",\"");
154 st = ee+3; 155 st = ee+3;
155 we = line.mid( se, ee-se ); 156 we = line.mid( se, ee-se );
156 wt = line.mid( st, et-st ); 157 wt = line.mid( st, et-st );
157 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); 158 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1());
158 mLocaleDict->insert( we, new QString (wt) ); 159 mLocaleDict->insert( we, new QString (wt) );
159 nbr = text.find ( "}", br ); 160 nbr = text.find ( "}", br );
160 line = text.mid( br, nbr - br ); 161 line = text.mid( br, nbr - br );
161 br = nbr+1; 162 br = nbr+1;
162 } 163 }
163 //qDebug("end *%s* ", end.latin1()); 164 //qDebug("end *%s* ", end.latin1());
164 165
165 setLocaleDict( mLocaleDict ); 166 setLocaleDict( mLocaleDict );
166 } else { 167 } else {
167 qDebug("KO: Cannot find translation file %s",fileName.latin1() ); 168 qDebug("KO: Cannot find translation file %s",fileName.latin1() );
168 } 169 }
169 } 170 }
170 } 171 }
171 172
172 KGlobal::locale()->setHore24Format( !mPreferredTime ); 173 KGlobal::locale()->setHore24Format( !mPreferredTime );
173 KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); 174 KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday );
174 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); 175 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate );
175 KGlobal::locale()->setLanguage( mPreferredLanguage ); 176 KGlobal::locale()->setLanguage( mPreferredLanguage );
176 QString dummy = mUserDateFormatLong; 177 QString dummy = mUserDateFormatLong;
177 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 178 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
178 dummy = mUserDateFormatShort; 179 dummy = mUserDateFormatShort;
179 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 180 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
180 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, 181 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving,
181 mDaylightsavingStart, 182 mDaylightsavingStart,
182 mDaylightsavingEnd ); 183 mDaylightsavingEnd );
183 KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min ); 184 KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min );
184 185
185} 186}
186KPimGlobalPrefs::~KPimGlobalPrefs() 187KPimGlobalPrefs::~KPimGlobalPrefs()
187{ 188{
188 if (sInstance == this) 189 if (sInstance == this)
189 sInstance = staticDeleterGP.setObject(0); 190 sInstance = staticDeleterGP.setObject(0);
190 else 191 else
191 qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?"); 192 qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?");
192 if ( mLocaleDict ) 193 if ( mLocaleDict )
193 delete mLocaleDict; 194 delete mLocaleDict;
194} 195}
195 196
196KPimGlobalPrefs *KPimGlobalPrefs::instance() 197KPimGlobalPrefs *KPimGlobalPrefs::instance()
197{ 198{
198 if ( !sInstance ) { 199 if ( !sInstance ) {
199 sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() ); 200 sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() );
200 sInstance->readConfig(); 201 sInstance->readConfig();
201 } 202 }
202 203
203 return sInstance; 204 return sInstance;
204} 205}
diff --git a/pwmanager/pwmanager/pwminit.cpp b/pwmanager/pwmanager/pwminit.cpp
index 9238c8c..d775aa9 100644
--- a/pwmanager/pwmanager/pwminit.cpp
+++ b/pwmanager/pwmanager/pwminit.cpp
@@ -1,201 +1,204 @@
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 "pwminit.h" 20#include "pwminit.h"
21#include "randomizer.h" 21#include "randomizer.h"
22#include <qdir.h> 22#include <qdir.h>
23 23
24#ifndef PWM_EMBEDDED 24#ifndef PWM_EMBEDDED
25#include "selftest.h" 25#include "selftest.h"
26#include "configuration.h" 26#include "configuration.h"
27#else 27#else
28#include "pwmprefs.h" 28#include "pwmprefs.h"
29#endif 29#endif
30 30
31#include "pwm.h" 31#include "pwm.h"
32#include "pwmexception.h" 32#include "pwmexception.h"
33#include "pwmtray.h" 33#include "pwmtray.h"
34#include "pwmdoc.h" 34#include "pwmdoc.h"
35 35
36#ifdef CONFIG_KWALLETIF 36#ifdef CONFIG_KWALLETIF
37# include "kwalletemu.h" 37# include "kwalletemu.h"
38#endif // CONFIG_KWALLETIF 38#endif // CONFIG_KWALLETIF
39#ifdef CONFIG_KEYCARD 39#ifdef CONFIG_KEYCARD
40# include "pwmkeycard.h" 40# include "pwmkeycard.h"
41#endif // CONFIG_KEYCARD 41#endif // CONFIG_KEYCARD
42 42
43#include <qmessagebox.h> 43#include <qmessagebox.h>
44 44
45#include <kmessagebox.h> 45#include <kmessagebox.h>
46#ifndef PWM_EMBEDDED 46#ifndef PWM_EMBEDDED
47#include <kcmdlineargs.h> 47#include <kcmdlineargs.h>
48#include <kwin.h> 48#include <kwin.h>
49#include <dcopclient.h> 49#include <dcopclient.h>
50#endif 50#endif
51 51
52#include <kapplication.h> 52#include <kapplication.h>
53#include <kiconloader.h> 53#include <kiconloader.h>
54 54
55#include <signal.h> 55#include <signal.h>
56 56
57static PwMInit *sig_init_pointer; 57static PwMInit *sig_init_pointer;
58#ifdef _WIN32_
59static void sig_handler(int signum)
60#else
58static NOREGPARM void sig_handler(int signum) 61static NOREGPARM void sig_handler(int signum)
62#endif
59{ 63{
60 switch (signum) { 64 switch (signum) {
61 case SIGINT: 65 case SIGINT:
62 case SIGTERM: 66 case SIGTERM:
63 sig_init_pointer->shutdownApp(20 + signum); 67 sig_init_pointer->shutdownApp(20 + signum);
64 break; 68 break;
65 default: 69 default:
66 printDebug(string("unhandled signal ") 70 printDebug(string("unhandled signal ")
67 + tostr(signum)); 71 + tostr(signum));
68 } 72 }
69} 73}
70 74
71 75
72 76
73
74PwMInit::PwMInit(PwMApplication *_app) 77PwMInit::PwMInit(PwMApplication *_app)
75 : runStatus (unknown) 78 : runStatus (unknown)
76 , _curWidget (0) 79 , _curWidget (0)
77 , _dcopClient (0) 80 , _dcopClient (0)
78 , _kwalletEmu (0) 81 , _kwalletEmu (0)
79 , _keycard (0) 82 , _keycard (0)
80 , _tray (0) 83 , _tray (0)
81{ 84{
82 sig_init_pointer = this; 85 sig_init_pointer = this;
83 app = _app; 86 app = _app;
84} 87}
85 88
86PwMInit::~PwMInit() 89PwMInit::~PwMInit()
87{ 90{
88#ifndef PWM_EMBEDDED 91#ifndef PWM_EMBEDDED
89 SelfTest::cancel(); 92 SelfTest::cancel();
90 // close all open mainwnds 93 // close all open mainwnds
91 QValueList<PwM *>::iterator i = _mainWndList.begin(), 94 QValueList<PwM *>::iterator i = _mainWndList.begin(),
92 end = _mainWndList.end(); 95 end = _mainWndList.end();
93 96
94#else 97#else
95 // close all open mainwnds 98 // close all open mainwnds
96 QValueList<PwM *>::Iterator i = _mainWndList.begin(), 99 QValueList<PwM *>::Iterator i = _mainWndList.begin(),
97 end = _mainWndList.end(); 100 end = _mainWndList.end();
98#endif 101#endif
99 while (i != end) { 102 while (i != end) {
100 disconnect(*i, SIGNAL(closed(PwM *)), 103 disconnect(*i, SIGNAL(closed(PwM *)),
101 this, SLOT(mainWndClosed(PwM *))); 104 this, SLOT(mainWndClosed(PwM *)));
102 delete *i; 105 delete *i;
103 ++i; 106 ++i;
104 } 107 }
105 _mainWndList.clear(); 108 _mainWndList.clear();
106 // close all remaining open documents 109 // close all remaining open documents
107 PwMDocList *_dl = PwMDoc::getOpenDocList(); 110 PwMDocList *_dl = PwMDoc::getOpenDocList();
108 vector<PwMDocList::listItem> dl = *(_dl->getList()); 111 vector<PwMDocList::listItem> dl = *(_dl->getList());
109 vector<PwMDocList::listItem>::iterator i2 = dl.begin(), 112 vector<PwMDocList::listItem>::iterator i2 = dl.begin(),
110 end2 = dl.end(); 113 end2 = dl.end();
111 while (i2 != end2) { 114 while (i2 != end2) {
112 delete (*i2).doc; 115 delete (*i2).doc;
113 ++i2; 116 ++i2;
114 } 117 }
115 118
116#ifdef CONFIG_KWALLETIF 119#ifdef CONFIG_KWALLETIF
117 delete_ifnot_null(_kwalletEmu); 120 delete_ifnot_null(_kwalletEmu);
118#endif // CONFIG_KWALLETIF 121#endif // CONFIG_KWALLETIF
119#ifdef CONFIG_KEYCARD 122#ifdef CONFIG_KEYCARD
120 delete_ifnot_null(_keycard); 123 delete_ifnot_null(_keycard);
121#endif // CONFIG_KEYCARD 124#endif // CONFIG_KEYCARD
122 delete_ifnot_null(_tray); 125 delete_ifnot_null(_tray);
123 126
124 Randomizer::cleanup(); 127 Randomizer::cleanup();
125#ifndef PWM_EMBEDDED 128#ifndef PWM_EMBEDDED
126 Configuration::cleanup(); 129 Configuration::cleanup();
127#endif 130#endif
128} 131}
129 132
130void PwMInit::initializeApp() 133void PwMInit::initializeApp()
131{ 134{
132 //qDebug("PwMInit::initializeApp() "); 135 //qDebug("PwMInit::initializeApp() ");
133 PWM_ASSERT(runStatus == unknown); 136 PWM_ASSERT(runStatus == unknown);
134 runStatus = init; 137 runStatus = init;
135 initPosixSignalHandler(); 138 initPosixSignalHandler();
136 Randomizer::init(); 139 Randomizer::init();
137#ifndef PWM_EMBEDDED 140#ifndef PWM_EMBEDDED
138 Configuration::init(); 141 Configuration::init();
139#endif 142#endif
140 initDCOP(); 143 initDCOP();
141 initKWalletEmu(); 144 initKWalletEmu();
142 initKeycard(); 145 initKeycard();
143 initTray(); 146 initTray();
144 handleCmdLineArgs(); 147 handleCmdLineArgs();
145 bool openDeeplocked = false; 148 bool openDeeplocked = false;
146 if (conf()->confGlobAutostartDeepLocked() || 149 if (conf()->confGlobAutostartDeepLocked() ||
147 savedCmd.open_deeplocked) 150 savedCmd.open_deeplocked)
148 openDeeplocked = true; 151 openDeeplocked = true;
149 if ( false ){ 152 if ( false ){
150 // LR is not working 153 // LR is not working
151 //if (conf()->confWndAutoMinimizeOnStart() || 154 //if (conf()->confWndAutoMinimizeOnStart() ||
152 // savedCmd.minToTray) { 155 // savedCmd.minToTray) {
153 PwMDoc *newDoc = createDoc(); 156 PwMDoc *newDoc = createDoc();
154 qDebug(" createDoc()"); 157 qDebug(" createDoc()");
155 if (!newDoc->openDocUi(newDoc, 158 if (!newDoc->openDocUi(newDoc,
156 conf()->confGlobAutoStart(), 159 conf()->confGlobAutoStart(),
157 openDeeplocked)) { 160 openDeeplocked)) {
158 delete newDoc; 161 delete newDoc;
159 } 162 }
160 163
161 //US ENH for embedded devices: in the case of failure, open a document the default way 164 //US ENH for embedded devices: in the case of failure, open a document the default way
162 createMainWnd(conf()->confGlobAutoStart(), 165 createMainWnd(conf()->confGlobAutoStart(),
163 openDeeplocked, 166 openDeeplocked,
164 true, 167 true,
165 0, 168 0,
166 savedCmd.minimized); 169 savedCmd.minimized);
167 170
168 171
169 172
170 173
171 //} 174 //}
172 } else { 175 } else {
173 createMainWnd(conf()->confGlobAutoStart(), 176 createMainWnd(conf()->confGlobAutoStart(),
174 openDeeplocked, 177 openDeeplocked,
175 true, 178 true,
176 0, 179 0,
177 savedCmd.minimized); 180 savedCmd.minimized);
178 } 181 }
179 182
180 runStatus = running; 183 runStatus = running;
181} 184}
182 185
183void PwMInit::shutdownApp(int exitStatus) 186void PwMInit::shutdownApp(int exitStatus)
184{ 187{
185 printDebug(string("PwMInit::shutdownApp(") 188 printDebug(string("PwMInit::shutdownApp(")
186 + tostr(exitStatus) + ") called."); 189 + tostr(exitStatus) + ") called.");
187 PWM_ASSERT((runStatus == running) || (runStatus == init)); 190 PWM_ASSERT((runStatus == running) || (runStatus == init));
188 runStatus = shutdown; 191 runStatus = shutdown;
189 QApplication::exit(exitStatus); 192 QApplication::exit(exitStatus);
190 /* The destructor of PwMInit is called when control 193 /* The destructor of PwMInit is called when control
191 * leaves main() 194 * leaves main()
192 */ 195 */
193} 196}
194 197
195void PwMInit::initPosixSignalHandler() 198void PwMInit::initPosixSignalHandler()
196{ 199{
197 signal(SIGINT, sig_handler); 200 signal(SIGINT, sig_handler);
198 signal(SIGTERM, sig_handler); 201 signal(SIGTERM, sig_handler);
199} 202}
200 203
201void PwMInit::initDCOP() 204void PwMInit::initDCOP()